Function: consult--buffer-query-prompt

consult--buffer-query-prompt is a byte-compiled function defined in consult.el.

Signature

(consult--buffer-query-prompt PROMPT QUERY)

Documentation

Return a list of buffers and create an appropriate prompt string.

Return a pair of a prompt string and a list of buffers. PROMPT is the prefix of the prompt string. QUERY specifies the buffers to search and is passed to consult--buffer-query.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--buffer-query-prompt (prompt query)
  "Return a list of buffers and create an appropriate prompt string.
Return a pair of a prompt string and a list of buffers.  PROMPT
is the prefix of the prompt string.  QUERY specifies the buffers
to search and is passed to `consult--buffer-query'."
  (let* ((dir (plist-get query :directory))
         (ndir (consult--normalize-directory dir))
         (buffers (apply #'consult--buffer-query :directory ndir query))
         (count (length buffers)))
    (cons (format "%s (%d buffer%s%s): " prompt count
                  (if (= count 1) "" "s")
                  (cond
                   ((and ndir (eq dir 'project))
                    (format ", Project %s" (consult--project-name ndir)))
                   (ndir (concat  ", " (consult--left-truncate-file ndir)))
                   (t "")))
          buffers)))