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:
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
(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
'((?y "yes" "kill buffer without saving")
(?n "no" "exit without doing anything")
(?s "save and then kill" "save the buffer and then kill it"))
- nil nil (not use-short-answers)))))
+ nil nil (and (not use-short-answers)
+ (not (use-dialog-box-p)))))))
(if (equal response "no")
nil
(unless (equal response "yes")