roam_refsに重複がないか確認する Emacs OrgMode OrgRoam
Org-roamで ROAM_REFS に完全一致するNodeを検索するためにはおそらくroam-dbへのクエリが必要っぽい。
org-roam-ref-read--completions に関連する実装があったので、これを参考にしてみる。
(defun org-roam-ref-read--completions ()
"Return an alist for ref completion.
The car is the ref, and the cdr is the corresponding node for the ref."
(let ((rows (org-roam-db-query
[:select [id ref type nodes:file pos title]
:from refs
:left-join nodes
:on (= refs:node-id nodes:id)])))
...
これにWhereを組み合わせてrefに一致するNodeをとりだしたい。
(let ((rows (org-roam-db-query
[:select [ref]
:from refs
:where (= ref "//github.com")])))
(when rows
"Found."))
Found.
いいね。