Function: auth-source-read-char-choice

auth-source-read-char-choice is a byte-compiled function defined in auth-source.el.gz.

Signature

(auth-source-read-char-choice PROMPT CHOICES)

Documentation

Read one of CHOICES by read-char-choice, or read-char.

dropdown-list support is disabled because it doesn't work reliably. Only one of CHOICES will be returned. The PROMPT is augmented with "[a/b/c] " if CHOICES is (?a ?b ?c).

Source Code

;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
(defun auth-source-read-char-choice (prompt choices)
  "Read one of CHOICES by `read-char-choice', or `read-char'.
`dropdown-list' support is disabled because it doesn't work reliably.
Only one of CHOICES will be returned.  The PROMPT is augmented
with \"[a/b/c] \" if CHOICES is \(?a ?b ?c)."
  (when choices
    (let* ((prompt-choices
            (apply #'concat
                   (cl-loop for c in choices collect (format "%c/" c))))
           (prompt-choices (concat "[" (substring prompt-choices 0 -1) "] "))
           (full-prompt (concat prompt prompt-choices))
           k)

      (while (not (memq k choices))
        (setq k (read-char-choice full-prompt choices)))
      k)))