GNU bug report logs - #14708
24.2; query-replace-regexp when match and replacement are the same

Previous Next

Package: emacs;

Reported by: Ed Avis <eda <at> waniasset.com>

Date: Mon, 24 Jun 2013 15:52:05 UTC

Severity: wishlist

Tags: wontfix

Found in version 24.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Josh <josh <at> foxtail.org>
To: Ed Avis <eda <at> waniasset.com>
Cc: 14708 <at> 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
On Mon, Jun 24, 2013 at 4:44 AM, Ed Avis <eda <at> 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.




This bug report was last modified 11 years and 118 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.