unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "27896@debbugs.gnu.org" <27896@debbugs.gnu.org>
Subject: bug#27896: [External] : Re: bug#27896: 25.2; `C-M-%' with `rectangle-mark-mode'
Date: Tue, 09 Feb 2021 11:24:46 +0200	[thread overview]
Message-ID: <87a6sd1txh.fsf@mail.linkov.net> (raw)
In-Reply-To: <871rdpll0w.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 09 Feb 2021 09:09:51 +0100")

>>> But we could somewhat easily change `C-M-%' to be slightly less
>>> surprising, and document its limitations.  That is, we say that no
>>> multi-line matches are impossible in rectangle mode, and we implement it
>>
>> The current limitation is inability to use some greedy
>> regexps in rectangle mode.  This is not much worse than
>> limiting query-replace to non-multi-line matches only.
>
> Aren't multi-line replacements already disallowed in rectangle mode by
> the filtering function?

Except in a degenerate case when a rectangular region covers lines
completely from beginning to end.

>>> by just narrowing to each successive line part, and executing the
>>> query-replace-regexp once per line.  (With some magic to handle `!' etc,
>>> I guess.)
>>
>> Actually not narrowing in the sense of narrow-to-region,
>> but temporarily setting the LIMIT arg of 'replace-search'
>> to the end of the region of the current line.
>
> Yup.
>
> But I guess it's not that easy to get this to work sensibly -- it'd only
> highlight matches in one line at a time, which would be odd.

Maybe it's possible to add special handling for lazy-highlighting
as well, but unfortunately implementing all this takes too much time.

So this is a question of priorities: does it make sense to spend
much time implementing this.  Are there any users of this feature?

I mean the feature of regexp and multi-line replacements in rectangle mode,
because non-regexp single-line string replacements already work fine
in rectangle mode.

Or it's enough to explain the current limitation in the documentation.





  reply	other threads:[~2021-02-09  9:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6sd1txh.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=27896@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).