diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-09 16:49:11 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-09 16:49:11 -0500 |
| commit | b9c966b400874aeb4dee365b94734d3f0fbac989 (patch) | |
| tree | 5632a27c53800edccaf8a6ab10be988f798d7185 /tests/test-auto-dim-config.el | |
| parent | 0bb5e68cf3edfbb9389318246a3af99645ceabce (diff) | |
| download | dotemacs-b9c966b400874aeb4dee365b94734d3f0fbac989.tar.gz dotemacs-b9c966b400874aeb4dee365b94734d3f0fbac989.zip | |
fix(auto-dim): dim org headings, links, and tags in unfocused windows
org-level-1..8, org-link, and org-tag were missing from auto-dim-other-buffers-affected-faces, so they stayed lit while the rest of an unfocused window faded.
I flat-dimmed them rather than giving them -dim variants. The active theme gives all eight heading levels one foreground and no height or weight, so no level-by-colour signal is lost. The fork remaps relatively, so org-link keeps its underline and the stars and org-indent keep conveying depth. That premise is theme-dependent, and the comment says so.
A second test pins the keyword and priority faces to their -dim variants, so a later change can't quietly flat-dim those too.
Diffstat (limited to 'tests/test-auto-dim-config.el')
| -rw-r--r-- | tests/test-auto-dim-config.el | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test-auto-dim-config.el b/tests/test-auto-dim-config.el index 2686b88f..b69b0d1f 100644 --- a/tests/test-auto-dim-config.el +++ b/tests/test-auto-dim-config.el @@ -35,6 +35,39 @@ (when (fboundp 'auto-dim-other-buffers-mode) (auto-dim-other-buffers-mode -1)))) +(defconst test-auto-dim--flat-dimmed-org-faces + (append (mapcar (lambda (n) (intern (format "org-level-%d" n))) + (number-sequence 1 8)) + '(org-link org-tag)) + "Org faces that must flat-dim to the `auto-dim-other-buffers' face. +These carry no signal that a dedicated -dim variant would preserve: the +theme gives `org-level-1' through `org-level-8' one shared foreground and +no height or weight, `org-link' keeps its underline through a relative +remap, and `org-tag' keeps its surrounding colons.") + +(ert-deftest test-auto-dim-config-org-structure-faces-flat-dim () + "Normal: org heading, link, and tag faces remap to the flat dim face." + (skip-unless (file-directory-p test-auto-dim--fork)) + (require 'auto-dim-config) + (dolist (face test-auto-dim--flat-dimmed-org-faces) + (let ((entry (assq face auto-dim-other-buffers-affected-faces))) + (should entry) + (should (eq 'auto-dim-other-buffers (car (cdr entry)))) + (should (null (cdr (cdr entry))))))) + +(ert-deftest test-auto-dim-config-keyword-faces-keep-dim-variants () + "Boundary: org TODO-keyword faces keep dedicated -dim variants, not flat dim. +Keyword status is scanned across unfocused windows, so it earns a variant; +heading colour does not. Guards the flat-dim change from over-reaching." + (skip-unless (file-directory-p test-auto-dim--fork)) + (require 'auto-dim-config) + (dolist (pair '((org-faces-todo . org-faces-todo-dim) + (org-faces-doing . org-faces-doing-dim) + (org-faces-priority-a . org-faces-priority-a-dim))) + (let ((entry (assq (car pair) auto-dim-other-buffers-affected-faces))) + (should entry) + (should (eq (cdr pair) (car (cdr entry))))))) + (ert-deftest test-auto-dim-config-never-dim-dashboard-exempts-dashboard () "Normal: the *dashboard* buffer is exempt from dimming." (skip-unless (file-directory-p test-auto-dim--fork)) |
