summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* bump version to 0.3.0v0.3.0Craig Jennings2026-04-041-1/+1
| | | | | | 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.
* fix: clean byte-compilation warningsCraig Jennings2026-04-042-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.
* doc: note wttr.in update frequency in refresh interval docstringsCraig Jennings2026-04-041-2/+5
| | | | | | 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.
* doc: tighten README prose, remove AI writing patternsCraig Jennings2026-04-041-30/+15
| | | | | | | 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.
* doc: update README with missing features, fix stale contentCraig Jennings2026-04-041-15/+20
| | | | | | | | | | 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.
* doc: improve source comments for senior developer audienceCraig Jennings2026-04-042-29/+26
| | | | | | | | | | 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.
* fix: debug-wttrin-show-raw serves cached data instead of fetchingCraig Jennings2026-04-042-4/+23
| | | | | | 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.
* fix: emoji dimming can disagree with tooltip stalenessCraig Jennings2026-04-042-0/+36
| | | | | | | | | | 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.
* fix: cache timestamp reflects request time, not response timeCraig Jennings2026-04-042-3/+30
| | | | | | | 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.
* fix: validate-weather-data corrupts match dataCraig Jennings2026-04-042-1/+12
| | | | | string-match modifies global match data as a side effect. A predicate should not do this. Use string-match-p instead.
* fix: mode-line tooltip always shows "Updated just now"Craig Jennings2026-04-043-16/+204
| | | | | | | | | | | 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".
* fix: mode-line tooltip shows location in lowercaseCraig Jennings2026-04-042-1/+95
| | | | | | | 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.
* doc: update copyright years to 2026 and add missing author fieldCraig Jennings2026-04-0437-37/+38
| | | | | Update copyright headers across all 37 .el files to include 2026. Add missing Author field to testutil-wttrin.el for consistency.
* refactor: remove malformed autoload cookie for risky-local-variableCraig Jennings2026-04-041-1/+0
| | | | | | 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.
* refactor: extract mode-line icon and string helpersCraig Jennings2026-04-042-40/+160
| | | | | | | | 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.
* refactor: replace debug guard blocks with self-guarding no-op stubsCraig Jennings2026-04-041-62/+43
| | | | | | | | | 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.
* refactor: remove dead wttrin-exit functionCraig Jennings2026-04-041-5/+0
| | | | | Never called anywhere. The 'q' keybinding in wttrin-mode inherits quit-window from special-mode, making this function redundant.
* fix: debug-wttrin-show-raw broken by async API changeCraig Jennings2026-04-042-13/+120
| | | | | | | 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.
* test: add 50 tests for untested functions; fix nil crash in save-debug-dataCraig Jennings2026-04-0412-4/+1172
| | | | | | | | | | | | | | | | | 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.
* feat: unified cache and staleness handling for mode-line and bufferCraig Jennings2026-02-219-247/+479
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* feat: mode-line: show hourglass placeholder before first weather fetchCraig Jennings2026-02-202-0/+86
| | | | | | Display ⏳ with "Fetching weather..." tooltip immediately when mode-line mode starts, so the user sees wttrin is active before the first API response arrives.
* fix: mode-line: validate API response before updating displayCraig Jennings2026-02-202-4/+244
| | | | | | 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.
* doc: tests: update README-DEBUG-TESTS.org with renamed integration test fileCraig Jennings2026-02-171-0/+83
| | | | Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: tests: standardize naming, consolidate files, and expand testutilCraig Jennings2026-02-1723-897/+798
| | | | | | | | | | | | | | | | | - 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>
* refactor: core: rename wttrin-mode-line-favorite-location to ↵Craig Jennings2025-11-137-26/+27
| | | | | | | | 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.
* doc: core: fix checkdoc warnings in docstringsCraig Jennings2025-11-131-2/+2
| | | | | | 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
* feat: mode-line: defer network requests until after Emacs initializationCraig Jennings2025-11-131-1/+7
| | | | | | 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.
* refactor: fetch: extract response parsing into separate testable functionsCraig Jennings2025-11-134-54/+420
| | | | | | 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.
* doc: readme: use :load-path instead of add-to-list for use-packageCraig Jennings2025-11-081-3/+1
| | | | | Replace add-to-list approach with use-package's :load-path keyword for cleaner, more idiomatic configuration.
* doc: readme: simplify xterm-color configuration instructionsCraig Jennings2025-11-081-20/+13
| | | | | | | | | | | | | | | 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.
* refactor: core: lazy-load xterm-color dependencyCraig Jennings2025-11-082-3/+7
| | | | | | | | | | | | | | | | | 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)
* feat: makefile: add smoke test target and standardize output symbolsCraig Jennings2025-11-081-24/+45
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* test: smoke: reorganize test suite following quality-engineer.org naming ↵Craig Jennings2025-11-082-148/+121
| | | | | | | | | | | | | | | | | | | | | 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)
* refactor: debug: route all debug output to debug log instead of MessagesCraig Jennings2025-11-082-16/+15
| | | | | | | | - 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
* refactor: Improve cache cleanup clarity and add input validationCraig Jennings2025-11-086-56/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* docs: Simplify manual installation debug exampleCraig Jennings2025-11-081-2/+1
| | | | | | | | | | | 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>
* docs: Use :preface for wttrin-debug instead of external setqCraig Jennings2025-11-081-9/+8
| | | | | | | | | | | 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>
* refactor: make debug functions public (single hyphen naming)Craig Jennings2025-11-084-9/+10
| | | | | | | | | | | | | | | | | | | | 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>
* docs: add critical setup rules for local development and debuggingCraig Jennings2025-11-081-5/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* feat: debug: add comprehensive debug logging and integration testsCraig Jennings2025-11-085-11/+417
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* test: add comprehensive integration tests for package loadingCraig Jennings2025-11-081-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* refactor: mode-line: extract inline keymap to shared defvarCraig Jennings2025-11-082-6/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* refactor: config: replace magic numbers with named constantsCraig Jennings2025-11-082-5/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* test: render: add comprehensive ERT tests for display helper functionsCraig Jennings2025-11-083-0/+298
| | | | | | | | | | | | 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>
* refactor: render: split wttrin--display-weather into focused helper functionsCraig Jennings2025-11-081-12/+25
| | | | | | | | | | | | | - 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
* test: core: enhance ERT tests for pure functionsCraig Jennings2025-11-083-146/+172
| | | | | | | | | | | | | - 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
* refactor: fetch: extract duplicate URL fetching logic into wttrin--fetch-urlCraig Jennings2025-11-082-35/+224
| | | | | | | | | | | - Created wttrin--fetch-url helper to eliminate code duplication - Refactored wttrin-fetch-raw-string to use helper (27 lines -> 3 lines) - Refactored wttrin--mode-line-fetch-weather to use helper (~30 lines -> ~10 lines) - Added comprehensive ERT test suite with 9 tests covering normal, boundary, and error cases - All tests passing This refactoring provides a single point of truth for async URL fetching, making the code more maintainable and reducing duplication by ~40 lines.
* fix(wttrin): Fix ANSI color rendering on fresh Emacs launchCraig Jennings2025-11-046-19/+936
| | | | | | | | | | | | | | | | | | | | 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
* docs: Update vc-install instructions for Wttrin in READMECraig Jennings2025-11-041-3/+2
| | | | | Simplify Emacs Lisp configuration using `:vc` keyword for Wttrin installation and update.
* feat:docs: Add mode-line weather display featureCraig Jennings2025-11-041-0/+50
| | | | | | | Introduce mode-line weather display in README.org. Add setup, features, and customization instructions, enabling users to show weather updates directly in the mode-line with automatic refresh and interactive options.