From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Bob Floyd" Newsgroups: gmane.emacs.bugs Subject: bug#45617: 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> References: <000001d6e16c$984bcb70$c8e36250$@net> <83turycc18.fsf@gnu.org> <87ble4ob6v.fsf@mail.linkov.net> <000601d6e2ea$8f6601e0$ae3205a0$@net> <877dorkznt.fsf@mail.linkov.net> <002701d6e39b$4ac35680$e04a0380$@net> <8735ze9e09.fsf@mail.linkov.net> <83mtxm0vzd.fsf@gnu.org> <002d01d6e478$ca50cdf0$5ef269d0$@net> <87k0sgirr0.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17794"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45617@debbugs.gnu.org To: "'Juri Linkov'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 15 19:10:38 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l0TYT-0004X9-V5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Jan 2021 19:10:37 +0100 Original-Received: from localhost ([::1]:35258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0TYS-0000fP-OF for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Jan 2021 13:10:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0TXu-0000ex-Vx for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:10:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0TXu-0002UV-Oy for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l0TXu-0002Cy-Iu for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Bob Floyd" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Jan 2021 18:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45617 X-GNU-PR-Package: emacs Original-Received: via spool by 45617-submit@debbugs.gnu.org id=B45617.16107341978467 (code B ref 45617); Fri, 15 Jan 2021 18:10:02 +0000 Original-Received: (at 45617) by debbugs.gnu.org; 15 Jan 2021 18:09:57 +0000 Original-Received: from localhost ([127.0.0.1]:41686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0TXo-0002CV-OO for submit@debbugs.gnu.org; Fri, 15 Jan 2021 13:09:56 -0500 Original-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 ) id 1l0TXm-0002CI-PM for 45617@debbugs.gnu.org; Fri, 15 Jan 2021 13:09:55 -0500 Original-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== Original-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 In-Reply-To: <87k0sgirr0.fsf@mail.linkov.net> X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Adbp3vlii5CbgRImSi2QJPxAGEBxiABipDPg Content-Language: en-us X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197997 Archived-At: PS: The 1st patch has the same wrong behavior also! -----Original Message----- From: Juri Linkov [mailto:juri@linkov.net] Sent: Wednesday, January 13, 2021 10:54 AM To: Bob Floyd Cc: 'Eli Zaretskii'; 45617@debbugs.gnu.org Subject: Re: bug#45617: 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, 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.