diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-26 18:29:27 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-26 18:29:27 -0500 |
| commit | eabd510c302b43b0b40ee7b92bf5830d345d058d (patch) | |
| tree | 31a73830e61e14850343a024558610088343bbd1 /scripts/coverage-summary.py | |
| parent | fe653a231b186393b02a2723985e61ce97baba1c (diff) | |
| download | emacs-wttrin-eabd510c302b43b0b40ee7b92bf5830d345d058d.tar.gz emacs-wttrin-eabd510c302b43b0b40ee7b92bf5830d345d058d.zip | |
refactor: extract wttrin--mode-line-stale-p helper
The staleness check `(> 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 `>` 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.
Diffstat (limited to 'scripts/coverage-summary.py')
0 files changed, 0 insertions, 0 deletions
