1
0
Fork 0

[oni-org] Add support for id: backlinks in oni-backlinks dblock

This commit is contained in:
Tom Willemse 2022-04-01 18:39:47 -07:00
parent 641f736478
commit 64fee97d35

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2022.0315.220855 ;; Version: 2022.0401.183938
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch) ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -332,7 +332,9 @@ _di_: Add inlineimages STARTUP
(defun oni-org-dblock-write-backlinks (_params) (defun oni-org-dblock-write-backlinks (_params)
"Generate backlinks to org headings." "Generate backlinks to org headings."
(let ((current-heading (nth 4 (org-heading-components))) (let ((current-heading (nth 4 (org-heading-components)))
(current-heading-id (alist-get "CUSTOM_ID" (org-entry-properties) nil nil #'string=)) (current-heading-id
(or (alist-get "CUSTOM_ID" (org-entry-properties) nil nil #'string=)
(org-id-get)))
backlinks) backlinks)
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -344,7 +346,8 @@ _di_: Add inlineimages STARTUP
(when (not (null current-heading-id)) (when (not (null current-heading-id))
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward (rx-to-string `(and "#" ,current-heading-id "]")) nil t) (while (re-search-forward (rx-to-string `(or (seq "[[id:" ,current-heading-id "]")
(seq "#" ,current-heading-id "]"))) nil t)
(unless (or (oni-org-in-dblock-p) (unless (or (oni-org-in-dblock-p)
(oni-org-at-origin-property-p)) (oni-org-at-origin-property-p))
(let ((components (org-heading-components))) (let ((components (org-heading-components)))