emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] emacs-25 bc55a57: * lisp/menu-bar.el (kill-this-buffer


From: Stefan Monnier
Subject: Re: [Emacs-diffs] emacs-25 bc55a57: * lisp/menu-bar.el (kill-this-buffer): Doc fix. (Bug#26466)
Date: Sun, 16 Apr 2017 09:42:04 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> After so many years that this code existed, I see no reason to rock
> the boat now.  This bike shed's color was fixed long ago; if we didn't
> care during all these years, we should definitely leave it at that
> now.

I think the patch below would make the function more robust and
eliminate the need to warn about weird behaviors in unusual circumstances.


        Stefan


diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 28464f13df..2ee3f4777d 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1896,16 +1896,13 @@ menu-bar-non-minibuffer-window-p
               (frame-selected-window menu-frame))))))
 
 (defun kill-this-buffer ()     ; for the menu bar
-  "Kill the current buffer.
+  "Kill the selected window's buffer.
 When called in the minibuffer, get out of the minibuffer
 using `abort-recursive-edit'."
   (interactive)
   (cond
-   ;; Don't do anything when `menu-frame' is not alive or visible
-   ;; (Bug#8184).
-   ((not (menu-bar-menu-frame-live-and-visible-p)))
-   ((menu-bar-non-minibuffer-window-p)
-    (kill-buffer (current-buffer)))
+   ((window-minibuffer-p (selected-window))
+    (kill-buffer (window-buffer)))
    (t
     (abort-recursive-edit))))
 



reply via email to

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