diff --git a/config.org b/config.org index 1095bc9..3edf285 100644 --- a/config.org +++ b/config.org @@ -3342,13 +3342,15 @@ Areas are stored as subnodes of the =Areas= file node, and likewise for goals. T #+begin_src emacs-lisp (defun ~/org-roam-get-linked-nodes (node tag) "Return the nodes that NODE links to that are tagged with TAG." + (unless (stringp node) + (setq node (org-roam-node-id node))) (let ((response (org-roam-db-query [:select :distinct [dest] :from links :inner-join tags :on (= dest node_id) :where (= source $s1) :and (= type "id") :and (= tag $s2)] - (org-roam-node-id node) tag))) + node tag))) (mapcar (lambda (id) (org-roam-populate (org-roam-node-create :id (car id)))) response))) @@ -3612,9 +3614,12 @@ By customizing ~org-super-agenda-groups~ via a let-binding in my custom agenda v (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)) - (node (org-super-agenda--when-with-marker-buffer marker - (org-roam-node-at-point))) - (links (~/org-roam-get-linked-nodes node tag))) + (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)))) (->> links (mapcar #'org-roam-node-title) (-interpose ", ")