| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
Enable truncate-lines in wttrin-mode so the fixed-width weather art
clips at the window edge instead of wrapping and breaking the layout.
|
| |
|
|
|
|
| |
wttr.in returns "Weather report: new orleans, la" regardless of
query casing. Replace the lowercase location on the header line
with the user's original string after rendering.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add HTTP status code checking (wttrin--extract-http-status) and pass
error descriptions through the callback chain so users see "Location
not found (HTTP 404)" or "Network error — check your connection"
instead of the generic "Perhaps the location was misspelled?" for
every failure.
Also fix pre-existing bug where the condition-case error handler in
extract-response-body killed an unrelated buffer after unwind-protect
already cleaned up.
330 tests (was 307), all passing.
|
| |
|
|
|
|
| |
Dynamic mode-line tooltip, staleness dimming, location casing fix,
debug guard refactor, expanded test suite (307 tests), and multiple
bug fixes since 0.2.3.
|
| |
|
|
|
|
|
| |
Move define-obsolete-variable-alias before its referent defcustom to
fix "alias should be declared before its referent" warning. Add
defvar for wttrin--force-refresh in wttrin-debug.el so the
byte-compiler knows the dynamic variable is intentional.
|
| |
|
|
|
|
| |
wttr.in updates its data roughly every 10 minutes (max-age=600).
Add a note to both refresh interval defcustoms so users know not
to poll more aggressively than the service can provide.
|
| |
|
|
|
|
|
| |
Rewrite sections that read like generated text: replace clinical
descriptions with conversational language matching the existing
voice, cut padding phrases ("proactively", "several aspects",
"what's happening"), and trim the debug section down to essentials.
|
| |
|
|
|
|
|
|
|
|
| |
Add: staleness display in weather buffer, stale mode-line dimming,
wttrin-clear-cache command, wttrin-mode-line-startup-delay option,
minimum Emacs version (24.4).
Fix: font height default was listed as 110 (actually 130), debug
output example didn't match current log format, manual debug setup
section was a duplicate of the use-package section.
|
| |
|
|
|
|
|
|
|
|
| |
Remove obvious comments that restate what the code does ("save debug
data if enabled", "temporarily allow editing", "align buffer to top").
Add comments explaining non-obvious decisions: why risky-local-variable
is needed, why user-agent is curl, what wttr.in format codes mean,
what the emoji extraction regex matches, and why after-init-time
matters. Fix stale docstrings that no longer match the no-op stub
pattern.
|
| |
|
|
|
|
| |
A debug command should show what the API currently returns, not a
cached copy. Bind wttrin--force-refresh to t so the fetch always
bypasses the cache.
|
| |
|
|
|
|
|
|
|
|
| |
The emoji face (dimmed/normal) was frozen at the last update-display
call, but the tooltip computes staleness dynamically. Between
refreshes, data could cross the stale threshold — tooltip says "Stale"
while the emoji is still normal.
Track the rendered staleness state. When the tooltip detects a
transition, trigger a re-render so the emoji dimming matches.
|
| |
|
|
|
|
|
| |
float-time was captured in the outer let* before the async fetch.
The callback used this stale value, making cache entries appear
slightly older than they are. Move the float-time call into the
callback so the timestamp reflects when the data actually arrived.
|
| |
|
|
|
| |
string-match modifies global match data as a side effect. A predicate
should not do this. Use string-match-p instead.
|
| |
|
|
|
|
|
|
|
|
|
| |
The tooltip was a static string computed at fetch time. Since every
successful fetch sets the cache timestamp to now and immediately
renders the tooltip, it was always "just now".
Extract wttrin--mode-line-tooltip as a named function that computes
age from the cache at call time. Set help-echo to this function so
Emacs invokes it on hover, producing an accurate age like
"Updated 12 minutes ago".
|
| |
|
|
|
|
|
| |
wttr.in's %l format returns locations in lowercase (e.g.,
"new orleans, la") regardless of the query casing. Replace the API's
location prefix with the user's original wttrin-favorite-location
string at cache time so tooltips display what the user expects.
|
| |
|
|
|
| |
Update copyright headers across all 37 .el files to include 2026.
Add missing Author field to testutil-wttrin.el for consistency.
|
| |
|
|
|
|
| |
The ;;;###autoload(put ...) form on the same line was never processed
by the autoload generator. The actual (put ...) call on the next line
handles this at load time. Remove the dead cookie.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
Define wttrin--debug-log and wttrin--debug-mode-line-info as no-op
stubs in wttrin.el that get overridden when wttrin-debug.el loads.
Remove all 24 (when (featurep 'wttrin-debug) ...) guard blocks.
Reduces cyclomatic complexity across 12 functions and eliminates
visual clutter without changing behavior.
|
| |
|
|
|
| |
Never called anywhere. The 'q' keybinding in wttrin-mode inherits
quit-window from special-mode, making this function redundant.
|
| |
|
|
|
|
|
| |
debug-wttrin-show-raw called wttrin--get-cached-or-fetch with 1 arg,
but the function now requires 2 (location + callback) since the async
refactor. Rewrote to use the callback pattern. Also handles nil
response gracefully.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add 11 new test files covering wttrin--save-debug-data,
wttrin--buffer-cache-refresh, wttrin--mode-line-stop,
wttrin--mode-line-start, wttrin-query, wttrin-requery-force,
wttrin-mode-line-click, wttrin-mode-line-force-refresh,
wttrin-fetch-raw-string, wttrin-clear-cache, and wttrin-requery.
Fix bug in wttrin--save-debug-data where nil raw-string caused
(insert nil) crash — reachable when debug mode is on and fetch fails.
Refactor wttrin-requery: extract wttrin--requery-location so the
core kill-buffer-and-query logic is testable without mocking
completing-read.
267 tests total (was 217), all passing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace TTL-based cache invalidation with proactive scheduled refresh.
Both mode-line and buffer systems now follow: timer refreshes cache,
display reads from cache, staleness indicated when data is old.
Phase 1 - Mode-line cache formalization + staleness display:
- Replace wttrin--mode-line-tooltip-data with wttrin--mode-line-cache
as (timestamp . data) cons cell matching buffer cache pattern
- Add wttrin--format-age helper for human-readable age strings
- Rewrite wttrin--mode-line-update-display to take no arguments,
read from cache, compute staleness (age > 2x refresh interval),
dim emoji gray when stale, show staleness info in tooltip
- Rewrite wttrin--mode-line-fetch-weather to write cache on success,
show stale display on failure with cache, error placeholder without
- Add wttrin--mode-line-update-placeholder-error for first-launch failure
Phase 2 - Remove TTL, add proactive buffer refresh:
- Rename wttrin-cache-ttl to wttrin-refresh-interval (default 3600s)
with define-obsolete-variable-alias for backward compatibility
- Change wttrin-mode-line-refresh-interval default from 900 to 3600
- Remove TTL check from wttrin--get-cached-or-fetch; serve cached data
regardless of age, background timer keeps it fresh
- Add buffer refresh timer (wttrin--buffer-cache-refresh)
Phase 3 - Buffer staleness display:
- Add wttrin--format-staleness-header for buffer age display
- Insert staleness line in wttrin--display-weather before instructions
Phase 4 - Cleanup:
- Remove all references to wttrin--mode-line-tooltip-data
- Update README.org cache settings and mode-line documentation
- Update tests for new API (198 tests across 21 files, all passing)
|
| |
|
|
|
|
| |
Display ⏳ with "Fetching weather..." tooltip immediately when
mode-line mode starts, so the user sees wttrin is active before
the first API response arrives.
|
| |
|
|
|
|
| |
Reject empty or malformed wttr.in responses to prevent blank icon and
tooltip. Fix tooltip lambda to treat empty string as falsy. Add debug
logging for nil-location and invalid-response paths.
|
| |
|
|
| |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Expand testutil-wttrin.el with shared fixtures and macros
(testutil-wttrin-with-clean-weather-buffer,
testutil-wttrin-mock-http-response, sample ANSI/weather constants)
- Consolidate cache tests: port unique tests from cleanup-cache-constants
and cleanup-cache-refactored into cleanup-cache-if-needed, delete
obsolete files
- Extract startup-delay tests into dedicated file
- Add setup/teardown and (require 'testutil-wttrin) to all test files
- Rename all 160 tests to follow
test-<module>-<category>-<scenario>-<expected-result> convention
- Rename integration test file and add detailed docstrings
- Update Makefile glob to discover new integration test naming pattern
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
| |
wttrin-favorite-location
Renamed variable to remove 'mode-line' prefix, making it usable for
future location-based features beyond mode-line display. Updated all
references in code, tests, and documentation. All 187 tests passing.
|
| |
|
|
|
|
| |
Fixed two checkdoc issues in recently added functions:
- Added double space after period in wttrin--extract-response-body
- Quoted url-retrieve symbol in wttrin--handle-fetch-callback
|
| |
|
|
|
|
| |
Prevents mode-line from making network requests during Emacs startup.
Network activity now deferred to after-init-hook when Emacs is not yet
fully initialized, improving startup performance.
|
| |
|
|
|
|
| |
Extracted wttrin--extract-response-body and wttrin--handle-fetch-callback
from wttrin--fetch-url to improve testability and separation of concerns.
Added comprehensive unit tests for both new functions.
|
| |
|
|
|
| |
Replace add-to-list approach with use-package's :load-path keyword
for cleaner, more idiomatic configuration.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove outdated xterm-color configuration requirements following the
lazy-load refactor. Users no longer need :after, :preface, or separate
use-package declarations for xterm-color.
Changes:
- Simplified local development setup (no xterm-color use-package needed)
- Removed :preface xterm-color :demand t from debug examples
- Updated manual install to just require wttrin (not xterm-color first)
- Clarified that xterm-color loads automatically when needed
- Noted MELPA auto-installs xterm-color as dependency
The configuration is now simpler and matches the lazy-loading behavior.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move xterm-color from top-level require to on-demand loading within
functions that actually use it. This simplifies user configuration
by eliminating the need for separate xterm-color use-package declarations.
Changes:
- Replace top-level (require 'xterm-color) with declare-function
- Add (require 'xterm-color) in wttrin--process-weather-content
- Add (require 'xterm-color) in wttrin--display-weather
- Update smoke test to check loadability vs. feature presence
Benefits:
- Simpler use-package config (no :after xterm-color needed)
- xterm-color still auto-installed via Package-Requires on MELPA
- Load time optimization (loads only when displaying weather)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Smoke Test Target:
- Add SMOKE_TESTS variable matching test-*-smoke.el pattern
- Create test-smoke target that runs before unit/integration tests
- Implement fail-fast behavior: smoke test failures stop further execution
- Update test execution order: smoke → unit → integration (testing pyramid)
- Fix INTEGRATION_TESTS pattern to match test-*-integration-*.el
- Update help text with correct test counts for each category
Symbol Standardization:
- Replace Unicode symbols with bracketed ASCII for better portability
- ✓ → [✓] (success/completion)
- ✗ → [✗] (error/failure)
- ⚠ → [!] (warning/attention)
- Apply to all targets: test, validate, compile, lint, install-deps, clean
- No color codes (were never present)
- Benefits: works in all terminals, easier to grep/parse
Test organization now:
- 1 smoke test file (package sanity checks - runs first)
- 16 unit test files (function behavior)
- 1 integration test file (component interactions)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
conventions
- Create test-wttrin-smoke.el with 15 smoke tests for package sanity checks
- Delete test-wttrin-integration.el (misnamed, contained smoke tests not integration tests)
- Remove redundant functional tests already covered in dedicated unit test files
- URL building: covered by test-wttrin--build-url.el (12 tests)
- Cache operations: covered by test-wttrin--get-cached-or-fetch.el (11 tests)
- Mode-line display: covered by test-wttrin--mode-line-map.el
Smoke tests verify:
- Package loads without errors
- Dependencies available (xterm-color, url)
- Public API exists and is interactive
- Configuration variables defined
- Keymaps exist and are valid
- Package metadata correct (version, autoload cookies)
Final test organization: 18 files, 162 tests (15 smoke + 142 unit + 5 integration)
|
| |
|
|
|
|
|
|
| |
- Remove (message ...) call from wttrin--debug-log function
- Replace 9 debug message calls in wttrin.el with wttrin--debug-log
- All debug output now goes to debug log for review with M-x wttrin-debug-show-log
- User-facing error messages preserved (network errors, processing errors)
- Updated docstring to clarify messages are stored for later review
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Cache Refactorings:
- Extract wttrin--get-cache-entries-by-age helper function
- Refactor wttrin--cleanup-cache-if-needed to use helper
- Improves code clarity with descriptive variable names
- Makes cache logic independently testable
- Add 15 new tests (8 for helper, 7 for refactored cleanup)
Input Validation:
- Add range validation to wttrin-mode-line-startup-delay (1-10 seconds)
- Prevents invalid values (0, negative, or excessive delays)
- Uses restricted-sexp type for enforcement
Test Fixes:
- Fix debug function naming (use public wttrin-debug-clear-log)
- Ensure wttrin-debug module loads in test setup
- Make mocks synchronous for batch mode compatibility
- Update test expectations to match actual debug messages
- Fix startup delay test to check defcustom default value
Linter/Compiler Fixes:
- Add declare-function for wttrin--debug-log
- Add defvar/declare-function in wttrin-debug.el
- Fix docstring line lengths (wrap at 80 chars)
- Fix checkdoc warnings (imperative mood, escaping)
- Disambiguate temporary-file-directory reference
All 165 tests passing. Clean byte-compile, package-lint, checkdoc.
|
| |
|
|
|
|
|
|
|
|
|
| |
Remove add-to-list from manual installation example and ensure
:ensure t is included. The :preface section with xterm-color
and wttrin-debug settings works the same whether installing
from MELPA or a local path.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Update README to show wttrin-debug being set in :preface section
of use-package declarations. This is cleaner and follows standard
use-package conventions better than requiring users to set
variables outside the declaration.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Renamed private debug functions to public API:
- wttrin--debug-show-log → wttrin-debug-show-log
- wttrin--debug-clear-log → wttrin-debug-clear-log
Added ;;;###autoload to both functions for proper autoloading.
Updated all references:
- README.org (2 occurrences)
- tests/README-DEBUG-TESTS.md (4 occurrences)
- tests/test-wttrin-integration-with-debug.el (8 occurrences)
These are user-facing commands that should be discoverable via M-x,
so they follow the public API naming convention (single hyphen).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added two new sections to README:
1. "Local Development / Manual Install" section:
- Shows correct pattern for loading xterm-color in :preface
- Explains :demand t ensures immediate loading
- Provides both use-package and manual install examples
- Emphasizes xterm-color must load BEFORE wttrin
2. "Debugging and Troubleshooting" section:
- Documents wttrin-debug must be set BEFORE loading wttrin
- Shows correct vs incorrect examples (with ❌ for wrong way)
- Explains how to view debug log with M-x wttrin--debug-show-log
- Includes example debug output
- Lists common issues and solutions
Key rules documented:
- xterm-color in :preface with :demand t for local development
- wttrin-debug set before (require 'wttrin) or use-package declaration
- Debug checked at load time, can't be set in :custom section
These are common pitfalls that prevented wttrin from loading correctly.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enhanced wttrin-debug.el:
- Added wttrin--debug-log() function for timestamped logging
- Added wttrin--debug-clear-log() to clear log
- Added wttrin--debug-show-log() to display log in buffer
- Debug log structure: list of (timestamp . message) pairs
Added debug logging to key functions in wttrin.el:
- wttrin--fetch-url: Logs start, success (bytes), and errors
- wttrin--mode-line-fetch-weather: Logs start, URL, data received
- wttrin--mode-line-update-display: Logs display update, emoji extraction
Created comprehensive integration tests:
- test-wttrin-integration-with-debug.el (5 tests, 3 passing)
- Tests fetch, mode-line display, error handling with debug logging
- Includes mocked network calls to avoid external dependencies
- Example debug output shows complete flow:
[wttrin-debug 11:51:46.490] mode-line-fetch: Starting fetch for Berkeley, CA
[wttrin-debug 11:51:46.490] mode-line-fetch: Received data = "Berkeley, CA: ☀️ +62°F Clear"
[wttrin-debug 11:51:46.490] mode-line-display: Extracted emoji = "☀", font = Noto Color Emoji
[wttrin-debug 11:51:46.490] mode-line-display: Complete. mode-line-string set = YES
Added test fixtures:
- tests/fixtures/test-init.el: Minimal config with debug enabled
- tests/README-DEBUG-TESTS.md: Documentation for using debug features
Usage:
(setq wttrin-debug t) ; Before loading wttrin
(require 'wttrin)
M-x wttrin--debug-show-log ; View all logged events
This provides complete visibility into wttrin's operation for troubleshooting.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add 18 integration tests to verify wttrin loads correctly:
Package Loading:
- Package loads without errors
- Feature is properly provided
- Dependencies available (xterm-color, url)
Function Availability:
- Main commands defined and interactive (wttrin, wttrin-clear-cache)
- Modes defined (wttrin-mode, wttrin-mode-line-mode)
Configuration:
- All defcustom variables exist
- Internal variables defined
- Keymaps exist and valid
Package Metadata:
- Version information present
- Autoload cookies in place
Smoke Tests:
- URL building works
- Cache operations function
- Mode-line display works
All 18 tests passing - package loads correctly when dependencies available.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace inline keymap construction with shared wttrin--mode-line-map defvar.
Before (line 474-479): Keymap recreated on every mode-line update
- (let ((map (make-sparse-keymap))) ...)
- Allocates new keymap object each time
- 6 lines of repetitive code
After (line 183-190 + line 483): Shared keymap created once
- (defvar wttrin--mode-line-map ...)
- Reference: 'local-map wttrin--mode-line-map
- Single allocation, no repeated construction
Added comprehensive tests (8 tests, all passing):
- Keymap existence and structure verification
- Keybinding tests (mouse-1, mouse-3, no mouse-2)
- Integration test verifying mode-line uses shared map
Benefits:
- More efficient (no allocation on every update)
- Clearer code structure
- Easier to add new keybindings
- Self-documenting with inline documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace two magic numbers with self-documenting constants:
1. Cache cleanup percentage (line 395):
- Before: (dotimes (_ (/ (length entries) 5))
- After: (dotimes (_ (floor (* (length entries) wttrin--cache-cleanup-percentage)))
- Added: wttrin--cache-cleanup-percentage constant (0.20 = 20%)
- Explains WHY 20%: provides buffer before next cleanup cycle
2. Mode-line startup delay (line 508):
- Before: (run-at-time 3 nil #'wttrin--mode-line-fetch-weather)
- After: (run-at-time wttrin-mode-line-startup-delay nil ...)
- Added: wttrin-mode-line-startup-delay defcustom (default 3 seconds)
- Now user-customizable, range 1-5 seconds recommended
Added comprehensive tests (8 tests, all passing):
- 5 tests verify cache cleanup behavior (removes ~20% of oldest entries)
- 3 tests verify startup delay defcustom exists and has reasonable value
Benefits:
- Self-documenting code (explains WHY these values exist)
- Startup delay is now user-customizable
- Easier for future maintainers to understand rationale
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Add 34 new tests covering the three helper functions extracted from
wttrin--display-weather:
- test-wttrin--validate-weather-data.el (12 tests)
- test-wttrin--process-weather-content.el (12 tests)
- test-wttrin--add-buffer-instructions.el (10 tests)
Tests follow Normal/Boundary/Error pattern and all pass.
Co-Authored-By: Claude <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- Extracted wttrin--validate-weather-data for data validation
- Extracted wttrin--process-weather-content for ANSI filtering and cleanup
- Extracted wttrin--add-buffer-instructions for UI instructions
- Refactored main function to use helpers (improved readability)
Benefits:
- Each function has single, clear purpose
- Easier to test individual components
- Better code organization and maintainability
- Main function reduced from ~40 lines to ~20 lines
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- Enhanced test-wttrin-additional-url-params with clearer test organization
- Enhanced test-wttrin--build-url with comprehensive boundary and error cases
- Added tests for Unicode, special characters, GPS coordinates, domains
- Fixed domain name test to check for URL-encoded @ symbol (%40)
- Enhanced test-wttrin--make-cache-key with extensive boundary tests
- Critical test: same location with different units produces different keys
- Added tests for special chars, Unicode, empty strings, pipe characters
All 29 tests for these three pure functions now pass (6 + 12 + 11)
Combined with wttrin--fetch-url tests: 38 total tests passing
|