diff options
author | Marek Paśnikowski <marek@marekpasnikowski.pl> | 2024-08-14 04:36:57 +0200 |
---|---|---|
committer | Marek Paśnikowski <marek@marekpasnikowski.pl> | 2024-08-15 19:00:22 +0200 |
commit | f63ee1b9b3f43b0f29a9fd0c11c5975305e4cd9c (patch) | |
tree | 529e4178f5743561eb050fe31eb0b3db2a569290 /suweren | |
parent | 473a0d065df4399815d50eb486ff1b3fdd667a99 (diff) |
feat(roam): implement integration with org-agenda
Diffstat (limited to 'suweren')
-rw-r--r-- | suweren/home/emacs-roam.el | 78 |
1 files changed, 34 insertions, 44 deletions
diff --git a/suweren/home/emacs-roam.el b/suweren/home/emacs-roam.el index 8daf683..4e0673d 100644 --- a/suweren/home/emacs-roam.el +++ b/suweren/home/emacs-roam.el @@ -1,3 +1,30 @@ +(require 'org-roam) + +(defun org-roam-db-query-tasks () + (concat "The query constructor to receive a list of files with tasks.") + (org-roam-db-query [:select + :distinct [file] + :from nodes + :where (like todo "TODO") + :or (like todo "DONE")])) + +(defun org-roam-dailies-with-tasks () + (concat "List of distinct Org Roam files with tasks,\n" + "obtained with Roam’s SQLite database query.\n" + "\n" + "The application of append is necessary to unpack the query result.") + (apply 'append + (funcall #'org-roam-db-query-tasks))) + +(defvar org-roam-merged-agenda-files + (append org-agenda-files + (org-roam-dailies-with-tasks)) + (concat "List of Roam’s agenda files merged with agenda files set earlier.")) + +(defun org-roam-update-agenda-files (&rest _) + (concat "Refresh the list of agenda files before opening the agenda.") + (setq org-agenda-files (org-roam-dailies-with-tasks))) + (use-package org-roam :init (setq org-roam-v2-ack t) @@ -5,22 +32,12 @@ :config (require 'org-roam-dailies) (org-roam-db-autosync-mode) - - ;; :preface - - ;; :mode - - ;; :magic - - ;; :magic-fallback - - ;; :interpreter - - ;; :commands - - ;; :autoload - - ;; :hook + (advice-add 'org-agenda + :before + #'org-roam-update-agenda-files) + (advice-add 'org-todo-list + :before + #'org-roam-update-agenda-files) :bind (("C-c n f" . org-roam-node-find) @@ -34,28 +51,6 @@ :bind-keymap ("C-c n d" . org-roam-dailies-map) - ;; :bind-keymap* - - ;; :defer - - ;; :demand - - ;; :after - - ;; :if - - ;; :disabled - - ;; :defines - - ;; :functions - - ;; :load-path - - ;; :diminish - - ;; :delight - :custom (org-roam-directory "~/Dokumenty/Baza") (org-roam-dailies-directory "Dziennik/") @@ -64,9 +59,4 @@ "#+title: ${title}\n") :unnarrowed t))) - ;; :custom-face - - :ensure t - - ;; :pin - ) + :ensure t) |