Function: helpful--read-symbol

helpful--read-symbol is a byte-compiled function defined in helpful.el.

Signature

(helpful--read-symbol PROMPT DEFAULT-VAL PREDICATE)

Documentation

Read a symbol from the minibuffer, with completion.

Returns the symbol.

Source Code

;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--read-symbol (prompt default-val predicate)
  "Read a symbol from the minibuffer, with completion.
Returns the symbol."
  (when (and default-val
             (not (funcall predicate default-val)))
    (setq default-val nil))
  (when default-val
    ;; `completing-read' expects a string.
    (setq default-val (symbol-name default-val))

    ;; TODO: Only modify the prompt when we don't have ido/ivy/helm,
    ;; because the default is obvious for them.
    (setq prompt
          (replace-regexp-in-string
           (rx ": " eos)
           (format " (default: %s): " default-val)
           prompt)))
  (intern (completing-read prompt obarray
                           predicate t nil nil
                           default-val)))