Add per-config buffer list order
This commit is contained in:
27
eyebrowse.el
27
eyebrowse.el
@ -268,7 +268,7 @@ This function keeps the sortedness intact."
|
||||
|
||||
(defun eyebrowse--current-window-config (slot tag)
|
||||
"Returns a window config list appliable for SLOT."
|
||||
(list slot (window-state-get nil t) tag))
|
||||
(list slot (window-state-get nil t) tag (buffer-list)))
|
||||
|
||||
(defun eyebrowse--dotted-list-p (list)
|
||||
"Non-nil if LIST is terminated by a non-nil value."
|
||||
@ -319,6 +319,24 @@ If a buffer name equal to OLD is found, it is replaced with NEW."
|
||||
(eyebrowse--rename-window-config-buffers window-config old new))))
|
||||
ad-return-value))
|
||||
|
||||
(defun update-buffer-list (new-list)
|
||||
"Set buffers in NEW-LIST to be the most recently used, in order."
|
||||
(when new-list
|
||||
(let (firstbuf buf)
|
||||
(while new-list
|
||||
(setq buf (car new-list))
|
||||
(when (stringp buf)
|
||||
(setq buf (get-buffer buf)))
|
||||
(when (buffer-live-p buf)
|
||||
(bury-buffer buf)
|
||||
(unless firstbuf
|
||||
(setq firstbuf buf)))
|
||||
(setq new-list (cdr new-list)))
|
||||
(setq new-list (buffer-list))
|
||||
(while (not (eq (car new-list) firstbuf))
|
||||
(bury-buffer (car new-list))
|
||||
(setq new-list (cdr new-list))))))
|
||||
|
||||
(defun eyebrowse--load-window-config (slot)
|
||||
"Restore the window config from SLOT."
|
||||
(-when-let (match (assq slot (eyebrowse--get 'window-configs)))
|
||||
@ -330,9 +348,12 @@ If a buffer name equal to OLD is found, it is replaced with NEW."
|
||||
;; KLUDGE: workaround for visual-fill-column foolishly
|
||||
;; setting the split-window parameter
|
||||
(let ((ignore-window-parameters t)
|
||||
(window-config (cadr match)))
|
||||
(window-config (cadr match))
|
||||
(buffer-list (cadddr match)))
|
||||
(eyebrowse--fixup-window-config window-config)
|
||||
(window-state-put window-config (frame-root-window) 'safe))))
|
||||
(window-state-put window-config (frame-root-window) 'safe)
|
||||
(when buffer-list
|
||||
(update-buffer-list buffer-list)))))
|
||||
|
||||
(defun eyebrowse--string-to-number (x)
|
||||
"Version of `string-to-number' that returns nil if not a number."
|
||||
|
||||
Reference in New Issue
Block a user