aboutsummaryrefslogtreecommitdiff
path: root/wttrin-debug.el
Commit message (Collapse)AuthorAgeFilesLines
* refactor: rename debug-wttrin-* commands to wttrin-debug-* with obsolete aliasesCraig Jennings2026-05-051-9/+25
| | | | | | | | | | | | | | | | The four interactive commands in `wttrin-debug.el` used `debug-wttrin-` as their prefix instead of the package's `wttrin-debug-` prefix. package-lint flags this as a convention violation, and it makes M-x discovery slightly less consistent for users. Renamed: - `debug-wttrin-show-raw` -> `wttrin-debug-show-raw` - `debug-wttrin-enable` -> `wttrin-debug-enable` - `debug-wttrin-disable` -> `wttrin-debug-disable` - `debug-wttrin-mode-line` -> `wttrin-debug-mode-line` The old names stay available as `define-obsolete-function-alias` entries marked since 0.4.0, so anyone with a keybinding or `(call-interactively 'debug-wttrin-enable)` in their config keeps working. The byte-compiler will emit an obsolescence warning to nudge migration. Aliases will be removed in a future release. Internal caller `wttrin--debug-mode-line-info` now invokes the new name. Test files renamed to match (`test-debug-wttrin-*.el` -> `test-wttrin-debug-*.el`); inside each, ert-deftest names and function calls were updated. Added `tests/test-wttrin-debug-aliases.el` to verify each old name resolves via `indirect-function` to the new name and carries `byte-obsolete-info` with the expected target and "0.4.0" version.
* fix: drop if-let and personal-config reference in debug-wttrin-mode-lineCraig Jennings2026-05-051-9/+6
| | | | | | `if-let` requires Emacs 25.1, but the package declares (emacs "24.4") in Package-Requires. Replaced with `let` + `if` so the debug module loads on the stated minimum. Also dropped the `cj/modeline-major-mode` branch. That symbol is from my personal Emacs config, so the conditional was effectively dead code for anyone else and a confusing reference in a published package. The diagnostic now always shows the formatted mode-name, which is useful for everyone.
* feat: specific error messages for fetch failuresCraig Jennings2026-04-041-1/+1
| | | | | | | | | | | | | | 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.
* fix: clean byte-compilation warningsCraig Jennings2026-04-041-0/+1
| | | | | | | 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: improve source comments for senior developer audienceCraig Jennings2026-04-041-6/+5
| | | | | | | | | | 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-041-4/+6
| | | | | | 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.
* doc: update copyright years to 2026 and add missing author fieldCraig Jennings2026-04-041-1/+1
| | | | | Update copyright headers across all 37 .el files to include 2026. Add missing Author field to testutil-wttrin.el for consistency.
* fix: debug-wttrin-show-raw broken by async API changeCraig Jennings2026-04-041-13/+16
| | | | | | | 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.
* refactor: debug: route all debug output to debug log instead of MessagesCraig Jennings2025-11-081-3/+3
| | | | | | | | - 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-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* refactor: make debug functions public (single hyphen naming)Craig Jennings2025-11-081-2/+3
| | | | | | | | | | | | | | | | | | | | 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>
* feat: debug: add comprehensive debug logging and integration testsCraig Jennings2025-11-081-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* refactor:debug: Rename and enhance wttrin debug functionsCraig Jennings2025-11-041-0/+107
- Reorganized debugging utilities by renaming `debug-wttrin.el` to `wttrin-debug.el` and adding new functions. - The updated module now supports `debug-wttrin-mode-line` for detailed mode-line diagnostics and introduces customizable mode-line weather display with new configuration options. - Additionally, extended debugging capabilities ensure concise emoji-based weather info and tooltip data management, incorporated with auto-loaded conditional debug logic.