aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-17 19:04:51 -0500
committerCraig Jennings <c@cjennings.net>2026-07-17 19:04:51 -0500
commit17ae3e2a30eba73898ca4b5758d2923ece6528db (patch)
tree33724a771c7dfc55d1e745341f548940f262174d /modules
parent65b23131a2014032ffc13a404025188d9fc9aabe (diff)
downloaddotemacs-17ae3e2a30eba73898ca4b5758d2923ece6528db.tar.gz
dotemacs-17ae3e2a30eba73898ca4b5758d2923ece6528db.zip
feat(org-agenda): raise file-cache TTL to 24h and bind S-<f8> force-refreshHEADmain
The agenda file-list cache held a 1h TTL, so once an hour the next agenda open re-walked projects-dir from scratch. That cache tracks only which files exist, never their contents, so task edits and completions are never staled by it. The only thing a long TTL delays is a new project's todo.org appearing. That's rare, so I raised it to 24h. For that case I bound cj/org-agenda-refresh-files (the manual force-rescan) to S-<f8>, the free slot in the F8 agenda family (<f8>, s-<f8>, C-<f8>, M-<f8>).
Diffstat (limited to 'modules')
-rw-r--r--modules/org-agenda-config.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/org-agenda-config.el b/modules/org-agenda-config.el
index 632184e5..3cff9d95 100644
--- a/modules/org-agenda-config.el
+++ b/modules/org-agenda-config.el
@@ -123,8 +123,15 @@ the file keeps precedence."
;; Cache agenda file list to avoid expensive directory scanning on every view.
;; The TTL+building cache lifecycle is provided by `cj-cache.el'.
-(defvar cj/--org-agenda-files-cache (cj/cache-make :ttl 3600)
- "Cache state for the agenda files list. See `cj-cache.el'.")
+(defvar cj/--org-agenda-files-cache (cj/cache-make :ttl 86400)
+ "Cache state for the agenda files list. See `cj-cache.el'.
+
+TTL is 24h. The cache holds only the file *list* (which files are agenda
+files), never their contents -- task edits and completions are re-read on
+every agenda build/redo regardless of cache age. The list only changes when
+a project directory with a todo.org is created or removed, which is rare, so a
+long TTL costs little; use `cj/org-agenda-refresh-files' (S-<f8>) to force a
+re-scan the moment a new project is added.")
;; ------------------------ Add Files To Org Agenda List -----------------------
;; Checks immediate subdirectories of DIRECTORY for todo.org files and adds
@@ -216,9 +223,13 @@ improves performance from several seconds to instant."
"Force rebuild of agenda files cache.
Use this after adding new projects or todo.org files.
-Bypasses cache and scans directories from scratch."
+Bypasses cache and scans directories from scratch.
+
+Bound to S-<f8>, the force-rebuild sibling of the F8 agenda family
+\(<f8> display, s-<f8> all files, C-<f8> single project, M-<f8> this buffer)."
(interactive)
(cj/build-org-agenda-list 'force-rebuild))
+(global-set-key (kbd "S-<f8>") #'cj/org-agenda-refresh-files)
(defun cj/todo-list-all-agenda-files ()
"Displays an \\='org-agenda\\=' todo list.