summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-02-19 11:29:32 +0200
committerEli Zaretskii <eliz@gnu.org>2023-02-19 11:29:32 +0200
commit4faebba2fedcb428838fbda8537140841bdd8aa0 (patch)
treec9041ffe2cba7f0413bb722dac43c60e98e48c16 /lisp/emacs-lisp
parentcd05fca5f78048cb867be2d5f0857f6997f12ccc (diff)
downloademacs-4faebba2fedcb428838fbda8537140841bdd8aa0.tar.gz
emacs-4faebba2fedcb428838fbda8537140841bdd8aa0.tar.bz2
emacs-4faebba2fedcb428838fbda8537140841bdd8aa0.zip
Fix invocation of File->Close from the menu bar
* lisp/simple.el (kill-buffer--possibly-save): Don't request LONG-FORM from 'read-multiple-choice' if GUI dialog should be used. * lisp/emacs-lisp/rmc.el (read-multiple-choice): Doc fix. (read-multiple-choice--short-answers): Don't append "?" to CHOICES and don't display the prompt in the echo area if GUI dialog is used. Use 'use-dialog-box-p'. (Bug#61553)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/rmc.el27
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 542c96512f5..bfd7434be9a 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -162,8 +162,10 @@ dialogs. Otherwise, the function will always use text-mode dialogs.
The return value is the matching entry from the CHOICES list.
-If LONG-FORM, do a `completing-read' over the NAME elements in
-CHOICES instead.
+If LONG-FORM is non-nil, do a `completing-read' over the NAME elements
+in CHOICES instead. In this case, GUI dialog is not used, regardless
+of the value of `use-dialog-box' and whether the function was invoked
+via a mouse gesture.
Usage example:
@@ -177,8 +179,9 @@ Usage example:
prompt choices help-string show-help)))
(defun read-multiple-choice--short-answers (prompt choices help-string show-help)
- (let* ((prompt-choices
- (if show-help choices (append choices '((?? "?")))))
+ (let* ((dialog-p (use-dialog-box-p))
+ (prompt-choices
+ (if (or show-help dialog-p) choices (append choices '((?? "?")))))
(altered-names (mapcar #'rmc--add-key-description prompt-choices))
(full-prompt
(format
@@ -192,16 +195,14 @@ Usage example:
(setq buf (rmc--show-help prompt help-string show-help
choices altered-names)))
(while (not tchar)
- (message "%s%s"
- (if wrong-char
- "Invalid choice. "
- "")
- full-prompt)
+ (unless dialog-p
+ (message "%s%s"
+ (if wrong-char
+ "Invalid choice. "
+ "")
+ full-prompt))
(setq tchar
- (if (and (display-popup-menus-p)
- last-input-event ; not during startup
- (consp last-nonmenu-event)
- use-dialog-box)
+ (if dialog-p
(x-popup-dialog
t
(cons prompt