Function: consult--bookmark-preview

consult--bookmark-preview is a byte-compiled function defined in consult.el.

Signature

(consult--bookmark-preview)

Documentation

Create preview function for bookmarks.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;;; Command: consult-bookmark

(defun consult--bookmark-preview ()
  "Create preview function for bookmarks."
  (let ((preview (consult--jump-preview))
        (open (consult--temporary-files)))
    (lambda (action cand)
      (unless cand
        (funcall open))
      (funcall
       preview action
       ;; Only preview bookmarks with the default handler.
       (when-let* ((bm (and cand (eq action 'preview) (assoc cand bookmark-alist)))
                   (handler (or (bookmark-get-handler bm) #'bookmark-default-handler))
                   ((eq handler #'bookmark-default-handler))
                   (file (bookmark-get-filename bm))
                   (pos (bookmark-get-position bm))
                   (buf (funcall open file)))
         (set-marker (make-marker) pos buf))))))