From 1f16a64c411543673ff5ce3e7f52df549ec356e3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 8 Oct 2013 11:22:56 +0300 Subject: [PATCH] F10 can now invoke menu-bar menus from local map. --- lisp/menu-bar.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 892ef49cb54..41a02019039 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2344,6 +2344,11 @@ If nil, the current mouse position is used." (defvar tty-menu-open-use-tmm nil "If non-nil, menu-bar-open on a TTY will invoke `tmm-menubar'.") +(defvar tty-menu--initial-menu-x 10 + "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. @@ -2362,9 +2367,12 @@ If FRAME is nil or not given, use the selected frame." ((null tty-menu-open-use-tmm) ;; FIXME: This should open the leftmost menu, and let the user ;; move to others via C-f or right-arrow. - (let ((menu (menu-bar-menu-at-x-y 10 0 frame))) - (popup-menu (lookup-key global-map (vector 'menu-bar menu)) - (posn-at-x-y 10 0 nil t) t))) + (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) t))) (t (with-selected-frame (or frame (selected-frame)) (tmm-menubar)))))) -- 2.39.2