From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Juri Linkov <juri@linkov.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#27896: [External] : Re: bug#27896: 25.2;
 `C-M-%' with `rectangle-mark-mode'
Date: Tue, 09 Feb 2021 11:24:46 +0200
Organization: LINKOV.NET
Message-ID: <87a6sd1txh.fsf@mail.linkov.net>
References: <8b30a5cc-24db-4bca-94bd-50c79e65b43a@default>
 <cf0b64a5-dab3-4a71-b49b-fd9b20e77b41@default>
 <87pn1eiv4m.fsf@gnus.org>
 <SA2PR10MB44741A63A4C7EA23A6F63421F3B29@SA2PR10MB4474.namprd10.prod.outlook.com>
 <87eehrwyd8.fsf@mail.linkov.net> <87im73y51q.fsf@gnus.org>
 <87r1lqlbzj.fsf@mail.linkov.net> <871rdpll0w.fsf@gnus.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="17864"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
Cc: "27896@debbugs.gnu.org" <27896@debbugs.gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 09 11:02:10 2021
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1l9PqU-0004Yl-B1
	for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 11:02:10 +0100
Original-Received: from localhost ([::1]:40166 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1l9PqT-0008Au-CH
	for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 05:02:09 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49576)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1l9PnT-0006RY-FV
 for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 04:59:03 -0500
Original-Received: from debbugs.gnu.org ([209.51.188.43]:41172)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1l9PnR-0007QB-Sl
 for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 04:59:03 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1l9PnR-0007v6-R1
 for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 04:59:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Juri Linkov <juri@linkov.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Tue, 09 Feb 2021 09:59:01 +0000
Resent-Message-ID: <handler.27896.B27896.161286468630360@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 27896
X-GNU-PR-Package: emacs
Original-Received: via spool by 27896-submit@debbugs.gnu.org id=B27896.161286468630360
 (code B ref 27896); Tue, 09 Feb 2021 09:59:01 +0000
Original-Received: (at 27896) by debbugs.gnu.org; 9 Feb 2021 09:58:06 +0000
Original-Received: from localhost ([127.0.0.1]:52718 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1l9PmX-0007tc-NB
 for submit@debbugs.gnu.org; Tue, 09 Feb 2021 04:58:05 -0500
Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:57075)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@linkov.net>) id 1l9PmV-0007sl-JH
 for 27896@debbugs.gnu.org; Tue, 09 Feb 2021 04:58:04 -0500
Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204])
 (Authenticated sender: juri@linkov.net)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id 04955200011;
 Tue,  9 Feb 2021 09:57:55 +0000 (UTC)
In-Reply-To: <871rdpll0w.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue,
 09 Feb 2021 09:09:51 +0100")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.bugs:199679
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/199679>

>>> 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.