summaryrefslogtreecommitdiff
path: root/tests/test-wttrin--display-weather.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-04 19:21:34 -0600
committerCraig Jennings <c@cjennings.net>2025-11-04 19:21:34 -0600
commit7673e72ed4dc4af9c3db9a5962c4673bd1ce90e3 (patch)
tree555ad7fdfbcf852a37f142063cd18c88032a4499 /tests/test-wttrin--display-weather.el
parent629d09a69d4fbb75f0d36fb44d750c515873834d (diff)
fix(wttrin): Fix ANSI color rendering on fresh Emacs launch
Critical bug fix: On fresh Emacs launch, weather displayed with only double quotes colored blue, all other text white. Pressing 'g' to refresh brought colors back. Root cause: wttrin-mode (derived mode) calls kill-all-local-variables internally. The code was setting xterm-color--state buffer-local BEFORE calling wttrin-mode, so the state was immediately wiped out. On refresh, the mode was already active (no-op), so the state survived. Fix: Call wttrin-mode FIRST, then set buffer-local variables after. This ensures kill-all-local-variables runs before we set any state. Changes: - Reorder initialization in wttrin--display-weather (wttrin.el:277-285) - Add regression tests for mode initialization order (2 new tests) Test results: 65 tests, all passing
Diffstat (limited to 'tests/test-wttrin--display-weather.el')
-rw-r--r--tests/test-wttrin--display-weather.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test-wttrin--display-weather.el b/tests/test-wttrin--display-weather.el
index 364908f..4b2a90d 100644
--- a/tests/test-wttrin--display-weather.el
+++ b/tests/test-wttrin--display-weather.el
@@ -87,7 +87,7 @@ Weather report: Paris, France
;; Check that keybindings are set (they should be in the local map)
(should (keymapp (current-local-map)))
(should (commandp (lookup-key (current-local-map) "q")))
- (should (commandp (lookup-key (current-local-map) "r")))
+ (should (commandp (lookup-key (current-local-map) "a")))
(should (commandp (lookup-key (current-local-map) "g")))))
(test-wttrin--display-weather-teardown)))
@@ -103,8 +103,8 @@ Weather report: Paris, France
(forward-line -2)
;; Should contain help text
(should (search-forward "Press:" nil t))
- (should (search-forward "[g] to query another location" nil t))
- (should (search-forward "[r] to refresh" nil t))
+ (should (search-forward "[a] for another location" nil t))
+ (should (search-forward "[g] to refresh" nil t))
(should (search-forward "[q] to quit" nil t))))
(test-wttrin--display-weather-teardown)))