Simplify and speed up update-buffer-list

This commit is contained in:
2025-04-22 13:55:27 -10:00
parent 2034ec7a44
commit adacbd6e9a

View File

@ -333,20 +333,10 @@ If a buffer name equal to OLD is found, it is replaced with NEW."
(defun update-buffer-list (new-list) (defun update-buffer-list (new-list)
"Set buffers in NEW-LIST to be the most recently used, in order." "Set buffers in NEW-LIST to be the most recently used, in order."
(when new-list (when new-list
(let (firstbuf buf) (dolist (b (reverse new-list))
(while new-list (when (and (buffer-live-p b)
(setq buf (car new-list)) (not (minibufferp b)))
(when (stringp buf) (switch-to-buffer b)))))
(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) (defun eyebrowse--load-window-config (slot)
"Restore the window config from SLOT." "Restore the window config from SLOT."