tweak(org): revamp agenda view

This commit is contained in:
Kiana Sheibani 2026-02-04 16:41:00 -05:00
parent 5397e486b3
commit d13dd8dc29
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -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))) (setq node (org-roam-node-id node)))
(let ((response (org-roam-db-query [:select :distinct [dest] (let ((response (org-roam-db-query [:select :distinct [dest]
:from links :from links
:inner-join nodes :on (= dest id)
:inner-join tags :on (= dest node_id) :inner-join tags :on (= dest node_id)
:where (= source $s1) :where
:and (= type "id") (and (= links:source $s1)
:and (= tag $s2)] (= links:type "id")
node tag))) (or (= tags:tag $s2)
(like nodes:properties
(escape $r3 ?\\))))]
node tag
(format "%%(\"TASK\\_TYPE\" . \"%s\")%%" tag))))
(mapcar (lambda (id) (org-roam-populate (mapcar (lambda (id) (org-roam-populate
(org-roam-node-create :id (car id)))) (org-roam-node-create :id (car id))))
response))) 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-deadline-warning-days 7
org-agenda-tags-todo-honor-ignore-options t
org-agenda-sorting-strategy org-agenda-sorting-strategy
'((agenda time-up habit-down timestamp-up priority-down category-up) '((agenda time-up habit-down timestamp-up priority-down category-up)
(todo urgency-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. 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 #+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) (defun ~/org-agenda-section-by-link (prefix tag item)
"Org super-agenda function to categorize agenda entries by linked node with TAG." "Org super-agenda function to categorize agenda entries by linked node with TAG."
(when-let* ((marker (org-super-agenda--get-marker item)) (when-let* ((marker (org-super-agenda--get-marker item))
(nodes (org-super-agenda--when-with-marker-buffer marker (current (org-super-agenda--when-with-marker-buffer marker
(--keep (org-element-property :ID it) (and (org-roam-file-p) (org-element-context))))
(org-element-lineage (org-element-context) nil t)))) (links (~/org-agenda-section-names tag current)))
(-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))))
(->> links (->> links
(mapcar #'org-roam-node-title) (--map (-interpose " > " it))
(--map (apply #'concat it))
(-interpose ", ") (-interpose ", ")
(apply #'concat prefix)))) (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.") "`org-super-agenda' groups for TODO entries of agenda.")
(after! org (after! org
(setq ~/org-todo-groups (setq org-super-agenda-properties-inherit nil
~/org-todo-groups
'((:name "Next/In Progress" '((:name "Next/In Progress"
:todo ("NEXT" "STRT" "WAIT" "HOLD")) :todo ("NEXT" "STRT" "WAIT" "HOLD"))
(:discard (:todo "PROJ"))
(:name "Important" (:name "Important"
:priority "A" :priority "A"
:order 1) :order 1)
(:name "Unimportant"
:priority "C"
:order 20)
(:name "Goals" (:name "Goals"
:tag "goal" :tag "goal"
:property ("TASK_NAME" "goal")
:order 8) :order 8)
(:name "Assignments"
:tag "assign"
:order 2)
(:auto-map (lambda (item) (:auto-map (lambda (item)
(~/org-agenda-section-by-link (~/org-agenda-section-by-link
"Goal: " "goal" item)) "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 org-agenda-custom-commands
'(("o" "Overview" '(("o" "Overview"
((agenda "") ((agenda "")
(alltodo "" ((org-super-agenda-groups (alltodo "" ((org-super-agenda-groups ~/org-todo-groups)
(-insert-at 1 '(:discard (org-agenda-todo-ignore-with-date t)))))
(:date t
:deadline t
:scheduled t))
~/org-todo-groups))))))
("g" "Grouped list of TODO entries" ("g" "Grouped list of TODO entries"
alltodo "" ((org-super-agenda-groups ~/org-todo-groups)))))) alltodo "" ((org-super-agenda-groups ~/org-todo-groups))))))
#+end_src #+end_src