Mercurial > emacs
changeset 93010:6bc37f1965b5
(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.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Sun, 16 Mar 2008 17:44:20 +0000 |
parents | 5af8822703da |
children | b1cbc5b82a29 |
files | lisp/menu-bar.el |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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))