all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Josh <josh@foxtail.org>
To: Ed Avis <eda@waniasset.com>
Cc: 14708@debbugs.gnu.org
Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same
Date: Mon, 24 Jun 2013 09:19:18 -0700	[thread overview]
Message-ID: <CANdFEAEiog_AM7qyJ9i=nwCJdZ6K+ERtFLkKoEH2+1zHoOTSxA@mail.gmail.com> (raw)
In-Reply-To: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local>

On Mon, Jun 24, 2013 at 4:44 AM, Ed Avis <eda@waniasset.com> wrote:
> Do M-x query-replace-regexp and enter ' +' as the regexp and ' '
> as the replacement text.  Emacs matches each sequence of one or
> more space characters, as specified in the regexp, and asks whether
> to replace it.

Why not target two or more spaces in the search expression, i.e. "  +"?

> However, for many of the cases the replacement text will be the same
> as the match, so it makes no difference whether you replace or not.
> Since the aim of query-replace-regexp is primarily to do a search
> and replace, not to find all places in the buffer where a regexp
> matches, it should instead skip over those cases and only ask about
> places where replacing will make a difference.

I wouldn't like it if Emacs were to behave that way, because when
confirming a replacement would result in no change to the text it often
indicates a broken regexp (as in this case) that I want to know about.





  reply	other threads:[~2013-06-24 16:19 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 [this message]
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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANdFEAEiog_AM7qyJ9i=nwCJdZ6K+ERtFLkKoEH2+1zHoOTSxA@mail.gmail.com' \
    --to=josh@foxtail.org \
    --cc=14708@debbugs.gnu.org \
    --cc=eda@waniasset.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.