lisp/org.el (org--dnd-rmc): Fix `read-multiple-choice' call

* lisp/org.el (org--dnd-rmc): Add docstring.  Fix the call to
`read-multiple-choice' when extended help ("?") is requested by the
user.

Reported-by: Johann Klähn <org-mode@web.jklaehn.de>
Link: https://orgmode.org/list/87ikyhg9qi.fsf@jklaehn.de
This commit is contained in:
Ihor Radchenko 2024-06-14 15:03:49 +02:00
parent bd8b861ee9
commit 2347eac669
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 15 additions and 1 deletions

View File

@ -20873,11 +20873,25 @@ When nil, use `org-attach-method'."
(defvar org-attach-method)
(defun org--dnd-rmc (prompt choices)
"Display a menu or dialog and select with PROMPT among CHOICES.
PROMPT is the prompt string. CHOICES is a list of choices. Each
choice is a list of (key description value). VALUE from the selected
choice is returned."
(if (null (and
;; Emacs <=28 does not have `use-dialog-box-p'.
(fboundp 'use-dialog-box-p)
(use-dialog-box-p)))
(caddr (read-multiple-choice prompt choices))
(progn
(setq choices
(mapcar
(pcase-lambda (`(,key ,message ,val))
;; `read-multiple-choice' expects VAL to be a long
;; description of the choice - string or nil. Move VAL
;; further, so that it is not seen by the extended
;; help in `read-multiple-choice'.
(list key message nil val))
choices))
(nth 3 (read-multiple-choice prompt choices)))
(setq choices
(mapcar
(pcase-lambda (`(_key ,message ,val))