unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27896: 25.2; `C-M-%' with `rectangle-mark-mode'
@ 2017-08-01  4:17 Drew Adams
  2017-08-02 22:22 ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: Drew Adams @ 2017-08-01  4:17 UTC (permalink / raw)
  To: 27896

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=-O2
 -static -g3''





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-02-09 21:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01  4:17 bug#27896: 25.2; `C-M-%' with `rectangle-mark-mode' Drew Adams
2017-08-02 22:22 ` Drew Adams
2021-02-05 11:58   ` Lars Ingebrigtsen
2021-02-05 16:19     ` bug#27896: [External] : " Drew Adams
2021-02-07 18:58       ` Juri Linkov
2021-02-07 20:52         ` Lars Ingebrigtsen
2021-02-08 18:12           ` Juri Linkov
2021-02-09  8:09             ` Lars Ingebrigtsen
2021-02-09  9:24               ` Juri Linkov
2021-02-09 17:34                 ` Drew Adams
2021-02-09 17:54                   ` Juri Linkov
2021-02-09 18:38                     ` Drew Adams
2021-02-09 19:19                       ` Juri Linkov
2021-02-09 21:01                         ` Drew Adams
2021-02-09 21:07                 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).