Have kill-this-buffer don't do anything when frame is not alive or visible (Bug#8184).
authorMartin Rudalics <rudalics@gmx.at>
Wed, 3 Oct 2012 08:50:49 +0000 (10:50 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Wed, 3 Oct 2012 08:50:49 +0000 (10:50 +0200)
* menu-bar.el (kill-this-buffer): Don't do anything when
`menu-frame' is not alive or visible (Bug#8184).

lisp/ChangeLog
lisp/menu-bar.el

index 34afcee..1b115e5 100644 (file)
@@ -1,5 +1,8 @@
 2012-10-03  Martin Rudalics  <rudalics@gmx.at>
 
+       * menu-bar.el (kill-this-buffer): Don't do anything when
+       `menu-frame' is not alive or visible (Bug#8184).
+
        * emacs-lisp/debug.el (debug): When quitting the debugger window
        restore current buffer (Bug#12502).
 
index 010b4ed..88e59ef 100644 (file)
@@ -1812,9 +1812,14 @@ for the definition of the menu frame."
 When called in the minibuffer, get out of the minibuffer
 using `abort-recursive-edit'."
   (interactive)
-  (if (menu-bar-non-minibuffer-window-p)
-      (kill-buffer (current-buffer))
-    (abort-recursive-edit)))
+  (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)))
+   (t
+    (abort-recursive-edit))))
 
 (defun kill-this-buffer-enabled-p ()
   "Return non-nil if the `kill-this-buffer' menu item should be enabled."