diff options
| author | Eli Zaretskii | 2019-07-13 12:47:02 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-07-13 12:47:02 +0300 |
| commit | 127dadbb8cde30d2ffd77548c1c60481b8d9067a (patch) | |
| tree | 0b0ce1145c0d3d191aac04cd7d66659ea3a4ef49 | |
| parent | b2783ba6f4c663556709f524a2ff34f18072e9f3 (diff) | |
| download | emacs-127dadbb8cde30d2ffd77548c1c60481b8d9067a.tar.gz emacs-127dadbb8cde30d2ffd77548c1c60481b8d9067a.zip | |
Fix TTY menus in GUD and GDB-MI modes
* lisp/menu-bar.el (menu-bar-open): Accept a numerical
argument interactively, and drop down menu at that X
coordinate.
(popup-menu): Detect when MENU is not a list. (Bug#36613)
| -rw-r--r-- | lisp/menu-bar.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 4ff60ed9910..389234e9751 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -2362,6 +2362,7 @@ FROM-MENU-BAR, if non-nil, means we are dropping one of menu-bar's menus." | |||
| 2362 | (let* ((map (cond | 2362 | (let* ((map (cond |
| 2363 | ((keymapp menu) menu) | 2363 | ((keymapp menu) menu) |
| 2364 | ((and (listp menu) (keymapp (car menu))) menu) | 2364 | ((and (listp menu) (keymapp (car menu))) menu) |
| 2365 | ((not (listp menu)) nil) | ||
| 2365 | (t (let* ((map (easy-menu-create-menu (car menu) (cdr menu))) | 2366 | (t (let* ((map (easy-menu-create-menu (car menu) (cdr menu))) |
| 2366 | (filter (when (symbolp map) | 2367 | (filter (when (symbolp map) |
| 2367 | (plist-get (get map 'menu-prop) :filter)))) | 2368 | (plist-get (get map 'menu-prop) :filter)))) |
| @@ -2459,9 +2460,12 @@ first (leftmost) menu-bar item; you can select other items by typing | |||
| 2459 | 2460 | ||
| 2460 | This is meant to be used only for debugging TTY menus.") | 2461 | This is meant to be used only for debugging TTY menus.") |
| 2461 | 2462 | ||
| 2462 | (defun menu-bar-open (&optional frame) | 2463 | (defun menu-bar-open (&optional frame initial-x) |
| 2463 | "Start key navigation of the menu bar in FRAME. | 2464 | "Start key navigation of the menu bar in FRAME. |
| 2464 | 2465 | ||
| 2466 | Optional argument INITIAL-X gives the X coordinate of the | ||
| 2467 | first TTY menu-bar menu to be dropped down. Interactively, | ||
| 2468 | this is the numeric argument to the command. | ||
| 2465 | This function decides which method to use to access the menu | 2469 | This function decides which method to use to access the menu |
| 2466 | depending on FRAME's terminal device. On X displays, it calls | 2470 | depending on FRAME's terminal device. On X displays, it calls |
| 2467 | `x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it | 2471 | `x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it |
| @@ -2469,7 +2473,8 @@ calls either `popup-menu' or `tmm-menubar' depending on whether | |||
| 2469 | `tty-menu-open-use-tmm' is nil or not. | 2473 | `tty-menu-open-use-tmm' is nil or not. |
| 2470 | 2474 | ||
| 2471 | If FRAME is nil or not given, use the selected frame." | 2475 | If FRAME is nil or not given, use the selected frame." |
| 2472 | (interactive) | 2476 | (interactive |
| 2477 | (list nil (prefix-numeric-value current-prefix-arg))) | ||
| 2473 | (let ((type (framep (or frame (selected-frame))))) | 2478 | (let ((type (framep (or frame (selected-frame))))) |
| 2474 | (cond | 2479 | (cond |
| 2475 | ((eq type 'x) (x-menu-bar-open frame)) | 2480 | ((eq type 'x) (x-menu-bar-open frame)) |
| @@ -2482,7 +2487,7 @@ If FRAME is nil or not given, use the selected frame." | |||
| 2482 | ;; menu item that should be removed when we exit the minibuffer. | 2487 | ;; menu item that should be removed when we exit the minibuffer. |
| 2483 | (force-mode-line-update) | 2488 | (force-mode-line-update) |
| 2484 | (redisplay) | 2489 | (redisplay) |
| 2485 | (let* ((x tty-menu--initial-menu-x) | 2490 | (let* ((x (max initial-x tty-menu--initial-menu-x)) |
| 2486 | (menu (menu-bar-menu-at-x-y x 0 frame))) | 2491 | (menu (menu-bar-menu-at-x-y x 0 frame))) |
| 2487 | (popup-menu (or | 2492 | (popup-menu (or |
| 2488 | (lookup-key-ignore-too-long | 2493 | (lookup-key-ignore-too-long |