From: Ed Avis <eda@waniasset.com>
To: "'jlf@foxtail.org'" <jlf@foxtail.org>,
"'monnier@iro.umontreal.ca'" <monnier@iro.umontreal.ca>
Cc: "'14708@debbugs.gnu.org'" <14708@debbugs.gnu.org>
Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same
Date: Tue, 25 Jun 2013 06:56:07 +0000 [thread overview]
Message-ID: <7E039918541B4C4183BFDB8F015C74300E9E08@WCL-EXCH02.wcl.local> (raw)
In-Reply-To: <CANdFEAH3JAvZsyw8TJkKtmMZTxW2mf+gpESKuvO2nQi9bR8X0A@mail.gmail.com>
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
______________________________________________________________________
next prev parent reply other threads:[~2013-06-25 6:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 11:44 bug#14708: 24.2; query-replace-regexp when match and replacement are the same Ed Avis
2013-06-24 16:19 ` Josh
2013-06-24 16:30 ` Ed Avis
2013-06-24 17:01 ` Andreas Schwab
2013-06-25 1:49 ` Stefan Monnier
2013-06-25 4:17 ` Josh Feinstein
2013-06-25 6:56 ` Ed Avis [this message]
2013-06-25 14:10 ` Drew Adams
2013-06-25 15:03 ` Josh
2013-06-25 13:39 ` Stefan Monnier
2013-06-25 14:59 ` Josh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7E039918541B4C4183BFDB8F015C74300E9E08@WCL-EXCH02.wcl.local \
--to=eda@waniasset.com \
--cc=14708@debbugs.gnu.org \
--cc=jlf@foxtail.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).