Use org-ql regexp search to find backlins

This is because org-ql link queries seem to be broken when target links contain
brackets in their description.
This commit is contained in:
Daniel - 2022-06-09 21:27:35 +02:00
parent 72c67796c2
commit b84eb291e3
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 4 additions and 1 deletions

View File

@ -1004,9 +1004,12 @@ referenced in `org-agenda-text-search-extra-files'."
(pop extra-files))
(setq files (append files extra-files))
;; Search directly for “[[id:ITEM-ID]” instead of using the regular
;; expression for links, as the latter seems to be broken (as of
;; [2022-06-09] when descriptions contain brackets
(org-ql-query :select '(org-id-get-create)
:from files
:where (let ((link-expression `(link :target ,item-id)))
:where (let ((link-expression `(regexp ,(format "\\[\\[id:%s\\]" item-id))))
(if org-ql-match
`(and ,link-expression ,org-ql-match)
link-expression)))))