Optimize Org agenda section code
The tag filter can be done directly in Emacs. This probably doesn't speed things up all that much, but it does look better.
This commit is contained in:
parent
ed2b1796ab
commit
8a8845da85
21
config.org
21
config.org
|
@ -2858,16 +2858,17 @@ Areas are stored as subnodes of the =Areas= file node, and likewise for goals. T
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun ~/org-roam-get-linked-nodes (node tag)
|
(defun ~/org-roam-get-linked-nodes (node tag)
|
||||||
"Return the nodes that NODE links to that are tagged with TAG."
|
"Return the nodes that NODE links to that are tagged with TAG."
|
||||||
(let* ((response (org-roam-db-query [:select :distinct [dest]
|
(let ((response (org-roam-db-query [:select :distinct [dest]
|
||||||
:from links
|
:from links
|
||||||
:where (= source $s1)
|
:inner-join tags :on (= dest node_id)
|
||||||
:and (= type "id")
|
:where (= source $s1)
|
||||||
:group :by dest]
|
:and (= type "id")
|
||||||
(org-roam-node-id node)))
|
:and (= tag $s2)
|
||||||
(ids (mapcar #'car response)))
|
:group :by dest]
|
||||||
(--keep (let ((node (org-roam-node-from-id it)))
|
(org-roam-node-id node) tag)))
|
||||||
(when (-contains? (org-roam-node-tags node) tag)
|
(mapcar (lambda (id) (org-roam-populate
|
||||||
node)) ids)))
|
(org-roam-node-create :id (car id))))
|
||||||
|
response)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Roam Buffer
|
*** Roam Buffer
|
||||||
|
|
Loading…
Reference in a new issue