<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs-wttrin/tests/test-wttrin--mode-line-helpers.el, branch release/0.4.0</title>
<subtitle>Emacs frontend for Igor Chubin's wttr.in weather service
</subtitle>
<id>https://git.cjennings.net/emacs-wttrin/atom?h=release%2F0.4.0</id>
<link rel='self' href='https://git.cjennings.net/emacs-wttrin/atom?h=release%2F0.4.0'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/'/>
<updated>2026-06-24T03:04:46+00:00</updated>
<entry>
<title>feat: expose themeable faces for mode-line and buffer text</title>
<updated>2026-06-24T03:04:46+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-06-24T03:04:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=4d46eafaa087f5570ece9d2e5f5d2ba6bc0d824e'/>
<id>urn:sha1:4d46eafaa087f5570ece9d2e5f5d2ba6bc0d824e</id>
<content type='text'>
I added four customizable faces so themes and customize-face can restyle the text wttrin draws itself: wttrin-mode-line-stale (the dimmed stale mode-line emoji), wttrin-staleness-header (the "Last updated:" line), wttrin-instructions (the footer prose), and wttrin-key (the [a]/[g]/[q] chords).

The package exposed no faces before and hardcoded one color. The stale-emoji dimming used a literal "gray60". Now it inherits a face, so the color tracks the theme. I changed make-emoji-icon's second argument from a color string to a face symbol applied via :inherit.

wttrin-key inherits bold rather than help-key-binding, which is Emacs 28+ while the package supports 24.4.

The weather ASCII art stays colored by xterm-color's ANSI faces. Only the package's own text is newly faced.
</content>
</entry>
<entry>
<title>refactor: extract wttrin--mode-line-extract-emoji helper</title>
<updated>2026-04-26T23:32:02+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-04-26T23:32:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=38a6a0a745022ed7f0336f7deb121d75f589a916'/>
<id>urn:sha1:38a6a0a745022ed7f0336f7deb121d75f589a916</id>
<content type='text'>
The regex that pulls the emoji character out of a wttr.in mode-line response was inlined inside `wttrin--mode-line-update-display`, mixed in with the render logic. Six tests of the parser couldn't be written without invoking the whole render path.

The new pure helper takes the weather string, runs the regex, and returns either the first non-whitespace character after the colon or "?" as a placeholder. The format-explanation comment that used to sit above the inline code is gone now that the same explanation lives in the helper's docstring. There's no risk of comment and code drifting apart.

Six tests cover Normal (typical response, different emoji), Boundary (no whitespace after colon, multiple whitespace chars), and Error (no colon, empty string).
</content>
</entry>
<entry>
<title>refactor: extract wttrin--mode-line-stale-p helper</title>
<updated>2026-04-26T23:29:27+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-04-26T23:29:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=eabd510c302b43b0b40ee7b92bf5830d345d058d'/>
<id>urn:sha1:eabd510c302b43b0b40ee7b92bf5830d345d058d</id>
<content type='text'>
The staleness check `(&gt; age (* 2 wttrin-mode-line-refresh-interval))` lived in two places, `wttrin--mode-line-tooltip` and `wttrin--mode-line-update-display`, along with the four-line preamble that read the timestamp out of the cache cons and computed age. Centralizing the rule in a single helper means the threshold lives in one spot. That makes it easy to add a `wttrin-mode-line-staleness-threshold` defcustom later if the magic 2× ever needs to be tunable.

The helper takes a cache entry (or nil) and returns t/nil. Five new tests cover Normal (fresh, stale) and Boundary (just below the threshold, just past, nil entry). The boundary tests use 199s and 201s against a 100s refresh interval to lock the strict `&gt;` semantics with comfortable float-time margins.

In `wttrin--mode-line-update-display` the refactor also drops two locals (`timestamp` and `age`) that were no longer used after the helper call replaced the inline calculation. Behavior is unchanged at both call sites.
</content>
</entry>
<entry>
<title>test: regression lock for nil :foreground in --make-emoji-icon</title>
<updated>2026-04-26T22:59:59+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-04-26T22:59:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=8f3c770e062a9aefec17f6b5f4f0a5ed927ac603'/>
<id>urn:sha1:8f3c770e062a9aefec17f6b5f4f0a5ed927ac603</id>
<content type='text'>
When wttrin-mode-line-emoji-font is set and the cache is fresh, --make-emoji-icon was emitting a face plist of the form (:family ... :height 1.0 :foreground nil). Emacs validates faces on every redisplay, so a single fresh-cache state produced hundreds of "Invalid face attribute :foreground nil" warnings in *Messages*.

The new boundary test asserts the face plist omits :foreground entirely when the caller passes nil. The assertion uses plist-member, not plist-get. plist-get returns nil for both a missing key and a present key bound to nil. That's the exact distinction Emacs's redisplay validator cares about.
</content>
</entry>
<entry>
<title>doc: update copyright years to 2026 and add missing author field</title>
<updated>2026-04-04T17:51:32+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-04-04T17:51:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=622ae39ad1e2544980cff73af8a5d5b2a64dacc8'/>
<id>urn:sha1:622ae39ad1e2544980cff73af8a5d5b2a64dacc8</id>
<content type='text'>
Update copyright headers across all 37 .el files to include 2026.
Add missing Author field to testutil-wttrin.el for consistency.
</content>
</entry>
<entry>
<title>refactor: extract mode-line icon and string helpers</title>
<updated>2026-04-04T17:42:46+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-04-04T17:42:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=130bbc076b17f8a5a275bea00e5aa2a354baad49'/>
<id>urn:sha1:130bbc076b17f8a5a275bea00e5aa2a354baad49</id>
<content type='text'>
Add wttrin--make-emoji-icon and wttrin--set-mode-line-string to
eliminate three near-identical propertize blocks across
update-placeholder-error, set-placeholder, and update-display.

Reduces wttrin--mode-line-update-display from 40 lines to 25.
</content>
</entry>
</feed>
