aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-24 16:48:45 -0500
committerCraig Jennings <c@cjennings.net>2026-07-24 16:48:45 -0500
commit01e1793831ee2a80a20e266ac3b0b950b71df240 (patch)
tree0afacf5c58cc943d007189eac8204560a2af1e91 /modules
parent6a88b2618835937fa4a508f55e2454ac16d1f408 (diff)
downloaddotemacs-01e1793831ee2a80a20e266ac3b0b950b71df240.tar.gz
dotemacs-01e1793831ee2a80a20e266ac3b0b950b71df240.zip
fix(agenda-frame): keep the allowlist when org-agenda loads first
- The read-only shadow walk keeps a key only when the frame map binds it commandp. - It ran from with-eval-after-load partway up the file. - The day/week/redo handlers are defined further down. - With org-agenda already loaded, the walk fired before those defuns existed. - So it read them as non-commands and denied d/w/g/r — the keys the allowlist grants. - That is the normal startup order and every module reload. - Moved the walk to the end of the file, after all the handlers are defined. - A subprocess test loads org-agenda first and pins d/w/g/r surviving, t denied. - Retitled the t-test to assert the deny outcome, not the pre-walk unbound state.
Diffstat (limited to 'modules')
-rw-r--r--modules/org-agenda-frame.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/org-agenda-frame.el b/modules/org-agenda-frame.el
index 8fbcb390..f0de99ce 100644
--- a/modules/org-agenda-frame.el
+++ b/modules/org-agenda-frame.el
@@ -359,8 +359,14 @@ re-running rebinds the same denials. Runs from `with-eval-after-load' once
#'cj/--agenda-frame-denied-readonly))))))))
source)))
-(with-eval-after-load 'org-agenda
- (cj/--agenda-frame-shadow-mutations))
+;; The shadow walk is installed at the END of this file, not here: it reads
+;; `commandp' on each allowlisted binding to decide whether to keep it, and the
+;; view/redo handlers (day-view, week-view, safe-redo) are defined further down.
+;; If org-agenda is already loaded when this file loads (the normal startup order,
+;; and every reload), `with-eval-after-load' fires immediately -- so the walk must
+;; not run until those defuns exist, or it reads them as undefined, fails the
+;; commandp guard, and denies the very keys the allowlist grants. See the bottom
+;; of the file.
(defun cj/--agenda-frame-maybe-enable-mode ()
"Re-enable `cj/agenda-frame-mode' after an agenda build in the agenda frame.
@@ -831,5 +837,11 @@ force-refresh idea in the F8 family."
;; The public gesture appears only now that the feature is complete and live.
(cj/--agenda-frame-install-keys)
+;; Install the read-only shadow now that every allowlist handler above is
+;; defined, so the walk's `commandp' guard recognizes them and preserves the
+;; allowlist regardless of whether org-agenda loaded before or after this file.
+(with-eval-after-load 'org-agenda
+ (cj/--agenda-frame-shadow-mutations))
+
(provide 'org-agenda-frame)
;;; org-agenda-frame.el ends here