emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114606: * lisp/menu-bar.el (tty-menu-navigation-map


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114606: * lisp/menu-bar.el (tty-menu-navigation-map): Reduce redundancy.
Date: Thu, 10 Oct 2013 02:33:39 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114606
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-10-09 22:33:35 -0400
message:
  * lisp/menu-bar.el (tty-menu-navigation-map): Reduce redundancy.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/menu-bar.el               menubar.el-20091113204419-o5vbwnq5f7feedwu-546
  test/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-8588
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-10-10 01:18:01 +0000
+++ b/lisp/ChangeLog    2013-10-10 02:33:35 +0000
@@ -1,3 +1,7 @@
+2013-10-10  Stefan Monnier  <address@hidden>
+
+       * menu-bar.el (tty-menu-navigation-map): Reduce redundancy.
+
 2013-10-10  Andrei Chițu  <address@hidden>  (tiny change)
 
        * calendar/icalendar.el (icalendar-import-file):

=== modified file 'lisp/menu-bar.el'
--- a/lisp/menu-bar.el  2013-10-10 00:32:36 +0000
+++ b/lisp/menu-bar.el  2013-10-10 02:33:35 +0000
@@ -2271,51 +2271,34 @@
 
     ;; The tty-menu-* are just symbols interpreted by term.c, they are
     ;; not real commands.
-    (substitute-key-definition 'keyboard-quit 'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition 'keyboard-escape-quit 'tty-menu-exit
-                              map (current-global-map))
+    (dolist (bind '((keyboard-quit . tty-menu-exit)
+                    (keyboard-escape-quit . tty-menu-exit)
+                    ;; The following two will need to be revised if we ever
+                    ;; support a right-to-left menu bar.
+                    (forward-char . tty-menu-next-menu)
+                    (backward-char . tty-menu-prev-menu)
+                    (right-char . tty-menu-next-menu)
+                    (left-char . tty-menu-prev-menu)
+                    (next-line . tty-menu-next-item)
+                    (previous-line . tty-menu-prev-item)
+                    (newline . tty-menu-select)
+                    (newline-and-indent . tty-menu-select)))
+      (substitute-key-definition (car bind) (cdr bind)
+                                 map (current-global-map)))
+
     ;; The bindings of menu-bar items are so that clicking on the menu
     ;; bar when a menu is already shown pops down that menu.
     ;; FIXME: we should iterate over all the visible menu-bar items,
     ;; instead of naming them explicitly here.  Also, this doesn't
     ;; include items added by current major mode.
-    (substitute-key-definition (lookup-key (current-global-map) [menu-bar 
file])
-                              'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition (lookup-key (current-global-map) [menu-bar 
edit])
-                              'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition (lookup-key (current-global-map) [menu-bar 
options])
-                              'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition (lookup-key (current-global-map) [menu-bar 
buffer])
-                              'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition (lookup-key (current-global-map) [menu-bar 
tools])
-                              'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition (lookup-key (current-global-map) [menu-bar 
help-menu])
-                              'tty-menu-exit
-                              map (current-global-map))
-    (substitute-key-definition 'forward-char 'tty-menu-next-menu
-                              map (current-global-map))
-    (substitute-key-definition 'backward-char 'tty-menu-prev-menu
-                              map (current-global-map))
-    ;; The following two will need to be revised if we ever support
-    ;; a right-to-left menu bar.
-    (substitute-key-definition 'right-char 'tty-menu-next-menu
-                              map (current-global-map))
-    (substitute-key-definition 'left-char 'tty-menu-prev-menu
-                              map (current-global-map))
-    (substitute-key-definition 'next-line 'tty-menu-next-item
-                              map (current-global-map))
-    (substitute-key-definition 'previous-line 'tty-menu-prev-item
-                              map (current-global-map))
-    (substitute-key-definition 'newline 'tty-menu-select
-                              map (current-global-map))
-    (substitute-key-definition 'newline-and-indent 'tty-menu-select
-                              map (current-global-map))
+    ;;
+    ;; FIXME: Why not (define-key map [menu-bat t] 'tty-menu-exit) ?  --Stef
+    (dolist (event '(file edit options buffer tools help-menu))
+      (substitute-key-definition
+       (lookup-key (current-global-map) (vector 'menu-bar event))
+       'tty-menu-exit
+       map (current-global-map)))
+
     (define-key map [?\C-r] 'tty-menu-select)
     (define-key map [?\C-j] 'tty-menu-select)
     (define-key map [return] 'tty-menu-select)

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-10-07 13:27:29 +0000
+++ b/test/ChangeLog    2013-10-10 02:33:35 +0000
@@ -2,6 +2,10 @@
 
        * indent/ruby.rb: Fix a spurious change, add more failing examples.
 
+2013-10-07  Stefan Monnier  <address@hidden>
+
+       * indent/ruby.rb: Add a few more tests; adjust some indentation.
+
 2013-10-06  Dmitry Gutov  <address@hidden>
 
        * automated/ruby-mode-tests.el: Add tests for `ruby-forward-sexp'


reply via email to

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