1
0
Fork 0

Don’t use the ORIGIN property for back-links

A lot of the time when capturing some task my cursor is at a random location and
it doesn’t actually mean what I’m looking at is at all related to what I’m
writing.

I think this will make me occasionally miss certain connections, but usually
will provide less noise.
This commit is contained in:
Tom Willemse 2020-11-15 14:10:39 -08:00
parent 690ec65a30
commit f6fb70894b

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.0921.230900
;; Version: 2020.1115.140847
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons)
;; This program is free software; you can redistribute it and/or modify
@ -150,6 +150,14 @@ _l_: Store link ^^ _j_: Journal entry
"^[ \t]*#\\+end"
lim-up lim-down))))
(defun oni-org-at-origin-property-p ()
"Non-nil when point is in an origin property."
(save-match-data
(save-excursion
(goto-char (line-beginning-position))
(and (looking-at org-property-re)
(string= (match-string 2) "ORIGIN")))))
(defun oni-org-dblock-write-backlinks (_params)
"Generate backlinks to org headings."
(let ((current-heading (nth 4 (org-heading-components)))
@ -158,7 +166,8 @@ _l_: Store link ^^ _j_: Journal entry
(save-excursion
(goto-char (point-min))
(while (re-search-forward (rx-to-string `(and "*" ,current-heading "]")) nil t)
(unless (oni-org-in-dblock-p)
(unless (or (oni-org-in-dblock-p)
(oni-org-at-origin-property-p))
(push (nth 4 (org-heading-components)) backlinks))))
(when (not (null current-heading-id))
(save-excursion