# HG changeset patch # User Juri Linkov # Date 1205689460 0 # Node ID 6bc37f1965b56ffac93f958cf03f166cd9712e1e # Parent 5af8822703daa719249533dc7a1daae058a0b55c (kill-this-buffer): Use menu-bar-non-minibuffer-window-p to check if the current buffer is the minibuffer, and in this case call abort-recursive-edit to kill the minibuffer. Doc fix. (kill-this-buffer-enabled-p): Allow this function to return non-nil when the current buffer is the minibuffer. diff -r 5af8822703da -r 6bc37f1965b5 lisp/menu-bar.el --- a/lisp/menu-bar.el Sun Mar 16 17:44:11 2008 +0000 +++ b/lisp/menu-bar.el Sun Mar 16 17:44:20 2008 +0000 @@ -1439,9 +1439,13 @@ (not (window-minibuffer-p (frame-selected-window menu-frame))))) (defun kill-this-buffer () ; for the menu bar - "Kill the current buffer." + "Kill the current buffer. +When called in the minibuffer, get out of the minibuffer +using `abort-recursive-edit'." (interactive) - (kill-buffer (current-buffer))) + (if (menu-bar-non-minibuffer-window-p) + (kill-buffer (current-buffer)) + (abort-recursive-edit))) (defun kill-this-buffer-enabled-p () (let ((count 0) @@ -1450,8 +1454,8 @@ (or (string-match "^ " (buffer-name (car buffers))) (setq count (1+ count))) (setq buffers (cdr buffers))) - (and (menu-bar-non-minibuffer-window-p) - (> count 1)))) + (or (not (menu-bar-non-minibuffer-window-p)) + (> count 1)))) (put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))