diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-26 12:39:36 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-26 12:39:36 -0400 |
| commit | 9459a0b30f86adb9066312672c7bd96e70bc1f6f (patch) | |
| tree | 2a0fa7d370aeeb9a9be69b63a224682c1a3b1f5d /wttrin.el | |
| parent | d4d12746e81348a55a25a1e40dbeac6a935e2825 (diff) | |
| download | emacs-wttrin-9459a0b30f86adb9066312672c7bd96e70bc1f6f.tar.gz emacs-wttrin-9459a0b30f86adb9066312672c7bd96e70bc1f6f.zip | |
feat: save the location to the directory when making it the default
Pressing d on a typed or aliased location set the favorite but never added it to wttrin-saved-locations, so the default persisted only as the favorite string, not as a named directory entry. The coordinate branch already saved. The typed/alias branch did not.
The typed/alias branch now puts the location into the directory before promoting it, so a typed default like "Reykjavik" persists as a ("Reykjavik" . "Reykjavik") entry. An empty-name coordinate detection still keeps the raw coordinates without saving an entry.
Diffstat (limited to 'wttrin.el')
| -rw-r--r-- | wttrin.el | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1229,11 +1229,13 @@ here works whether or not savehist is loaded." (defun wttrin-make-default () "Make the location shown in this buffer the favorite (persisted) default. -A named buffer (a saved alias or a typed location) is promoted directly. A raw -coordinate buffer (a fresh geolocation detection) first prompts for a name, -prefilled with the detected address; the entered name is saved to the directory -and promoted. An empty name keeps the raw coordinates as the default. No-op -with a message when the buffer has no current location." +A named buffer (a saved alias or a typed location) is saved to the directory and +promoted, so the default also persists as a named entry rather than only the +favorite string. A raw coordinate buffer (a fresh geolocation detection) first +prompts for a name, prefilled with the detected address; the entered name is +saved and promoted. An empty name keeps the raw coordinates as the default +without saving a directory entry. No-op with a message when the buffer has no +current location." (interactive) (cond ((null wttrin--current-location) @@ -1251,6 +1253,7 @@ with a message when the buffer has no current location." (message "wttrin: %s is now the default location" name)))) (t (let ((favorite (or wttrin--current-display wttrin--current-location))) + (wttrin--put-saved-location favorite wttrin--current-location) (wttrin--set-favorite-location favorite) (message "wttrin: %s is now the default location" favorite))))) |
