emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/beframe b6edf4dafa: Tweak beframe-buffer-sort-visibilit


From: ELPA Syncer
Subject: [elpa] externals/beframe b6edf4dafa: Tweak beframe-buffer-sort-visibility
Date: Sun, 21 May 2023 00:57:34 -0400 (EDT)

branch: externals/beframe
commit b6edf4dafa7589a2cb902ead7f8346ff28e38246
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Tweak beframe-buffer-sort-visibility
---
 beframe.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/beframe.el b/beframe.el
index 6a7e8767a3..9df1fbc44d 100644
--- a/beframe.el
+++ b/beframe.el
@@ -614,16 +614,19 @@ With optional DISABLE remove the advice."
       (advice-add cmd :around #'beframe--with-other-frame)))))
 
 (defun beframe-buffer-sort-visibility (buffers)
-  "Sort the given BUFFERS by visibility.
-Concretely, this means this function will return a sequence that
-first lists hidden, then visible, and then the current buffer."
-  (let* ((current (current-buffer))
-         (bufs (seq-group-by
-                (lambda (buf)
-                  (cond ((eq buf current)                 :current)
-                        ((get-buffer-window buf 'visible) :visible)
-                        (t                                :hidden)))
-                buffers)))
+  "Group the given BUFFERS by visibility and sort them accordingly.
+Return a sequence that first lists hidden, then visible, and then
+the current buffer.
+
+This function can be used as the :sort key of
+`beframe-buffer-list' or `beframe-buffer-names'."
+  (let ((bufs (seq-group-by
+               (lambda (buf)
+                 (cond
+                  ((eq buf (current-buffer)) :current)
+                  ((get-buffer-window buf 'visible) :visible)
+                  (t :hidden)))
+               buffers)))
     (nconc (alist-get :hidden  bufs)
            (alist-get :visible bufs)
            (alist-get :current bufs))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]