<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs-wttrin/tests/test-wttrin-make-default.el, branch main</title>
<subtitle>Emacs frontend for Igor Chubin's wttr.in weather service
</subtitle>
<id>https://git.cjennings.net/emacs-wttrin/atom?h=main</id>
<link rel='self' href='https://git.cjennings.net/emacs-wttrin/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/'/>
<updated>2026-06-24T04:10:51+00:00</updated>
<entry>
<title>feat: add 'd' key to make the displayed location the default</title>
<updated>2026-06-24T04:10:51+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-06-24T04:10:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/emacs-wttrin/commit/?id=efd3cdce5b3aebfdb3e02460d1ec0434cef85949'/>
<id>urn:sha1:efd3cdce5b3aebfdb3e02460d1ec0434cef85949</id>
<content type='text'>
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.
</content>
</entry>
</feed>
