Subject: 24.2; query-replace-regexp when match and replacement are the same

From: Ed Avis <[email-masked]>
Date: Mon, 24 Jun 2013 11:44:40 +0000

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

Enter some text in a buffer with some space characters and some
double  or   triple   spaced  like  this.

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.

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.

So in this example, only the double and triple spaces would be
asked about for replacement.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.2/etc/DEBUG.

In GNU Emacs 24.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.6.4)
 of 2013-04-12 on buildvm-05.phx2.fedoraproject.org
Configured using:
 `configure '--build=x86_64-redhat-linux-gnu'
 '--host=x86_64-redhat-linux-gnu' '--program-prefix='
 '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include'
 '--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
 '--localstatedir=/var' '--sharedstatedir=/var/lib'
 '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus'
 '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
 '--with-xft' '--with-xpm' '--with-x-toolkit=gtk3' '--with-gpm=no'
 '--with-wide-int' 'build_alias=x86_64-redhat-linux-gnu'
 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
 --param=ssp-buffer-size=4 -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LC_MESSAGES: en_GB.UTF-8
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: HTML

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
a t SPC w a c s l = " C-x o ESC O C ESC O C ESC O C
ESC O C ESC O C ESC O C ESC O C ESC O C ESC O C ESC
O C ESC O C ESC O C ESC O C ESC O C ESC O C ESC O C
ESC O C ESC O C ESC O C ESC O C ESC O C ESC O C ESC
O C ESC O C ESC O C ESC O C C-@ ESC O B ESC O B ESC
O B ESC O B ESC O D ESC O B ESC O D ESC w C-x o C-y
ESC O A ESC O A ESC O A ESC O A ESC O A C-e C-d C-e
C-d C-e C-d C-e C-d C-e C-d C-e " SPC f o r m a t =
" 0 . 0 DEL # " SPC r e p o r t - c h a n g e s = "
1 " SPC / > < / T D > C-a ESC d C-_ ESC f ESC f ESC
x r e DEL DEL q u e r SPC r e SPC - r e g e SPC RET
SPC c C-h + C-g ESC x ESC O A RET SPC + RET SPC RET
y y y y y y y y y y y y y y y C-a ESC x r e p o r t
SPC e m SPC b SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC DEL DEL DEL DEL
DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL
DEL DEL DEL RET

Recent messages:
Keyboard macro defined
(Type e to repeat macro) [17 times]
Making completion list...
Mark set
Mark saved where search started [2 times]
Auto-saving...done
Mark set [2 times]
Undo!
Quit [2 times]
Mark set

Load-path shadows:

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