GNU bug report logs - #78658
30.1; [PATCH] Dired feature suggestion: dired-on-marked-files-in-all-buffers

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Sun, 1 Jun 2025 03:20:06 UTC

Severity: normal

Tags: patch

Found in version 30.1

Full log


Message #104 received at 78658 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: rms <at> gnu.org, psainty <at> orcon.net.nz, 78658 <at> debbugs.gnu.org, juri <at> linkov.net,
 stefankangas <at> gmail.com, acorallo <at> gnu.org
Subject: Re: bug#78658: 30.1; [PATCH] Dired feature
 suggestion: dired-on-marked-files-in-all-buffers
Date: Sat, 07 Jun 2025 13:19:04 +0300
> From: Drew Adams <drew.adams <at> oracle.com>
> CC: "psainty <at> orcon.net.nz" <psainty <at> orcon.net.nz>,
>         "78658 <at> debbugs.gnu.org"
> 	<78658 <at> debbugs.gnu.org>,
>         "juri <at> linkov.net" <juri <at> linkov.net>,
>         "stefankangas <at> gmail.com" <stefankangas <at> gmail.com>,
>         "acorallo <at> gnu.org"
> 	<acorallo <at> gnu.org>, "rms <at> gnu.org" <rms <at> gnu.org>
> Date: Thu, 5 Jun 2025 21:25:13 +0000
> 
> When `dired-mode' is invoked it calls `dired-advertise',
> which adds the Dired buffer to the value of global variable
> `dired-buffers'.  A couple commands remove a buffer name from
> this list, by calling `dired-unadvertise'.  In particular,
> `wdired-change-to-wdired-mode' does this, because it changes
> the major mode from `dired-mode' to `wdired-mode'.
> 
> The value of var `dired-buffers' is thus generally a list of
> all buffers in `dired-mode'.  (This can include buffers that
> have been killed, so filtering with `buffer-live-p' is also
> needed.)
> 
> The only exceptions are (1) commands `find-dired' and its
> derivatives such as `find-name-dired', and (2) commands
> `find-lisp-dired*'.  They're exceptions because they bind
> `dired-buffers' around their work (see above), so as not to
> add their resulting Dired buffers to `dired-buffers'.
> 
> This means that code can't just examine `dired-buffers' to
> find the set of Dired buffers (buffers advertised to be in
> `dired-mode').  Instead, it needs to filter `buffer-list',
> to gather the buffers with modes derived from `dired-mode'.
> That's unfortunate - it's much more costly, in general.
> 
> The question is whether there's a good reason why find*
> buffers, which are in `dired-mode', should be excluded from
> being "advertised" as such, i.e., whether they should really
> be excluded from `dired-buffers'.  And if so, why?
> 
> It was apparently a 1998 commit by Richard that added the
> protective binding to `find-dired', but with no comment as
> to why.
> 
> In the Emacs sources, at least, there are no other places
> that exclude `dired-mode' buffers from `dired-buffers'.
> And grepping for `find-dired' shows that there are no places
> that rely on such exclusion for `find-dired' buffers.  Same
> for `find-lisp-find-dired-internal' (which binds
> `dired-buffers' for `find-lisp*').

Thanks.

If we allow find-dired to add its buffers to the list in
dired-buffers, we need to make sure they are removed from the list.
We also need to make sure that functions which scan the list and
operate on its buffers will DTRT with find-dired buffers found in the
list.  Is all of this reasonable to do, and if so, is it planned to be
done as part of the changes you are discussing?




This bug report was last modified 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.