From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Ed Avis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2013 15:52:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14708@debbugs.gnu.org X-Debbugs-Original-To: "'bug-gnu-emacs@gnu.org'" Received: via spool by submit@debbugs.gnu.org id=B.1372089107464 (code B ref -1); Mon, 24 Jun 2013 15:52:05 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jun 2013 15:51:47 +0000 Received: from localhost ([127.0.0.1]:38806 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ur93S-00007N-GN for submit@debbugs.gnu.org; Mon, 24 Jun 2013 11:51:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59100) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ur5Ce-0006Ap-1l for submit@debbugs.gnu.org; Mon, 24 Jun 2013 07:45:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur5CV-00030M-SR for submit@debbugs.gnu.org; Mon, 24 Jun 2013 07:44:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,UNPARSEABLE_RELAY autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur5CV-00030G-Pi for submit@debbugs.gnu.org; Mon, 24 Jun 2013 07:44:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur5CS-0007vH-FM for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2013 07:44:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur5CO-0002yu-B1 for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2013 07:44:48 -0400 Received: from mail1.bemta5.messagelabs.com ([195.245.231.140]:49767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur5CO-0002yX-1Q for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2013 07:44:44 -0400 Received: from [85.158.139.83:39976] by server-4.bemta-5.messagelabs.com id 30/49-20445-A2138C15; Mon, 24 Jun 2013 11:44:42 +0000 X-Env-Sender: eda@waniasset.com X-Msg-Ref: server-3.tower-182.messagelabs.com!1372074281!28394356!1 X-Originating-IP: [80.169.169.167] X-StarScan-Received: X-StarScan-Version: 6.9.9; banners=waniasset.com,-,- X-VirusChecked: Checked Received: (qmail 32567 invoked from network); 24 Jun 2013 11:44:41 -0000 Received: from unknown (HELO WCL-EXCHCAS02.wcl.local) (80.169.169.167) by server-3.tower-182.messagelabs.com with AES128-SHA encrypted SMTP; 24 Jun 2013 11:44:41 -0000 Received: from WCL-EXCH02.wcl.local ([169.254.1.11]) by WCL-EXCHCAS02.wcl.local ([149.85.127.102]) with mapi id 14.02.0318.004; Mon, 24 Jun 2013 12:44:41 +0100 From: Ed Avis Thread-Topic: 24.2; query-replace-regexp when match and replacement are the same Thread-Index: Ac5w0CjtpWjfQgWfSKGXwT/2YP4U9g== Date: Mon, 24 Jun 2013 11:44:40 +0000 Message-ID: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [149.85.127.148] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Mon, 24 Jun 2013 11:51:45 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) 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=20primarily 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=3Dx86_64-redhat-linux-gnu' '--host=3Dx86_64-redhat-linux-gnu' '--program-prefix=3D' '--disable-dependency-tracking' '--prefix=3D/usr' '--exec-prefix=3D/usr' '--bindir=3D/usr/bin' '--sbindir=3D/usr/sbin' '--sysconfdir=3D/etc' '--datadir=3D/usr/share' '--includedir=3D/usr/include' '--libdir=3D/usr/lib64' '--libexecdir=3D/usr/libexec' '--localstatedir=3D/var' '--sharedstatedir=3D/var/lib' '--mandir=3D/usr/share/man' '--infodir=3D/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=3Dgtk3' '--with-gpm=3Dno' '--with-wide-int' 'build_alias=3Dx86_64-redhat-linux-gnu' 'host_alias=3Dx86_64-redhat-linux-gnu' 'CFLAGS=3D-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=3D2 -fexceptions -fstack-protector --param=3Dssp-buffer-size=3D4 -m64 -mtune=3Dgeneric' 'LDFLAGS=3D-Wl,-z,re= lro '' 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 =3D " 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 =3D " 0 . 0 DEL # " SPC r e p o r t - c h a n g e s =3D " 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 ______________________________________________________________________ From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Josh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2013 16:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ed Avis Cc: 14708@debbugs.gnu.org Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.13720907975119 (code B ref 14708); Mon, 24 Jun 2013 16:20:02 +0000 Received: (at 14708) by debbugs.gnu.org; 24 Jun 2013 16:19:57 +0000 Received: from localhost ([127.0.0.1]:38870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ur9Ui-0001KV-VV for submit@debbugs.gnu.org; Mon, 24 Jun 2013 12:19:57 -0400 Received: from mail-qc0-f169.google.com ([209.85.216.169]:34217) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ur9Ug-0001K8-EQ for 14708@debbugs.gnu.org; Mon, 24 Jun 2013 12:19:55 -0400 Received: by mail-qc0-f169.google.com with SMTP id c10so6500427qcz.0 for <14708@debbugs.gnu.org>; Mon, 24 Jun 2013 09:19:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=Dxk+F0m6sTA2vHqpNtgwvpI5D+/JtL2uQFwxvlc9mYs=; b=gfiibzx79NDTKE6VlNWczWajJKKgOGoqauk+dQ0DjIAWYyzUp0bqNPwrWZZPcZWsha E/qZD2OoROpbWNHiQwAZMzd1/ecpTjdvhh3c8xgb8Z0wGmEHnhmdHRGZnCUPCqbvpYFz DvUteAYMhmbTHuJudhMU96Kqe7KCqQYlEx8VciaYka8w2CIfFd0JWWuYOrs5LzLAXrSe OJ6N5EYJ9p/hWkhC0XOQbYtg4R3vpMhzJ5s6NsKetVkImV35ZdDSVqXndku6E1NE1Az7 SMNEQ6M23u8EOKaIJUELbM4N9gL0OyLWDvG03KRtgQgyQYj1wiDSp/UPiPmQTgMZaK9m v7kQ== X-Received: by 10.49.116.230 with SMTP id jz6mr19020395qeb.94.1372090788715; Mon, 24 Jun 2013 09:19:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.30.41 with HTTP; Mon, 24 Jun 2013 09:19:18 -0700 (PDT) In-Reply-To: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> From: Josh Date: Mon, 24 Jun 2013 09:19:18 -0700 X-Google-Sender-Auth: mKsuW0dfyEH30VurvgCFAYELLU8 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnEtbawlkpXGNUG7h+32QNEn6CLL6IYy3ZWKFuQ7NqfsaIxTOZ7Mm7rFp2go3Gbyg+nlPqY X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Mon, Jun 24, 2013 at 4:44 AM, Ed Avis 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. From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Ed Avis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2013 16:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 'Josh' Cc: "14708@debbugs.gnu.org" <14708@debbugs.gnu.org> Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.13720914566730 (code B ref 14708); Mon, 24 Jun 2013 16:31:02 +0000 Received: (at 14708) by debbugs.gnu.org; 24 Jun 2013 16:30:56 +0000 Received: from localhost ([127.0.0.1]:38874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ur9fM-0001kS-4d for submit@debbugs.gnu.org; Mon, 24 Jun 2013 12:30:56 -0400 Received: from mail1.bemta5.messagelabs.com ([195.245.231.141]:46887) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ur9fI-0001kC-NL for 14708@debbugs.gnu.org; Mon, 24 Jun 2013 12:30:53 -0400 Received: from [85.158.139.83:11348] by server-5.bemta-5.messagelabs.com id 05/75-27868-93478C15; Mon, 24 Jun 2013 16:30:49 +0000 X-Env-Sender: eda@waniasset.com X-Msg-Ref: server-13.tower-182.messagelabs.com!1372091447!27897674!1 X-Originating-IP: [80.169.169.167] X-StarScan-Received: X-StarScan-Version: 6.9.9; banners=waniasset.com,-,- X-VirusChecked: Checked Received: (qmail 16417 invoked from network); 24 Jun 2013 16:30:47 -0000 Received: from unknown (HELO WCL-EXCHCAS02.wcl.local) (80.169.169.167) by server-13.tower-182.messagelabs.com with AES128-SHA encrypted SMTP; 24 Jun 2013 16:30:47 -0000 Received: from WCL-EXCH02.wcl.local ([169.254.1.11]) by WCL-EXCHCAS02.wcl.local ([149.85.127.102]) with mapi id 14.02.0318.004; Mon, 24 Jun 2013 17:30:47 +0100 From: Ed Avis Thread-Topic: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Thread-Index: Ac5w0CjtpWjfQgWfSKGXwT/2YP4U9gAHgjYAAAJIsLA= Date: Mon, 24 Jun 2013 16:30:46 +0000 Message-ID: <7E039918541B4C4183BFDB8F015C74300E9459@WCL-EXCH02.wcl.local> References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> In-Reply-To: Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [149.85.127.148] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Yes, I could have specified the regexp as ' +' instead of just ' +'. That would not have given any cases where the match and replacement are th= e same. I typed the regexp without too much thought, but it is not incorrect; replacing one or more spaces with one space does what I want, just with more replacement operations than are strictly necessary. I think it would make Emacs more usable if it only prompted for replacemen= ts which make a difference, after all, if the buffer contents will not be aff= ected one way or the other why waste the user's time asking for yes or no? I do take your point that a no-op replacement can indicate a bug in the regexp. Perhaps query-replace-regexp could print 'Skipping some cases where matched text and replacement text are the same'. --=20 Ed Avis ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________ From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2013 17:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ed Avis Cc: 'Josh' , "14708@debbugs.gnu.org" <14708@debbugs.gnu.org> Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137209326811484 (code B ref 14708); Mon, 24 Jun 2013 17:02:02 +0000 Received: (at 14708) by debbugs.gnu.org; 24 Jun 2013 17:01:08 +0000 Received: from localhost ([127.0.0.1]:38897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrA8Z-0002z8-H4 for submit@debbugs.gnu.org; Mon, 24 Jun 2013 13:01:07 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:34587) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrA8X-0002yv-9m for 14708@debbugs.gnu.org; Mon, 24 Jun 2013 13:01:06 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3bfGwv5SFVz3hhkb; Mon, 24 Jun 2013 19:01:03 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3bfGwv1sLNzbbgb; Mon, 24 Jun 2013 19:01:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id vAb_7HBLXc1W; Mon, 24 Jun 2013 19:01:02 +0200 (CEST) X-Auth-Info: xF6xv+Luo9CPf4yJ0gz1t3BNoiAr7O6gvVyogD2nxeM= Received: from igel.home (ppp-88-217-113-140.dynamic.mnet-online.de [88.217.113.140]) by mail.mnet-online.de (Postfix) with ESMTPA; Mon, 24 Jun 2013 19:01:02 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id DD8CDE54A3; Mon, 24 Jun 2013 19:01:01 +0200 (CEST) From: Andreas Schwab References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> <7E039918541B4C4183BFDB8F015C74300E9459@WCL-EXCH02.wcl.local> X-Yow: HELLO KITTY gang terrorizes town, family STICKERED to death! Date: Mon, 24 Jun 2013 19:01:01 +0200 In-Reply-To: <7E039918541B4C4183BFDB8F015C74300E9459@WCL-EXCH02.wcl.local> (Ed Avis's message of "Mon, 24 Jun 2013 16:30:46 +0000") Message-ID: <87fvw7v3xu.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Should this no-op replacement increment the replacement counter (\#)? Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 01:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ed Avis Cc: 14708@debbugs.gnu.org Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137212498720790 (code B ref 14708); Tue, 25 Jun 2013 01:50:02 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 01:49:47 +0000 Received: from localhost ([127.0.0.1]:39249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrIOA-0005PG-Pi for submit@debbugs.gnu.org; Mon, 24 Jun 2013 21:49:46 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:23340) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrIO8-0005P0-Ch for 14708@debbugs.gnu.org; Mon, 24 Jun 2013 21:49:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="17085022" Received: from 76-10-154-64.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([76.10.154.64]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 Jun 2013 21:49:33 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 6EFAAAE246; Mon, 24 Jun 2013 21:49:38 -0400 (EDT) From: Stefan Monnier Message-ID: References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> Date: Mon, 24 Jun 2013 21:49:38 -0400 In-Reply-To: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> (Ed Avis's message of "Mon, 24 Jun 2013 11:44:40 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > 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 don't think the difference is very important, but I wouldn't oppose such a change. Stefan From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Josh Feinstein Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 05:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: Ed Avis , 14708@debbugs.gnu.org Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.13721385749661 (code B ref 14708); Tue, 25 Jun 2013 05:37:01 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 05:36:14 +0000 Received: from localhost ([127.0.0.1]:39422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrLvJ-0002Vk-Vj for submit@debbugs.gnu.org; Tue, 25 Jun 2013 01:36:14 -0400 Received: from mail-qe0-f50.google.com ([209.85.128.50]:64303) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrKi6-0000Vz-HS for 14708@debbugs.gnu.org; Tue, 25 Jun 2013 00:18:31 -0400 Received: by mail-qe0-f50.google.com with SMTP id f6so463569qej.23 for <14708@debbugs.gnu.org>; Mon, 24 Jun 2013 21:18:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=GpQB+yHq1lTSJA4rsweEnXiqisSGlPzw8XuMwfzhz28=; b=VYx+ZMsW5JU1jqHSQQ5OUwalN3ENtiRxhVfFRU/TRhjkcLxNvCAhUABzvihMRLdHr9 Btm0oHCYT5LLnJ5czf95Taje8iOeU97eWZvxyoJzMgKI8RDVrzfYtdfx2n+GSIe8J+EB RhRFbWev2MkFIa661ZcxM0pyaPVDeyw5B1mouD5ZMMKHM2urA8Af300mrNviwY48KpSZ nSqlOKLedXO/5PykwgEHNSaxg1iqwYrO7UmlWa4+amZ1PF1D1Lf9DFPkr5Ue4MX6tFmD 1/aBljEfbsc3nEJpBlT75dYqj03KjXuaAU3rXfYF6C8/b0+DE2eO6IteyTc/hVZYhHex TPgw== X-Received: by 10.49.41.41 with SMTP id c9mr25219441qel.19.1372133905086; Mon, 24 Jun 2013 21:18:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.5.227 with HTTP; Mon, 24 Jun 2013 21:17:53 -0700 (PDT) In-Reply-To: References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> From: Josh Feinstein Date: Mon, 24 Jun 2013 21:17:53 -0700 Message-ID: Content-Type: multipart/alternative; boundary=047d7bea3fceff861104dff2d1d8 X-Gm-Message-State: ALoCoQkuB1yaVsG4z+AsuIPlBeoBN4yeUvc7503T/sO1lEujfOorS3PlVW5ZU9g++2PJau8EFgFw X-Spam-Score: -0.7 (/) X-Mailman-Approved-At: Tue, 25 Jun 2013 01:36:12 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --047d7bea3fceff861104dff2d1d8 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Jun 24, 2013 at 6:49 PM, Stefan Monnier wrote: > > 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 don't think the difference is very important, but I wouldn't oppose > such a change. > Did you read the point I made above and which the reporter conceded, namely that such no-op replacements often indicate broken regexps? Changing the behavior to either silently ignore such cases or issue a vague "skipped some replacements" message would make it more difficult to detect such breakage and the affected buffer locations, with the only benefit stated so far being to save someone typing " +" instead of " +". --047d7bea3fceff861104dff2d1d8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Mon, Jun 24, 2013 at 6:49 PM, Stefan Monnier <= monnier@iro.umontreal.ca> wrote:
> Si= nce 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 don't think the difference is very important, but I wouldn'= t oppose
such a change.

Did you read the point I made above and which the reporter= conceded, namely that such no-op replacements often indicate broken regexp= s?=A0 Changing the behavior to either silently ignore such cases or issue a= vague "skipped some replacements" message would make it more dif= ficult to detect such breakage and the affected buffer locations, with the = only benefit stated so far being to save someone typing "=A0 +" i= nstead of " +".
--047d7bea3fceff861104dff2d1d8-- From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> Resent-From: Ed Avis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 06:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "'jlf@foxtail.org'" , "'monnier@iro.umontreal.ca'" Cc: "'14708@debbugs.gnu.org'" <14708@debbugs.gnu.org> Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137214337817566 (code B ref 14708); Tue, 25 Jun 2013 06:57:01 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 06:56:18 +0000 Received: from localhost ([127.0.0.1]:39515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrNAn-0004ZF-5L for submit@debbugs.gnu.org; Tue, 25 Jun 2013 02:56:17 -0400 Received: from mail1.bemta5.messagelabs.com ([195.245.231.152]:56458) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrNAj-0004Z4-0C for 14708@debbugs.gnu.org; Tue, 25 Jun 2013 02:56:13 -0400 Received: from [85.158.139.83:40867] by server-16.bemta-5.messagelabs.com id 2B/75-31941-A0F39C15; Tue, 25 Jun 2013 06:56:10 +0000 X-Env-Sender: eda@waniasset.com X-Msg-Ref: server-4.tower-182.messagelabs.com!1372143368!25783935!1 X-Originating-IP: [80.169.169.167] X-StarScan-Received: X-StarScan-Version: 6.9.9; banners=waniasset.com,-,- X-VirusChecked: Checked Received: (qmail 30273 invoked from network); 25 Jun 2013 06:56:09 -0000 Received: from unknown (HELO WCL-EXCHCAS02.wcl.local) (80.169.169.167) by server-4.tower-182.messagelabs.com with AES128-SHA encrypted SMTP; 25 Jun 2013 06:56:09 -0000 Received: from WCL-EXCH02.wcl.local ([169.254.1.11]) by WCL-EXCHCAS02.wcl.local ([149.85.127.102]) with mapi id 14.02.0318.004; Tue, 25 Jun 2013 07:56:08 +0100 From: Ed Avis Thread-Topic: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Thread-Index: Ac5w0CjtpWjfQgWfSKGXwT/2YP4U9gAdhnAyAAMUaYAAB585gA== Date: Tue, 25 Jun 2013 06:56:07 +0000 Message-ID: <7E039918541B4C4183BFDB8F015C74300E9E08@WCL-EXCH02.wcl.local> In-Reply-To: Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [149.85.127.28] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) I wouldn't say that the regexp in this case is broken - only suboptimal. T= he user entered something correct, to replace all sequences of spaces by a= single space. If done as a global replace without confirmation, you would= n'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 se= e that sometimes you might use query-replace-regexp as a debugging aid (th= ough surely a simple search without replacement would be better). But even= then it would be enough just to flag up one case where match=3Dreplacemen= t, 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 res= t.=20 ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________ From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 13:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Josh Feinstein Cc: Ed Avis , 14708@debbugs.gnu.org Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137216757511482 (code B ref 14708); Tue, 25 Jun 2013 13:40:03 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 13:39:35 +0000 Received: from localhost ([127.0.0.1]:40099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrTT3-0002z7-Sg for submit@debbugs.gnu.org; Tue, 25 Jun 2013 09:39:34 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:42189) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrTT0-0002yt-Px for 14708@debbugs.gnu.org; Tue, 25 Jun 2013 09:39:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GsR+QDpEKA6R6gV6DEw X-IPAS-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GsR+QDpEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="17114003" Received: from 76-10-154-64.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([76.10.154.64]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Jun 2013 09:39:19 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 64F18AE10E; Tue, 25 Jun 2013 09:39:24 -0400 (EDT) From: Stefan Monnier Message-ID: References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> Date: Tue, 25 Jun 2013 09:39:24 -0400 In-Reply-To: (Josh Feinstein's message of "Mon, 24 Jun 2013 21:17:53 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> I don't think the difference is very important, but I wouldn't oppose >> such a change. > Did you read the point I made above and which the reporter conceded, namely > that such no-op replacements often indicate broken regexps? I did. And just like the improvement he proposes, this downside is minor. I don't think either of the arguments justifies spending time on a patch, Stefan From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 14:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ed Avis , jlf@foxtail.org, monnier@iro.umontreal.ca Cc: 14708@debbugs.gnu.org Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137216943415573 (code B ref 14708); Tue, 25 Jun 2013 14:11:02 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 14:10:34 +0000 Received: from localhost ([127.0.0.1]:40488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrTx3-000433-QR for submit@debbugs.gnu.org; Tue, 25 Jun 2013 10:10:34 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:31704) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrTx0-00042i-FL for 14708@debbugs.gnu.org; Tue, 25 Jun 2013 10:10:31 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r5PEANSl007161 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Jun 2013 14:10:24 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5PEAKjN006221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Jun 2013 14:10:22 GMT Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5PEAKQF006209; Tue, 25 Jun 2013 14:10:20 GMT MIME-Version: 1.0 Message-ID: Date: Tue, 25 Jun 2013 07:10:20 -0700 (PDT) From: Drew Adams References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> <7E039918541B4C4183BFDB8F015C74300E9E08@WCL-EXCH02.wcl.local> In-Reply-To: <7E039918541B4C4183BFDB8F015C74300E9E08@WCL-EXCH02.wcl.local> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Score: -3.6 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.6 (---) > 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 would= n't > even notice. The user asked for confirmation of each change to end up wit= h > the right text in the buffer, not as an academic exercise in finding the > best possible regexp. >=20 > So prompting for each no-op match is not really helping the user. I can s= ee > that sometimes you might use query-replace-regexp as a debugging aid (tho= ugh > surely a simple search without replacement would be better). But even the= n > it would be enough just to flag up one case where match=3Dreplacement, no= t > request y or n for each one, since they are all identical. (Here I am > assuming no capturing groups.) >=20 > So maybe the answer is to flag the first no-op match but then skip the re= st. Haven't been following this thread, so excuse if I misunderstand. It would be wrong, IMHO, to simply skip ANY matches, e.g., because the occu= rrence precisely matches the replacement string. This could be an optional behavior, but it certainly should not simply repl= ace the longstanding behavior. Why? Because query replacing is not just about replacing. It can be about= checking occurrences (all of them). It can involve stopping and doing som= ething (e.g. editing the occurrence in a different way from the replacement= text, or editing surrounding text). And that "stopping" can be either via= recursive edit (allowing q-r resuming) or simply stopping altogether (and = perhaps restarting, at the same spot or elsewhere). In sum, there is a lot more to a q-r interaction than simply y/n replacemen= t. Do not mess up what has already been available. If you like, provide a= n option (on the fly via a key or via a user option) to do what you request= . But please do not just replace the existing, rich behavior. From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Josh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: Ed Avis , 14708@debbugs.gnu.org Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137217241021380 (code B ref 14708); Tue, 25 Jun 2013 15:01:02 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 15:00:10 +0000 Received: from localhost ([127.0.0.1]:40565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrUj2-0005Yj-Kn for submit@debbugs.gnu.org; Tue, 25 Jun 2013 11:00:09 -0400 Received: from mail-qe0-f45.google.com ([209.85.128.45]:33370) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrUiw-0005XS-Dr for 14708@debbugs.gnu.org; Tue, 25 Jun 2013 11:00:03 -0400 Received: by mail-qe0-f45.google.com with SMTP id w7so601949qeb.32 for <14708@debbugs.gnu.org>; Tue, 25 Jun 2013 07:59:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=V0iKObn5gRlF5imtQaxWJAOLSI1Yi10K2fgcWB6uQew=; b=lko/wPABeL/1pyg9+fPQ7wpNPrMVIaoGfh7fMyICqn+8I3cmFMgd2ms62GPl8w8wfB F5EJjZUP0JpcNpQIyGM7jTAcfzme7xzX/zXsQsEK6N0fcIFTDuNS6AIH2kx4h8UfUOhM Q2AmnOV/zD4a8ncxRy6OH3ii708SZzjHY2AOLqK/2h3xnknMbm7QvUtDXom1/2hy66jr aHdzKB6BUcLzR1GyF3UjZnCv/0kvb+IHS7LdqBaLgr7kX4yMsVQ1XrCXgiQHPgTU/TlK iWmWqiggII/CZdHDqsqeWfv4RGq46oV0gAW45k6NN8nm6vYPnsLdzeEy5lG8VgZYYDmC 6j1A== X-Received: by 10.224.188.74 with SMTP id cz10mr318556qab.31.1372172396250; Tue, 25 Jun 2013 07:59:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.35.206 with HTTP; Tue, 25 Jun 2013 07:59:26 -0700 (PDT) In-Reply-To: References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> From: Josh Date: Tue, 25 Jun 2013 07:59:26 -0700 X-Google-Sender-Auth: nDnmR-H6DwXdO7ftNi8BGsxhBnc Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmAvztU9IZg30nz6btrJv4tXmWiWMwQeJlXMWOjPd9SbQifIzfyv6+lepaCO1nIxLthF2/G X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, Jun 25, 2013 at 6:39 AM, Stefan Monnier wrote: >>> I don't think the difference is very important, but I wouldn't oppose >>> such a change. >> Did you read the point I made above and which the reporter conceded, namely >> that such no-op replacements often indicate broken regexps? > > I did. And just like the improvement he proposes, this downside > is minor. I don't think either of the arguments justifies spending > time on a patch, I don't understand what you mean here. I see one argument (the reporter's) in favor of some form of patch and one argument (mine) in favor of no change whatsoever to the current behavior. From unknown Wed Jun 25 03:56:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14708: 24.2; query-replace-regexp when match and replacement are the same Resent-From: Josh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 15:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Drew Adams Cc: 14708@debbugs.gnu.org, Ed Avis , Stefan Monnier Received: via spool by 14708-submit@debbugs.gnu.org id=B14708.137217267621999 (code B ref 14708); Tue, 25 Jun 2013 15:05:01 +0000 Received: (at 14708) by debbugs.gnu.org; 25 Jun 2013 15:04:36 +0000 Received: from localhost ([127.0.0.1]:40581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrUnL-0005ik-CJ for submit@debbugs.gnu.org; Tue, 25 Jun 2013 11:04:36 -0400 Received: from mail-qa0-f50.google.com ([209.85.216.50]:42745) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrUnI-0005iV-8V for 14708@debbugs.gnu.org; Tue, 25 Jun 2013 11:04:32 -0400 Received: by mail-qa0-f50.google.com with SMTP id l18so688975qak.2 for <14708@debbugs.gnu.org>; Tue, 25 Jun 2013 08:04:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=I9L+CLRvCmIM++Bl+u3yK3KXsnW746arnMkFBg3mRx0=; b=AK/MOaMvFoovLxI3KNwVCm44PlfLuUiU1dxm81WNtzhQiycak4wC7zY2yFF6LrciAW 5UiX1VqRJwyvfjsYUtCiaZwywgDINm5elLbzXL1Ik1iLJhxJ6eCoyI7QcTNx8CQmNrNH skRGScy3IKiAUNL/7Q7JcB9hlJkX+ua9zj6nmp3UKLSWWHQ0vAZsggreO575iK09Eg6n B4tBsTJKxC9ztl2asnfRKIN5Bu9AhUqP6WwOZS/ON4MVgjrBj5tQ43uoyDg8HGjK0d/b PluRaoIlu6KMBsiDfO2Hi4wcXkOJz26ZFNgTCWzCFeFdL4y+SPKEHqoDDiLH0y802W0R xw1w== X-Received: by 10.49.29.106 with SMTP id j10mr33064349qeh.37.1372172666616; Tue, 25 Jun 2013 08:04:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.35.206 with HTTP; Tue, 25 Jun 2013 08:03:56 -0700 (PDT) In-Reply-To: References: <7E039918541B4C4183BFDB8F015C74300E8E80@WCL-EXCH02.wcl.local> <7E039918541B4C4183BFDB8F015C74300E9E08@WCL-EXCH02.wcl.local> From: Josh Date: Tue, 25 Jun 2013 08:03:56 -0700 X-Google-Sender-Auth: fHvL5CoiLTjWAoINWvCb_66yw3g Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQlxR8ahHXIHZAYV+Y07zd7/NAcaFCPwFV5ikLut+D2PQrQ9tI1E9MjOyfvU+RMP9Xjy6UOq X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, Jun 25, 2013 at 7:10 AM, Drew Adams wrote: >> 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 woul= dn't >> even notice. The user asked for confirmation of each change to end up wi= th >> 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 (th= ough >> surely a simple search without replacement would be better). But even th= en >> it would be enough just to flag up one case where match=3Dreplacement, n= ot >> 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 r= est. > > Haven't been following this thread, so excuse if I misunderstand. > > It would be wrong, IMHO, to simply skip ANY matches, e.g., because the oc= currence precisely matches the replacement string. > > This could be an optional behavior, but it certainly should not simply re= place the longstanding behavior. > > Why? Because query replacing is not just about replacing. It can be abo= ut checking occurrences (all of them). It can involve stopping and doing s= omething (e.g. editing the occurrence in a different way from the replaceme= nt text, or editing surrounding text). And that "stopping" can be either v= ia recursive edit (allowing q-r resuming) or simply stopping altogether (an= d perhaps restarting, at the same spot or elsewhere). > > In sum, there is a lot more to a q-r interaction than simply y/n replacem= ent. Do not mess up what has already been available. If you like, provide= an option (on the fly via a key or via a user option) to do what you reque= st. But please do not just replace the existing, rich behavior. Yes, exactly. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 25 12:01:13 2013 Received: (at control) by debbugs.gnu.org; 25 Jun 2013 16:01:13 +0000 Received: from localhost ([127.0.0.1]:40681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrVg9-0007Vt-1D for submit@debbugs.gnu.org; Tue, 25 Jun 2013 12:01:13 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:51556 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrVg7-0007Vm-C2 for control@debbugs.gnu.org; Tue, 25 Jun 2013 12:01:11 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1UrVg6-0000gt-Sm for control@debbugs.gnu.org; Tue, 25 Jun 2013 12:01:10 -0400 Date: Tue, 25 Jun 2013 12:01:10 -0400 Message-Id: Subject: control message for bug 14708 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.3 (------) tag 14708 wontfix From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 01 02:18:30 2014 Received: (at control) by debbugs.gnu.org; 1 Feb 2014 07:18:30 +0000 Received: from localhost ([127.0.0.1]:43668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W9UqU-0001zZ-43 for submit@debbugs.gnu.org; Sat, 01 Feb 2014 02:18:30 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:50782) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W9UqT-0001zS-40 for control@debbugs.gnu.org; Sat, 01 Feb 2014 02:18:29 -0500 Received: from [204.14.154.233] (helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1W9UqE-0001rR-V6 for control@debbugs.gnu.org; Sat, 01 Feb 2014 08:18:15 +0100 Date: Fri, 31 Jan 2014 23:17:23 -0800 Message-Id: <8738k3qp30.fsf@building.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #14708 X-MailScanner-ID: 1W9UqE-0001rR-V6 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1391843895.97293@/5Fngf5SppgvXKOQ6aGphA X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) close 14708