From f6fb70894b663e8df795341696f198e22543ccfe Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 15 Nov 2020 14:10:39 -0800 Subject: 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. --- oni-org/oni-org.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'oni-org') diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index 9ac593b..d0ffd87 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; 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 -- cgit v1.2.3-54-g00ecf