Subject: Re: bug#23078: 24.5; Query-replace case insensitive - do not prompt for do-nothing replacements

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 12 May 2022 18:30:49 +0200

Ed Avis <[email-masked]> writes:

> M-x query-replace is case insensitive by default.  You may sometimes
> want to replace a string with another differing only in case, for
> example changing 'aaa' to 'Aaa'.  But query-replace prompts for all
> cases where a case-insensitive match for 'aaa' is found, even those that
> already equal the destination string.
>
> Here are the keypresses starting from 'emacs -Q' to reproduce:
>
> a a a RET A a a RET ESC O A ESC O A ESC % a a a RET
> A a a RET y
>
> I suggest that if the search and replacement strings differ only in
> case, then Emacs should prompt only where there is a real choice to be
> made.  When the match of 'Aaa' is highlighted it makes no difference
> whether you answer y or n; so Emacs should not waste the user's time
> asking.
>
> This does mean that the matches highlighted by query-replace differ from
> those you would find with a normal case insensitive search, in these
> specific circumstances where the search and replacement strings differ
> only in case.  I think that is a fair tradeoff.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I think this might be more confusing than anything else.  And just
because the default replacement has no changes, you can (for instance)
`E' out and type in something else for that specific match.

So I don't think this would be a good idea as the default interface, and
I don't think many people would want to modify a user option for
something like this, so I'm closing this bug report as a "wontfix".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no