From 4a2b44252ef4e71f183f627a49e6ec70c3cf8903 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sat, 6 Nov 2021 18:09:50 +0800 Subject: [PATCH] (fix)db: don't consider links in ROAM_REFS as links (#1947) Links within ROAM_REFS are no longer added as links into the database. This prevents self-referencing. Links within other properties are still valid. --- org-roam-db.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org-roam-db.el b/org-roam-db.el index b22cc44..f94a9c6 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -342,6 +342,10 @@ If UPDATE-P is non-nil, first remove the file in the database." ;; Links correctly recognized by Org Mode ((eq type 'link) (setq link element)) + ;; Prevent self-referencing links in ROAM_REFS + ((and (eq type 'node-property) + (string-equal (org-element-property :key element) "ROAM_REFS")) + nil) ;; Links in property drawers and lines starting with #+. Recall that, as for Org Mode v9.4.4, the ;; org-element-type of links within properties drawers is "node-property" and for lines starting with ;; #+ is "keyword". @@ -354,7 +358,7 @@ If UPDATE-P is non-nil, first remove the file in the database." (with-temp-buffer (delay-mode-hooks (org-mode)) (insert link) - (goto-char 1) + (point-min) (setq link (org-element-context))))) (when link (dolist (fn fns)