Function: corfu-info-location

corfu-info-location is an autoloaded, interactive and byte-compiled function defined in corfu-info.el.

Signature

(corfu-info-location &optional ARG)

Documentation

Show location of current candidate.

If called with a prefix ARG, the buffer is persistent.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/corfu-20260813.950/corfu-info.el
;;;###autoload
(defun corfu-info-location (&optional arg)
  "Show location of current candidate.
If called with a prefix ARG, the buffer is persistent."
  (interactive "P")
  ;; Company support, taken from `company.el', see `company-show-location'.
  (when (< corfu--index 0)
    (user-error "No candidate selected"))
  (let* ((cand (nth corfu--index corfu--candidates))
         (cand-str (substring-no-properties cand)))
    (if-let* ((fun (corfu--metadata-get 'company-location))
              ;; BUG: company-location may throw errors if location is not found
              (loc (ignore-errors (funcall fun cand))))
        (with-selected-window
            (corfu-info--display-buffer
             (or (and (bufferp (car loc)) (car loc))
                 (find-file-noselect (car loc) t))
             (and arg (format "*corfu loc: %s*" cand-str)))
          (without-restriction
            (goto-char (point-min))
            (when-let* ((pos (cdr loc)))
              (if (bufferp (car loc))
                  (goto-char pos)
                (forward-line (1- pos))))
            (set-window-start nil (point))))
      (user-error "No location available for `%s'" cand-str))))