summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-09-06 13:42:41 -0700
committerFranck Cuny <franck@fcuny.net>2024-09-06 13:42:41 -0700
commit3921a92dd1155400376d7cdda877b5655c454d99 (patch)
tree4d5203ce6287643dd33572ed86d47c50c97e571b
parentadd new binding for denote (diff)
downloademacs.d-3921a92dd1155400376d7cdda877b5655c454d99.tar.gz
refile tasks where I want them to be
-rw-r--r--config/init-notes.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/config/init-notes.el b/config/init-notes.el
index b00626a..277b156 100644
--- a/config/init-notes.el
+++ b/config/init-notes.el
@@ -48,6 +48,20 @@
   (org-mode . visual-line-mode)
   (org-mode . org-indent-mode)
 
+  :preface
+  (defun my/org-entry-get-immediate (property)
+    (save-excursion
+      (let ((local (org--property-local-values property nil)))
+        (and local (mapconcat #'identity
+                              (delq nil local)
+                              (org--property-get-separator property))))))
+
+  (defun org-refile-heading-p ()
+    (let ((todo-state (org-get-todo-state)))
+      (if todo-state
+          (string= todo-state "PROJECT")
+        (my/org-entry-get-immediate "CATEGORY"))))
+
   :custom
   (org-directory "~/Documents/notes")
   (org-default-notes-file (expand-file-name "tasks.org" org-directory))
@@ -64,15 +78,17 @@
   ;; quick access for todo states
   (org-todo-keywords
    '((sequence "TODO(t)" "NEXT(n)" "WAITING(w!)" "|" "DONE(d)")
+     (sequence "PROJECT(p@/!)" "|" "COMPLETE(d@/!)" "ABORTED(x@/!)")
      (sequence "|" "CANCELLED(c)")))
 
   (org-log-done 'time)
   (org-log-into-drawer t)
 
   ;; org-refile options
+  (org-refile-target-verify-function 'org-refile-heading-p)
+  (org-refile-targets
+   '((org-agenda-files :maxlevel . 4)))
   (org-refile-allow-creating-parent-nodes (quote confirm))
-  (org-refile-targets '(("tasks.org" :tag . "project")))
-  (org-refile-use-outline-path 'file)
 
   (org-hide-emphasis-markers t)
   (org-hide-leading-stars t)