From c7e551f28a6cb410ed05c3a8f867c70672927b94 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 20 Jul 2026 16:22:49 -0500 Subject: fix(agenda): repair the refresh tick, tighten the gutter, allow point motion Every 5-minute refresh failed. The F command's general settings carried (org-agenda-sticky t), and those settings are baked into the buffer's series-redo-cmd and re-applied on each redo. With the buffer already existing, org-agenda-use-sticky-p turned true mid-redo and org-agenda-prepare threw 'exit ("use r to refresh") to a catch that doesn't exist inside org-agenda-redo. I removed sticky from the command settings (the spawn wrapper still binds it, which is where the buffer gets its name) and kept the redo path free of sticky, since org-agenda-redo handles the in-place rebuild itself. Verified with a real tick against a live frame: rebuild succeeds, the failure banner clears, the latch resets. The wide gutter between the source column and the item was the global agenda prefix format's 25-char category pad. The F view now sets its own format with a 10-char pad. C-a hit the deny catch-all. I allowlisted read-only point motion (C-a, C-e, C-f, C-b) and isearch (C-s, C-r). --- modules/org-agenda-frame.el | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/org-agenda-frame.el b/modules/org-agenda-frame.el index efd74115..fd911a97 100644 --- a/modules/org-agenda-frame.el +++ b/modules/org-agenda-frame.el @@ -108,9 +108,18 @@ a non-nil global default can't open a second window at build time." ((org-agenda-span 7) (org-agenda-start-day "0d") (org-agenda-start-on-weekday nil) - (org-agenda-start-with-follow-mode nil)))) - ((org-agenda-sticky t) - (org-agenda-window-setup 'current-window)))) + (org-agenda-start-with-follow-mode nil) + ;; Narrow category column: the global agenda format pads the + ;; category to 25 chars, leaving a wide blank gutter between + ;; the source name (todo:, dcal:) and the item. + (org-agenda-prefix-format " %i %-10:c%?-12t% s")))) + ;; No `org-agenda-sticky' here, deliberately: these settings are baked + ;; into the buffer's series-redo-cmd and re-applied by every redo, and a + ;; sticky t mid-redo makes `org-agenda-use-sticky-p' true while the + ;; buffer exists -- `org-agenda-prepare' then throws \\='exit ("use `r' + ;; to refresh") with no catch, failing every refresh tick. Stickiness + ;; is bound in the spawn wrapper instead, where it names the buffer. + ((org-agenda-window-setup 'current-window)))) (defun cj/--agenda-frame-register-command () "Register the agenda-frame view in `org-agenda-custom-commands'. @@ -220,6 +229,13 @@ The default binding for every key not on the allowlist." (define-key map (kbd "M-v") #'scroll-down-command) (define-key map (kbd "M-<") #'beginning-of-buffer) (define-key map (kbd "M->") #'end-of-buffer) + ;; Read-only point motion and search within the agenda. + (define-key map (kbd "C-a") #'move-beginning-of-line) + (define-key map (kbd "C-e") #'move-end-of-line) + (define-key map (kbd "C-f") #'forward-char) + (define-key map (kbd "C-b") #'backward-char) + (define-key map (kbd "C-s") #'isearch-forward) + (define-key map (kbd "C-r") #'isearch-backward) (define-key map (kbd "C-g") #'keyboard-quit) ;; (b) Engage / open — routed to the working frame, never the agenda frame. ;; Bind the GUI function-key events ([return]/[tab]) as well as the ASCII @@ -609,7 +625,14 @@ Either way the frame is never blank, unrestricted, or non-retryable." (snapshot (cj/--agenda-frame-snapshot buffer window))) (unwind-protect (condition-case nil - (let ((inhibit-message t)) + ;; Never bind sticky here: `org-agenda-redo' handles the + ;; in-place rebuild itself (binds sticky nil, redirects the + ;; buffer name). A sticky t reaching `org-agenda-prepare' + ;; mid-redo makes it throw \\='exit with no catch, failing + ;; every tick. current-window is bound as a belt so a rule + ;; can't split the frame during the rebuild. + (let ((inhibit-message t) + (org-agenda-window-setup 'current-window)) (org-agenda-redo) (cj/--agenda-frame-remove-overlay buffer) (cj/--agenda-frame-restore-point old-marker old-line) -- cgit v1.2.3