From: Drew Adams Date: Tue, 21 Jun 2011 01:49:36 +0000 (-0400) Subject: * lisp/menu-bar.el: Use function variable instead of switch-to-buffer. X-Git-Tag: emacs-pretest-24.0.90~104^2~498 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5d907d6cf02df3549a0da92691037b8c9cc2e534;p=emacs.git * 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. --- diff --git a/etc/NEWS b/etc/NEWS index f8d6e590835..7d32cdba0a6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f0039e0b613..526f22ca679 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-06-21 Drew Adams + + * 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 * emacs-lisp/bytecomp.el (add-to-list): Add handler to check the diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 343a9c6dd0c..437bd523841 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -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.