diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-21 11:01:16 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-21 11:01:43 +0100 |
| commit | 7321d20be7a4ac2f214f149419314c075c239ec8 (patch) | |
| tree | dcc1b4f029a9a578dbada4fedae8c3aa261b9c56 /compat-29.el | |
| parent | f74574e3e289a42e4eac62f8b5e1e66d371e29b4 (diff) | |
compat-29: Add read-multiple-choice with LONG-FORM argument
Diffstat (limited to 'compat-29.el')
| -rw-r--r-- | compat-29.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compat-29.el b/compat-29.el index 5d441a9..df39dc6 100644 --- a/compat-29.el +++ b/compat-29.el @@ -1183,5 +1183,24 @@ Also see `buttonize'." ;; Obsolete Alias since 29 (compat-defalias button-buttonize buttonize :obsolete t) ;; <compat-tests:button-buttonize> +;;;; Defined in rmc.el + +(compat-defun read-multiple-choice ;; <compat-tests:read-multiple-choice> + (prompt choices &optional _help-str _show-help long-form) + "Handle LONG-FORM argument." + :explicit t + (if (not long-form) + (read-multiple-choice prompt choices) + (let ((answer + (completing-read + (concat prompt " (" + (mapconcat #'identity (mapcar #'cadr choices) "/") + ") ") + (mapcar #'cadr choices) nil t))) + (catch 'found + (dolist (c choices) + (when (equal answer (cadr c)) + (throw 'found c))))))) + (provide 'compat-29) ;;; compat-29.el ends here |
