branch: externals-release/org
commit 2347eac669e4d6ceddecc05e1d0d288ce446fe0a
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    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-m...@web.jklaehn.de>
    Link: https://orgmode.org/list/87ikyhg9qi....@jklaehn.de
---
 lisp/org.el | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 795a4d51bb..44734a733c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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))

Reply via email to