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:36:32 +0200 Organization: LINKOV.NET Message-ID: <87lfc5rr33.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="23871"; 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:56:17 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 1l7MO0-00067J-Jj for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 18:56:16 +0100 Original-Received: from localhost ([::1]:37584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7MNz-0000tY-LR for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 12:56:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7MF6-0005iR-86 for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 12:47:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7MF5-0007wI-HV for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 12:47:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l7MF5-00084G-Fx 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.161237438330918 (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:23 +0000 Original-Received: from localhost ([127.0.0.1]:38769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7MEQ-00082b-Q4 for submit@debbugs.gnu.org; Wed, 03 Feb 2021 12:46:23 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:52097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7MEP-00081w-Th for 46268@debbugs.gnu.org; Wed, 03 Feb 2021 12:46:22 -0500 X-Originating-IP: 91.129.108.204 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 29265C0007; Wed, 3 Feb 2021 17:46:14 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Wed, 03 Feb 2021 10:22:50 -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:199217 Archived-At: >> + (mapconcat (lambda (boo) >> + (or (and (buffer-live-p boo) >> + (buffer-name boo)) > > `buffer-name` used to be the function that provided the functionality of > `buffer-live-p`, so you can replace > > (and (buffer-live-p boo) > (buffer-name boo)) > > with just > > (buffer-live-p boo) > > By definition of a buffer is live iff it has a name. > >> + (and (overlayp boo) >> + (buffer-live-p (overlay-buffer boo)) >> + (buffer-name (overlay-buffer boo))))) > > And here you can further simplify because `overlay-buffer` only returns > non-nil if the buffer is live. Maybe then this should be enough to handle all cases: diff --git a/lisp/replace.el b/lisp/replace.el index f13d27aff8..d320542d62 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1545,7 +1545,10 @@ occur-rename-buffer (with-current-buffer (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) (rename-buffer (concat "*Occur: " - (mapconcat #'buffer-name + (mapconcat (lambda (boo) + (buffer-name (if (overlayp boo) + (overlay-buffer boo) + boo))) (car (cddr occur-revert-arguments)) "/") "*") (or unique-p (not interactive-p)))))