From ebc6985b83ce2b1aefd761072d40ec3037bdd996 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 5 Feb 2016 14:52:45 +1100 Subject: [PATCH] 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 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index e47570a5689..8e430bf98f5 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)) -- 2.39.2