Subject: bug#31796: 27.1; dired-do-find-regexp-and-replace fails to find multiline regexps

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 Nov 2020 17:48:11 +0200

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Wed, 25 Nov 2020 09:28:57 +0200
> 
> >> >> dired-do-find-regexp-and-replace could be left bound to Q, but
> >> >> dired-do-query-replace-regexp could be bound to M-% in Dired.
> >> >
> >> > How will this help when the command to continue the loop is not bound
> >> > to any key?
> >>
> >> dired-do-query-replace-regexp works like normal 'M-%' with 'y/n/!'
> >> keys and automatically moves to the next file on multiple files.
> >> So it seemes it doesn't need a key to continue the loop.
> >
> > AFAIR, it does need a way to continue the loop if the user exits the
> > loop.
> 
> Where would the users get the idea that it's possible to interrupt
> query-replace and resume it anytime later, if single-file query-replace
> doesn't support this feature?

In the manual.  And in their muscle memory: we are talking about users
who knew about the original binding of Q in Dired, so we should assume
they also know about the possibility of exiting the loop and then
resuming it.

the command that was previously bound to Q used the UI that is very
similar to find-tag: you are presented with the first hit, and then go
to the next one, and the one after it, etc.  "Exiting the loop" can be
as simple as moving point or switching to another buffer to consult
some other part of Emacs.  It is very natural.  Once you've done that,
you'd want to resume the loop.

> I can't find where this feature of continuing the loop is
> documented.  (info "(emacs) Query Replace") only says:
> 
>      To restart a ‘query-replace’ once it is exited, use ‘C-x <ESC>
>   <ESC>’, which repeats the ‘query-replace’ because it used the minibuffer
>   to read its arguments.  *Note C-x <ESC> <ESC>: Repetition.

Wrong part of the manual, and the text which described that was
removed from the manual when we changed the binding.  Visit the Emacs
24 manual and go to "Operating on Files", a section of the "Dired"
chapter.  There you will see this text:

  `Q REGEXP <RET> TO <RET>'
       Perform `query-replace-regexp' on each of the specified files,
       replacing matches for REGEXP with the string TO
       (`dired-do-query-replace-regexp').

       This command is a variant of `tags-query-replace'.  If you exit the
       query replace loop, you can use `M-,' to resume the scan and
       replace more matches.  *Note Tags Search::.

The new UI presents all the hits in a separate window, so you can
easily use that to go to any hit you want even if you exit the loop.