| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Add an "Auto-Fit and Centering" subsection to the README font settings: the
weather block centers automatically, and wttrin-auto-fit-font (with the
min/max floor and cap) opts into sizing the font to the window.
|
| |
|
|
|
| |
Five labels used Markdown **bold**, which renders literally in the Org
README. Switched them to Org *bold*.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Centering and auto-fit share one resize hook (wttrin--update-layout on
window-configuration-change-hook).
Centering is always on. The block centers via the window's left margin,
measured in pixels from the buffer font so it stays exact under a font-height
remap. It centers against the available width including the current margin, so
the margin shrinking the body can't make the value oscillate.
Auto-fit is opt-in (wttrin-auto-fit-font, off by default). When on, the font is
sized so the whole buffer fits top to bottom (down to the row past the footer's
last menu item) without the widest line truncating, clamped to
wttrin-font-height-min and -max.
The pixel-exact measurement needs window-font-width and window-font-height, so
the minimum is now Emacs 25.1.
|
| | |
|
| |
|
|
|
|
|
|
| |
A saved location carries a display name distinct from its query target ("Mom's House" maps to coordinates or an address), stored in a savehist-persisted wttrin-saved-locations alist. The name shows everywhere the place appears (picker, buffer header, mode-line tooltip) while wttr.in is still queried by the target.
Management commands wttrin-save-location, wttrin-rename-location, and wttrin-remove-location edit the directory, with refuse-on-collision rename and a favorite-fallback warning on remove. In the weather buffer, s/r/x reach those commands and d names a detected location before promoting it to the default. The footer is two columns: a "This view" column (another, refresh, quit) and a "Saved locations" column (save, make default, rename, remove). The buffer anchors to the top so the forecast isn't scrolled out of view in a short window.
The mode-line follows favorite changes immediately rather than waiting for the next scheduled fetch, and its hover tooltip shows the saved name instead of the raw query. History holds named entries only: raw coordinate detections and saved names stay out of it.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
These build on the current-location picker with the rest of the geolocation work.
wttrin-geolocation-command runs a command that prints {lat,lng} (and optionally an address) and queries wttr.in by those coordinates. IP geolocation only finds the network's exit point, which is wrong on a VPN or hotspot. A command that scans nearby WiFi resolves to street level. It runs asynchronously, falls back to the IP provider when unset or failing, and assumes nothing about the OS, so it's inert until set. When the command returns an address, wttrin shows it on a "Location:" line, so the resolved place is readable even though the fetch is by raw coordinates.
wttrin-use-current-location is a labeled command that sets the favorite to auto-detect, so the bare t value never has to be typed into init by hand.
wttrin-geolocation-enabled (default t) turns every geolocation surface off for anyone who wants that: the picker entry, the auto-detect favorite, and the command.
examples/geolocation/ ships two reference adapters for the command: google-geolocate.py (Google API, key via the environment or ~/.authinfo.gpg) and apple-wps.py (Apple's keyless WiFi positioning, which uses an undocumented endpoint, so read its caveat). Both are Python 3 standard library and scan via nmcli, with notes on adapting the scan to other systems.
|
| |
|
|
|
|
|
|
|
|
| |
Geolocation used to live in a separate command, so getting weather for where you are meant knowing a second command existed. I added a "Current location (detect)" entry pinned to the top of the M-x wttrin picker. Selecting it detects your location and shows its weather. If the guess is wrong (VPN, hotspot) the detected city is visible in the header, so you reopen the picker and type one. Press d to keep the detected city as the default.
The entry is pinned first through a completion table whose display-sort-function holds against completion frameworks that re-sort, and it never enters location history or the cache as a place.
A new wttrin-geolocation-enabled (default t) turns every geolocation surface off for users who want that: the picker entry, the auto-detect favorite, and the command. It stays on by default.
The older wttrin-set-location-from-geolocation command is now obsolete in favor of the picker. Its customize-save-variable persistence advice is replaced by savehist, which already carries the favorite across sessions.
|
| |
|
|
|
|
|
|
|
|
| |
I bound d in the weather buffer to wttrin-make-default, which sets wttrin-favorite-location to the location on screen so it drives the mode-line and future sessions. The footer advertises "[d] to make default".
Persistence rides savehist, not the Emacs custom-variable mechanism: wttrin--savehist-register registers wttrin-favorite-location alongside the search history, at load and on savehist-save-hook. Enable savehist-mode and the favorite survives restarts.
Promoting a location drops it from the search history, the way wttrin-default-locations entries are kept out of history. The favorite shows in the picker instead: wttrin--completion-candidates prepends it when it's a string and not already a default, so it appears exactly once.
The setter only assigns the variable and trims history. It doesn't register with savehist itself, because savehist-additional-variables is unbound until savehist loads, so a direct add-to-list would error for users without savehist. Registration stays on the load and save-hook path.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
A one-time add-to-list put wttrin--location-history into savehist-additional-variables when savehist loaded. Any user who later setqs that list, a common config pattern for curating which histories persist, replaces it and drops the entry. The search history then silently never saves.
Re-assert the registration on savehist-save-hook, which runs at the top of every savehist-save. The variable is now in the list whenever a save happens, regardless of init order or a clobbering setq. Restore was never affected, since savehist reloads the value from explicit setq forms in its file.
The README persistence note now reflects this: the variable stays registered even if you set savehist-additional-variables yourself.
|
| |
|
|
|
|
|
|
|
|
| |
Successful searches are now remembered and offered as completion candidates the next time you run wttrin, listed after the configured defaults. Only successful fetches are saved, so typos and not-found locations never enter the history. A location already in wttrin-default-locations isn't duplicated into it. The list is capped at wttrin-location-history-max (default 20), oldest entries falling off first.
Persistence uses savehist: the history variable is registered with savehist-additional-variables, so enabling savehist-mode carries it across restarts with no custom file I/O. Without savehist it lasts the session.
Two commands manage the list: wttrin-remove-location-history drops one entry, wttrin-clear-location-history clears all.
I don't pass the history variable as the completing-read history argument, because the minibuffer would then save every typed string, including failed lookups. It stays a curated candidate source, updated only on success. I trim with butlast rather than seq-take to keep the Emacs 24.4 baseline.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Completes the three-mode configuration the favorite-location feature was always meant to have:
- nil — disabled (default; unchanged)
- a string — explicit location (unchanged)
- t — auto-detect via IP geolocation (NEW)
When the user sets `wttrin-favorite-location` to t, wttrin runs the geolocation lookup once on first use and caches the result for the session. Subsequent reads return the cached string. The lookup happens in the background via the existing `wttrin-geolocation-detect`, so Emacs startup is never blocked.
I added two private state vars (`wttrin--resolved-favorite-location`, `wttrin--favorite-location-pending`) and a resolver `wttrin--resolve-favorite-location` that maps the three modes onto a returned string or nil. When t is set and the cache is empty, the resolver kicks off the lookup and returns nil for that call — the next consumer tick after the callback completes gets the cached string. The pending flag prevents duplicate concurrent lookups when several consumers ask during the resolution window.
Five consumer call sites now go through the resolver instead of reading `wttrin-favorite-location` directly: `wttrin--mode-line-fetch-weather`, `wttrin-mode-line-click`, `wttrin-mode-line-force-refresh`, `wttrin--buffer-cache-refresh`, and `wttrin--mode-line-start`. Two display sites (the placeholder and error tooltips) use a new `wttrin--favorite-location-display-name` helper that returns "current location" while a t-mode lookup is pending, instead of showing the literal `t` to the user.
Tests cover the resolver across all three modes, including the pending state, the duplicate-suppression behavior, and detection-failure retry. Existing consumer tests stay green because the resolver returns the bound string unchanged when the variable is a string. One care: the test file requires wttrin-geolocation up front so cl-letf mocks of `wttrin-geolocation-detect` aren't undone by the resolver's lazy require — without that, the first run hit ipapi.co for real.
README documents the new mode under "Setting the Favorite Location from IP Geolocation".
|
| |
|
|
|
|
|
|
|
|
|
|
| |
wttr.in accepts single-character flags appended to the URL that control what the report looks like — no Follow line (F), narrow output (n), quiet mode (q), forecast horizon (0/1/2), console-glyph mode (d), and so on. Until now wttrin always used the same default report shape with no way to opt into these.
Added a `wttrin-display-options` defcustom that takes a string of concatenated flags, e.g. "0Fq" for current weather only with no Follow line and no header. The flags get appended to every request via `wttrin--build-url`. The defcustom defaults to nil so existing users see no change.
I excluded `A` and `T` from the recommended set in the docstring since wttrin needs ANSI output for the xterm-color rendering to produce the colored glyphs. The user could still pass them, but the docstring nudges them away.
Tests cover the normal cases (single, multi-flag, with and without unit system), the boundaries (nil and empty string both leave the URL unchanged from baseline, single character works), and a sanity check that the new flags slot in after the always-on `A`. Existing build-url tests stay green because they don't bind the new variable, and the default is nil.
Also added `.claude/` to .gitignore — the scheduled-tasks lockfile from local wakeup scheduling shouldn't be tracked.
|
| |
|
|
| |
Both badges point at the GitHub mirror, which is where the workflow runs and where the coverage gets reported. The CI badge reflects the latest run on `main`. The Coveralls badge tracks the most recent coverage upload from that branch.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Lets users set `wttrin-favorite-location` by IP lookup instead of typing a city by hand. `M-x wttrin-set-location-from-geolocation` runs the lookup, shows the detected "City, Region" in a yes/no prompt, and on confirmation sets the variable for the session. The docstring points at `M-x customize-save-variable` for persistence across restarts.
The new `wttrin-geolocation.el` module provides the provider layer. Three providers come built in: ipapi.co (the default), ipinfo.io, and ipwho.is. All three are HTTPS, need no API key, and have free tiers large enough for interactive use. The module has three layers. Pure JSON parsers handle the per-provider quirks: ipapi's `error: true` flag, ipwho.is's `success: false` flag, ipinfo's HTTP-status-only signalling. A small fetch helper extracts the HTTP body. `wttrin-geolocation-detect` wires them together and calls back with "City, Region" on success, or nil on any failure (network error, HTTP 4xx or 5xx, malformed response, rate-limit signal).
Providers live in an alist keyed by symbol, with plist values for :name, :url, and :parser. To use a different provider, push an entry onto `wttrin-geolocation--providers` and select it via `wttrin-geolocation-provider`. No code change needed.
README gains a subsection under Mode-line Weather Display covering the command, how to persist the result, provider selection with free-tier limits, and the accuracy caveat for VPN or mobile-hotspot users.
39 new tests across the parser layer (10 ipapi, 6 ipinfo, 6 ipwhois), fetch-and-dispatch (11), and interactive command (6). Each suite covers Normal, Boundary, and Error categories. Tests mock `url-retrieve` and `yes-or-no-p` at their boundaries and run the real extract-and-parse pipeline underneath. Test suite: 333 → 373 passing.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
| |
Simplify Emacs Lisp configuration using `:vc` keyword for Wttrin
installation and update.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Make asynchronous loading the only mode of operation. It's well tested
and doesn't lock up Emacs during fetching. Synchronous loading code has been removed.
|
| |
|
|
|
|
|
| |
Add a note for Emacs 29+ users about using `setopt` for type
checking. Include sections on asynchronous loading and cache
settings under advanced settings, providing customization options
for Wttrin's behavior.
|
| |
|
|
|
| |
Include detailed steps for installing Wttrin using package-vc in
Emacs 30 or later.
|
| |
|
|
|
|
| |
- fix numbering mistake
- swap package installation ordering
- word tweaking, probably born out of procrastination
|
| | |
|
|
|
- moved the format from markdown to org
- much better text IMHO
- badges and sections and pictures oh my!
|