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: Mon, 25 Jan 2021 11:34:16 -0800 Message-ID: <000301d6f351$1275aa10$3760fe30$@net> References: <000001d6e16c$984bcb70$c8e36250$@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> <002101d6eadc$e816a070$b843e150$@net> <87k0sezj07.fsf@mail.linkov.net> <000c01d6eb68$f3f675f0$dbe361d0$@net> <877do8eull.fsf@mail.linkov.net> <000401d6ef83$32407e50$96c17af0$@net> <87czxyy5sz.fsf@mail.linkov.net> <009c01d6f0e4$7cdaeba0$7690c2e0$@net> <874kj7d1kd.fsf@mail.linkov.net> <002e01d6f1b2$1f2290c0$5d67b240$@net> <87eeiba4jo.fsf@mail.linkov.net> <006101d6f291$2b537dc0$81fa7940$@net> <87ft2p1fcl.fsf@mail.linkov.net> <006c01d6f345$c82aa7e0$587ff7a0$@net> <87im7ku9t2.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="2518"; 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 Mon Jan 25 20:35:16 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 1l47dr-0000X1-Vz for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Jan 2021 20:35:16 +0100 Original-Received: from localhost ([::1]:54966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l47dq-0002IU-T3 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Jan 2021 14:35:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l47dg-0002FZ-7B for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2021 14:35:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l47de-0003Jv-Eh for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2021 14:35:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l47de-0007Bh-Bj for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2021 14:35: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: Mon, 25 Jan 2021 19:35: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.161160326727583 (code B ref 45617); Mon, 25 Jan 2021 19:35:02 +0000 Original-Received: (at 45617) by debbugs.gnu.org; 25 Jan 2021 19:34:27 +0000 Original-Received: from localhost ([127.0.0.1]:40010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l47d5-0007Ap-0n for submit@debbugs.gnu.org; Mon, 25 Jan 2021 14:34:27 -0500 Original-Received: from resqmta-po-09v.sys.comcast.net ([96.114.154.168]:50768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l47d3-0007Ac-I5 for 45617@debbugs.gnu.org; Mon, 25 Jan 2021 14:34:26 -0500 Original-Received: from resomta-po-01v.sys.comcast.net ([96.114.154.225]) by resqmta-po-09v.sys.comcast.net with ESMTP id 43G4lHyaVJbAB47cxlfWTr; Mon, 25 Jan 2021 19:34:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1611603259; bh=J9lsXjdc6oLeWpk6dEbpVVV0q+guqKPh76a4kzdEZgM=; h=Received:Received:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type; b=hgtMzYgTm2ot6hMdo6HUdr9fA6vSvjMDA7I9eaCqrPSScgzP127EIHJ3tEazyZuwb p7CYTxMoD6K8CWP4aFulfPadKZ/HI0FmXwnd7GwwQkq9h0yjGpSuOxGOtehZ93Crv4 DRMNQt1Ullaa0W6Utg9iqb9ZLvYrxmuHZ6Drveu+pikRXvAp7bgvSVDFF3SojW84z5 T7Sf6zH3pj5YoLKNZq3iWTWbQu7MaGOJRshPdQOjch2CQkudpURef5/Ag4L2De89qX iW6VzPzz//bbx27rTIk+A052uIlUwo3elCV0cmzXfl1/iIOrTFULIJFnAzt7jZg5BF UWN9+SqLywGiA== Original-Received: from Cache ([IPv6:2601:647:6100:1480::a080]) by resomta-po-01v.sys.comcast.net with ESMTPA id 47cvlFrQannBO47cwl8ei9; Mon, 25 Jan 2021 19:34:18 +0000 X-Xfinity-VMeta: sc=-100.00;st=legit In-Reply-To: <87im7ku9t2.fsf@mail.linkov.net> X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us Thread-Index: AdbzS5wJ+L+AGnemTKKWn4L1MiReFgAAyroQ 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:198584 Archived-At: >This is strange because if there is no region selected, this means that >it should replace everywhere in the whole buffer (but only when point is >at the beginning of the buffer). Agreed, but that is what it does. Perhaps a clue? I put the message in below as you suggest, but the result is as though no region is selected - it replaces everywhere in the whole buffer: (interactive (let ((common (query-replace-read-args (concat "Query replace" (if current-prefix-arg (if (eq current-prefix-arg '-) " backward" " word") "") (if (use-region-p) " in region" "")) nil))) (list (nth 0 common) (nth 1 common) (nth 2 common) ;; 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))))) (message "region: %S %S" start end) (perform-replace from-string to-string t nil delimited nil nil start end backward region-noncontiguous-p)) And *Messages* only contains: Mark saved where search started Mark set [2 times] Replaced 11 occurences The region I selected contained only 3 occurences. Have I put your message in the correct place? -----Original Message----- From: Juri Linkov [mailto:juri@linkov.net] Sent: Monday, January 25, 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 > It was doing the expected, correct, query replace, for the first, oh, maybe > six times, then got into the broken state and when I repeat the above > sequence it behaves as if there was no region selected and no replacements > are offered (Replaced 0 occurences). This is strange because if there is no region selected, this means that it should replace everywhere in the whole buffer (but only when point is at the beginning of the buffer). > It seems like something was not restored correctly. I cannot say I precisely > followed the above steps for the first times when it was working - I wanted > to vary the sequence a bit (sometimes entering from the keyboard, sometimes > selecting text from a lower line in the selection) to see if I could break > it. I cannot be more specific about exactly which sequence broke it, only > that now, when it's broken, it consistently does not work! It could help you to debug when you insert the following line in 'query-replace' immediately before the 'perform-replace' call: (message "region: %S %S" start end) Then after query-replace you could check in the *Messages* buffer and see the exact region boundaries used. If there are 'nil' values, this might mean there is a bug in save-mark-and-excursion.