diff options
author | Tom Willemse | 2021-11-16 21:38:33 -0800 |
---|---|---|
committer | Tom Willemse | 2021-11-16 21:38:33 -0800 |
commit | 9a7c7e0673c12319b91511efdca8943a76bb9480 (patch) | |
tree | 1251beee478cbba6018a6f2c78ef983d007a4538 /oni-org-roam.el | |
parent | ad7152a4d2d10e25c26fca355b72ce141414bfb2 (diff) | |
download | emacs-config-9a7c7e0673c12319b91511efdca8943a76bb9480.tar.gz emacs-config-9a7c7e0673c12319b91511efdca8943a76bb9480.zip |
[oni-org-roam] Add any files with tasks in them to org agenda files
Diffstat (limited to 'oni-org-roam.el')
-rw-r--r-- | oni-org-roam.el | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/oni-org-roam.el b/oni-org-roam.el index a53e422..68b6b22 100644 --- a/oni-org-roam.el +++ b/oni-org-roam.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2021.1028.195800 +;; Version: 2021.1116.213141 ;; Package-Requires: (oni-org org-roam) ;; This program is free software; you can redistribute it and/or modify @@ -30,11 +30,29 @@ ;;; Code: (require 'org-roam) +(require 'seq) (setq org-roam-completion-everywhere t) (setq org-roam-directory (expand-file-name "~/documents/exocortex/")) (mkdir org-roam-directory t) +;;; Taken from/inspired by +;;; https://magnus.therning.org/2021-07-23-keeping-todo-items-in-org-roam-v2.html +(defun oni-org-roam--todo-node-p (node) + "Predicate to check whether or not NODE is task." + (not (null (org-roam-node-todo node)))) + +(defun oni-org-roam--todo-files () + "Get a list of all the files in the org-roam database with tasks in them." + (let ((nodes (seq-filter #'oni-org-roam--todo-node-p (org-roam-node-list)))) + (seq-uniq (seq-map #'org-roam-node-file nodes)))) + +(defun oni-org-roam-update-todo-files (&rest _) + "Set ‘org-agenda-files’ to all roam files with a task in them." + (setq org-agenda-files (seq-uniq (append org-agenda-files (oni-org-roam--todo-files))))) + +(advice-add 'org-agenda :before #'oni-org-roam-update-todo-files) + ;;;###autoload (setq org-roam-v2-ack t) |