Function: org--dnd-rmc

org--dnd-rmc is a byte-compiled function defined in org.el.gz.

Signature

(org--dnd-rmc PROMPT CHOICES)

Documentation

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.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(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)))
      (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))
             (cons (capitalize message) val))
           choices))
    (x-popup-menu t (list prompt (cons "" choices)))))