Function: org-roam-node-read--completions

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

Signature

(org-roam-node-read--completions &optional FILTER-FN SORT-FN)

Documentation

Return an alist for node completion.

The car is the displayed title or alias for the node, and the cdr is the org-roam-node. 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. SORT-FN is a function to sort nodes. See org-roam-node-read-sort-by-file-mtime for an example sort function. The displayed title is formatted according to org-roam-node-display-template.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-node.el
(defun org-roam-node-read--completions (&optional filter-fn sort-fn)
  "Return an alist for node completion.
The car is the displayed title or alias for the node, and the cdr
is the `org-roam-node'.
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.
SORT-FN is a function to sort nodes. See `org-roam-node-read-sort-by-file-mtime'
for an example sort function.
The displayed title is formatted according to `org-roam-node-display-template'."
  (let* (
         (nodes (org-roam-node-list))
         (nodes (if filter-fn
                    (cl-remove-if-not
                     (lambda (n) (funcall filter-fn n))
                     nodes)
                  nodes))
         (nodes (if (functionp org-roam-node-display-template)
                    (org-roam--format-nodes-using-function nodes)
                  (org-roam--format-nodes-using-template nodes)))

         (sort-fn (or sort-fn
                      (when org-roam-node-default-sort
                        (intern (concat "org-roam-node-read-sort-by-"
                                        (symbol-name org-roam-node-default-sort))))))
         (nodes (if sort-fn (seq-sort sort-fn nodes)
                  nodes)))
    nodes))