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

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

[elpa] externals/beframe bf6453d764 6/8: Merge pull request #8 from BBoa


From: ELPA Syncer
Subject: [elpa] externals/beframe bf6453d764 6/8: Merge pull request #8 from BBoal/collect-bufs
Date: Thu, 15 Aug 2024 15:57:32 -0400 (EDT)

branch: externals/beframe
commit bf6453d76433ae74a9fe2665f76a5cdb8a7fc136
Merge: cd766c5b9c 70d120a66b
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #8 from BBoal/collect-bufs
    
    Correction of previous expected behaviour and proposal for refactored 
deleted function
---
 beframe.el | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/beframe.el b/beframe.el
index 00e1e0bac9..c57c0e2145 100644
--- a/beframe.el
+++ b/beframe.el
@@ -141,21 +141,34 @@ automatically, use `customize-set-variable' or `setopt' 
(Emacs
 
 The following values of ARG can be used:
 
-- nil or \\='public\\=' to consider the return value of the `buffer-list'
+- \\='public\\=' to consider the return value of the `buffer-list'
   function.
 
 - \\='global\\=' to consider the user-custom option in `beframe-global-buffers'
 
-ARG can be the symbol \\='public or nil for `buffer-list' return value."
+- nil or a frame object satisfying `frame-live-p' to consider the
+  \\='buffer-list\\=' parameter of either `selected-frame' or the given 
object."
   (pcase arg
-    ((or 'public (pred null))
-     (beframe--remove-internal-buffers (buffer-list)))
+    ('public (beframe--remove-internal-buffers (buffer-list)))
     ('global (beframe--global-buffers))
-    ((or (and 'frame (let frame nil))
-         (and (pred frame-live-p) (let frame arg)))
-     (beframe--remove-internal-buffers (frame-parameter frame 'buffer-list)))
+    ((or (pred null) (pred frame-live-p))
+     (beframe--remove-internal-buffers (frame-parameter arg 'buffer-list)))
     (_ (user-error "Wrong argument in `beframe--get-buffers' pcase"))))
 
+
+(defun beframe--global-buffers ()
+  "Return list of `beframe-global-buffers' buffer objects."
+  (pcase-let* ((pub-buffs (beframe--get-buffers 'public))
+               (`(,str-re ,modes-lst)
+                (cl-loop for E in beframe-global-buffers
+                         if (stringp E) collect E into str
+                         else if (symbolp E) collect E into sym
+                         finally return (list (string-join str "\\|") sym))))
+    (cl-loop for b in pub-buffs
+             if (string-match-p str-re (buffer-name b)) collect b
+             else if (with-current-buffer b (derived-mode-p modes-lst))
+             collect b)))
+
 (cl-defun beframe-buffer-list (&optional frame &key sort)
   "Return list of buffers that are used by the current frame.
 With optional FRAME as an object that satisfies `framep', return



reply via email to

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