GNU bug report logs - #45617
<query-replace> loses the edit region. Works in 23.3, broke in 26.3

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "Bob Floyd" <bobfloyd@HIDDEN>; dated Sun, 3 Jan 2021 01:07:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 19 Jan 2021 18:40:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 19 13:40:59 2021
Received: from localhost ([127.0.0.1]:51724 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l1vw3-0007z1-D7
	for submit <at> debbugs.gnu.org; Tue, 19 Jan 2021 13:40:59 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1l1vw1-0007yj-4A
 for 45617 <at> debbugs.gnu.org; Tue, 19 Jan 2021 13:40:57 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58287)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1l1vvp-00020H-1U; Tue, 19 Jan 2021 13:40:51 -0500
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4073
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1l1vvC-00076Z-4Y; Tue, 19 Jan 2021 13:40:44 -0500
Date: Tue, 19 Jan 2021 20:39:35 +0200
Message-Id: <83v9bs7ouw.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87turcdfyq.fsf@HIDDEN> (message from Juri Linkov on
 Tue, 19 Jan 2021 19:45:09 +0200)
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <002d01d6e478$ca50cdf0$5ef269d0$@net> <87k0sgirr0.fsf@HIDDEN>
 <002101d6eadc$e816a070$b843e150$@net> <87k0sezj07.fsf@HIDDEN>
 <8335z2bg0h.fsf@HIDDEN> <87turcdfyq.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45617
Cc: bobfloyd@HIDDEN, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: bobfloyd@HIDDEN,  45617 <at> debbugs.gnu.org
> Date: Tue, 19 Jan 2021 19:45:09 +0200
> 
> >> The problem is that 'read-from-minibuffer' is implemented in C.
> >> If it was implemented in Lisp, it would be easy to add just
> >> 'save-mark-and-excursion', but in C this is impossible.
> >
> > You can do the equivalent of that in C, can't you?
> 
> Sorry, I can't.  Because 'save-mark-and-excursion' is a Lisp macro,
> but C doesn't have Lisp macros.

I didn't mean to suggest that you call a Lisp macro.  My suggestion
was to perform all the steps 'save-mark-and-excursion' does in C,
inline.  I don't see why would that be hard, let alone impossible.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 19 Jan 2021 17:59:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 19 12:59:05 2021
Received: from localhost ([127.0.0.1]:51589 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l1vHU-0002WM-O8
	for submit <at> debbugs.gnu.org; Tue, 19 Jan 2021 12:59:04 -0500
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:38893)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1l1vHQ-0002V7-CZ
 for 45617 <at> debbugs.gnu.org; Tue, 19 Jan 2021 12:59:00 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 82B9BE0008;
 Tue, 19 Jan 2021 17:58:53 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <002d01d6e478$ca50cdf0$5ef269d0$@net> <87k0sgirr0.fsf@HIDDEN>
 <002101d6eadc$e816a070$b843e150$@net> <87k0sezj07.fsf@HIDDEN>
 <8335z2bg0h.fsf@HIDDEN>
Date: Tue, 19 Jan 2021 19:45:09 +0200
In-Reply-To: <8335z2bg0h.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 15 Jan
 2021 13:23:26 +0200")
Message-ID: <87turcdfyq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: bobfloyd@HIDDEN, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> The problem is that 'read-from-minibuffer' is implemented in C.
>> If it was implemented in Lisp, it would be easy to add just
>> 'save-mark-and-excursion', but in C this is impossible.
>
> You can do the equivalent of that in C, can't you?

Sorry, I can't.  Because 'save-mark-and-excursion' is a Lisp macro,
but C doesn't have Lisp macros.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 19 Jan 2021 17:59:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 19 12:59:00 2021
Received: from localhost ([127.0.0.1]:51583 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l1vHQ-0002VQ-Cn
	for submit <at> debbugs.gnu.org; Tue, 19 Jan 2021 12:59:00 -0500
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:54433)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1l1vHN-0002Ut-OO
 for 45617 <at> debbugs.gnu.org; Tue, 19 Jan 2021 12:58:58 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 2B45B20004;
 Tue, 19 Jan 2021 17:58:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <002d01d6e478$ca50cdf0$5ef269d0$@net> <87k0sgirr0.fsf@HIDDEN>
 <002101d6eadc$e816a070$b843e150$@net> <87k0sezj07.fsf@HIDDEN>
 <000c01d6eb68$f3f675f0$dbe361d0$@net>
Date: Tue, 19 Jan 2021 19:43:42 +0200
In-Reply-To: <000c01d6eb68$f3f675f0$dbe361d0$@net> (Bob Floyd's message of
 "Fri, 15 Jan 2021 10:05:04 -0800")
Message-ID: <877do8eull.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I'm having an issue with the new patch. <query-replace> fails!

Sorry, I tried your test case, but can't reproduce the problem.

> 1. Select entire region by dragging mouse.
> 2. Begin <query-replace>
>    In the command window: Query replace in region: 
> 3. Enter RL using the keyboard
>    In the command window: Query replace in region RL with: 
> 4. Now, with the mouse, select RL at line 12 ...
>    paramset P2 RL; <--- THIS ONE
>    ... then yank it to the command window and with keyboard enter X:

The most important line of your test case is the line above,
but I don't understand what you mean by yanking the selected text.
I tried to drag the selected text "RL" to the minibuffer window,
as all other apps allow to do, but Emacs fails to do the same.
Please help to clarify how do you yank the selected text.

>    In the command window: Query replace in region RL with: RLX
> 5. Enter
>    Only one of the two RL's in the region are selected, depending on
>    if the region was selected from top-to-bottom or bottom-to-top.
>
>    It should select both RL's!

It selects both RL's when I tried.

> Just in case I misread the diff, this is the function as I have manually
> patched it:
>
> (defun query-replace-read-args (prompt regexp-flag &optional noerror)
>   (unless noerror
>     (barf-if-buffer-read-only))
>   (save-mark-and-excursion
>   (let* ((from (query-replace-read-from prompt regexp-flag))
> 	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
> 	       (query-replace-read-to from prompt regexp-flag))))
>     (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
> 	(and (plist-member (text-properties-at 0 from)
> 'isearch-regexp-function)
> (get-text-property 0 'isearch-regexp-function from)))
>     (list from to
> 	  (and current-prefix-arg (not (eq current-prefix-arg '-)))
> 	  (and current-prefix-arg (eq current-prefix-arg '-))))))

This function is very much messed up.  Please try the function below:

(defun query-replace-read-args (prompt regexp-flag &optional noerror)
  (unless noerror
    (barf-if-buffer-read-only))
  (save-mark-and-excursion
    (let* ((from (query-replace-read-from prompt regexp-flag))
           (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
                 (query-replace-read-to from prompt regexp-flag))))
      (list from to
            (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
                (and (plist-member (text-properties-at 0 from) 'isearch-regexp-function)
                     (get-text-property 0 'isearch-regexp-function from)))
            (and current-prefix-arg (eq current-prefix-arg '-))))))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 15 Jan 2021 18:09:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 15 13:09:57 2021
Received: from localhost ([127.0.0.1]:41686 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l0TXo-0002CV-OO
	for submit <at> debbugs.gnu.org; Fri, 15 Jan 2021 13:09:56 -0500
Received: from resqmta-po-03v.sys.comcast.net ([96.114.154.162]:60492)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1l0TXm-0002CI-PM
 for 45617 <at> debbugs.gnu.org; Fri, 15 Jan 2021 13:09:55 -0500
Received: from resomta-po-16v.sys.comcast.net ([96.114.154.240])
 by resqmta-po-03v.sys.comcast.net with ESMTP
 id 0SY9l7qXHYcEc0TXglyji7; Fri, 15 Jan 2021 18:09:48 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1610734188;
 bh=Z9NjdNbB8gkZHnQlhZ3a6i8N89Byy/EINXuVdpn2B5o=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=6TVDGxRhZkrWODDWqbAH24/sbWDuup41BpixpS+dwS++G2oObdEXBUyummUorEtRP
 QBsimbdf2KSX773S5oOGvK+Axn5ytmWILpKw2BHYm74KrMmt6a7lZPYyQH8gDBmwYU
 oXOgEngqKlPXigYEydwU8n3lR3+8NPu0eVoStKkFMVSeFS4cXDtWDPSnCuy3pePMWC
 NYN8rV1KN/I1ZOnOxvIm0oBJq8SYCsmPapHL2m9PYTk5XUspSFcZ1NUxCdvweBLxA+
 WmAvOhZ66eNOG/1YFE2l/LUyNfLR2oXmRdXmUNcFTBAjzwgwfHjXm7RRMo4+/RHwDG
 VXhNapSE8B9Jw==
Received: from Cache ([IPv6:2601:647:6100:1480::5a21])
 by resomta-po-16v.sys.comcast.net with ESMTPA
 id 0TXflOBZ9rkvT0TXgl6TJR; Fri, 15 Jan 2021 18:09:48 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Juri Linkov'" <juri@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net>
 <83turycc18.fsf@HIDDEN>	<87ble4ob6v.fsf@HIDDEN>
 <000601d6e2ea$8f6601e0$ae3205a0$@net>	<877dorkznt.fsf@HIDDEN>
 <002701d6e39b$4ac35680$e04a0380$@net>	<8735ze9e09.fsf@HIDDEN>
 <83mtxm0vzd.fsf@HIDDEN>	<002d01d6e478$ca50cdf0$5ef269d0$@net>
 <87k0sgirr0.fsf@HIDDEN>
In-Reply-To: <87k0sgirr0.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Fri, 15 Jan 2021 10:09:46 -0800
Message-ID: <000d01d6eb69$9c522190$d4f664b0$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Adbp3vlii5CbgRImSi2QJPxAGEBxiABipDPg
Content-Language: en-us
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

PS: The 1st patch has the same wrong behavior also!

-----Original Message-----
From: Juri Linkov [mailto:juri@HIDDEN] 
Sent: Wednesday, January 13, 2021 10:54 AM
To: Bob Floyd
Cc: 'Eli Zaretskii'; 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
23.3, broke in 26.3

> Perhaps another way to think about this is that emacs is "mode-less".
>
> I can begin a command, recurse into another, pop out and resume the first
> command.
>
> Without the patch, or minibuffer fix, <query-replace> breaks that design.

So here is a simpler patch that fixes all query-replace commands:

diff --git a/lisp/replace.el b/lisp/replace.el
index d41dc98a0d..16b80a8fd1 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -327,6 +336,7 @@ query-replace-read-to
 (defun query-replace-read-args (prompt regexp-flag &optional noerror)
   (unless noerror
     (barf-if-buffer-read-only))
+  (save-mark-and-excursion
   (let* ((from (query-replace-read-from prompt regexp-flag))
 	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
 	       (query-replace-read-to from prompt regexp-flag))))
@@ -334,7 +344,7 @@ query-replace-read-args
 	  (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
               (and (plist-member (text-properties-at 0 from)
'isearch-regexp-function)
                    (get-text-property 0 'isearch-regexp-function from)))
-	  (and current-prefix-arg (eq current-prefix-arg '-)))))
+	  (and current-prefix-arg (eq current-prefix-arg '-))))))
 
 (defun query-replace (from-string to-string &optional delimited start end
backward region-noncontiguous-p)
   "Replace some occurrences of FROM-STRING with TO-STRING.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 15 Jan 2021 18:05:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 15 13:05:20 2021
Received: from localhost ([127.0.0.1]:41681 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l0TTK-00026B-3U
	for submit <at> debbugs.gnu.org; Fri, 15 Jan 2021 13:05:20 -0500
Received: from resqmta-po-05v.sys.comcast.net ([96.114.154.164]:60766)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1l0TTE-00025k-Oi
 for 45617 <at> debbugs.gnu.org; Fri, 15 Jan 2021 13:05:16 -0500
Received: from resomta-po-08v.sys.comcast.net ([96.114.154.232])
 by resqmta-po-05v.sys.comcast.net with ESMTP
 id 0SDWlxUZjoWle0TT8lO7Gi; Fri, 15 Jan 2021 18:05:06 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1610733906;
 bh=K7LCJ1qBewwDL3sYoP60ew57gnJQjFoJxFCpif1j0sM=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=oZ+Y7Yvu6vn+xyJxHwNGAkMsQ+ZqWsf/M3LLpaGQhKvaQVnTwfs+0IW+43OEcNeQy
 r6fE4rhvh1WosgAvabLA9qTynF5AR7PVUK/dpxjF+g+EiBKlAmxV5tBasdEKKuypzk
 cleNbN++m6KyKy+pw7bu+eK0lJTL74FFp/vWW6fRXdnLqz+4HiL/VteghkYOw2wihf
 L6KWTb8LIuAYoupPnHEZEUK+LfIHunJ71gRVEl9n+qI5WULpLgRZfhNVBCrj7e2hXi
 sH57vtIJyyWFDETcEIywpzM181pEOf4O7/yk96PCmQF6+oETidXnVRMtR1j3JENVDb
 lV3Zev94M6EoA==
Received: from Cache ([IPv6:2601:647:6100:1480::5a21])
 by resomta-po-08v.sys.comcast.net with ESMTPA
 id 0TT6lHVr38b6T0TT7l01wD; Fri, 15 Jan 2021 18:05:06 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Juri Linkov'" <juri@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net>
 <83turycc18.fsf@HIDDEN>	<87ble4ob6v.fsf@HIDDEN>
 <000601d6e2ea$8f6601e0$ae3205a0$@net>	<877dorkznt.fsf@HIDDEN>
 <002701d6e39b$4ac35680$e04a0380$@net>	<8735ze9e09.fsf@HIDDEN>
 <83mtxm0vzd.fsf@HIDDEN>	<002d01d6e478$ca50cdf0$5ef269d0$@net>
 <87k0sgirr0.fsf@HIDDEN>	<002101d6eadc$e816a070$b843e150$@net>
 <87k0sezj07.fsf@HIDDEN>
In-Reply-To: <87k0sezj07.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Fri, 15 Jan 2021 10:05:04 -0800
Message-ID: <000c01d6eb68$f3f675f0$dbe361d0$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdbrHziXuXmfJwLtSGuGID0M5A7yRwAR4FDA
Content-Language: en-us
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

I'm having an issue with the new patch. <query-replace> fails!

1. Select entire region by dragging mouse.
2. Begin <query-replace>
   In the command window: Query replace in region: 
3. Enter RL using the keyboard
   In the command window: Query replace in region RL with: 
4. Now, with the mouse, select RL at line 12 ...
   paramset P2 RL; <--- THIS ONE
   ... then yank it to the command window and with keyboard enter X:
   In the command window: Query replace in region RL with: RLX
5. Enter
   Only one of the two RL's in the region are selected, depending on
   if the region was selected from top-to-bottom or bottom-to-top.

   It should select both RL's!

----------------------------------------------------
module RL ( electrical in, out );
   parameter real R1 = 7000.0;
   parameter real C  = 1p;
   
   analog begin
      I(in,out) <+ V(in,out) / R1;
      I(out)    <+ C * ddt( V(out) );
   end
   
endmodule // Sub

paramset P2 RL;
parameter real R=1000;
.R1= R;
endparamset
----------------------------------------------------

Just in case I misread the diff, this is the function as I have manually
patched it:

(defun query-replace-read-args (prompt regexp-flag &optional noerror)
  (unless noerror
    (barf-if-buffer-read-only))
  (save-mark-and-excursion
  (let* ((from (query-replace-read-from prompt regexp-flag))
	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
	       (query-replace-read-to from prompt regexp-flag))))
    (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
	(and (plist-member (text-properties-at 0 from)
'isearch-regexp-function)
(get-text-property 0 'isearch-regexp-function from)))
    (list from to
	  (and current-prefix-arg (not (eq current-prefix-arg '-)))
	  (and current-prefix-arg (eq current-prefix-arg '-))))))



-----Original Message-----
From: Juri Linkov [mailto:juri@HIDDEN] 
Sent: Friday, January 15, 2021 12:55 AM
To: Bob Floyd
Cc: 'Eli Zaretskii'; 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
23.3, broke in 26.3

> I've removed the earlier patch and installed these changes. Now testing
it!
> Thanks.
>
> -----Original Message-----
>  (defun query-replace-read-args (prompt regexp-flag &optional noerror)
>    (unless noerror
>      (barf-if-buffer-read-only))
> +  (save-mark-and-excursion
>    (let* ((from (query-replace-read-from prompt regexp-flag))
>  	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
>  	       (query-replace-read-to from prompt regexp-flag))))

It seems this is what we need to push to be able to close this bug report.
Indeed, it fixes only query-replace commands.  But fixing all commands
that use the minibuffer is not as easy as adding 'save-mark-and-excursion'
like in the patch above.

The problem is that 'read-from-minibuffer' is implemented in C.
If it was implemented in Lisp, it would be easy to add just
'save-mark-and-excursion', but in C this is impossible.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 15 Jan 2021 11:23:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 15 06:23:40 2021
Received: from localhost ([127.0.0.1]:40005 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l0NCe-0004cW-JP
	for submit <at> debbugs.gnu.org; Fri, 15 Jan 2021 06:23:40 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47054)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1l0NCa-0004cG-AG
 for 45617 <at> debbugs.gnu.org; Fri, 15 Jan 2021 06:23:38 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48265)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1l0NCU-0001BR-LF; Fri, 15 Jan 2021 06:23:30 -0500
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1221
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1l0NCT-0008Bm-W2; Fri, 15 Jan 2021 06:23:30 -0500
Date: Fri, 15 Jan 2021 13:23:26 +0200
Message-Id: <8335z2bg0h.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87k0sezj07.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 15 Jan 2021 10:54:56 +0200)
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <002d01d6e478$ca50cdf0$5ef269d0$@net> <87k0sgirr0.fsf@HIDDEN>
 <002101d6eadc$e816a070$b843e150$@net> <87k0sezj07.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45617
Cc: bobfloyd@HIDDEN, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: "'Eli Zaretskii'" <eliz@HIDDEN>,  <45617 <at> debbugs.gnu.org>
> Date: Fri, 15 Jan 2021 10:54:56 +0200
> 
> The problem is that 'read-from-minibuffer' is implemented in C.
> If it was implemented in Lisp, it would be easy to add just
> 'save-mark-and-excursion', but in C this is impossible.

You can do the equivalent of that in C, can't you?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 15 Jan 2021 09:17:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 15 04:17:22 2021
Received: from localhost ([127.0.0.1]:39899 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l0LEQ-0007sv-2F
	for submit <at> debbugs.gnu.org; Fri, 15 Jan 2021 04:17:22 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:34229)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1l0LEN-0007sg-S5
 for 45617 <at> debbugs.gnu.org; Fri, 15 Jan 2021 04:17:20 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id EDACE240006;
 Fri, 15 Jan 2021 09:17:12 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <002d01d6e478$ca50cdf0$5ef269d0$@net> <87k0sgirr0.fsf@HIDDEN>
 <002101d6eadc$e816a070$b843e150$@net>
Date: Fri, 15 Jan 2021 10:54:56 +0200
In-Reply-To: <002101d6eadc$e816a070$b843e150$@net> (Bob Floyd's message of
 "Thu, 14 Jan 2021 17:22:34 -0800")
Message-ID: <87k0sezj07.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I've removed the earlier patch and installed these changes. Now testing it!
> Thanks.
>
> -----Original Message-----
>  (defun query-replace-read-args (prompt regexp-flag &optional noerror)
>    (unless noerror
>      (barf-if-buffer-read-only))
> +  (save-mark-and-excursion
>    (let* ((from (query-replace-read-from prompt regexp-flag))
>  	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
>  	       (query-replace-read-to from prompt regexp-flag))))

It seems this is what we need to push to be able to close this bug report.
Indeed, it fixes only query-replace commands.  But fixing all commands
that use the minibuffer is not as easy as adding 'save-mark-and-excursion'
like in the patch above.

The problem is that 'read-from-minibuffer' is implemented in C.
If it was implemented in Lisp, it would be easy to add just
'save-mark-and-excursion', but in C this is impossible.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 15 Jan 2021 01:22:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 14 20:22:44 2021
Received: from localhost ([127.0.0.1]:39702 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l0Dp6-0004k1-85
	for submit <at> debbugs.gnu.org; Thu, 14 Jan 2021 20:22:44 -0500
Received: from resqmta-po-10v.sys.comcast.net ([96.114.154.169]:47038)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1l0Dp4-0004jj-Nm
 for 45617 <at> debbugs.gnu.org; Thu, 14 Jan 2021 20:22:43 -0500
Received: from resomta-po-17v.sys.comcast.net ([96.114.154.241])
 by resqmta-po-10v.sys.comcast.net with ESMTP
 id 0D5hlyyid2Xuv0DoylwLKb; Fri, 15 Jan 2021 01:22:36 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1610673756;
 bh=SCy5PA1muQx4qmxa9QeKh8jJiDRr2yonHcbKGkBCAPM=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=xxadunfM+hP10mUAj32nie6c7g/aooxwK2WIl/lhnd1KFEHuLI395R7Z5UZHdyKGm
 IHuKAonjlA8aOcNvgDJHsjAIcPsnTwSXn3t6U0Cblr7Z9c/+T8+zo8PiKaWgEtentD
 9Op++MAzWtDvAoDI7oRamI3u3kU6rPZpx1e1BEKamqRGLLPefMkCSZLruzJIcO6F29
 KOjr/MEUPTp+vQcN1CWxymuPKpaagXQt9/eZRMnQ/RfHOJzqMU9rPgC8bsi7DkDdKU
 5WZzZjfYO1Td1doDGjweqv1vH6PsjJ2912LHtfI/csx3xNtDsvwk7zccaZcjNY8+Ia
 T/i3a1OIBm0NQ==
Received: from Cache ([IPv6:2601:647:6100:1480::5a21])
 by resomta-po-17v.sys.comcast.net with ESMTPA
 id 0Dowlj5XCj2qx0DoxlTQ1j; Fri, 15 Jan 2021 01:22:36 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Juri Linkov'" <juri@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net>
 <83turycc18.fsf@HIDDEN>	<87ble4ob6v.fsf@HIDDEN>
 <000601d6e2ea$8f6601e0$ae3205a0$@net>	<877dorkznt.fsf@HIDDEN>
 <002701d6e39b$4ac35680$e04a0380$@net>	<8735ze9e09.fsf@HIDDEN>
 <83mtxm0vzd.fsf@HIDDEN>	<002d01d6e478$ca50cdf0$5ef269d0$@net>
 <87k0sgirr0.fsf@HIDDEN>
In-Reply-To: <87k0sgirr0.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Thu, 14 Jan 2021 17:22:34 -0800
Message-ID: <002101d6eadc$e816a070$b843e150$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Adbp3vlii5CbgRImSi2QJPxAGEBxiAA/cRXg
Content-Language: en-us
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

I've removed the earlier patch and installed these changes. Now testing it!
Thanks.

-----Original Message-----
From: Juri Linkov [mailto:juri@HIDDEN] 
Sent: Wednesday, January 13, 2021 10:54 AM
To: Bob Floyd
Cc: 'Eli Zaretskii'; 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
23.3, broke in 26.3

> Perhaps another way to think about this is that emacs is "mode-less".
>
> I can begin a command, recurse into another, pop out and resume the first
> command.
>
> Without the patch, or minibuffer fix, <query-replace> breaks that design.

So here is a simpler patch that fixes all query-replace commands:

diff --git a/lisp/replace.el b/lisp/replace.el
index d41dc98a0d..16b80a8fd1 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -327,6 +336,7 @@ query-replace-read-to
 (defun query-replace-read-args (prompt regexp-flag &optional noerror)
   (unless noerror
     (barf-if-buffer-read-only))
+  (save-mark-and-excursion
   (let* ((from (query-replace-read-from prompt regexp-flag))
 	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
 	       (query-replace-read-to from prompt regexp-flag))))
@@ -334,7 +344,7 @@ query-replace-read-args
 	  (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
               (and (plist-member (text-properties-at 0 from)
'isearch-regexp-function)
                    (get-text-property 0 'isearch-regexp-function from)))
-	  (and current-prefix-arg (eq current-prefix-arg '-)))))
+	  (and current-prefix-arg (eq current-prefix-arg '-))))))
 
 (defun query-replace (from-string to-string &optional delimited start end
backward region-noncontiguous-p)
   "Replace some occurrences of FROM-STRING with TO-STRING.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 13 Jan 2021 19:04:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 13 14:04:56 2021
Received: from localhost ([127.0.0.1]:36610 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kzlRw-000233-A1
	for submit <at> debbugs.gnu.org; Wed, 13 Jan 2021 14:04:56 -0500
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:48033)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kzlRv-00022p-93
 for 45617 <at> debbugs.gnu.org; Wed, 13 Jan 2021 14:04:55 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id D910CC000C;
 Wed, 13 Jan 2021 19:04:47 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <002d01d6e478$ca50cdf0$5ef269d0$@net>
Date: Wed, 13 Jan 2021 20:53:31 +0200
In-Reply-To: <002d01d6e478$ca50cdf0$5ef269d0$@net> (Bob Floyd's message of
 "Wed, 6 Jan 2021 14:10:48 -0800")
Message-ID: <87k0sgirr0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Perhaps another way to think about this is that emacs is "mode-less".
>
> I can begin a command, recurse into another, pop out and resume the first
> command.
>
> Without the patch, or minibuffer fix, <query-replace> breaks that design.

So here is a simpler patch that fixes all query-replace commands:

diff --git a/lisp/replace.el b/lisp/replace.el
index d41dc98a0d..16b80a8fd1 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -327,6 +336,7 @@ query-replace-read-to
 (defun query-replace-read-args (prompt regexp-flag &optional noerror)
   (unless noerror
     (barf-if-buffer-read-only))
+  (save-mark-and-excursion
   (let* ((from (query-replace-read-from prompt regexp-flag))
 	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
 	       (query-replace-read-to from prompt regexp-flag))))
@@ -334,7 +344,7 @@ query-replace-read-args
 	  (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
               (and (plist-member (text-properties-at 0 from) 'isearch-regexp-function)
                    (get-text-property 0 'isearch-regexp-function from)))
-	  (and current-prefix-arg (eq current-prefix-arg '-)))))
+	  (and current-prefix-arg (eq current-prefix-arg '-))))))
 
 (defun query-replace (from-string to-string &optional delimited start end backward region-noncontiguous-p)
   "Replace some occurrences of FROM-STRING with TO-STRING.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 7 Jan 2021 19:36:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 07 14:36:45 2021
Received: from localhost ([127.0.0.1]:48707 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kxb5R-0000g2-Gj
	for submit <at> debbugs.gnu.org; Thu, 07 Jan 2021 14:36:45 -0500
Received: from eggs.gnu.org ([209.51.188.92]:45754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kxb5P-0000fn-Bc
 for 45617 <at> debbugs.gnu.org; Thu, 07 Jan 2021 14:36:44 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34960)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kxb5J-0003qR-Bg; Thu, 07 Jan 2021 14:36:37 -0500
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3188
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kxb5H-0001Kn-JZ; Thu, 07 Jan 2021 14:36:37 -0500
Date: Thu, 07 Jan 2021 21:36:36 +0200
Message-Id: <8335zclet7.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <8735zcpouq.fsf@HIDDEN> (message from Juri Linkov on
 Thu, 07 Jan 2021 20:46:05 +0200)
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
 <8735zcpouq.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45617
Cc: bobfloyd@HIDDEN, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: bobfloyd@HIDDEN,  45617 <at> debbugs.gnu.org
> Date: Thu, 07 Jan 2021 20:46:05 +0200
> 
> >> The question we need to answer: should this fix affect all other uses
> >> of the minibuffer?  So for any command that operates on the active region
> >> and asks its arguments from the minibuffer, when you copy the text
> >> from the original buffer to the minibuffer and thus change its region,
> >> should quitting the minibuffer restore the original region for
> >> all such commands?  This means restoring the original mark and point.
> >
> > I think the answer is YES, especially if we did behave like that in
> > the distant past.
> 
> Interesting, this means this behavior was changed intentionally
> in a recent version?

AFAICT, it did change, but only slightly.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 7 Jan 2021 18:48:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 07 13:48:21 2021
Received: from localhost ([127.0.0.1]:48687 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kxaKb-0007Zx-58
	for submit <at> debbugs.gnu.org; Thu, 07 Jan 2021 13:48:21 -0500
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:41339)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kxaKZ-0007ZX-N1
 for 45617 <at> debbugs.gnu.org; Thu, 07 Jan 2021 13:48:20 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 5F6851BF206;
 Thu,  7 Jan 2021 18:48:11 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN> <83mtxm0vzd.fsf@HIDDEN>
Date: Thu, 07 Jan 2021 20:46:05 +0200
In-Reply-To: <83mtxm0vzd.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 06 Jan
 2021 20:19:02 +0200")
Message-ID: <8735zcpouq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: bobfloyd@HIDDEN, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> The question we need to answer: should this fix affect all other uses
>> of the minibuffer?  So for any command that operates on the active region
>> and asks its arguments from the minibuffer, when you copy the text
>> from the original buffer to the minibuffer and thus change its region,
>> should quitting the minibuffer restore the original region for
>> all such commands?  This means restoring the original mark and point.
>
> I think the answer is YES, especially if we did behave like that in
> the distant past.

Interesting, this means this behavior was changed intentionally
in a recent version?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 6 Jan 2021 22:10:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 06 17:10:57 2021
Received: from localhost ([127.0.0.1]:45793 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kxH16-00056M-Vg
	for submit <at> debbugs.gnu.org; Wed, 06 Jan 2021 17:10:57 -0500
Received: from resqmta-po-10v.sys.comcast.net ([96.114.154.169]:48196)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1kxH16-00056A-37
 for 45617 <at> debbugs.gnu.org; Wed, 06 Jan 2021 17:10:56 -0500
Received: from resomta-po-15v.sys.comcast.net ([96.114.154.239])
 by resqmta-po-10v.sys.comcast.net with ESMTP
 id xGmkkoiyo2XuvxH0zkcIYc; Wed, 06 Jan 2021 22:10:49 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1609971049;
 bh=ZK0yWWSSlrwKjj/h6Ntz6yHq3ITaTNkuSrfuKiPuceE=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=uGmZ7RvJkKRvbUY3fZFBBUPijru8yhmB36G8P2Tu4YWGjjTFbGZ5Vc61q7cv62ZyF
 OcDto5qBuAqohEFtJnEGzrjZmyxqGwgkf7iqV5ogQWBR13f1kRAS8KVKniqFrjA2Nq
 k1xnAv5KZ67mE0msnCms9B2G5HhU37KbR3Mx4a2wfViYjBGCwlCux9qgaQJRtjmW9b
 rHAV85hT7fVFvm7L+r2i3sxIO96aW6wEnX5AVLuduN/pD9i61HKvd88j5c6my0zgkD
 +d52D9/gdfM5lo0ok/0uA3uHB/cZawQBXYhKYXBTff3WXrd7GjeqleT6GNpRZ1omZO
 /V1CHGJWdcI4A==
Received: from Cache ([IPv6:2601:647:6100:1480::48be])
 by resomta-po-15v.sys.comcast.net with ESMTPA
 id xH0yk0ARjBKOqxH0zkwkOc; Wed, 06 Jan 2021 22:10:49 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Eli Zaretskii'" <eliz@HIDDEN>,
	"'Juri Linkov'" <juri@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net>
 <83turycc18.fsf@HIDDEN>	<87ble4ob6v.fsf@HIDDEN>
 <000601d6e2ea$8f6601e0$ae3205a0$@net>	<877dorkznt.fsf@HIDDEN>
 <002701d6e39b$4ac35680$e04a0380$@net>	<8735ze9e09.fsf@HIDDEN>
 <83mtxm0vzd.fsf@HIDDEN>
In-Reply-To: <83mtxm0vzd.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Wed, 6 Jan 2021 14:10:48 -0800
Message-ID: <002d01d6e478$ca50cdf0$5ef269d0$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdbkWGsn0kCAZr7SRgODhM+jtfOGhQAHx2YQ
Content-Language: en-us
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Perhaps another way to think about this is that emacs is "mode-less".

I can begin a command, recurse into another, pop out and resume the first
command.

Without the patch, or minibuffer fix, <query-replace> breaks that design.

If the minibffer fix better supports mode-less operation in general it would
be better than the patch.

-----Original Message-----
From: Eli Zaretskii [mailto:eliz@HIDDEN] 
Sent: Wednesday, January 6, 2021 10:19 AM
To: Juri Linkov
Cc: bobfloyd@HIDDEN; 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
23.3, broke in 26.3

> From: Juri Linkov <juri@HIDDEN>
> Cc: "'Eli Zaretskii'" <eliz@HIDDEN>,  <45617 <at> debbugs.gnu.org>
> Date: Wed, 06 Jan 2021 19:44:30 +0200
> 
> > For my two cents, what you write sounds like the real problem is the
> > minibuffer failing to restore on exit. A fix to that would be preferable
to
> > the patch. After all, who knows what else may affected by the
minibuffer!
> > I'd be happy to test this alternative.
> 
> The question we need to answer: should this fix affect all other uses
> of the minibuffer?  So for any command that operates on the active region
> and asks its arguments from the minibuffer, when you copy the text
> from the original buffer to the minibuffer and thus change its region,
> should quitting the minibuffer restore the original region for
> all such commands?  This means restoring the original mark and point.

I think the answer is YES, especially if we did behave like that in
the distant past.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 6 Jan 2021 18:19:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 06 13:19:14 2021
Received: from localhost ([127.0.0.1]:45502 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kxDOr-0007iN-Us
	for submit <at> debbugs.gnu.org; Wed, 06 Jan 2021 13:19:14 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58662)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kxDOn-0007i6-63
 for 45617 <at> debbugs.gnu.org; Wed, 06 Jan 2021 13:19:12 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:38179)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kxDOh-0002rI-Mv; Wed, 06 Jan 2021 13:19:03 -0500
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3019
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kxDOg-0004f9-EI; Wed, 06 Jan 2021 13:19:02 -0500
Date: Wed, 06 Jan 2021 20:19:02 +0200
Message-Id: <83mtxm0vzd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <8735ze9e09.fsf@HIDDEN> (message from Juri Linkov on
 Wed, 06 Jan 2021 19:44:30 +0200)
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
 <8735ze9e09.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45617
Cc: bobfloyd@HIDDEN, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: "'Eli Zaretskii'" <eliz@HIDDEN>,  <45617 <at> debbugs.gnu.org>
> Date: Wed, 06 Jan 2021 19:44:30 +0200
> 
> > For my two cents, what you write sounds like the real problem is the
> > minibuffer failing to restore on exit. A fix to that would be preferable to
> > the patch. After all, who knows what else may affected by the minibuffer!
> > I'd be happy to test this alternative.
> 
> The question we need to answer: should this fix affect all other uses
> of the minibuffer?  So for any command that operates on the active region
> and asks its arguments from the minibuffer, when you copy the text
> from the original buffer to the minibuffer and thus change its region,
> should quitting the minibuffer restore the original region for
> all such commands?  This means restoring the original mark and point.

I think the answer is YES, especially if we did behave like that in
the distant past.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 6 Jan 2021 18:10:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 06 13:10:51 2021
Received: from localhost ([127.0.0.1]:45468 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kxDGl-0005ON-4w
	for submit <at> debbugs.gnu.org; Wed, 06 Jan 2021 13:10:51 -0500
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:46125)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kxDGj-0005Nx-EA
 for 45617 <at> debbugs.gnu.org; Wed, 06 Jan 2021 13:10:49 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 34FB66000A;
 Wed,  6 Jan 2021 18:10:41 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
 <877dorkznt.fsf@HIDDEN> <002701d6e39b$4ac35680$e04a0380$@net>
Date: Wed, 06 Jan 2021 19:44:30 +0200
In-Reply-To: <002701d6e39b$4ac35680$e04a0380$@net> (Bob Floyd's message of
 "Tue, 5 Jan 2021 11:45:15 -0800")
Message-ID: <8735ze9e09.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> For my two cents, what you write sounds like the real problem is the
> minibuffer failing to restore on exit. A fix to that would be preferable to
> the patch. After all, who knows what else may affected by the minibuffer!
> I'd be happy to test this alternative.

The question we need to answer: should this fix affect all other uses
of the minibuffer?  So for any command that operates on the active region
and asks its arguments from the minibuffer, when you copy the text
from the original buffer to the minibuffer and thus change its region,
should quitting the minibuffer restore the original region for
all such commands?  This means restoring the original mark and point.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 5 Jan 2021 19:45:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 05 14:45:27 2021
Received: from localhost ([127.0.0.1]:42728 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kwsGl-0004cY-47
	for submit <at> debbugs.gnu.org; Tue, 05 Jan 2021 14:45:27 -0500
Received: from resqmta-po-05v.sys.comcast.net ([96.114.154.164]:58931)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1kwsGi-0004cJ-53
 for 45617 <at> debbugs.gnu.org; Tue, 05 Jan 2021 14:45:25 -0500
Received: from resomta-po-05v.sys.comcast.net ([96.114.154.229])
 by resqmta-po-05v.sys.comcast.net with ESMTP
 id wpsSkklYCoWlewsGckzaes; Tue, 05 Jan 2021 19:45:18 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1609875918;
 bh=FBTdcWkhyBc2agXzi0nz9VW6pJG4q5gtlFZ5UtWO+5A=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=Q0xEZAOe98Ztxst0Ozu+y2QXRe0JOlywwOK/O3WLKUCrtJ3CISyM2NsCF5edY2Xnl
 kv0FkFYhgnHo93GBrwp6keJiVLtufv9+6JzUX9CfM/tH7Miq8FHGzaFQWYHAwvxKxj
 42u12Uk/BzCLT95b0wU++dap2GnMMaIXW269/Pd99bHB5WFF25kazi8ZDByBU1YetA
 tOdyo5bDV4Q3DTxI+yrP5vFyQRz6vZDvsFITxqp+p1fGLKfIo5Vi6tR/NZN4uL061m
 gPHlVImC4wQkSS40XOfsnW+6mW91gEoE2hXIJq6RGAKYQ0ImeL6GB9K9/FZ+lKiJ24
 41mAtBXDpdzJg==
Received: from Cache ([IPv6:2601:647:6100:1480::48be])
 by resomta-po-05v.sys.comcast.net with ESMTPA
 id wsGakq0UMDmOXwsGbkZ33O; Tue, 05 Jan 2021 19:45:17 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Juri Linkov'" <juri@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net>
 <83turycc18.fsf@HIDDEN>	<87ble4ob6v.fsf@HIDDEN>
 <000601d6e2ea$8f6601e0$ae3205a0$@net> <877dorkznt.fsf@HIDDEN>
In-Reply-To: <877dorkznt.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Tue, 5 Jan 2021 11:45:15 -0800
Message-ID: <002701d6e39b$4ac35680$e04a0380$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Content-Language: en-us
Thread-Index: AdbjkPF4BUprE83KR6i6EKqrHoTJ6wACYIpw
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

For my two cents, what you write sounds like the real problem is the
minibuffer failing to restore on exit. A fix to that would be preferable to
the patch. After all, who knows what else may affected by the minibuffer!
I'd be happy to test this alternative.

-----Original Message-----
From: Juri Linkov [mailto:juri@HIDDEN] 
Sent: Tuesday, January 5, 2021 10:27 AM
To: Bob Floyd
Cc: 'Eli Zaretskii'; 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
23.3, broke in 26.3

> Thanks! The patch has fixed the issue.

If there is no need to support the broken feature of saving
region boundaries as code in the command history, then
this patch could be pushed.  Otherwise, another solution is
to restore the previously selected region after exiting the minibuffer
the same way as exiting the minibuffer restores window configurations
(there is a new option to disable this discussed in bug#45072).





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 5 Jan 2021 18:31:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 05 13:31:15 2021
Received: from localhost ([127.0.0.1]:42669 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kwr6w-0000mA-O9
	for submit <at> debbugs.gnu.org; Tue, 05 Jan 2021 13:31:15 -0500
Received: from relay12.mail.gandi.net ([217.70.178.232]:53497)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kwr6v-0000lk-4i
 for 45617 <at> debbugs.gnu.org; Tue, 05 Jan 2021 13:31:13 -0500
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id 00202200005;
 Tue,  5 Jan 2021 18:31:05 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN> <000601d6e2ea$8f6601e0$ae3205a0$@net>
Date: Tue, 05 Jan 2021 20:27:02 +0200
In-Reply-To: <000601d6e2ea$8f6601e0$ae3205a0$@net> (Bob Floyd's message of
 "Mon, 4 Jan 2021 14:40:09 -0800")
Message-ID: <877dorkznt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 'Eli Zaretskii' <eliz@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Thanks! The patch has fixed the issue.

If there is no need to support the broken feature of saving
region boundaries as code in the command history, then
this patch could be pushed.  Otherwise, another solution is
to restore the previously selected region after exiting the minibuffer
the same way as exiting the minibuffer restores window configurations
(there is a new option to disable this discussed in bug#45072).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 4 Jan 2021 22:40:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 04 17:40:19 2021
Received: from localhost ([127.0.0.1]:60536 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kwYWR-0008Ee-If
	for submit <at> debbugs.gnu.org; Mon, 04 Jan 2021 17:40:19 -0500
Received: from resqmta-po-10v.sys.comcast.net ([96.114.154.169]:41550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1kwYWP-0008ER-LN
 for 45617 <at> debbugs.gnu.org; Mon, 04 Jan 2021 17:40:18 -0500
Received: from resomta-po-18v.sys.comcast.net ([96.114.154.242])
 by resqmta-po-10v.sys.comcast.net with ESMTP
 id wXl8km2MV2XuvwYWJkX8fX; Mon, 04 Jan 2021 22:40:11 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1609800011;
 bh=xkVHeWRHuO338XPhpdfJGUv/0LGEJMxbxlfElFbsHYs=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=A7oeCEqeg/L7KOA2XVorbG4Ob4dQW0oQT+LMrArzHas71Moysr9SNE/emzszQjdpx
 wOZmBUChNxOKODdCbcJf7V9K3hmcINGU0mw8x1T3fbSuwUd02Bs3XPg4oPWolUkMDV
 7Y0C3b16hW+sJN3AVAFLAzZjfBEu9+LKNyr+SIqu507gmHFNvLeHPyxH39gxvmXXx5
 HYdKjIEbBFtGnn62G8D0AbIXQpvPMACBbUFil9UIFnoeP89GGNyUmZV+Lc3jGeceIz
 0HuL6JPsLBia2cAEJAiBNn0mW5rzf/AEzaENe0E/nZYE1lNhugQuQz9CCVSFzhbuKg
 ZMYxgS/HRWQEw==
Received: from Cache ([IPv6:2601:647:6100:1480::9c05])
 by resomta-po-18v.sys.comcast.net with ESMTPA
 id wYWHkg4LMSjDMwYWIkBbXv; Mon, 04 Jan 2021 22:40:10 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Juri Linkov'" <juri@HIDDEN>,
	"'Eli Zaretskii'" <eliz@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <87ble4ob6v.fsf@HIDDEN>
In-Reply-To: <87ble4ob6v.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Mon, 4 Jan 2021 14:40:09 -0800
Message-ID: <000601d6e2ea$8f6601e0$ae3205a0$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdbixKCbDCmEoWSjThCxlG4TPKmz9wAIFLKg
Content-Language: en-us
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Thanks! The patch has fixed the issue.=20


-----Original Message-----
From: Juri Linkov [mailto:juri@HIDDEN]=20
Sent: Monday, January 4, 2021 9:37 AM
To: Eli Zaretskii
Cc: Bob Floyd; 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in =
23.3, broke in 26.3

>> 7. Nothing happens because the region in step (1) has been lost.
>>     It should ask to replace 4  _xx s in the region.
>
> I suspect this is due to changes in how selection works in Emacs.
> Those changes were made in Emacs 24; please see the section "Selection =

> changes" in the file etc/NEWS.24, where you will also find=20
> instructions for getting back the old behavior.

I tried to fix this problem by this patch, and indeed it fixed it, so =
the region boundaries are preserved even when changed during the =
minibuffer reading the strings:






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 4 Jan 2021 18:08:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 04 13:08:45 2021
Received: from localhost ([127.0.0.1]:60232 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kwUHc-0005D7-Tj
	for submit <at> debbugs.gnu.org; Mon, 04 Jan 2021 13:08:45 -0500
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43833)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kwUHa-0005CR-Rg
 for 45617 <at> debbugs.gnu.org; Mon, 04 Jan 2021 13:08:43 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 364EFE0003;
 Mon,  4 Jan 2021 18:08:34 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
 23.3, broke in 26.3
Organization: LINKOV.NET
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
Date: Mon, 04 Jan 2021 19:37:28 +0200
In-Reply-To: <83turycc18.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 03 Jan
 2021 16:47:47 +0200")
Message-ID: <87ble4ob6v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: Bob Floyd <bobfloyd@HIDDEN>, 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

>> 7. Nothing happens because the region in step (1) has been lost.
>>     It should ask to replace 4 ‘_xx’s in the region.
>
> I suspect this is due to changes in how selection works in Emacs.
> Those changes were made in Emacs 24; please see the section "Selection
> changes" in the file etc/NEWS.24, where you will also find
> instructions for getting back the old behavior.

I tried to fix this problem by this patch, and indeed it fixed it,
so the region boundaries are preserved even when changed during
the minibuffer reading the strings:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=query-replace-region.patch

diff --git a/lisp/replace.el b/lisp/replace.el
index 9765b2b5be..c5acf8fca7 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -395,7 +395,10 @@ query-replace
 
 To customize possible responses, change the bindings in `query-replace-map'."
   (interactive
-   (let ((common
+   (let ((start (if (use-region-p) (region-beginning)))
+         (end (if (use-region-p) (region-end)))
+         (region-noncontiguous-p (if (use-region-p) (region-noncontiguous-p)))
+         (common
 	  (query-replace-read-args
 	   (concat "Query replace"
 		   (if current-prefix-arg
@@ -407,10 +410,7 @@ query-replace
 	   ;; These are done separately here
 	   ;; so that command-history will record these expressions
 	   ;; rather than the values they had this time.
-	   (if (use-region-p) (region-beginning))
-	   (if (use-region-p) (region-end))
-	   (nth 3 common)
-	   (if (use-region-p) (region-noncontiguous-p)))))
+	   start end (nth 3 common) region-noncontiguous-p)))
   (perform-replace from-string to-string t nil delimited nil nil start end backward region-noncontiguous-p))
 
 (define-key esc-map "%" 'query-replace)

--=-=-=
Content-Type: text/plain


But then I noticed this comment in 'query-replace':

	   ;; These are done separately here
	   ;; so that command-history will record these expressions
	   ;; rather than the values they had this time.

And indeed this patch broke this feature, so region boundaries
are saved as numbers in command-history for repeat-complex-command
instead of such code:

  C-x M-: (query-replace "a" "z" nil (if (use-region-p) (region-beginning)) (if (use-region-p) (region-end)) nil nil)

But anyway this feature was broken by design and never worked:
with a compiled replace.el it saves region boundaries as numbers,
and only when 'query-replace' is manually evaluated with 'eval-defun',
only then region boundaries are saved as code to command-history.

So we could just delete 'fix_command' from callint.c,
and don't worry about such cases.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 4 Jan 2021 17:26:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 04 12:26:26 2021
Received: from localhost ([127.0.0.1]:60120 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kwTcf-000419-TI
	for submit <at> debbugs.gnu.org; Mon, 04 Jan 2021 12:26:26 -0500
Received: from eggs.gnu.org ([209.51.188.92]:39732)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kwTce-00040w-Hf
 for 45617 <at> debbugs.gnu.org; Mon, 04 Jan 2021 12:26:24 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:39394)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kwTcZ-0004gL-BY; Mon, 04 Jan 2021 12:26:19 -0500
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3375
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kwTcV-0000n2-Mw; Mon, 04 Jan 2021 12:26:17 -0500
Date: Mon, 04 Jan 2021 19:26:05 +0200
Message-Id: <83ft3gbolu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
In-Reply-To: <000c01d6e205$292bd2a0$7b8377e0$@net> (bobfloyd@HIDDEN)
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
 <000c01d6e205$292bd2a0$7b8377e0$@net>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45617
Cc: 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: "Bob Floyd" <bobfloyd@HIDDEN>
> Cc: <45617 <at> debbugs.gnu.org>
> Date: Sun, 3 Jan 2021 11:18:03 -0800
> 
> I already had the NEWS.24 changes in my .emacs file! So that is not the cause of this issue.

That is strange, because if I make all the changes mentioned in
NEWS.24, in "emacs -Q", then your recipe works for me as you expected.

Did you try that in "emacs -Q"?  If not, please try; if "emacs -Q"
with the changes from NEWS.24 does work, then there's some other
customization in your init files which gets in the way.

> You do agree this is a bug - that <query-replace> fails, correct?

It is not a bug, it is a consequence of the changes in how selections
work in Emacs.  Your example assumes the old handling of selections,
so it doesn't work with Emacs >= 24 defaults.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 3 Jan 2021 19:18:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 03 14:18:12 2021
Received: from localhost ([127.0.0.1]:38632 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kw8tI-0001io-N3
	for submit <at> debbugs.gnu.org; Sun, 03 Jan 2021 14:18:12 -0500
Received: from resqmta-po-08v.sys.comcast.net ([96.114.154.167]:55307)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1kw8tG-0001iZ-Rr
 for 45617 <at> debbugs.gnu.org; Sun, 03 Jan 2021 14:18:11 -0500
Received: from resomta-po-17v.sys.comcast.net ([96.114.154.241])
 by resqmta-po-08v.sys.comcast.net with ESMTP
 id w8hnkKqnTXAgTw8tAkj6lD; Sun, 03 Jan 2021 19:18:04 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1609701484;
 bh=mtYF1j6auVExnSDaLBYATeKu6V2bG0F0P6uUq/MHnkg=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=NZi/WMUhMXjgYGJg2tY4VSz5TAWOQfNKNDY8FD/Ejm95hgm7HndIgBQLdTqcr7Jry
 0hyJZn+ThbermPguwV46/4lfyPtuAsFCUBSo1w1eW/vUGqwdq/MEFBbmzeEIiABikd
 Jg9BBPQzzjrF096x2LqVu5JDqgeN0juwRYNYHiYFEPCvp8GTSTkw9HrMX07yRzWzTC
 xEW4lvQmPMoqG0yebCa3F65FxepNrbKMFEnMeDSp6JG6WwazRko/YRX12rQH3NNlGx
 +20jCOS0qf+GNUIk/kO1lfpeFxAxg/etJi9hIzVdv+4yqG8tnDxw6zWIbm5rpbGMJl
 Q63dXOZzl/Pgg==
Received: from Cache ([IPv6:2601:647:6100:1480::9c05])
 by resomta-po-17v.sys.comcast.net with ESMTPA
 id w8t9kv9K8j2qxw8tAk9ISS; Sun, 03 Jan 2021 19:18:04 +0000
X-Xfinity-VMeta: sc=-100.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: "'Eli Zaretskii'" <eliz@HIDDEN>
References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@HIDDEN>
In-Reply-To: <83turycc18.fsf@HIDDEN>
Subject: RE: bug#45617: <query-replace> loses the edit region. Works in 23.3,
 broke in 26.3
Date: Sun, 3 Jan 2021 11:18:03 -0800
Message-ID: <000c01d6e205$292bd2a0$7b8377e0$@net>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Adbh325jfVS8GcLYTM+JeggJqWuatwAJL0/Q
Content-Language: en-us
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45617
Cc: 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Eli,

I already had the NEWS.24 changes in my .emacs file! So that is not the =
cause of this issue.

You do agree this is a bug - that <query-replace> fails, correct?

Thanks for your quick reply.
Bob

-----Original Message-----
From: Eli Zaretskii [mailto:eliz@HIDDEN]=20
Sent: Sunday, January 3, 2021 6:48 AM
To: Bob Floyd
Cc: 45617 <at> debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in =
23.3, broke in 26.3

> From: "Bob Floyd" <bobfloyd@HIDDEN>
> Date: Sat, 2 Jan 2021 17:05:57 -0800
>=20
> 7. Nothing happens because the region in step (1) has been lost.
>     It should ask to replace 4 =EF=BF=BD_xx=EF=BF=BDs in the region.

I suspect this is due to changes in how selection works in Emacs.
Those changes were made in Emacs 24; please see the section "Selection
changes" in the file etc/NEWS.24, where you will also find
instructions for getting back the old behavior.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at 45617 <at> debbugs.gnu.org:


Received: (at 45617) by debbugs.gnu.org; 3 Jan 2021 14:48:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 03 09:48:06 2021
Received: from localhost ([127.0.0.1]:37287 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kw4fu-0003GD-3S
	for submit <at> debbugs.gnu.org; Sun, 03 Jan 2021 09:48:06 -0500
Received: from eggs.gnu.org ([209.51.188.92]:56810)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kw4fs-0003Fk-KP
 for 45617 <at> debbugs.gnu.org; Sun, 03 Jan 2021 09:48:04 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:43196)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kw4fn-0002v6-8u; Sun, 03 Jan 2021 09:47:59 -0500
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4731
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kw4fm-0003KT-Kn; Sun, 03 Jan 2021 09:47:59 -0500
Date: Sun, 03 Jan 2021 16:47:47 +0200
Message-Id: <83turycc18.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Bob Floyd" <bobfloyd@HIDDEN>
In-Reply-To: <000001d6e16c$984bcb70$c8e36250$@net> (bobfloyd@HIDDEN)
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in 23.3, 
 broke in 26.3
References: <000001d6e16c$984bcb70$c8e36250$@net>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45617
Cc: 45617 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: "Bob Floyd" <bobfloyd@HIDDEN>
> Date: Sat, 2 Jan 2021 17:05:57 -0800
> 
> 7. Nothing happens because the region in step (1) has been lost.
>     It should ask to replace 4 ‘_xx’s in the region.

I suspect this is due to changes in how selection works in Emacs.
Those changes were made in Emacs 24; please see the section "Selection
changes" in the file etc/NEWS.24, where you will also find
instructions for getting back the old behavior.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Jan 2021 01:06:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 20:06:13 2021
Received: from localhost ([127.0.0.1]:33001 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kvrqX-00027C-I3
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2021 20:06:13 -0500
Received: from lists.gnu.org ([209.51.188.17]:45128)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bobfloyd@HIDDEN>) id 1kvrqV-00026y-BC
 for submit <at> debbugs.gnu.org; Sat, 02 Jan 2021 20:06:11 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:39070)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bobfloyd@HIDDEN>)
 id 1kvrqT-0001hH-1B
 for bug-gnu-emacs@HIDDEN; Sat, 02 Jan 2021 20:06:10 -0500
Received: from resqmta-po-04v.sys.comcast.net
 ([2001:558:fe16:19:96:114:154:163]:52120)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bobfloyd@HIDDEN>)
 id 1kvrqL-0002yS-FQ
 for bug-gnu-emacs@HIDDEN; Sat, 02 Jan 2021 20:06:07 -0500
Received: from resomta-po-04v.sys.comcast.net ([96.114.154.228])
 by resqmta-po-04v.sys.comcast.net with ESMTP
 id vrCFkMxU6bVMMvrqIkFeIV; Sun, 03 Jan 2021 01:05:58 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
 s=20190202a; t=1609635958;
 bh=Qr6En1d+MpBa0JwRDzo5XmiRzh2oFcHFR3JU1cObxYQ=;
 h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type;
 b=BBaS9OAFjo0YS0jhdKzWtoMPwGCvVHl8q+62mzlsTfnPFSIJzkkNadZTMx8rEJHTY
 1WVaFk342LUi/Y0eCFHamlMa1vOBcSqBQwKj5Tjev+QZR6A1OjyMIIjVmCch8gMi51
 OeGs3BcH/ggQYGnyo3tgLFuJ0NZgnH4m/RiHitpF9/G1t+CHA+gJW5yVbylsUmAeng
 WFYikCD9+6xA5h+QJ5/xnpvhsev/QWdYPIyCHLrXZGTE8P5QK5q4Yviz8BtnVARxNr
 eHUvDdt7zK1c0Y96wEToe99I1gstWv7jhBcVaedwNNkxrjjZZcBU4RztIqhOKb0Auy
 2bqjN0YHvkHIg==
Received: from Cache ([IPv6:2601:647:6100:1480::9c05])
 by resomta-po-04v.sys.comcast.net with ESMTPA
 id vrqGku1Iu5JK7vrqHkk3Rp; Sun, 03 Jan 2021 01:05:57 +0000
X-Xfinity-VMeta: sc=0.00;st=legit
From: "Bob Floyd" <bobfloyd@HIDDEN>
To: <bug-gnu-emacs@HIDDEN>
Subject: <query-replace> loses the edit region. Works in 23.3, broke in 26.3
Date: Sat, 2 Jan 2021 17:05:57 -0800
Message-ID: <000001d6e16c$984bcb70$c8e36250$@net>
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="----=_NextPart_000_0001_01D6E129.8A288B70"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdbhbJec5NV9sym9Qp+0CZ2+osTB3g==
Content-Language: en-us
Received-SPF: pass client-ip=2001:558:fe16:19:96:114:154:163;
 envelope-from=bobfloyd@HIDDEN; helo=resqmta-po-04v.sys.comcast.net
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.1 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

This is a multi-part message in MIME format.

------=_NextPart_000_0001_01D6E129.8A288B70
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Use this c++ test:

main()

{

  int         _xx;

 

  _xx = _xx + 2;

 

  return _xx;

}

 

"query-replace" loses the edit region. 

Works in Emacs 23.3. Broke in GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)

of 2019-08-29

 

1. Select region from line 2 '{' to line 8 '}'

 

2. Do "query-replace" to begin "Query replace in region"

 

3. Do Double-click left mouse to select '_xx' on line 3

   -or-

   <down-mouse-one> "mouse-drag-region" to select '_xx' on line 3

 

4. In "Query replace in region:" window do <mouse-2> "mouse-yank-at-click"

   to insert '_xx'.

 

5. Via keyboard hit "Enter" key, now you see:

   "Query replace in region _xx with:"

 

6. Via keyboard type '_yy' and 'enter'

"Query replace in region _xx with: _yy"

 

7. Nothing happens because the region in step (1) has been lost.

    It should ask to replace 4 '_xx's in the region.


------=_NextPart_000_0001_01D6E129.8A288B70
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><META =
HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 12 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
vlink=3Dpurple><div class=3DWordSection1><div =
style=3D'mso-element:para-border-div;border:none;border-bottom:solid =
windowtext 1.0pt;padding:0in 0in 1.0pt 0in'><p class=3DMsoNormal =
style=3D'border:none;padding:0in'>Use this c++ =
test:<o:p></o:p></p></div><p class=3DMsoNormal>main()<o:p></o:p></p><p =
class=3DMsoNormal>{<o:p></o:p></p><p class=3DMsoNormal>&nbsp; =
int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
_xx;<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>&nbsp; _xx =3D _xx + 2;<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&nbsp; =
return _xx;<o:p></o:p></p><div =
style=3D'mso-element:para-border-div;border:none;border-bottom:solid =
windowtext 1.0pt;padding:0in 0in 1.0pt 0in'><p class=3DMsoNormal =
style=3D'border:none;padding:0in'>}<o:p></o:p></p></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>&quot;query-replace&quot; loses the edit region. =
<o:p></o:p></p><p class=3DMsoNormal>Works in Emacs 23.3. Broke in GNU =
Emacs 26.3 (build 1, x86_64-w64-mingw32)<o:p></o:p></p><p =
class=3DMsoNormal> of 2019-08-29<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>1. Select =
region from line 2 '{' to line 8 '}'<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>2. Do =
&quot;query-replace&quot; to begin &quot;Query replace in =
region&quot;<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>3. Do Double-click left mouse to select '_xx' on line =
3<o:p></o:p></p><p class=3DMsoNormal>&nbsp;&nbsp; -or-<o:p></o:p></p><p =
class=3DMsoNormal>&nbsp;&nbsp; &lt;down-mouse-one&gt; =
&quot;mouse-drag-region&quot; to select '_xx' on line 3<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>4. In =
&quot;Query replace in region:&quot; window do &lt;mouse-2&gt; =
&quot;mouse-yank-at-click&quot;<o:p></o:p></p><p =
class=3DMsoNormal>&nbsp;&nbsp; to insert '_xx'.<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>5. Via =
keyboard hit &quot;Enter&quot; key, now you see:<o:p></o:p></p><p =
class=3DMsoNormal>&nbsp;&nbsp; &quot;Query replace in region _xx =
with:&quot;<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>6. Via keyboard type '_yy' and =
'enter'<o:p></o:p></p><p class=3DMsoNormal>&quot;Query replace in region =
_xx with: _yy&quot;<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>7. Nothing =
happens because the region in step (1) has been lost.<o:p></o:p></p><p =
class=3DMsoNormal>&nbsp;&nbsp;&nbsp; It should ask to replace 4 =
&#8216;_xx&#8217;s in the region.<o:p></o:p></p></div></body></html>
------=_NextPart_000_0001_01D6E129.8A288B70--





Acknowledgement sent to "Bob Floyd" <bobfloyd@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#45617; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 19 Jan 2021 18:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.