From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#27896: 25.2; `C-M-%' with `rectangle-mark-mode' Date: Mon, 31 Jul 2017 21:17:15 -0700 (PDT) Message-ID: <8b30a5cc-24db-4bca-94bd-50c79e65b43a@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1501561105 6975 195.159.176.226 (1 Aug 2017 04:18:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 Aug 2017 04:18:25 +0000 (UTC) To: 27896@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 01 06:18:19 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcOdI-00018O-Nt for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Aug 2017 06:18:12 +0200 Original-Received: from localhost ([::1]:34344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcOdN-0007C9-2z for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Aug 2017 00:18:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcOdC-0007AK-OH for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:18:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcOd8-0001sb-P3 for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:18:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33298) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcOd8-0001sN-Kf for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dcOd8-0007hI-FQ for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Aug 2017 04:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150156105629555 (code B ref -1); Tue, 01 Aug 2017 04:18:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Aug 2017 04:17:36 +0000 Original-Received: from localhost ([127.0.0.1]:35975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcOch-0007gc-Le for submit@debbugs.gnu.org; Tue, 01 Aug 2017 00:17:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcOcf-0007gN-Fi for submit@debbugs.gnu.org; Tue, 01 Aug 2017 00:17:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcOcZ-0001eo-7W for submit@debbugs.gnu.org; Tue, 01 Aug 2017 00:17:28 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcOcZ-0001ek-3x for submit@debbugs.gnu.org; Tue, 01 Aug 2017 00:17:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcOcX-00077d-VD for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:17:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcOcT-0001di-UC for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:17:25 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:44452) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcOcT-0001cG-Jx for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 00:17:21 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v714HHNo015012 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 1 Aug 2017 04:17:18 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v714HHdt015736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 1 Aug 2017 04:17:17 GMT Original-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v714HGfJ022705 for ; Tue, 1 Aug 2017 04:17:17 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6770.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135204 Archived-At: emacs -Q In *scratch*: 1. Duplicate the two lines of text, to get this: ;; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a file, visit it with C-x C-f and enter text in its buffer. ;; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a file, visit it with C-x C-f and enter text in its buffer. 2. Activate the region from before the `T' in the first `This' to after the `f' in the second `file', with point before the `T'. Then `M-x rectangle-mark-mode'. 3. `C-M-%' and type `e.*t' for the regexp and `AA' for the replacement text. I was expecting both occurrences of "eat" (inside "create") to be candidates for replacement, since they are both within the rectangle and they both match the regexp - but only the second occurrence is a candidate for replacement. (If you use regexp `e.t' instead, there is no such error.) It seems that what is happening is that the regexp is being checked against the full region, i.e., before the region is limited to the rectangular portion. Is that the design? I think a user would expect the rectangle to define the region of possible query-replacing, not just define a clipping area from the full region of searching. IOW, I think a user would expect the rectangular limits to be established first, and then searching to be limited to that rectangular space. If nothing else, if this is the intended design then I think the doc should be clear about it. It should say, in that case, that matches are sought throughout the full, non-rectangular region, and only those matches that are wholly (?) within the rectangle are then retained as possible matches. My guess of what's happening is supported by this: If you do the same thing (same region) but without using `rectangle-mark-mode' then you see that rectangle mark mode just retains the matches for the normal, non-rectangular region, that are wholly within the rectangle. Here are the matches for the normal, non-rectangular region: ;; This buffer is for text that is not saved, and for Lisp evaluation. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;; To create a file, visit it with C-x C-f and enter text in its buffer. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;; This buffer is for text that is not saved, and for Lisp evaluation. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;; To create a file, visit it with C-x C-f and enter text in its buffer. ^^^ This should be documented, as it is not, I think, what someone expects by searching a rectangular region (a region delimited by a rectangle). I think someone would expect that the search domain is limited by the rectangle, and then query-replace applies to matches within that domain. That's very different from the current behavior, which is to leave the search domain as the full region (undelimited by the rectangle) and then filter out (remove) any matches from that that are not wholly within the rectangle. In GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-04-24 built on LAPHROAIG Windowing system distributor 'Microsoft Corp.', version 6.1.7601 Configured using: 'configure --without-dbus --without-compress-install 'CFLAGS=3D-O2 -static -g3''