Function: org-roam-ref-read

org-roam-ref-read is a byte-compiled function defined in org-roam-node.el.

Signature

(org-roam-ref-read &optional INITIAL-INPUT FILTER-FN)

Documentation

Read an Org-roam ref and return a corresponding org-roam-node.

INITIAL-INPUT is the initial prompt value. FILTER-FN is a function to filter out nodes: it takes an org-roam-node, and when nil is returned the node will be filtered out. filtered out.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-node.el
;;; Refs
;;;; Completing-read interface
(defun org-roam-ref-read (&optional initial-input filter-fn)
  "Read an Org-roam ref and return a corresponding `org-roam-node'.
INITIAL-INPUT is the initial prompt value.
FILTER-FN is a function to filter out nodes: it takes an `org-roam-node',
and when nil is returned the node will be filtered out.
filtered out."
  (let* ((refs (org-roam-ref-read--completions))
         (refs (cl-remove-if-not (lambda (n)
                                   (if filter-fn (funcall filter-fn (cdr n)) t)) refs))
         (ref (completing-read "Ref: "
                               (lambda (string pred action)
                                 (if (eq action 'metadata)
                                     `(metadata
                                       (annotation-function
                                        . ,org-roam-ref-annotation-function)
                                       (category . org-roam-ref))
                                   (complete-with-action action refs string pred)))
                               nil t initial-input 'org-roam-ref-history)))
    (cdr (assoc ref refs))))