|
99 | 99 | "Delete all overlays in list." |
100 | 100 | (dolist (ov ivy-file-preview--overlays) (delete-overlay ov))) |
101 | 101 |
|
| 102 | +(defun ivy-file-preview--put-window-plist (prop val) |
| 103 | + "Set property list with PROP and VAL." |
| 104 | + (setq ivy-file-preview--window-status |
| 105 | + (plist-put ivy-file-preview--window-status prop val))) |
| 106 | + |
102 | 107 | ;;; Core |
103 | 108 |
|
104 | 109 | (defun ivy-file-preview--extract-candidates-overlay-data () |
@@ -189,24 +194,24 @@ POS can either be an integer or cons cell represent line number and columns." |
189 | 194 | (defun ivy-file-preview--back-to-pos () |
190 | 195 | "Back to starting position." |
191 | 196 | (with-selected-window minibuffer-scroll-window |
192 | | - (switch-to-buffer (nth 0 ivy-file-preview--window-status)) |
193 | | - (goto-char (nth 2 ivy-file-preview--window-status)))) |
| 197 | + (switch-to-buffer (plist-get ivy-file-preview--window-status :file)) |
| 198 | + (goto-char (plist-get ivy-file-preview--window-status :position)))) |
194 | 199 |
|
195 | 200 | (defun ivy-file-preview--cancel-revert () |
196 | 201 | "Revert frame status if user cancel the commands." |
197 | 202 | (ivy-file-preview--delete-overlays) |
198 | 203 | (unless ivy-exit |
199 | 204 | (setq ivy-file-preview--selected-file "") |
200 | | - (switch-to-buffer (nth 0 ivy-file-preview--window-status)) |
201 | | - (set-window-point minibuffer-scroll-window (nth 1 ivy-file-preview--window-status)))) |
| 205 | + (switch-to-buffer (plist-get ivy-file-preview--window-status :file)) |
| 206 | + (set-window-point minibuffer-scroll-window (plist-get ivy-file-preview--window-status :window-point)))) |
202 | 207 |
|
203 | 208 | (defun ivy-file-preview--enter () |
204 | 209 | "Execution after minibuffer setup." |
205 | 210 | (setq ivy-file-preview--window-status '()) |
206 | 211 | (with-selected-window minibuffer-scroll-window |
207 | | - (push (point) ivy-file-preview--window-status) |
208 | | - (push (window-point) ivy-file-preview--window-status) |
209 | | - (push (buffer-name) ivy-file-preview--window-status))) |
| 212 | + (ivy-file-preview--put-window-plist :file (current-buffer)) |
| 213 | + (ivy-file-preview--put-window-plist :window-point (window-point)) |
| 214 | + (ivy-file-preview--put-window-plist :position (point)))) |
210 | 215 |
|
211 | 216 | (defun ivy-file-preview--exit () |
212 | 217 | "Execution before minibuffer exits." |
|
0 commit comments