|
|
@ -1070,7 +1070,7 @@ org-roam-db-sync |
|
|
|
:init |
|
|
|
(setq org-roam-v2-ack t) |
|
|
|
|
|
|
|
(defun my--project-p () |
|
|
|
(defun my--roamtodo-p () |
|
|
|
"Return non-nil if current buffer has any todo entry. |
|
|
|
|
|
|
|
TODO entries marked as done are ignored, meaning this function |
|
|
@ -1084,17 +1084,17 @@ returns nil if current buffer contains only completed tasks." |
|
|
|
(lambda (h) |
|
|
|
(org-element-property :todo-type h))))) |
|
|
|
|
|
|
|
(defun my--project-update-tag () |
|
|
|
"Update PROJECT tag in the current buffer." |
|
|
|
(defun my--roamtodo-update-tag () |
|
|
|
"Update ROAMTODO tag in the current buffer." |
|
|
|
(when (and (not (active-minibuffer-window)) |
|
|
|
(my--buffer-roam-note-p)) |
|
|
|
(save-excursion |
|
|
|
(goto-char (point-min)) |
|
|
|
(let* ((tags (my--buffer-tags-get)) |
|
|
|
(original-tags tags)) |
|
|
|
(if (my--project-p) |
|
|
|
(setq tags (cons "project" tags)) |
|
|
|
(setq tags (remove "project" tags))) |
|
|
|
(if (my--roamtodo-p) |
|
|
|
(setq tags (cons "roamtodo" tags)) |
|
|
|
(setq tags (remove "roamtodo" tags))) |
|
|
|
|
|
|
|
;;cleanup duplicates |
|
|
|
(when (or (seq-difference tags original-tags) |
|
|
@ -1200,20 +1200,20 @@ If nil it defaults to `split-string-default-separators', normally |
|
|
|
(org-roam-node-list)))) |
|
|
|
|
|
|
|
(defun my/org-roam-refresh-agenda-list () |
|
|
|
"Add all org roam files with #+filetags: project" |
|
|
|
"Add all org roam files with #+filetags: roamtodo" |
|
|
|
(interactive) |
|
|
|
(my--org-agenda-files-set) |
|
|
|
(nconc org-agenda-files |
|
|
|
(my--org-roam-list-notes-by-tag "project")) |
|
|
|
(my--org-roam-list-notes-by-tag "roamtodo")) |
|
|
|
(setq org-agenda-files (delete-dups org-agenda-files))) |
|
|
|
|
|
|
|
(add-hook 'find-file-hook #'my--project-update-tag) |
|
|
|
(add-hook 'before-save-hook #'my--project-update-tag) |
|
|
|
(add-hook 'find-file-hook #'my--roamtodo-update-tag) |
|
|
|
(add-hook 'before-save-hook #'my--roamtodo-update-tag) |
|
|
|
|
|
|
|
(advice-add 'org-agenda :before #'my/org-roam-refresh-agenda-list) |
|
|
|
(advice-add 'org-todo-list :before #'my/org-roam-refresh-agenda-list) |
|
|
|
|
|
|
|
(add-to-list 'org-tags-exclude-from-inheritance "project") |
|
|
|
(add-to-list 'org-tags-exclude-from-inheritance "roamtodo") |
|
|
|
:config |
|
|
|
(require 'org-roam-dailies) ;; ensure the keymap is available |
|
|
|
(org-roam-db-autosync-mode) |
|
|
|