GNU bug report logs - #73635
dired-do-query-replace-regexp should check if files are selected first

Previous Next

Package: emacs;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Sat, 5 Oct 2024 03:46:01 UTC

Severity: wishlist

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 73635 <at> debbugs.gnu.org, visuweshm <at> gmail.com
Subject: Re: bug#73635: dired-do-query-replace-regexp should check if files
 are selected first
Date: Sat, 26 Oct 2024 09:59:39 +0300
> From: Dan Jacobson <jidanni <at> jidanni.org>
> Cc: Visuwesh <visuweshm <at> gmail.com>,  73635-done <at> debbugs.gnu.org
> Date: Sat, 26 Oct 2024 05:53:14 +0800
> 
> >> > E.g., yes there were files selected, but we just did a first run, and
> >> > are no longer looking at the dired buffer. We need to go back to the
> >> > dired buffer first. Fine. But at least let the user know before they
> >> > bother entering the from and to values.
> >> 
> >> It uses the filename under point if there are no marked files like all
> >> dired commands.
> 
> EZ> Right, and so I think there's no bug here to fix, and I'm therefore
> EZ> closing it.
> 
> There is no check that the user is staring at the dired buffer first
> before asking for the two strings.

When this command is invoked, it prompts thusly:

  Query replace regexp in marked files:

Which already says that files should be marked before they could be
query-replaced.

> In fact what needs to be changed is:
> dired-do-query-replace-regexp needs to first check if the current buffer
> is a dired buffer.

That already happens if you invoke with "M-X" (capital X) or if you
customize read-extended-command-predicate to
command-completion-default-include-p.  We just decided not to make
that the default yet.

> And if it is not, it needs to say "Must be run in a dired buffer" and
> quit.
> 
> (Even if there is only one dired buffer in buffer-list.)

I see no reason to complicate the command to cover such made-up
scenarios.  If and when we decide to make
command-completion-default-include-p the default, this will happen
automatically.




This bug report was last modified 209 days ago.

Previous Next


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