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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73635 in the body.
You can then email your comments to 73635 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#73635; Package emacs. (Sat, 05 Oct 2024 03:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 05 Oct 2024 03:46:02 GMT) Full text and rfc822 format available.

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

From: Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: dired-do-query-replace-regexp should check if files are selected first
Date: Sat, 05 Oct 2024 11:44:56 +0800
dired-do-query-replace-regexp
asks for the replace from value,
then asks for the replace to value,
and only then finally checks if any files are selected in the first
place.

It needs to check first.

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73635; Package emacs. (Sat, 05 Oct 2024 04:24:02 GMT) Full text and rfc822 format available.

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

From: Visuwesh <visuweshm <at> gmail.com>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 73635 <at> debbugs.gnu.org
Subject: Re: bug#73635: dired-do-query-replace-regexp should check if files
 are selected first
Date: Sat, 05 Oct 2024 09:52:08 +0530
[சனி அக்டோபர் 05, 2024] Dan Jacobson wrote:

> dired-do-query-replace-regexp
> asks for the replace from value,
> then asks for the replace to value,
> and only then finally checks if any files are selected in the first
> place.
>
> It needs to check first.
>
> 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.




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 12 Oct 2024 13:36:01 GMT) Full text and rfc822 format available.

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 19 Oct 2024 07:03:01 GMT) Full text and rfc822 format available.

Notification sent to Dan Jacobson <jidanni <at> jidanni.org>:
bug acknowledged by developer. (Sat, 19 Oct 2024 07:03:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 73635-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#73635: dired-do-query-replace-regexp should check if files are
 selected first
Date: Sat, 19 Oct 2024 10:02:09 +0300
> Cc: 73635 <at> debbugs.gnu.org
> From: Visuwesh <visuweshm <at> gmail.com>
> Date: Sat, 05 Oct 2024 09:52:08 +0530
> 
> [சனி அக்டோபர் 05, 2024] Dan Jacobson wrote:
> 
> > dired-do-query-replace-regexp
> > asks for the replace from value,
> > then asks for the replace to value,
> > and only then finally checks if any files are selected in the first
> > place.
> >
> > It needs to check first.
> >
> > 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.

Right, and so I think there's no bug here to fix, and I'm therefore
closing it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73635; Package emacs. (Fri, 25 Oct 2024 21:54:02 GMT) Full text and rfc822 format available.

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

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 73635-done <at> debbugs.gnu.org, Visuwesh <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 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.

So the user thinks they can mark some files, have a look at one, and
then do dired-do-query-replace-regexp... and it asks for the two
strings, and then says they have not selected any files.

But they did select the files. But they need to be back in the dired
buffer before running dired-do-query-replace-regexp. So
dired-do-query-replace-regexp should tell them that, instead of asking
them for the two strings.

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.

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.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73635; Package emacs. (Sat, 26 Oct 2024 07:01:02 GMT) Full text and rfc822 format available.

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73635; Package emacs. (Sat, 26 Oct 2024 09:00:01 GMT) Full text and rfc822 format available.

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

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.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 16:59:03 +0800
>>>>> "EZ" == Eli Zaretskii <eliz <at> gnu.org> writes:
EZ> I see no reason to complicate the command to cover such made-up
EZ> scenarios.  If and when we decide to make
EZ> command-completion-default-include-p the default, this will happen
EZ> automatically.

OK, it's a deal.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Nov 2024 12:24:10 GMT) Full text and rfc822 format available.

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.