Function: consult--location-state

consult--location-state is a natively compiled function defined in consult.el.

Signature

(consult--location-state CANDIDATES)

Documentation

Location state function.

The cheap location markers from CANDIDATES are upgraded on window selection change to full Emacs markers. CANDIDATES can also be an asynchronous completion table, a function taking a single argument.

Source Code

;; Defined in /nix/store/6higv2v1wk916v4ynnybyrdkfy2gq44d-emacs-packages-deps/share/emacs/site-lisp/elpa/consult-20261004.957/consult.el
(defun consult--location-state (candidates)
  "Location state function.
The cheap location markers from CANDIDATES are upgraded on window
selection change to full Emacs markers.  CANDIDATES can also be an
asynchronous completion table, a function taking a single argument."
  (let ((jump (consult--jump-state))
        (hook (make-symbol "consult--location-upgrade")))
    (fset hook
          (lambda (_)
            (unless (consult--completion-window-p)
              (remove-hook 'window-selection-change-functions hook)
              (mapc #'consult--get-location
                    (if (functionp candidates) (funcall candidates nil) candidates)))))
    (lambda (action cand)
      (pcase action
        ('setup (add-hook 'window-selection-change-functions hook))
        ('exit (remove-hook 'window-selection-change-functions hook)))
      (funcall jump action cand))))