Function: cider-read-from-minibuffer

cider-read-from-minibuffer is a byte-compiled function defined in cider-common.el.

Signature

(cider-read-from-minibuffer PROMPT &optional VALUE SKIP-COLON)

Documentation

Read a string from the minibuffer, prompting with PROMPT.

If VALUE is non-nil, it is inserted into the minibuffer as initial-input. PROMPT need not end with ": ". If it doesn't, VALUE is displayed on the prompt as a default value (used if the user doesn't type anything) and is not used as initial input (input is left empty). If SKIP-COLON is non-nil, no ": " is forced at the end of the prompt.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-common.el
(defun cider-read-from-minibuffer (prompt &optional value skip-colon)
  "Read a string from the minibuffer, prompting with PROMPT.
If VALUE is non-nil, it is inserted into the minibuffer as initial-input.
PROMPT need not end with \": \".  If it doesn't, VALUE is displayed on the
prompt as a default value (used if the user doesn't type anything) and is
not used as initial input (input is left empty).
If SKIP-COLON is non-nil, no \": \" is forced at the end of the prompt."
  (minibuffer-with-setup-hook
      (lambda ()
        (set-syntax-table clojure-mode-syntax-table)
        (add-hook 'completion-at-point-functions
                  #'cider-complete-at-point nil t)
        (setq-local eldoc-documentation-function #'cider-eldoc)
        (run-hooks 'eval-expression-minibuffer-setup-hook))
    (let* ((has-colon (string-match ": \\'" prompt))
           (input (read-from-minibuffer (cond
                                         (has-colon prompt)
                                         (skip-colon prompt)
                                         (value (format "%s (default %s): " prompt value))
                                         (t (format "%s: " prompt)))
                                        (when has-colon value) ; initial-input
                                        cider-minibuffer-map nil
                                        'cider-minibuffer-history
                                        (unless has-colon value)))) ; default-value
      (if (and (equal input "") value (not has-colon))
          value
        input))))