summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-14 07:18:11 -0500
committerCraig Jennings <c@cjennings.net>2026-05-14 07:18:11 -0500
commit96c232a06d23d6576632d6c945936473ee4486e6 (patch)
tree522eec2f0d0ec33b192509374022139ff55b42e5 /modules
parent1ac7e706abd1c3e4ecd5512e4bb80a78891ef9c5 (diff)
downloaddotemacs-96c232a06d23d6576632d6c945936473ee4486e6.tar.gz
dotemacs-96c232a06d23d6576632d6c945936473ee4486e6.zip
fix(org-roam-config): save journal buffer after copying DONE task
`cj/org-roam-copy-todo-to-today' tried to save the target journal buffer via `org-after-refile-insert-hook' bound to `#'save-buffer', but that value is the wrong shape (single function instead of a hook list), and the only other save mechanism -- the `:after' advice on `org-refile' that calls `org-save-all-org-buffers' -- doesn't attach until `:defer .5' elapses, so the very first DONE transition after startup leaves the journal unsaved. Drop the broken hook binding and save the target buffer explicitly after the refile call. New ERT test asserts `buffer-modified-p' on the journal buffer is nil after the function returns.
Diffstat (limited to 'modules')
-rw-r--r--modules/org-roam-config.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/org-roam-config.el b/modules/org-roam-config.el
index 3f011c9d..52c41127 100644
--- a/modules/org-roam-config.el
+++ b/modules/org-roam-config.el
@@ -170,7 +170,6 @@ created in that subdirectory of `org-roam-directory'."
:if-new (file+head+olp "%<%Y-%m-%d>.org"
"#+FILETAGS: Journal
#+TITLE: %<%Y-%m-%d>\n" ("Completed Tasks")))))
- (org-after-refile-insert-hook #'save-buffer)
today-file
pos)
(save-window-excursion
@@ -181,7 +180,11 @@ created in that subdirectory of `org-roam-directory'."
;; Only refile if the target file is different than the current file
(unless (equal (file-truename today-file)
(file-truename (buffer-file-name)))
- (org-refile nil nil (list "Completed Tasks" today-file nil pos)))))
+ (org-refile nil nil (list "Completed Tasks" today-file nil pos))
+ ;; Save explicitly so shutdown doesn't prompt about an unsaved journal buffer.
+ (when-let ((target-buffer (find-buffer-visiting today-file)))
+ (with-current-buffer target-buffer
+ (save-buffer))))))
;; ------------------------ Org-Branch To Org-Roam-Node ------------------------