emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108659: In EDT emulator, allow updat


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108659: In EDT emulator, allow updating of menu-bar Buffers menu.
Date: Tue, 19 Jun 2012 15:05:44 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108659
author: Kevin Gallagher <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2012-06-19 15:05:44 +0800
message:
  In EDT emulator, allow updating of menu-bar Buffers menu.
  
  * lisp/emulation/edt.el (edt-default-menu-bar-update-buffers)
  (edt-user-menu-bar-update-buffers): New functions.
  (edt-default-emulation-setup, edt-user-emulation-setup): Use them.
modified:
  lisp/ChangeLog
  lisp/emulation/edt.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-06-19 06:49:50 +0000
+++ b/lisp/ChangeLog    2012-06-19 07:05:44 +0000
@@ -1,3 +1,9 @@
+2012-06-19  Kevin Gallagher  <address@hidden>
+
+       * emulation/edt.el (edt-default-menu-bar-update-buffers)
+       (edt-user-menu-bar-update-buffers): New functions.
+       (edt-default-emulation-setup, edt-user-emulation-setup): Use them.
+
 2012-06-19  Chong Yidong  <address@hidden>
 
        * subr.el (with-selected-window): Preserve the selected window's

=== modified file 'lisp/emulation/edt.el'
--- a/lisp/emulation/edt.el     2012-01-19 07:21:25 +0000
+++ b/lisp/emulation/edt.el     2012-06-19 07:05:44 +0000
@@ -2071,6 +2071,20 @@
     (setq transient-mark-mode edt-orig-transient-mark-mode))
   (message "Original key bindings restored; EDT Emulation disabled"))
 
+(defun edt-default-menu-bar-update-buffers ()
+  ;; Update edt-default-global-map with latest copy of
+  ;; `global-buffers-menu-map' each time `menu-bar-update-buffers'
+  ;; updates global-map.
+  (define-key edt-default-global-map [menu-bar buffer]
+    (cons "Buffers" global-buffers-menu-map)))
+
+(defun edt-user-menu-bar-update-buffers ()
+  ;; We need to update edt-user-global-map with latest copy of
+  ;; `global-buffers-menu-map' each time `menu-bar-update-buffers'
+  ;; updates global-map.
+  (define-key edt-user-global-map [menu-bar buffer]
+    (cons "Buffers" global-buffers-menu-map)))
+
 (defun edt-default-emulation-setup (&optional user-setup)
   "Setup emulation of DEC's EDT editor.
 Optional argument USER-SETUP non-nil means  called from function
@@ -2110,10 +2124,8 @@
     (progn
       (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map))
       (edt-select-default-global-map)))
-  ;; We need to share `global-buffers-menu-map' with the saved global
-  ;; keymap, because `menu-bar-update-buffers' directly changes it.
-  (define-key (current-global-map) [menu-bar buffer]
-    (cons "Buffers" global-buffers-menu-map)))
+  ;; Keep the menu bar Buffers menu up-to-date in edt-default-global-map.
+  (add-hook 'menu-bar-update-hook 'edt-default-menu-bar-update-buffers))
 
 (defun edt-user-emulation-setup ()
   "Setup user custom emulation of DEC's EDT editor."
@@ -2134,7 +2146,9 @@
   ;; See Info node `edt' for more details, and sample edt-user.el file.
   (if (fboundp 'edt-setup-user-bindings)
       (edt-setup-user-bindings))
-  (edt-select-user-global-map))
+  (edt-select-user-global-map)
+  ;; Keep the menu bar Buffers menu up-to-date in edt-user-global-map.
+  (add-hook 'menu-bar-update-hook 'edt-user-menu-bar-update-buffers))
 
 (defun edt-select-default-global-map()
   "Select default EDT emulation key bindings."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]