Skip to content

Commit 485df23

Browse files
committed
Use plist instead of list.
1 parent bb20002 commit 485df23

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

ivy-file-preview.el

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
"Delete all overlays in list."
100100
(dolist (ov ivy-file-preview--overlays) (delete-overlay ov)))
101101

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+
102107
;;; Core
103108

104109
(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."
189194
(defun ivy-file-preview--back-to-pos ()
190195
"Back to starting position."
191196
(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))))
194199

195200
(defun ivy-file-preview--cancel-revert ()
196201
"Revert frame status if user cancel the commands."
197202
(ivy-file-preview--delete-overlays)
198203
(unless ivy-exit
199204
(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))))
202207

203208
(defun ivy-file-preview--enter ()
204209
"Execution after minibuffer setup."
205210
(setq ivy-file-preview--window-status '())
206211
(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))))
210215

211216
(defun ivy-file-preview--exit ()
212217
"Execution before minibuffer exits."

0 commit comments

Comments
 (0)