bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46268: 27.1.91; Error in occur-rename-buffer


From: Juri Linkov
Subject: bug#46268: 27.1.91; Error in occur-rename-buffer
Date: Wed, 03 Feb 2021 19:36:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> +             (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 via email to

[Prev in Thread] Current Thread [Next in Thread]