unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 46268@debbugs.gnu.org
Subject: bug#46268: 27.1.91; Error in occur-rename-buffer
Date: Wed, 03 Feb 2021 19:36:32 +0200	[thread overview]
Message-ID: <87lfc5rr33.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvsg6di3hf.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 03 Feb 2021 10:22:50 -0500")

>> +             (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)))))





  reply	other threads:[~2021-02-03 17:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  8:54 bug#46268: 27.1.91; Error in occur-rename-buffer Juri Linkov
2021-02-03 15:05 ` Stefan Monnier
2021-02-03 15:38   ` Stefan Monnier
2021-02-03 17:34     ` Juri Linkov
2021-02-03 15:22 ` Stefan Monnier
2021-02-03 17:36   ` Juri Linkov [this message]
2021-02-03 19:41     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfc5rr33.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=46268@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).