The Complete Computer

Jump to Missing Org Roam Nodes

LifeTechEmacsArcology

Invoking jump-to-missing-node picks a random org-roam link which is of the [[roam:Some Text]] form, i.e. a stub, so that you can fill in missing parts of your graph. This paired with help:org-roam-refile is a helpful way to flesh out your Knowledge Base .

emacs-lisp source: :tangle ~/org/cce/missing-org-roam.el
(defun one-random (list) (elt list (random (length list)))) (defun one-missing-node () (let* ((from-db (org-roam-db-query [:select [source dest] :from links :where (= type "roam")])) (dest-names (-map #'cadr from-db)) (as-alist (--map (cons (cadr it) (car it)) from-db)) (eln (one-random dest-names))) (assoc eln as-alist #'equal))) (defun jump-to-missing-node () (interactive) (pcase-let* ((`(,text . ,source-id) (one-missing-node)) (node (org-roam-node-from-id source-id))) (org-roam-node-open node) (goto-char (point-min)) (search-forward (format "[[roam:%s]]" text)) (outline-show-all))) (provide 'cce/missing-org-roam)