[oni-org-roam] Add any files with tasks in them to org agenda files
This commit is contained in:
parent
ad7152a4d2
commit
9a7c7e0673
1 changed files with 19 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2021.1028.195800
|
;; Version: 2021.1116.213141
|
||||||
;; Package-Requires: (oni-org org-roam)
|
;; Package-Requires: (oni-org org-roam)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -30,11 +30,29 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'org-roam)
|
(require 'org-roam)
|
||||||
|
(require 'seq)
|
||||||
|
|
||||||
(setq org-roam-completion-everywhere t)
|
(setq org-roam-completion-everywhere t)
|
||||||
(setq org-roam-directory (expand-file-name "~/documents/exocortex/"))
|
(setq org-roam-directory (expand-file-name "~/documents/exocortex/"))
|
||||||
(mkdir org-roam-directory t)
|
(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
|
;;;###autoload
|
||||||
(setq org-roam-v2-ack t)
|
(setq org-roam-v2-ack t)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue