Function: allout-solicit-char-in-string
allout-solicit-char-in-string is a byte-compiled function defined in
allout.el.gz.
Signature
(allout-solicit-char-in-string PROMPT STRING &optional DO-DEFAULTING)
Documentation
Solicit (with first arg PROMPT) choice of a character from string STRING.
Optional arg DO-DEFAULTING indicates to accept empty input (CR).
Source Code
;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_ : UI:
;;;_ > allout-solicit-char-in-string (prompt string &optional do-defaulting)
(defun allout-solicit-char-in-string (prompt string &optional do-defaulting)
"Solicit (with first arg PROMPT) choice of a character from string STRING.
Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
(let ((new-prompt prompt)
got)
(while (not got)
(message "%s" new-prompt)
;; We do our own reading here, so we can circumvent, eg, special
;; treatment for `?' character. (Oughta use minibuffer keymap instead.)
(setq got
(char-to-string (let ((cursor-in-echo-area nil)) (read-char))))
(setq got
(cond ((string-match (regexp-quote got) string) got)
((and do-defaulting (string= got "\r"))
;; Return empty string to default:
"")
((string= got "\C-g") (signal 'quit nil))
(t
(setq new-prompt (concat prompt
got
" ...pick from: "
string
""))
nil))))
;; got something out of loop -- return it:
got)
)