2021-03-26 04:20:04 +01:00
|
|
|
|
;;; oni-org-roam.el --- Configuration for org-roam -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
;; Copyright (C) 2021 Tom Willemse
|
|
|
|
|
|
|
|
|
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
|
|
|
|
;; Keywords: local
|
2021-11-23 09:40:28 +01:00
|
|
|
|
;; Version: 2021.1116.222944
|
2021-09-24 10:14:05 +02:00
|
|
|
|
;; Package-Requires: (oni-org org-roam)
|
2021-03-26 04:20:04 +01:00
|
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2021-07-20 10:15:47 +02:00
|
|
|
|
;; Configuration specific to ‘org-roam’. Add the following to your init file if
|
|
|
|
|
;; you want to use this configuration:
|
|
|
|
|
;;
|
|
|
|
|
;; (with-eval-after-load 'org-roam (require 'oni-org-roam))
|
2021-03-26 04:20:04 +01:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'org-roam)
|
2021-11-17 06:38:33 +01:00
|
|
|
|
(require 'seq)
|
2021-03-26 04:20:04 +01:00
|
|
|
|
|
2021-09-24 10:14:05 +02:00
|
|
|
|
(setq org-roam-completion-everywhere t)
|
|
|
|
|
(setq org-roam-directory (expand-file-name "~/documents/exocortex/"))
|
|
|
|
|
(mkdir org-roam-directory t)
|
2021-03-26 04:20:04 +01:00
|
|
|
|
|
2021-11-17 06:38:33 +01:00
|
|
|
|
;;; 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."
|
2021-11-23 09:40:28 +01:00
|
|
|
|
(let ((state (org-roam-node-todo node)))
|
|
|
|
|
(and (not (null state))
|
|
|
|
|
(not (string= state "FINISHED")))))
|
2021-11-17 06:38:33 +01:00
|
|
|
|
|
|
|
|
|
(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)
|
|
|
|
|
|
2021-09-24 10:14:05 +02:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(setq org-roam-v2-ack t)
|
2021-03-26 04:20:04 +01:00
|
|
|
|
|
2021-10-29 05:00:02 +02:00
|
|
|
|
(org-roam-db-autosync-mode)
|
|
|
|
|
|
2021-03-26 04:20:04 +01:00
|
|
|
|
(provide 'oni-org-roam)
|
|
|
|
|
;;; oni-org-roam.el ends here
|