diff --git a/config.org b/config.org index 2335cf4..76d3734 100644 --- a/config.org +++ b/config.org @@ -3555,11 +3555,16 @@ Areas are typically stored as subnodes of the =Areas= file node, and likewise fo (setq node (org-roam-node-id node))) (let ((response (org-roam-db-query [:select :distinct [dest] :from links + :inner-join nodes :on (= dest id) :inner-join tags :on (= dest node_id) - :where (= source $s1) - :and (= type "id") - :and (= tag $s2)] - node tag))) + :where + (and (= links:source $s1) + (= links:type "id") + (or (= tags:tag $s2) + (like nodes:properties + (escape $r3 ?\\))))] + node tag + (format "%%(\"TASK\\_TYPE\" . \"%s\")%%" tag)))) (mapcar (lambda (id) (org-roam-populate (org-roam-node-create :id (car id)))) response))) @@ -3781,6 +3786,8 @@ A full week-long agenda is usually too cluttered for me to read, so I'll narrow org-deadline-warning-days 7 + org-agenda-tags-todo-honor-ignore-options t + org-agenda-sorting-strategy '((agenda time-up habit-down timestamp-up priority-down category-up) (todo urgency-down category-up) @@ -3830,17 +3837,40 @@ The Org agenda is a very nice feature, but by default it doesn't really provide By customizing ~org-super-agenda-groups~ via a let-binding in my custom agenda view, I can set up a sophisticated multi-category agenda system. #+begin_src emacs-lisp +(defun ~/org-agenda-section-names (tag elem) + (while (and elem (not (org-element-property :ID elem))) + (setq elem (org-element-parent elem))) + (when elem + (let (names self) + (when-let* ((links (~/org-roam-get-linked-nodes + (org-element-property :ID elem) + tag))) + (setq names (--map (append (org-roam-node-olp it) + (list (or (cdr-safe (assoc-string "TASK_NAME" + (org-roam-node-properties it) t)) + (org-roam-node-title it)))) links))) + (setq self + (and (or (assoc-string tag (org-get-tags elem) t) + (string= (org-element-property :TASK_TYPE elem) tag)) + (list (or (org-element-property :TASK_NAME elem) + (org-element-property :title elem) + (org-roam-node-title + (org-roam-node-from-id + (org-element-property :ID elem))))))) + (if-let* ((par (org-element-parent elem)) + (nms (~/org-agenda-section-names tag par))) + (append names (butlast nms) (list (append (-last-item nms) self))) + (append names (and self (list self))))))) + (defun ~/org-agenda-section-by-link (prefix tag item) "Org super-agenda function to categorize agenda entries by linked node with TAG." (when-let* ((marker (org-super-agenda--get-marker item)) - (nodes (org-super-agenda--when-with-marker-buffer marker - (--keep (org-element-property :ID it) - (org-element-lineage (org-element-context) nil t)))) - (-compare-fn (lambda (a b) - (equal (org-roam-node-id a) (org-roam-node-id b)))) - (links (-distinct (--mapcat (~/org-roam-get-linked-nodes it tag) nodes)))) + (current (org-super-agenda--when-with-marker-buffer marker + (and (org-roam-file-p) (org-element-context)))) + (links (~/org-agenda-section-names tag current))) (->> links - (mapcar #'org-roam-node-title) + (--map (-interpose " > " it)) + (--map (apply #'concat it)) (-interpose ", ") (apply #'concat prefix)))) @@ -3848,18 +3878,21 @@ By customizing ~org-super-agenda-groups~ via a let-binding in my custom agenda v "`org-super-agenda' groups for TODO entries of agenda.") (after! org - (setq ~/org-todo-groups + (setq org-super-agenda-properties-inherit nil + ~/org-todo-groups '((:name "Next/In Progress" :todo ("NEXT" "STRT" "WAIT" "HOLD")) + (:discard (:todo "PROJ")) (:name "Important" :priority "A" :order 1) + (:name "Unimportant" + :priority "C" + :order 20) (:name "Goals" :tag "goal" + :property ("TASK_NAME" "goal") :order 8) - (:name "Assignments" - :tag "assign" - :order 2) (:auto-map (lambda (item) (~/org-agenda-section-by-link "Goal: " "goal" item)) @@ -3873,12 +3906,8 @@ By customizing ~org-super-agenda-groups~ via a let-binding in my custom agenda v org-agenda-custom-commands '(("o" "Overview" ((agenda "") - (alltodo "" ((org-super-agenda-groups - (-insert-at 1 '(:discard - (:date t - :deadline t - :scheduled t)) - ~/org-todo-groups)))))) + (alltodo "" ((org-super-agenda-groups ~/org-todo-groups) + (org-agenda-todo-ignore-with-date t))))) ("g" "Grouped list of TODO entries" alltodo "" ((org-super-agenda-groups ~/org-todo-groups)))))) #+end_src