aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2008-03-16 17:44:20 +0000
committerJuri Linkov2008-03-16 17:44:20 +0000
commita86b330f8fa754c4b919ea14d0c5dcf261f055c4 (patch)
tree4d609be205b7c66ba17cedfc4d7c628c869a56c0
parent363de02ef0e9f233285a3978412a75ceaaec79ee (diff)
downloademacs-a86b330f8fa754c4b919ea14d0c5dcf261f055c4.tar.gz
emacs-a86b330f8fa754c4b919ea14d0c5dcf261f055c4.zip
(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.
-rw-r--r--lisp/menu-bar.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 6d9e4608186..bd7cd8257ef 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1439,9 +1439,13 @@ for the definition of the menu frame."
1439 (not (window-minibuffer-p (frame-selected-window menu-frame))))) 1439 (not (window-minibuffer-p (frame-selected-window menu-frame)))))
1440 1440
1441(defun kill-this-buffer () ; for the menu bar 1441(defun kill-this-buffer () ; for the menu bar
1442 "Kill the current buffer." 1442 "Kill the current buffer.
1443When called in the minibuffer, get out of the minibuffer
1444using `abort-recursive-edit'."
1443 (interactive) 1445 (interactive)
1444 (kill-buffer (current-buffer))) 1446 (if (menu-bar-non-minibuffer-window-p)
1447 (kill-buffer (current-buffer))
1448 (abort-recursive-edit)))
1445 1449
1446(defun kill-this-buffer-enabled-p () 1450(defun kill-this-buffer-enabled-p ()
1447 (let ((count 0) 1451 (let ((count 0)
@@ -1450,8 +1454,8 @@ for the definition of the menu frame."
1450 (or (string-match "^ " (buffer-name (car buffers))) 1454 (or (string-match "^ " (buffer-name (car buffers)))
1451 (setq count (1+ count))) 1455 (setq count (1+ count)))
1452 (setq buffers (cdr buffers))) 1456 (setq buffers (cdr buffers)))
1453 (and (menu-bar-non-minibuffer-window-p) 1457 (or (not (menu-bar-non-minibuffer-window-p))
1454 (> count 1)))) 1458 (> count 1))))
1455 1459
1456(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p)) 1460(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
1457 1461