[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114629: Make the same key that opens TTY menus also
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r114629: Make the same key that opens TTY menus also exit the menu. |
Date: |
Fri, 11 Oct 2013 17:45:30 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114629
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-11 20:44:41 +0300
message:
Make the same key that opens TTY menus also exit the menu.
lisp/menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/menu-bar.el menubar.el-20091113204419-o5vbwnq5f7feedwu-546
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-10-11 03:28:31 +0000
+++ b/lisp/ChangeLog 2013-10-11 17:44:41 +0000
@@ -1,3 +1,7 @@
+2013-10-11 Eli Zaretskii <address@hidden>
+
+ * menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit.
+
2013-10-11 Stefan Monnier <address@hidden>
* progmodes/sh-script.el: Provide simpl(e|istic) completion.
=== modified file 'lisp/menu-bar.el'
--- a/lisp/menu-bar.el 2013-10-10 10:47:11 +0000
+++ b/lisp/menu-bar.el 2013-10-11 17:44:41 +0000
@@ -2261,6 +2261,50 @@
(popup-menu-normalize-position (event-end position)))
(t position)))
+(defcustom tty-menu-open-use-tmm nil
+ "If non-nil, \\[menu-bar-open] on a TTY will invoke `tmm-menubar'.
+
+If nil, \\[menu-bar-open] will drop down the menu corresponding to the
+first (leftmost) menu-bar item; you can select other items by typing
+\\[forward-char], \\[backward-char], \\[right-char] and \\[left-char]."
+ :type '(choice (const :tag "F10 drops down TTY menus" nil)
+ (const :tag "F10 invokes tmm-menubar" t))
+ :group 'display
+ :version "24.4")
+
+(defvar tty-menu--initial-menu-x 1
+ "X coordinate of the first menu-bar menu dropped by F10.
+
+This is meant to be used only for debugging TTY menus.")
+
+(defun menu-bar-open (&optional frame)
+ "Start key navigation of the menu bar in FRAME.
+
+This function decides which method to use to access the menu
+depending on FRAME's terminal device. On X displays, it calls
+`x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it
+calls either `popup-menu' or `tmm-menubar' depending on whether
+\`tty-menu-open-use-tmm' is nil or not.
+
+If FRAME is nil or not given, use the selected frame."
+ (interactive)
+ (let ((type (framep (or frame (selected-frame)))))
+ (cond
+ ((eq type 'x) (x-menu-bar-open frame))
+ ((eq type 'w32) (w32-menu-bar-open frame))
+ ((and (null tty-menu-open-use-tmm)
+ (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0))))
+ (let* ((x tty-menu--initial-menu-x)
+ (menu (menu-bar-menu-at-x-y x 0 frame)))
+ (popup-menu (or
+ (lookup-key global-map (vector 'menu-bar menu))
+ (lookup-key (current-local-map) (vector 'menu-bar menu)))
+ (posn-at-x-y x 0 nil t) nil t)))
+ (t (with-selected-frame (or frame (selected-frame))
+ (tmm-menubar))))))
+
+(global-set-key [f10] 'menu-bar-open)
+
(defvar tty-menu-navigation-map
(let ((map (make-sparse-keymap)))
;; The next line is disabled because it breaks interpretation of
@@ -2282,7 +2326,8 @@
(next-line . tty-menu-next-item)
(previous-line . tty-menu-prev-item)
(newline . tty-menu-select)
- (newline-and-indent . tty-menu-select)))
+ (newline-and-indent . tty-menu-select)
+ (menu-bar-open . tty-menu-exit)))
(substitute-key-definition (car bind) (cdr bind)
map (current-global-map)))
@@ -2327,51 +2372,6 @@
map)
"Keymap used while processing TTY menus.")
-
-(defcustom tty-menu-open-use-tmm nil
- "If non-nil, \\[menu-bar-open] on a TTY will invoke `tmm-menubar'.
-
-If nil, \\[menu-bar-open] will drop down the menu corresponding to the
-first (leftmost) menu-bar item; you can select other items by typing
-\\[forward-char], \\[backward-char], \\[right-char] and \\[left-char]."
- :type '(choice (const :tag "F10 drops down TTY menus" nil)
- (const :tag "F10 invokes tmm-menubar" t))
- :group 'display
- :version "24.4")
-
-(defvar tty-menu--initial-menu-x 1
- "X coordinate of the first menu-bar menu dropped by F10.
-
-This is meant to be used only for debugging TTY menus.")
-
-(defun menu-bar-open (&optional frame)
- "Start key navigation of the menu bar in FRAME.
-
-This function decides which method to use to access the menu
-depending on FRAME's terminal device. On X displays, it calls
-`x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it
-calls either `popup-menu' or `tmm-menubar' depending on whether
-\`tty-menu-open-use-tmm' is nil or not.
-
-If FRAME is nil or not given, use the selected frame."
- (interactive)
- (let ((type (framep (or frame (selected-frame)))))
- (cond
- ((eq type 'x) (x-menu-bar-open frame))
- ((eq type 'w32) (w32-menu-bar-open frame))
- ((and (null tty-menu-open-use-tmm)
- (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0))))
- (let* ((x tty-menu--initial-menu-x)
- (menu (menu-bar-menu-at-x-y x 0 frame)))
- (popup-menu (or
- (lookup-key global-map (vector 'menu-bar menu))
- (lookup-key (current-local-map) (vector 'menu-bar menu)))
- (posn-at-x-y x 0 nil t) nil t)))
- (t (with-selected-frame (or frame (selected-frame))
- (tmm-menubar))))))
-
-(global-set-key [f10] 'menu-bar-open)
-
(provide 'menu-bar)
;;; menu-bar.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114629: Make the same key that opens TTY menus also exit the menu.,
Eli Zaretskii <=