* lisp/menu-bar.el: Use function variable instead of switch-to-buffer.

(menu-bar-select-buffer-function): New variable.
(menu-bar-update-buffers): Use it.
This commit is contained in:
Drew Adams 2011-06-20 21:49:36 -04:00 committed by Stefan Monnier
parent 478d6f95ff
commit 5d907d6cf0
3 changed files with 16 additions and 1 deletions

View file

@ -309,6 +309,11 @@ If you need it, feedmail.el ought to provide a superset of the functionality.
The elisp implementation sha1.el is removed. Feature sha1 is provided
by default.
** Menu-bar changes
*** `menu-bar-select-buffer-function' lets you choose another operation
instead of `switch-to-buffer' when selecting an item in the Buffers menu.
* Editing Changes in Emacs 24.1

View file

@ -1,3 +1,9 @@
2011-06-21 Drew Adams <drew.adams@oracle.com>
* menu-bar.el: Use function variable instead of switch-to-buffer.
(menu-bar-select-buffer-function): New variable.
(menu-bar-update-buffers): Use it.
2011-06-21 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/bytecomp.el (add-to-list): Add handler to check the

View file

@ -1977,6 +1977,10 @@ Buffers menu is regenerated."
;; Used to cache the menu entries for commands in the Buffers menu
(defvar menu-bar-buffers-menu-command-entries nil)
(defvar menu-bar-select-buffer-function 'switch-to-buffer
"Function to select the buffer chosen from the `Buffers' menu-bar menu.
It must accept a buffer as its only required argument.")
(defun menu-bar-update-buffers (&optional force)
;; If user discards the Buffers item, play along.
(and (lookup-key (current-global-map) [menu-bar buffer])
@ -2022,7 +2026,7 @@ Buffers menu is regenerated."
(cons nil nil))
`(lambda ()
(interactive)
(switch-to-buffer ,(cdr pair))))))
(funcall menu-bar-select-buffer-function ,(cdr pair))))))
(list buffers-vec))))
;; Make a Frames menu if we have more than one frame.