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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 01 Jun 2025 09:10:45 +0300

> Date: Sun, 01 Jun 2025 15:19:02 +1200
> From: Phil Sainty <[email-masked]>
> 
> A user in the matrix.org Emacs chat room was asking why they couldn't
> open multiple directories in multiple dired buffers, mark various files
> in each of those buffers, and then perform some action on ALL of those
> marked files at once.

If those other directories are subdirectories of some common parent,
we already have 'i'.

> My first thought was that this would be chaotic due to the possibility
> of dired buffers with marked files which the user wasn't aware of at
> the time; but then I remembered that you can pass `dired' a file list
> in order to create a new dired buffer with only those files, and I
> thought *that* sounded like a nice feature which addressed the
> requirement in a safe manner (as the user then gets to review the file
> list in the new dired buffer before acting on them).
> 
> I've attached a patch with a first pass implementation.
> 
> Thoughts?

I guess we could add that, although it's a rare use case, and the
display is not very nice, since all the file names are absolute, and
thus long.  Perhaps use abbreviate-file-name?

> +(defun dired-on-marked-files-in-all-buffers ()
> +  "Invoke `dired' on the marked files in all dired buffers."
> +  (interactive)
> +  (if-let ((files (dired-get-marked-files-in-all-buffers)))
> +      (dired (cons "/" files))

Why "/"?  It sounds arbitrary.  Also non-portable; use

  (expand-file-name "/")

instead.