From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#46268: 27.1.91; Error in occur-rename-buffer Date: Wed, 03 Feb 2021 19:34:34 +0200 Organization: LINKOV.NET Message-ID: <8735ydt5qt.fsf@mail.linkov.net> References: <874kitttd3.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18888"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 46268@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 03 18:55: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 1l7MN2-0004oL-4D for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 18:55:16 +0100 Original-Received: from localhost ([::1]:35732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7MN1-0008Ru-3g for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 12:55:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7MF5-0005iQ-Cc for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 12:47:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55462) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7MF5-0007wE-5j for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 12:47:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l7MF5-000849-3t for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 12:47:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Feb 2021 17:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46268 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46268-submit@debbugs.gnu.org id=B46268.161237438130901 (code B ref 46268); Wed, 03 Feb 2021 17:47:03 +0000 Original-Received: (at 46268) by debbugs.gnu.org; 3 Feb 2021 17:46:21 +0000 Original-Received: from localhost ([127.0.0.1]:38766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7MEP-00082L-Gg for submit@debbugs.gnu.org; Wed, 03 Feb 2021 12:46:21 -0500 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:47557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7MEN-00081f-BN for 46268@debbugs.gnu.org; Wed, 03 Feb 2021 12:46:19 -0500 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 687A520000E; Wed, 3 Feb 2021 17:46:12 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Wed, 03 Feb 2021 10:38:45 -0500") 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:199215 Archived-At: >> AFAICT, `occur--garbage-collect-revert-args` aims to throw away the >> overlays when they're not needed, but we will need them again if we want >> to `revert-buffer`, so we shouldn't call this function until we're sure >> `revert-buffer` won't be called. IOW, I think we should just remove >> the above call. > > I now see what's going on: this call is supposed to throw away the > overlay used by the previous invocation of `occur`. So when we revert, > we don't want to throw them away but when it's a fresh new invocation, > we do. > > Maybe we should add a (unless (eq bufs (nth 2 occur-revert-arguments)))? Yep, this fixed the problem: diff --git a/lisp/replace.el b/lisp/replace.el index f13d27aff8..babae7fed9 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1779,7 +1783,8 @@ occur-1 42) (window-width)) "" (occur-regexp-descr regexp)))) - (occur--garbage-collect-revert-args) + (unless (eq bufs (nth 2 occur-revert-arguments)) + (occur--garbage-collect-revert-args)) (setq occur-revert-arguments (list regexp nlines bufs)) (if (= count 0) (kill-buffer occur-buf)