diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-09 17:17:54 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-09 17:17:54 -0500 |
| commit | 61824dc9f26ba8323a49e63b0bc96a418cbe383a (patch) | |
| tree | 04e3bcc8e1a10a2ce73006e05f10110aa7376d29 /tests/test-auto-dim-config.el | |
| parent | b9c966b400874aeb4dee365b94734d3f0fbac989 (diff) | |
| download | dotemacs-61824dc9f26ba8323a49e63b0bc96a418cbe383a.tar.gz dotemacs-61824dc9f26ba8323a49e63b0bc96a418cbe383a.zip | |
fix(auto-dim): flat-dim the remaining org structure faces
The earlier fix covered only the eleven faces the task named, so the document header (#+TITLE:, #+AUTHOR:, #+ARCHIVE: and their values), inline markup, drawers, planning lines, tables, and the fold indicator all stayed lit in unfocused windows.
I enumerated the faces a fontified org buffer actually uses, rather than adding only the ones I could see were wrong. Fifteen were missing.
org-todo and org-priority stay out of the flat-dim set. They're keyword class, and dimming them would erase the status colour the org-faces-*-dim variants preserve. Two tests pin that exclusion, and a third pins org-hide to the -hide face so folded text stays hidden.
Diffstat (limited to 'tests/test-auto-dim-config.el')
| -rw-r--r-- | tests/test-auto-dim-config.el | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/tests/test-auto-dim-config.el b/tests/test-auto-dim-config.el index b69b0d1f..2cc0afb3 100644 --- a/tests/test-auto-dim-config.el +++ b/tests/test-auto-dim-config.el @@ -38,12 +38,28 @@ (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-link org-tag + ;; Document header: #+TITLE:, #+AUTHOR:, #+ARCHIVE: and their values. + org-document-title org-document-info org-document-info-keyword + org-meta-line + ;; Inline markup and blocks. + org-code org-verbatim org-block-begin-line org-block-end-line + ;; Drawers, properties, planning lines. + org-drawer org-special-keyword org-property-value org-date + ;; Tables and the fold indicator. + org-table org-table-row org-ellipsis)) "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.") +These carry structure, not status: nothing about them needs to stay +readable in a window the user is not looking at. Excluded on purpose are +`org-todo' and `org-priority' (keyword class -- see the -dim variant test +below) and `org-hide' (needs `auto-dim-other-buffers-hide' so folded text +stays hidden).") + +(defconst test-auto-dim--keyword-dim-variants + '((org-faces-todo . org-faces-todo-dim) + (org-faces-doing . org-faces-doing-dim) + (org-faces-priority-a . org-faces-priority-a-dim)) + "Sample of keyword faces that must keep dedicated -dim variants.") (ert-deftest test-auto-dim-config-org-structure-faces-flat-dim () "Normal: org heading, link, and tag faces remap to the flat dim face." @@ -61,13 +77,31 @@ 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))) + (dolist (pair test-auto-dim--keyword-dim-variants) (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-todo-priority-faces-not-flat-dimmed () + "Boundary: `org-todo' and `org-priority' are never flat-dimmed. +They are keyword class. Dimming them would erase the status colour the +-dim variants exist to preserve, so they stay out of the flat-dim set." + (skip-unless (file-directory-p test-auto-dim--fork)) + (require 'auto-dim-config) + (dolist (face '(org-todo org-priority)) + (should-not (memq face test-auto-dim--flat-dimmed-org-faces)) + (let ((entry (assq face auto-dim-other-buffers-affected-faces))) + (should-not (and entry (eq 'auto-dim-other-buffers (car (cdr entry)))))))) + +(ert-deftest test-auto-dim-config-org-hide-uses-hide-face () + "Boundary: `org-hide' remaps to the -hide face, not the flat dim face. +Flat-dimming it would give folded text a visible foreground." + (skip-unless (file-directory-p test-auto-dim--fork)) + (require 'auto-dim-config) + (let ((entry (assq 'org-hide auto-dim-other-buffers-affected-faces))) + (should entry) + (should (eq 'auto-dim-other-buffers-hide (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)) |
