Subject: Re: bug#14708: 24.2; query-replace-regexp when match and replacement are the same

From: Ed Avis <[email-masked]>
Date: Tue, 25 Jun 2013 06:56:07 +0000

I wouldn't say that the regexp in this case is broken - only suboptimal. The user entered something correct, to replace all sequences of spaces by a single space. If done as a global replace without confirmation, you wouldn't even notice. The user asked for confirmation of each change to end up with the right text in the buffer, not as an academic exercise in finding the best possible regexp.

So prompting for each no-op match is not really helping the user. I can see that sometimes you might use query-replace-regexp as a debugging aid (though surely a simple search without replacement would be better). But even then it would be enough just to flag up one case where match=replacement, not request y or n for each one, since they are all identical. (Here I am assuming no capturing groups.)

So maybe the answer is to flag the first no-op match but then skip the rest. 

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________