Exclude NOTE entries in main org file as refile targets

The idea is that those entries represent project notes which should not get
tasks refiled as sub-items (sub-headings to structure these notes are fine,
though, and must be added directly).  To connect tasks with project notes, use
links and backlinks instead.

This helps to prevent accidental refiling of tasks under notes and loosing them
there.  A drawback is that `C-u org-refile` won't list notes as visiting targets
anymore; for this, use imenu instead.
This commit is contained in:
Daniel - 2022-06-11 21:17:57 +02:00
parent 7e2860a9d9
commit cff8720a44
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 10 additions and 4 deletions

View File

@ -294,13 +294,19 @@ In ~%s~:
;;; Refiling
(defun db/verify-refile-target ()
"Verify that a certain location is eligible as a refile target.
In other words, exclude tasks with a done state and those with
tag PERIODIC."
"Verify that a certain location is eligible as a refile target."
(and
;; Exclude DONE state tasks from refile targets (from bh)
(not (member (nth 2 (org-heading-components))
org-done-keywords))))
org-done-keywords))
;; Exclude NOTE entries in `db/org-default-org-file', as those are project
;; notes that should not have proper tasks as children (use links to connect
;; those tasks to the project notes instead)
(not (and (member "NOTE" (org-get-tags))
(not (null (buffer-file-name)))
(not (null db/org-default-org-file))
(file-equal-p (buffer-file-name)
db/org-default-org-file)))))
;;; Reset checklists