emacs-diffs
[Top][All Lists]
Advanced

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

master f7b408ec50: Don't require mouse for prompting via dialog boxes


From: Eli Zaretskii
Subject: master f7b408ec50: Don't require mouse for prompting via dialog boxes
Date: Sat, 29 Jan 2022 10:56:14 -0500 (EST)

branch: master
commit f7b408ec5001e777bf5facc81fcb815be0e1f5f6
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Don't require mouse for prompting via dialog boxes
    
    * lisp/subr.el (use-dialog-box-p): Don't require mouse support,
    and allow dialog boxes when invoked via the TTY menus without a
    mouse.
    (from--tty-menu-p): New internal variable.
    
    * lisp/menu-bar.el (popup-menu): Bind 'from--tty-menu-p' when
    invoking a command from the menu.
---
 lisp/menu-bar.el |  7 +++++--
 lisp/subr.el     | 11 +++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 817c2d485e..b6dbf209ec 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -2629,8 +2629,11 @@ FROM-MENU-BAR, if non-nil, means we are dropping one of 
menu-bar's menus."
       ;; `setup-specified-language-environment', for instance,
       ;; expects this to be set from a menu keymap.
       (setq last-command-event (car (last event)))
-      ;; mouse-major-mode-menu was using `command-execute' instead.
-      (call-interactively cmd))))
+      (setq from--tty-menu-p nil)
+      ;; Signal use-dialog-box-p this command was invoked from a menu.
+      (let ((from--tty-menu-p t))
+        ;; mouse-major-mode-menu was using `command-execute' instead.
+        (call-interactively cmd)))))
 
 (defun popup-menu-normalize-position (position)
   "Convert the POSITION to the form which `popup-menu' expects internally.
diff --git a/lisp/subr.el b/lisp/subr.el
index 4b4412a883..6d70d9e8d6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3249,11 +3249,14 @@ switch back again to the minibuffer before entering the
 character.  This is not possible when using `read-key', but using
 `read-key' may be less confusing to some users.")
 
+
+(defvar from--tty-menu-p nil
+  "Non-nil means the current command was invoked from a TTY menu.")
 (defun use-dialog-box-p ()
-  "Say whether the user should be prompted with a dialog popup box."
-  (and (display-popup-menus-p)
-       last-input-event                 ; not during startup
-       (listp last-nonmenu-event)
+  "Say whether the current command should promp the user via GUI dialog box."
+  (and last-input-event                 ; not during startup
+       (or (listp last-nonmenu-event)   ; invoked by a mouse event
+           from--tty-menu-p)             ; invoked via TTY menu
        use-dialog-box))
 
 (defun y-or-n-p (prompt)



reply via email to

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