* lisp/menu-bar.el: Use function variable instead of switch-to-buffer.
authorDrew Adams <drew.adams@oracle.com>
Tue, 21 Jun 2011 01:49:36 +0000 (21:49 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 21 Jun 2011 01:49:36 +0000 (21:49 -0400)
(menu-bar-select-buffer-function): New variable.
(menu-bar-update-buffers): Use it.

etc/NEWS
lisp/ChangeLog
lisp/menu-bar.el

index f8d6e59..7d32cdb 100644 (file)
--- 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.
+
 \f
 * Editing Changes in Emacs 24.1
 
index f0039e0..526f22c 100644 (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
index 343a9c6..437bd52 100644 (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.