emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master ebc6985: Use an X popup in read-multiple-choice if


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master ebc6985: Use an X popup in read-multiple-choice if running from a mouse command
Date: Fri, 05 Feb 2016 03:52:57 +0000

branch: master
commit ebc6985b83ce2b1aefd761072d40ec3037bdd996
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Use an X popup in read-multiple-choice if running from a mouse command
    
    * lisp/subr.el (read-multiple-choice): Use an X popup if
    called from a mouse action (bug#19368).
---
 lisp/subr.el |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index e47570a..8e430bf 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2296,10 +2296,23 @@ Usage example:
                        "Invalid choice.  "
                      "")
                    full-prompt)
-         (setq tchar (condition-case nil
-                          (let ((cursor-in-echo-area t))
-                            (read-char))
-                        (error nil)))
+          (setq tchar
+                (if (and (display-popup-menus-p)
+                         last-input-event ; not during startup
+                         (listp last-nonmenu-event)
+                         use-dialog-box)
+                    (x-popup-dialog
+                     t
+                     (cons prompt
+                           (mapcar
+                            (lambda (elem)
+                              (cons (capitalize (cadr elem))
+                                    (car elem)))
+                            choices)))
+                  (condition-case nil
+                      (let ((cursor-in-echo-area t))
+                        (read-char))
+                    (error nil))))
           ;; The user has entered an invalid choice, so display the
           ;; help messages.
          (when (not (assq tchar choices))



reply via email to

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