+workspace-buffer-list: preserve list order #144

persp-mode still doesn't preserve buffer list order. You'll have to use
+workspace-buffer-list to get this.
This commit is contained in:
Henrik Lissner 2017-07-08 13:44:41 +02:00
parent 6dfbda7901
commit 9194d020e4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -29,19 +29,22 @@
(defun +workspace-buffer-list (&optional persp) (defun +workspace-buffer-list (&optional persp)
"Return a list of buffers in PERSP (defaults to the current perspective). "Return a list of buffers in PERSP (defaults to the current perspective).
The buffer list is ordered by recency (same as `buffer-list').
PERSP can be a string (name of a workspace) or a perspective hash (satisfies PERSP can be a string (name of a workspace) or a perspective hash (satisfies
`+workspace-p'). `+workspace-p').
If PERSP is t, then return a list of orphaned buffers associated with no If PERSP is t, then return a list of orphaned buffers associated with no
perspectives." perspectives."
(cond ((not persp) (unless persp
(persp-buffer-list-restricted)) (setq persp (get-current-persp)))
((eq persp t) (if (eq persp t)
(cl-remove-if #'persp--buffer-in-persps (doom-buffer-list))) (cl-remove-if #'persp--buffer-in-persps (buffer-list))
((+workspace-p persp) (when (stringp persp)
(safe-persp-buffers persp)) (setq persp (+workspace-get persp t)))
((stringp persp) (cl-loop for buf in (buffer-list)
(safe-persp-buffers (+workspace-get persp t))))) if (persp-contain-buffer-p buf persp)
collect buf)))
;;;###autoload ;;;###autoload
(defun +workspace-p (obj) (defun +workspace-p (obj)