From 445a0be315f3d6fff585f1558262fb5dacd10d12 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 31 Jul 2026 11:04:42 -0500 Subject: feat(agenda): refresh the render cache on a timer, without the daemon The surface reading this has to stay correct while Emacs is down, and emacsclient is exactly the thing that cannot. So the writer is a batch Emacs and a user timer runs it every five minutes. - scripts/agenda-render-cache writes the cache from a batch Emacs. It resolves the agenda file list through the config's own resolver rather than restating it, so adding a calendar source stays a one-place change. - The timer uses OnCalendar so Persistent actually applies. On a monotonic schedule it is silently ignored, and a machine that slept would come back to a stale file with nothing to trigger a catch-up. - The window is now three days, yesterday through tomorrow. A consumer drawing a rolling window centred on now has nothing to draw for the part of its span outside today, which late in the evening is half the surface. The keyword list moved to user-constants, where a batch Emacs can reach it without this config's package dependencies. Without it org did not recognise DOING or VERIFY, so it stopped parsing those headlines as tasks at all: the keyword and priority cookie stayed glued to the front of every title and each row reported no keyword and not-done. The file parsed cleanly and was wrong, which is the failure worth guarding. The bats tests run against a fixture and this checkout, not the machine's real agenda and installed config. Asserting over live data let the same suite pass on a day that happened to have no keyworded entries. --- systemd/agenda-render-cache.service | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 systemd/agenda-render-cache.service (limited to 'systemd/agenda-render-cache.service') diff --git a/systemd/agenda-render-cache.service b/systemd/agenda-render-cache.service new file mode 100644 index 00000000..0fe08533 --- /dev/null +++ b/systemd/agenda-render-cache.service @@ -0,0 +1,14 @@ +[Unit] +Description=Write the agenda render cache for external surfaces +# Deliberately no dependency on emacs.service or graphical-session.target. +# The whole point is that the cache stays current while Emacs is down, so the +# writer is a batch Emacs that needs neither the daemon nor a compositor. +Documentation=file:%h/.emacs.d/modules/agenda-query.el + +[Service] +Type=oneshot +ExecStart=%h/.emacs.d/scripts/agenda-render-cache +# One run is about a second of CPU. Cap it well above that so a wedged run is +# killed rather than left holding the timer. +TimeoutStartSec=120 +Nice=10 -- cgit v1.2.3