From 9459a0b30f86adb9066312672c7bd96e70bc1f6f Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 26 Jun 2026 12:39:36 -0400 Subject: 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. --- wttrin.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'wttrin.el') diff --git a/wttrin.el b/wttrin.el index 6157589..b55e0cc 100644 --- a/wttrin.el +++ b/wttrin.el @@ -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))))) -- cgit v1.2.3