Skip to content

Commit 7dc76b7

Browse files
nobiotdustinfarris
authored andcommitted
fix(db): Org-roam does not store Org-ID w/ search option
add `:search-option` property to the `link` table when present. Fix: #2495 Close: #2496
1 parent f3db974 commit 7dc76b7

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

org-roam-db.el

+12-6
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,18 @@ INFO is the org-element parsed buffer."
563563
"Insert link data for LINK at current point into the Org-roam cache."
564564
(save-excursion
565565
(goto-char (org-element-property :begin link))
566-
(let ((type (org-element-property :type link))
567-
(path (org-element-property :path link))
568-
(source (org-roam-id-at-point))
569-
(properties (list :outline (ignore-errors
570-
;; This can error if link is not under any headline
571-
(org-get-outline-path 'with-self 'use-cache)))))
566+
(let* ((type (org-element-property :type link))
567+
(path (org-element-property :path link))
568+
(option (and (string-match "::\\(.*\\)\\'" path)
569+
(match-string 1 path)))
570+
(path (if (not option) path
571+
(substring path 0 (match-beginning 0))))
572+
(source (org-roam-id-at-point))
573+
(properties (list :outline (ignore-errors
574+
;; This can error if link is not under any headline
575+
(org-get-outline-path 'with-self 'use-cache))))
576+
(properties (if option (plist-put properties :search-option option)
577+
properties)))
572578
;; For Org-ref links, we need to split the path into the cite keys
573579
(when (and source path)
574580
(if (and (boundp 'org-ref-cite-types)

0 commit comments

Comments
 (0)