[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beframe 14d80d574c: Make beframe-global-buffers use reg
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beframe 14d80d574c: Make beframe-global-buffers use regular expressions instead of literal strings |
Date: |
Sat, 13 Jan 2024 06:57:27 -0500 (EST) |
branch: externals/beframe
commit 14d80d574cb8c3d1b546bb503d860aa74440744c
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make beframe-global-buffers use regular expressions instead of literal
strings
---
README.org | 17 +++++++++++------
beframe.el | 51 +++++++++++++++++++++++++++++----------------------
2 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/README.org b/README.org
index 75dfa4eaa5..27404c1ba8 100644
--- a/README.org
+++ b/README.org
@@ -82,12 +82,17 @@ There still is only one global list of buffers. Beframing
them simply
filters the list.
#+vindex: beframe-global-buffers
-The user option ~beframe-global-buffers~ contains a list of strings
-that represent buffers names. Those buffers are never beframed and
-are available in all frames. The default value contains the buffers
-=*scratch*=, =*Messages*=, and =*Backtrace*=. If the value is nil, no
-buffer enjoys such special treatment: they all follow the beframing
-scheme of remaining associated with the frame that opened them.
+The user option ~beframe-global-buffers~ contains a list of regular
+expressions that are matched against buffers names. The matching
+buffers are never beframed and are available in all frames. The
+default value contains the buffers =*scratch*=, =*Messages*=, and
+=*Backtrace*= (more preciselly, it matches the regular expressions
+=\\*scratch\\*=, =\\*Messages\\*= =\\*Backtrace\\*=). If the value is
+~nil~, no buffer enjoys such special treatment: they all follow the
+beframing scheme of remaining associated with the frame that opened
+them. [ The ~beframe-global-buffers~ is revised as part of
+{{{development-version}}} to take a list of regular expressions
+instead of literal strings. ]
#+vindex: beframe-create-frame-scratch-buffer
The user option ~beframe-create-frame-scratch-buffer~ allows
diff --git a/beframe.el b/beframe.el
index 9bfb177c16..bd53a752a3 100644
--- a/beframe.el
+++ b/beframe.el
@@ -41,11 +41,11 @@
"Isolate buffers per frame."
:group 'frames)
-(defcustom beframe-global-buffers '("*scratch*" "*Messages*" "*Backtrace*")
- "List of buffer names (as strings) to include in all frames.
-These buffers are always shown in the `beframe-buffer-menu' or
+(defcustom beframe-global-buffers '("\\*scratch\\*" "\\*Messages\\*"
"\\*Backtrace\\*")
+ "List of regular expressions to match buffer names.
+The matching buffers are always shown in the `beframe-buffer-menu' or
buffer selection prompts when `beframe-mode' is enabled. They do
-not need to be open inside the current frame and thus become
+not need to be open inside the current frame and to thus become
associated with it (the way other buffers are normally beframed).
When the value is nil, no buffer get this special treatment: they
@@ -53,12 +53,13 @@ all follow the beframing scheme of remaining associated
with the
frame that opened them.
Also see commands such as `beframe-assume-frame-buffers' and
-`beframe-unassume-frame-buffers'. The full list:
+`beframe-unassume-frame-buffers' to add/remove buffers from a
+frame's buffer list ad-hoc. The full list of commands:
\\{beframe-prefix-map}"
:group 'beframe
- :package-version '(beframe . "0.1.0")
- :type '(choice (repeat :tag "List of buffer names as strings" string)
+ :package-version '(beframe . "1.1.0")
+ :type '(choice (repeat :tag "List of regular expressions to match buffer
names" string)
(const :tag "No global buffers" nil)))
(defcustom beframe-create-frame-scratch-buffer t
@@ -130,10 +131,26 @@ automatically, use `customize-set-variable' or `setopt'
(Emacs
(not (string-prefix-p " " (buffer-name buf)))))
(frame-parameter frame 'buffer-list)))
+(defun beframe--public-buffers ()
+ "Return list of buffers from all frames.
+This is the same as the output of the `buffer-list' function
+minus all the internal buffers."
+ (seq-filter
+ (lambda (buf)
+ (and (bufferp buf)
+ (not (string-prefix-p " " (buffer-name buf)))))
+ (buffer-list)))
+
(defun beframe--global-buffers ()
"Return list of `beframe-global-buffers' buffer objects."
- (when beframe-global-buffers
- (mapcar #'get-buffer beframe-global-buffers)))
+ (mapcan
+ (lambda (regexp)
+ (seq-filter
+ (lambda (buffer)
+ (when (string-match-p regexp (buffer-name buffer))
+ buffer))
+ (beframe--public-buffers)))
+ beframe-global-buffers))
(cl-defun beframe-buffer-list (&optional frame &key sort)
"Return list of buffers that are used by the current frame.
@@ -152,16 +169,6 @@ Include `beframe-global-buffers' in the list."
(append (beframe--frame-buffers frame)
(beframe--global-buffers))))))
-(defun beframe--buffer-list-consolidated ()
- "Return list of buffers from all frames.
-This is the same as the output of the `buffer-list' function
-minus all the internal buffers."
- (seq-filter
- (lambda (buf)
- (and (bufferp buf)
- (not (string-prefix-p " " (buffer-name buf)))))
- (buffer-list)))
-
(define-obsolete-function-alias
'beframe--buffer-list
'beframe-buffer-list
@@ -176,7 +183,7 @@ more information."
(defun beframe--buffer-names-consolidated ()
"Return list of names of all buffers as strings."
- (mapcar #'buffer-name (beframe--buffer-list-consolidated)))
+ (mapcar #'buffer-name (beframe--public-buffers)))
(define-obsolete-function-alias
'beframe--buffer-names
@@ -511,7 +518,7 @@ Also see the other Beframe commands:
"Assume the consolidated buffer list (all frames)."
(declare (interactive-only t))
(interactive)
- (beframe--assume (beframe--buffer-list-consolidated)))
+ (beframe--assume (beframe--public-buffers)))
;;;###autoload
(defun beframe-unassume-all-buffers-no-prompts ()
@@ -523,7 +530,7 @@ Also see the other Beframe commands:
\\{beframe-prefix-map}"
(declare (interactive-only t))
(interactive)
- (beframe--unassume (beframe--buffer-list-consolidated))
+ (beframe--unassume (beframe--public-buffers))
(beframe--assume (beframe--global-buffers)))
;;; Minor mode setup
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/beframe 14d80d574c: Make beframe-global-buffers use regular expressions instead of literal strings,
ELPA Syncer <=