unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73635: dired-do-query-replace-regexp should check if files are selected first
@ 2024-10-05  3:44 Dan Jacobson
  2024-10-05  4:22 ` Visuwesh
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Jacobson @ 2024-10-05  3:44 UTC (permalink / raw)
  To: 73635

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#73635: dired-do-query-replace-regexp should check if files are selected first
  2024-10-05  3:44 bug#73635: dired-do-query-replace-regexp should check if files are selected first Dan Jacobson
@ 2024-10-05  4:22 ` Visuwesh
  2024-10-19  7:02   ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Visuwesh @ 2024-10-05  4:22 UTC (permalink / raw)
  To: Dan Jacobson; +Cc: 73635

[சனி அக்டோபர் 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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#73635: dired-do-query-replace-regexp should check if files are selected first
  2024-10-05  4:22 ` Visuwesh
@ 2024-10-19  7:02   ` Eli Zaretskii
  2024-10-25 21:53     ` Dan Jacobson
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-10-19  7:02 UTC (permalink / raw)
  To: Visuwesh; +Cc: 73635-done, jidanni

> Cc: 73635@debbugs.gnu.org
> From: Visuwesh <visuweshm@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#73635: dired-do-query-replace-regexp should check if files are selected first
  2024-10-19  7:02   ` Eli Zaretskii
@ 2024-10-25 21:53     ` Dan Jacobson
  2024-10-26  6:59       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Jacobson @ 2024-10-25 21:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73635-done, Visuwesh

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#73635: dired-do-query-replace-regexp should check if files are selected first
  2024-10-25 21:53     ` Dan Jacobson
@ 2024-10-26  6:59       ` Eli Zaretskii
  2024-10-26  8:59         ` Dan Jacobson
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-10-26  6:59 UTC (permalink / raw)
  To: Dan Jacobson; +Cc: 73635, visuweshm

> From: Dan Jacobson <jidanni@jidanni.org>
> Cc: Visuwesh <visuweshm@gmail.com>,  73635-done@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#73635: dired-do-query-replace-regexp should check if files are selected first
  2024-10-26  6:59       ` Eli Zaretskii
@ 2024-10-26  8:59         ` Dan Jacobson
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Jacobson @ 2024-10-26  8:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73635, visuweshm

>>>>> "EZ" == Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-26  8:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05  3:44 bug#73635: dired-do-query-replace-regexp should check if files are selected first Dan Jacobson
2024-10-05  4:22 ` Visuwesh
2024-10-19  7:02   ` Eli Zaretskii
2024-10-25 21:53     ` Dan Jacobson
2024-10-26  6:59       ` Eli Zaretskii
2024-10-26  8:59         ` Dan Jacobson

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