]> code.delx.au - gnu-emacs/commitdiff
Use an X popup in read-multiple-choice if running from a mouse command
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 5 Feb 2016 03:52:45 +0000 (14:52 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 5 Feb 2016 03:52:45 +0000 (14:52 +1100)
* lisp/subr.el (read-multiple-choice): Use an X popup if
called from a mouse action (bug#19368).

lisp/subr.el

index e47570a56896423bdbba9238b79681b88d3c3019..8e430bf98f5fb955ac1be584aa2ddd6bf965e388 100644 (file)
@@ -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))