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
This commit is contained in:
Noboru Ota
2025-01-04 07:10:22 +01:00
committed by Dustin Farris
parent f3db974bcc
commit 7dc76b708b

View File

@ -563,12 +563,18 @@ INFO is the org-element parsed buffer."
"Insert link data for LINK at current point into the Org-roam cache."
(save-excursion
(goto-char (org-element-property :begin link))
(let ((type (org-element-property :type link))
(path (org-element-property :path link))
(source (org-roam-id-at-point))
(properties (list :outline (ignore-errors
;; This can error if link is not under any headline
(org-get-outline-path 'with-self 'use-cache)))))
(let* ((type (org-element-property :type link))
(path (org-element-property :path link))
(option (and (string-match "::\\(.*\\)\\'" path)
(match-string 1 path)))
(path (if (not option) path
(substring path 0 (match-beginning 0))))
(source (org-roam-id-at-point))
(properties (list :outline (ignore-errors
;; This can error if link is not under any headline
(org-get-outline-path 'with-self 'use-cache))))
(properties (if option (plist-put properties :search-option option)
properties)))
;; For Org-ref links, we need to split the path into the cite keys
(when (and source path)
(if (and (boundp 'org-ref-cite-types)