* bug#59153: List project buffers
@ 2022-11-09 17:40 Juri Linkov
2022-11-09 18:01 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Juri Linkov @ 2022-11-09 17:40 UTC (permalink / raw)
To: 59153
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
Version: 29.0.50
Severity: wishlist
Tags: patch
There are project commands and keys corresponding
to the most useful buffer commands:
C-x k (kill-buffer) - C-x p k (project-kill-buffers)
C-x b (switch-to-buffer) - C-x p b (project-switch-to-buffer)
What is still missing is a command to list project buffers:
C-x C-b (list-buffers) - C-x p C-b (project-list-buffers)
project-kill-buffers already shows a list of project buffers,
but only as a part of confirmation for killing buffers.
Here is a patch that adds the missing command. Its argument
has exactly the same meaning as in 'list-buffers'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: project-list-buffers.patch --]
[-- Type: text/x-diff, Size: 1884 bytes --]
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index fc035675cec..e6f9dd750e7 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -713,6 +713,7 @@ project-prefix-map
(define-key map "G" 'project-or-external-find-regexp)
(define-key map "r" 'project-query-replace-regexp)
(define-key map "x" 'project-execute-extended-command)
+ (define-key map "\C-b" 'project-list-buffers)
map)
"Keymap for project commands.")
@@ -1223,6 +1224,25 @@ project-display-buffer-other-frame
(interactive (list (project--read-project-buffer)))
(display-buffer-other-frame buffer-or-name))
+;;;###autoload
+(defun project-list-buffers (&optional arg)
+ "Display a list of project buffers.
+The list is displayed in a buffer named \"*Buffer List*\".
+
+By default, all buffers are listed except those whose names start
+with a space (which are for internal use). With prefix argument
+ARG, show only buffers that are visiting files."
+ (interactive "P")
+ (let* ((pr (project-current t))
+ (bufs (mapcan
+ (lambda (buf)
+ (when (and (project--buffer-check buf '("\\`[^ ]"))
+ (or (not arg)
+ (project--buffer-check buf '(buffer-file-name))))
+ (list buf)))
+ (project-buffers pr))))
+ (display-buffer (list-buffers-noselect arg bufs))))
+
(defcustom project-kill-buffer-conditions
'(buffer-file-name ; All file-visiting buffers are included.
;; Most of temp and logging buffers (aside from hidden ones):
@@ -1283,6 +1303,7 @@ project-kill-buffers-display-buffer-list
:package-version '(project . "0.8.2")
:safe #'booleanp)
+;; UNUSED?
(defun project--buffer-list (pr)
"Return the list of all buffers in project PR."
(let ((conn (file-remote-p (project-root pr)))
^ permalink raw reply related [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-09 17:40 bug#59153: List project buffers Juri Linkov
@ 2022-11-09 18:01 ` Eli Zaretskii
2022-11-09 19:22 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 21:21 ` Dmitry Gutov
2 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2022-11-09 18:01 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153
> From: Juri Linkov <juri@linkov.net>
> Date: Wed, 09 Nov 2022 19:40:02 +0200
>
> +By default, all buffers are listed except those whose names start
^^^^^^^^^^^
Suggest to say "all project buffers", otherwise this could be
misinterpreted.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-09 17:40 bug#59153: List project buffers Juri Linkov
2022-11-09 18:01 ` Eli Zaretskii
@ 2022-11-09 19:22 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 7:56 ` Juri Linkov
2022-11-10 21:21 ` Dmitry Gutov
2 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-09 19:22 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153
[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]
Juri Linkov <juri@linkov.net> writes:
> What is still missing is a command to list project buffers:
>
> C-x C-b (list-buffers) - C-x p C-b (project-list-buffers)
>
> project-kill-buffers already shows a list of project buffers,
> but only as a part of confirmation for killing buffers.
>
> Here is a patch that adds the missing command. Its argument
> has exactly the same meaning as in 'list-buffers'.
>
> +;;;###autoload
> +(defun project-list-buffers (&optional arg)
> + "Display a list of project buffers.
> +The list is displayed in a buffer named \"*Buffer List*\".
> +
> +By default, all buffers are listed except those whose names start
> +with a space (which are for internal use). With prefix argument
> +ARG, show only buffers that are visiting files."
> + (interactive "P")
> + (let* ((pr (project-current t))
> + (bufs (mapcan
> + (lambda (buf)
> + (when (and (project--buffer-check buf '("\\`[^ ]"))
> + (or (not arg)
> + (project--buffer-check buf '(buffer-file-name))))
> + (list buf)))
> + (project-buffers pr))))
> + (display-buffer (list-buffers-noselect arg bufs))))
This won't survive a revert buffer, I think. (I'll show all buffers
then.)
--
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-09 19:22 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-10 7:56 ` Juri Linkov
2022-11-10 8:56 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 17:59 ` Juri Linkov
0 siblings, 2 replies; 21+ messages in thread
From: Juri Linkov @ 2022-11-10 7:56 UTC (permalink / raw)
To: Akib Azmain Turja; +Cc: 59153
>> + (bufs (mapcan
>> + (lambda (buf)
>> + (when (and (project--buffer-check buf '("\\`[^ ]"))
>> + (or (not arg)
>> + (project--buffer-check buf '(buffer-file-name))))
>> + (list buf)))
>> + (project-buffers pr))))
>> + (display-buffer (list-buffers-noselect arg bufs))))
>
> This won't survive a revert buffer, I think. (I'll show all buffers
> then.)
This means that all uses of the BUFFER-LIST arg of 'list-buffers-noselect'
are flawed. So better would be to provide not a list of buffers, but
a predicate to filter out a list of buffers. Then the revert could use
such a predicate from e.g. a buffer-local variable.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-10 7:56 ` Juri Linkov
@ 2022-11-10 8:56 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 17:59 ` Juri Linkov
1 sibling, 0 replies; 21+ messages in thread
From: Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-10 8:56 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
Juri Linkov <juri@linkov.net> writes:
>>> + (bufs (mapcan
>>> + (lambda (buf)
>>> + (when (and (project--buffer-check buf '("\\`[^ ]"))
>>> + (or (not arg)
>>> + (project--buffer-check buf '(buffer-file-name))))
>>> + (list buf)))
>>> + (project-buffers pr))))
>>> + (display-buffer (list-buffers-noselect arg bufs))))
>>
>> This won't survive a revert buffer, I think. (I'll show all buffers
>> then.)
>
> This means that all uses of the BUFFER-LIST arg of 'list-buffers-noselect'
> are flawed. So better would be to provide not a list of buffers, but
> a predicate to filter out a list of buffers. Then the revert could use
> such a predicate from e.g. a buffer-local variable.
I just modify the tabulated-list-revert-hook buffer-locally.
--
Akib Azmain Turja --- https://akib.codeberg.page/
GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social, Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-10 7:56 ` Juri Linkov
2022-11-10 8:56 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-10 17:59 ` Juri Linkov
2022-11-12 1:41 ` Dmitry Gutov
1 sibling, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-10 17:59 UTC (permalink / raw)
To: Akib Azmain Turja; +Cc: 59153
[-- Attachment #1: Type: text/plain, Size: 869 bytes --]
>>> + (bufs (mapcan
>>> + (lambda (buf)
>>> + (when (and (project--buffer-check buf '("\\`[^ ]"))
>>> + (or (not arg)
>>> + (project--buffer-check buf '(buffer-file-name))))
>>> + (list buf)))
>>> + (project-buffers pr))))
>>> + (display-buffer (list-buffers-noselect arg bufs))))
>>
>> This won't survive a revert buffer, I think. (I'll show all buffers
>> then.)
>
> This means that all uses of the BUFFER-LIST arg of 'list-buffers-noselect'
> are flawed. So better would be to provide not a list of buffers, but
> a predicate to filter out a list of buffers. Then the revert could use
> such a predicate from e.g. a buffer-local variable.
Here is a patch that adds a buffer-local variable similar to
Buffer-menu-files-only:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Buffer-menu-filter-predicate.patch --]
[-- Type: text/x-diff, Size: 4460 bytes --]
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index abf152f058c..fbf2bbc58bc 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -101,6 +101,13 @@ Buffer-menu-files-only
This is set by the prefix argument to `buffer-menu' and related
commands.")
+(defvar-local Buffer-menu-filter-predicate nil
+ "Function to filter out buffers in the buffer list.
+Buffers that don't satisfy the predicate will be skipped.
+The value should be a function of one argument; it will be
+called with the buffer. If this function returns non-nil,
+then the buffer will be displayed in the buffer list.")
+
(defvar-keymap Buffer-menu-mode-map
:doc "Local keymap for `Buffer-menu-mode' buffers."
:parent tabulated-list-mode-map
@@ -597,19 +604,23 @@ Buffer-menu-view-other-window
;;; Functions for populating the Buffer Menu.
;;;###autoload
-(defun list-buffers-noselect (&optional files-only buffer-list)
+(defun list-buffers-noselect (&optional files-only buffer-list filter-predicate)
"Create and return a Buffer Menu buffer.
This is called by `buffer-menu' and others as a subroutine.
If FILES-ONLY is non-nil, show only file-visiting buffers.
If BUFFER-LIST is non-nil, it should be a list of buffers; it
-means list those buffers and no others."
+means list those buffers and no others.
+If FILTER-PREDICATE is non-nil, it should be a function
+that filters out buffers from the list of buffers.
+See more at `Buffer-menu-filter-predicate'."
(let ((old-buffer (current-buffer))
(buffer (get-buffer-create "*Buffer List*")))
(with-current-buffer buffer
(Buffer-menu-mode)
(setq Buffer-menu-files-only
(and files-only (>= (prefix-numeric-value files-only) 0)))
+ (setq Buffer-menu-filter-predicate filter-predicate)
(list-buffers--refresh buffer-list old-buffer)
(tabulated-list-print))
buffer))
@@ -631,6 +642,8 @@ list-buffers--refresh
(marked-buffers (Buffer-menu-marked-buffers))
(buffer-menu-buffer (current-buffer))
(show-non-file (not Buffer-menu-files-only))
+ (filter-predicate (and (functionp Buffer-menu-filter-predicate)
+ Buffer-menu-filter-predicate))
entries name-width)
;; Collect info for each buffer we're interested in.
(dolist (buffer (or buffer-list
@@ -644,7 +657,9 @@ list-buffers--refresh
(and (or (not (string= (substring name 0 1) " "))
file)
(not (eq buffer buffer-menu-buffer))
- (or file show-non-file))))
+ (or file show-non-file)
+ (or (not filter-predicate)
+ (funcall filter-predicate buffer)))))
(push (list buffer
(vector (cond
((eq buffer old-buffer) ".")
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index fc035675cec..917d80b2d3f 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -713,6 +713,7 @@ project-prefix-map
(define-key map "G" 'project-or-external-find-regexp)
(define-key map "r" 'project-query-replace-regexp)
(define-key map "x" 'project-execute-extended-command)
+ (define-key map "\C-b" 'project-list-buffers)
map)
"Keymap for project commands.")
@@ -1223,6 +1224,19 @@ project-display-buffer-other-frame
(interactive (list (project--read-project-buffer)))
(display-buffer-other-frame buffer-or-name))
+;;;###autoload
+(defun project-list-buffers (&optional arg)
+ "Display a list of project buffers.
+The list is displayed in a buffer named \"*Buffer List*\".
+
+By default, all project buffers are listed except those whose names
+start with a space (which are for internal use). With prefix argument
+ARG, show only buffers that are visiting files."
+ (interactive "P")
+ (let* ((pr (project-current t))
+ (filter-predicate (lambda (buf) (memq buf (project-buffers pr)))))
+ (display-buffer (list-buffers-noselect arg nil filter-predicate))))
+
(defcustom project-kill-buffer-conditions
'(buffer-file-name ; All file-visiting buffers are included.
;; Most of temp and logging buffers (aside from hidden ones):
@@ -1283,6 +1297,7 @@ project-kill-buffers-display-buffer-list
:package-version '(project . "0.8.2")
:safe #'booleanp)
+;; UNUSED?
(defun project--buffer-list (pr)
"Return the list of all buffers in project PR."
(let ((conn (file-remote-p (project-root pr)))
^ permalink raw reply related [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-10 17:59 ` Juri Linkov
@ 2022-11-12 1:41 ` Dmitry Gutov
2022-11-12 18:02 ` Juri Linkov
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-12 1:41 UTC (permalink / raw)
To: Juri Linkov, Akib Azmain Turja; +Cc: 59153
On 10.11.2022 19:59, Juri Linkov wrote:
> + (display-buffer (list-buffers-noselect arg nil filter-predicate))))
I suppose we'll need an arity check here?
So that this command also works in older emacsen with an install of
project.el from ELPA.
Alternatively, the command could set the value of
Buffer-menu-filter-predicate inside the resulting buffer, rather than
pass it as an argument to list-buffers-noselect.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-12 1:41 ` Dmitry Gutov
@ 2022-11-12 18:02 ` Juri Linkov
2022-11-13 2:37 ` Dmitry Gutov
0 siblings, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-12 18:02 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 59153, Akib Azmain Turja
>> + (display-buffer (list-buffers-noselect arg nil filter-predicate))))
>
> I suppose we'll need an arity check here?
>
> So that this command also works in older emacsen with an install of
> project.el from ELPA.
Ah, I forgot about older emacsen.
> Alternatively, the command could set the value of
> Buffer-menu-filter-predicate inside the resulting buffer, rather than pass
> it as an argument to list-buffers-noselect.
Setting a buffer-local variable looks like a safer option since
Stefan M. warned many times that an arity check is not reliable.
But then need to display buffer twice: first call
list-buffers-noselect without an argument, then
set buffer-local Buffer-menu-filter-predicate,
then programmatically revert the buffer.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-12 18:02 ` Juri Linkov
@ 2022-11-13 2:37 ` Dmitry Gutov
2022-11-13 17:57 ` Juri Linkov
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-13 2:37 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153, Akib Azmain Turja
On 12.11.2022 20:02, Juri Linkov wrote:
>>> + (display-buffer (list-buffers-noselect arg nil filter-predicate))))
>> I suppose we'll need an arity check here?
>>
>> So that this command also works in older emacsen with an install of
>> project.el from ELPA.
> Ah, I forgot about older emacsen.
>
>> Alternatively, the command could set the value of
>> Buffer-menu-filter-predicate inside the resulting buffer, rather than pass
>> it as an argument to list-buffers-noselect.
> Setting a buffer-local variable looks like a safer option since
> Stefan M. warned many times that an arity check is not reliable.
Catching the wrong-number-of-arguments error is a established way of
handling this.
But we could also, for example, introduce a new function which receives
a predicate, instead of adding a new arg to list-buffers-noselect.
Or just use an Emacs version check. It doesn't feel as nice, but should
work fine nevertheless.
> But then need to display buffer twice: first call
> list-buffers-noselect without an argument, then
> set buffer-local Buffer-menu-filter-predicate,
> then programmatically revert the buffer.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-13 2:37 ` Dmitry Gutov
@ 2022-11-13 17:57 ` Juri Linkov
2022-11-13 22:18 ` Dmitry Gutov
0 siblings, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-13 17:57 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 59153, Akib Azmain Turja
> Or just use an Emacs version check. It doesn't feel as nice, but should
> work fine nevertheless.
Using an Emacs version check is the best thing to do
because it will allow to hide (undefine) the whole
new function (and its keybinding) in older versions
since the new function don't work reliably without
accompanying changes in buff-menu.el.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-13 17:57 ` Juri Linkov
@ 2022-11-13 22:18 ` Dmitry Gutov
2022-11-15 8:36 ` Juri Linkov
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-13 22:18 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153, Akib Azmain Turja
On 13.11.2022 19:57, Juri Linkov wrote:
>> Or just use an Emacs version check. It doesn't feel as nice, but should
>> work fine nevertheless.
> Using an Emacs version check is the best thing to do
> because it will allow to hide (undefine) the whole
> new function (and its keybinding) in older versions
> since the new function don't work reliably without
> accompanying changes in buff-menu.el.
If you're sure, maybe.
But I would imagine that users of Emacs 28 and earlier would rather
enjoy the new command (with a 'g' caveat) than have it disabled.
As a safety measure, in older Emacs you could also set
'revert-buffer-function' locally to something displaying an error.
I don't remember using 'g' in ibuffer or list-buffers much anyway. But
that depends on one's habits.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-13 22:18 ` Dmitry Gutov
@ 2022-11-15 8:36 ` Juri Linkov
2022-11-15 14:53 ` Dmitry Gutov
0 siblings, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-15 8:36 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 59153, Akib Azmain Turja
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
> But I would imagine that users of Emacs 28 and earlier would rather enjoy
> the new command (with a 'g' caveat) than have it disabled.
>
> As a safety measure, in older Emacs you could also set
> 'revert-buffer-function' locally to something displaying an error.
>
> I don't remember using 'g' in ibuffer or list-buffers much anyway. But that
> depends on one's habits.
Maybe something like this that supports 'g' in older versions:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: project-list-buffers.patch --]
[-- Type: text/x-diff, Size: 1753 bytes --]
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ed26872ae77..63510e90502 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -712,6 +712,7 @@ project-prefix-map
(define-key map "G" 'project-or-external-find-regexp)
(define-key map "r" 'project-query-replace-regexp)
(define-key map "x" 'project-execute-extended-command)
+ (define-key map "\C-b" 'project-list-buffers)
map)
"Keymap for project commands.")
@@ -1222,6 +1223,28 @@ project-display-buffer-other-frame
(interactive (list (project--read-project-buffer)))
(display-buffer-other-frame buffer-or-name))
+;;;###autoload
+(defun project-list-buffers (&optional arg)
+ "Display a list of project buffers.
+The list is displayed in a buffer named \"*Buffer List*\".
+
+By default, all project buffers are listed except those whose names
+start with a space (which are for internal use). With prefix argument
+ARG, show only buffers that are visiting files."
+ (interactive "P")
+ (let ((pr (project-current t)))
+ (display-buffer
+ (if (version< emacs-version "29.0.50")
+ (let ((buf (list-buffers-noselect arg (project-buffers pr))))
+ (with-current-buffer buf
+ (setq-local revert-buffer-function
+ (lambda (&rest _ignored)
+ (list-buffers--refresh (project-buffers pr))
+ (tabulated-list-print t))))
+ buf)
+ (list-buffers-noselect
+ arg nil (lambda (buf) (memq buf (project-buffers pr))))))))
+
(defcustom project-kill-buffer-conditions
'(buffer-file-name ; All file-visiting buffers are included.
;; Most of temp and logging buffers (aside from hidden ones):
^ permalink raw reply related [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-15 8:36 ` Juri Linkov
@ 2022-11-15 14:53 ` Dmitry Gutov
2022-11-15 18:55 ` Juri Linkov
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-15 14:53 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153, Akib Azmain Turja
On 15.11.2022 10:36, Juri Linkov wrote:
> Maybe something like this that supports 'g' in older versions:
LGTM, thanks!
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-15 14:53 ` Dmitry Gutov
@ 2022-11-15 18:55 ` Juri Linkov
2022-11-16 10:16 ` Pankaj Jangid
0 siblings, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-15 18:55 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 59153, Akib Azmain Turja
close 59153 29.0.50
thanks
>> Maybe something like this that supports 'g' in older versions:
>
> LGTM, thanks!
Thanks for reviewing, now pushed to master. I didn't bump the version
to give more time for testing in master.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-15 18:55 ` Juri Linkov
@ 2022-11-16 10:16 ` Pankaj Jangid
2022-11-18 7:09 ` Juri Linkov
0 siblings, 1 reply; 21+ messages in thread
From: Pankaj Jangid @ 2022-11-16 10:16 UTC (permalink / raw)
To: 59153
This is a really helpful feature. A query though. Will that be another
feature request for the users of ibuffer. May be a variable
`project-list-buffers-function`.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-16 10:16 ` Pankaj Jangid
@ 2022-11-18 7:09 ` Juri Linkov
2022-11-19 18:34 ` Dmitry Gutov
0 siblings, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-18 7:09 UTC (permalink / raw)
To: Pankaj Jangid; +Cc: 59153
> This is a really helpful feature. A query though. Will that be another
> feature request for the users of ibuffer. May be a variable
> `project-list-buffers-function`.
Probably this could be implemented in ibuffer.el.
So when ibuffer is loaded, it could override the
keybinding 'C-x p C-b' with own function that uses
ibuffer filters with the current project buffers.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-18 7:09 ` Juri Linkov
@ 2022-11-19 18:34 ` Dmitry Gutov
2022-11-19 18:48 ` Juri Linkov
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-19 18:34 UTC (permalink / raw)
To: Juri Linkov, Pankaj Jangid; +Cc: 59153
On 18.11.2022 09:09, Juri Linkov wrote:
>> This is a really helpful feature. A query though. Will that be another
>> feature request for the users of ibuffer. May be a variable
>> `project-list-buffers-function`.
>
> Probably this could be implemented in ibuffer.el.
> So when ibuffer is loaded, it could override the
> keybinding 'C-x p C-b' with own function that uses
> ibuffer filters with the current project buffers.
Might as well add 'project-ibuffer' to project.el straight, similarly to
how we have both 'project-shell' and 'project-eshell'.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-19 18:34 ` Dmitry Gutov
@ 2022-11-19 18:48 ` Juri Linkov
2022-11-19 19:22 ` Dmitry Gutov
0 siblings, 1 reply; 21+ messages in thread
From: Juri Linkov @ 2022-11-19 18:48 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 59153, Pankaj Jangid
>>> This is a really helpful feature. A query though. Will that be another
>>> feature request for the users of ibuffer. May be a variable
>>> `project-list-buffers-function`.
>> Probably this could be implemented in ibuffer.el.
>> So when ibuffer is loaded, it could override the
>> keybinding 'C-x p C-b' with own function that uses
>> ibuffer filters with the current project buffers.
>
> Might as well add 'project-ibuffer' to project.el straight, similarly to
> how we have both 'project-shell' and 'project-eshell'.
Not sure where proliferating the number of keybindings for every
alternative will lead to. I'd rather try to use more
`define-alternatives' to allow choosing alternatives between
shell/eshell, list-buffers/ibuffer, ... with the same
project keybinding.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-19 18:48 ` Juri Linkov
@ 2022-11-19 19:22 ` Dmitry Gutov
0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-19 19:22 UTC (permalink / raw)
To: Juri Linkov; +Cc: 59153, Pankaj Jangid
On 19.11.2022 20:48, Juri Linkov wrote:
>>>> This is a really helpful feature. A query though. Will that be another
>>>> feature request for the users of ibuffer. May be a variable
>>>> `project-list-buffers-function`.
>>> Probably this could be implemented in ibuffer.el.
>>> So when ibuffer is loaded, it could override the
>>> keybinding 'C-x p C-b' with own function that uses
>>> ibuffer filters with the current project buffers.
>> Might as well add 'project-ibuffer' to project.el straight, similarly to
>> how we have both 'project-shell' and 'project-eshell'.
> Not sure where proliferating the number of keybindings for every
> alternative will lead to. I'd rather try to use more
> `define-alternatives' to allow choosing alternatives between
> shell/eshell, list-buffers/ibuffer, ... with the same
> project keybinding.
Maybe add it without a binding. Let the user do that choice themselves.
Regarding 'define-alternatives' - sure, that's also possible.
^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#59153: List project buffers
2022-11-09 17:40 bug#59153: List project buffers Juri Linkov
2022-11-09 18:01 ` Eli Zaretskii
2022-11-09 19:22 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-10 21:21 ` Dmitry Gutov
2022-11-12 1:39 ` Dmitry Gutov
2 siblings, 1 reply; 21+ messages in thread
From: Dmitry Gutov @ 2022-11-10 21:21 UTC (permalink / raw)
To: Juri Linkov, 59153
On 09.11.2022 19:40, Juri Linkov wrote:
> There are project commands and keys corresponding
> to the most useful buffer commands:
>
> C-x k (kill-buffer) - C-x p k (project-kill-buffers)
> C-x b (switch-to-buffer) - C-x p b (project-switch-to-buffer)
>
> What is still missing is a command to list project buffers:
>
> C-x C-b (list-buffers) - C-x p C-b (project-list-buffers)
This is fine with me, thank you.
> +;; UNUSED?
> (defun project--buffer-list (pr)
> "Return the list of all buffers in project PR."
> (let ((conn (file-remote-p (project-root pr)))
And this is a good catch. Apparently the common project buffer
enumeration logic is now missing the file-remote-p related speedup we
added for
https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg00152.html.
I wonder if it's still relevant, that's worth retesting.
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2022-11-19 19:22 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-09 17:40 bug#59153: List project buffers Juri Linkov
2022-11-09 18:01 ` Eli Zaretskii
2022-11-09 19:22 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 7:56 ` Juri Linkov
2022-11-10 8:56 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 17:59 ` Juri Linkov
2022-11-12 1:41 ` Dmitry Gutov
2022-11-12 18:02 ` Juri Linkov
2022-11-13 2:37 ` Dmitry Gutov
2022-11-13 17:57 ` Juri Linkov
2022-11-13 22:18 ` Dmitry Gutov
2022-11-15 8:36 ` Juri Linkov
2022-11-15 14:53 ` Dmitry Gutov
2022-11-15 18:55 ` Juri Linkov
2022-11-16 10:16 ` Pankaj Jangid
2022-11-18 7:09 ` Juri Linkov
2022-11-19 18:34 ` Dmitry Gutov
2022-11-19 18:48 ` Juri Linkov
2022-11-19 19:22 ` Dmitry Gutov
2022-11-10 21:21 ` Dmitry Gutov
2022-11-12 1:39 ` Dmitry Gutov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).