aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-20 16:55:58 -0500
committerCraig Jennings <c@cjennings.net>2026-07-20 16:55:58 -0500
commit8a00b8809a9f9c79cb4354736c205c841f27fb25 (patch)
treea7761dceffca9b1cd0d9cb7ee880051c6c2efd6f /modules
parentda6ab4174ae8bb404b6740edd7ec437c20b822bd (diff)
downloaddotemacs-8a00b8809a9f9c79cb4354736c205c841f27fb25.tar.gz
dotemacs-8a00b8809a9f9c79cb4354736c205c841f27fb25.zip
feat(agenda): suspend auto-dim while the agenda frame is open
The refresh tick's selection swing marks the working window non-selected, and auto-dim's debounced dim lands after the tick, so the working frame visibly dimmed every five minutes. Spawn now turns auto-dim-other-buffers-mode off (remembering it was on) and closing the frame restores it. A spawn with auto-dim already off touches nothing. It also keeps the standing agenda fully lit instead of dimmed-when-unfocused.
Diffstat (limited to 'modules')
-rw-r--r--modules/org-agenda-frame.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/org-agenda-frame.el b/modules/org-agenda-frame.el
index 2604f979..d7fc3d4d 100644
--- a/modules/org-agenda-frame.el
+++ b/modules/org-agenda-frame.el
@@ -314,6 +314,29 @@ tick, killing the buffer would no longer delete the frame."
(defconst cj/--agenda-frame-timer-parameter 'cj/agenda-frame-timer
"Frame parameter holding the agenda frame's refresh timer (set in Phase 2).")
+(declare-function auto-dim-other-buffers-mode "auto-dim-other-buffers" (&optional arg))
+
+(defvar cj/--agenda-frame-dim-was-on nil
+ "Non-nil when the agenda frame's spawn turned `auto-dim-other-buffers-mode' off.
+The refresh tick's selection swing marks the working window non-selected,
+and auto-dim's debounced dim lands after the tick -- the working frame
+visibly dims every five minutes. Spawn suspends the mode and remembers it
+here; closing the frame restores it.")
+
+(defun cj/--agenda-frame-suspend-dim ()
+ "Turn auto-dim off for the agenda frame's lifetime, remembering it was on."
+ (when (and (bound-and-true-p auto-dim-other-buffers-mode)
+ (fboundp 'auto-dim-other-buffers-mode))
+ (setq cj/--agenda-frame-dim-was-on t)
+ (auto-dim-other-buffers-mode -1)))
+
+(defun cj/--agenda-frame-restore-dim ()
+ "Restore auto-dim if the agenda frame's spawn suspended it."
+ (when (and cj/--agenda-frame-dim-was-on
+ (fboundp 'auto-dim-other-buffers-mode))
+ (setq cj/--agenda-frame-dim-was-on nil)
+ (auto-dim-other-buffers-mode 1)))
+
(defvar cj/--agenda-frame-tearing-down nil
"Non-nil while the agenda frame is being torn down.
Breaks the `delete-frame' / `kill-buffer-hook' re-entrancy loop: deleting
@@ -343,6 +366,7 @@ kills the dedicated sticky buffer, so the next spawn regenerates fresh
rather than reusing stale sticky content. A non-agenda frame is ignored."
(when (cj/--agenda-frame-p frame)
(cj/--agenda-frame-cancel-timer frame)
+ (cj/--agenda-frame-restore-dim)
(let ((buffer (cj/--agenda-frame-sticky-buffer))
(cj/--agenda-frame-tearing-down t))
(when (buffer-live-p buffer)
@@ -414,6 +438,7 @@ Returns the new agenda frame on success."
(add-hook 'kill-buffer-hook
#'cj/--agenda-frame-on-kill-buffer nil t))))
(cj/--agenda-frame-start-timer frame)
+ (cj/--agenda-frame-suspend-dim)
frame)
(error
(when (frame-live-p frame)