Mercurial > emacs
changeset 38903:5653fe43d6fb
(mode-line-unbury-buffer): Add EVENT parameter.
Temporarily select EVENT's window for switching buffers.
(mode-line-bury-buffer): New function.
(mode-line-buffer-identification-keymap): Use it instead of
bury-buffer. Bind down-mouse events to prevent global down-mouse
events to shine through.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 22 Aug 2001 08:54:43 +0000 |
parents | 7c02e0051bda |
children | db6c2951e6a7 |
files | lisp/bindings.el |
diffstat | 1 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/bindings.el Wed Aug 22 08:29:37 2001 +0000 +++ b/lisp/bindings.el Wed Aug 22 08:54:43 2001 +0000 @@ -241,13 +241,22 @@ (defvar mode-line-mode-menu-keymap nil "\ Keymap for mode operations menu in the mode line.") -(defun mode-line-unbury-buffer () "\ +(defun mode-line-unbury-buffer (event) "\ Switch to the last buffer in the buffer list that is not hidden." - (interactive) - (let ((list (reverse (buffer-list)))) - (while (eq (aref (buffer-name (car list)) 0) ? ) - (setq list (cdr list))) - (switch-to-buffer (car list)))) + (interactive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (let ((list (reverse (buffer-list)))) + (while (eq (aref (buffer-name (car list)) 0) ? ) + (setq list (cdr list))) + (switch-to-buffer (car list))))) + +(defun mode-line-bury-buffer (event) "\ +Like bury-buffer, but temporarily select EVENT's window." + (interactive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (bury-buffer))) (defun mode-line-other-buffer () "\ Switch to the most recently selected buffer other than the current one." @@ -334,10 +343,16 @@ ;; of the mode line.or header line. ; (let ((map (make-sparse-keymap))) + ;; Bind down- events so that the global keymap won't ``shine + ;; through''. + (define-key map [mode-line down-mouse-1] 'ignore) (define-key map [mode-line mouse-1] 'mode-line-unbury-buffer) + (define-key map [header-line down-mouse-1] 'ignore) (define-key map [header-line mouse-1] 'mode-line-unbury-buffer) - (define-key map [mode-line mouse-3] 'bury-buffer) - (define-key map [header-line mouse-3] 'bury-buffer) + (define-key map [header-line down-mouse-3] 'ignore) + (define-key map [mode-line mouse-3] 'mode-line-bury-buffer) + (define-key map [header-line down-mouse-3] 'ignore) + (define-key map [header-line mouse-3] 'mode-line-bury-buffer) (setq mode-line-buffer-identification-keymap map)) (defun propertized-buffer-identification (fmt)