diff options
author | 2020-09-22 22:15:33 -0700 | |
---|---|---|
committer | 2020-09-22 22:15:33 -0700 | |
commit | 91a59dcd56aa10a3440175f2ccf5c3192e2bf62d (patch) | |
tree | 74c3f1463f33898b875ef29ef9e58294a7716630 /oni-org | |
parent | e9b7271cebb77ddcea90427a2ce7ee4960f3cfc2 (diff) | |
download | emacs-config-91a59dcd56aa10a3440175f2ccf5c3192e2bf62d.tar.gz emacs-config-91a59dcd56aa10a3440175f2ccf5c3192e2bf62d.zip |
Include links that use the custom id
Diffstat (limited to 'oni-org')
-rw-r--r-- | oni-org/oni-org.el | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index 249298a..8108d77 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -153,12 +153,19 @@ _l_: Store link ^^ _j_: Journal entry (defun oni-org-dblock-write-backlinks (_params) "Generate backlinks to org headings." (let ((current-heading (nth 4 (org-heading-components))) + (current-heading-id (alist-get "CUSTOM_ID" (org-entry-properties) nil nil #'string=)) backlinks) (save-excursion (goto-char (point-min)) (while (re-search-forward (rx-to-string `(and "*" ,current-heading "]")) nil t) (unless (oni-org-in-dblock-p) (push (nth 4 (org-heading-components)) backlinks)))) + (when (not (null current-heading-id)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward (rx-to-string `(and "#" ,current-heading-id "]")) nil t) + (unless (oni-org-in-dblock-p) + (push (nth 4 (org-heading-components)) backlinks))))) (insert (string-join (mapcar (lambda (link) (concat "- [[*" link "][" link "]]")) |