From 2347eac669e4d6ceddecc05e1d0d288ce446fe0a Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 14 Jun 2024 15:03:49 +0200 Subject: [PATCH] lisp/org.el (org--dnd-rmc): Fix `read-multiple-choice' call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Link: https://orgmode.org/list/87ikyhg9qi.fsf@jklaehn.de --- lisp/org.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 795a4d51b..44734a733 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))