aboutsummaryrefslogtreecommitdiff
path: root/tests/test-wttrin-requery.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-26 10:53:18 -0400
committerCraig Jennings <c@cjennings.net>2026-06-26 10:53:18 -0400
commit55ee8158a1f85bb532a24d752f9ef409192a924c (patch)
tree417ee476e2dfa75c75e2ce2a4e99f77e36ccdac2 /tests/test-wttrin-requery.el
parent7027cccea9eb7170ea0f08e1def3f979f2e59932 (diff)
downloademacs-wttrin-55ee8158a1f85bb532a24d752f9ef409192a924c.tar.gz
emacs-wttrin-55ee8158a1f85bb532a24d752f9ef409192a924c.zip
feat: add named-locations directory with display names
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.
Diffstat (limited to 'tests/test-wttrin-requery.el')
-rw-r--r--tests/test-wttrin-requery.el14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-wttrin-requery.el b/tests/test-wttrin-requery.el
index 5d52b36..e065c43 100644
--- a/tests/test-wttrin-requery.el
+++ b/tests/test-wttrin-requery.el
@@ -39,7 +39,7 @@
(test-wttrin-requery-setup)
(unwind-protect
(let ((old-buffer (get-buffer-create "*wttr.in*")))
- (cl-letf (((symbol-function 'wttrin-query) (lambda (_loc) nil)))
+ (cl-letf (((symbol-function 'wttrin-query) (lambda (_loc &rest _) nil)))
(wttrin--requery-location "Tokyo")
;; Old buffer should be dead
(should-not (buffer-live-p old-buffer))))
@@ -51,7 +51,7 @@
(unwind-protect
(let ((queried-location nil))
(cl-letf (((symbol-function 'wttrin-query)
- (lambda (loc) (setq queried-location loc))))
+ (lambda (loc &rest _) (setq queried-location loc))))
(wttrin--requery-location "Berlin, DE")
(should (equal queried-location "Berlin, DE"))))
(test-wttrin-requery-teardown)))
@@ -66,7 +66,7 @@
;; Ensure no buffer exists
(should-not (get-buffer "*wttr.in*"))
(cl-letf (((symbol-function 'wttrin-query)
- (lambda (loc) (setq queried-location loc))))
+ (lambda (loc &rest _) (setq queried-location loc))))
(wttrin--requery-location "Paris")
(should (equal queried-location "Paris"))))
(test-wttrin-requery-teardown)))
@@ -77,7 +77,7 @@
(unwind-protect
(let ((queried-location nil))
(cl-letf (((symbol-function 'wttrin-query)
- (lambda (loc) (setq queried-location loc))))
+ (lambda (loc &rest _) (setq queried-location loc))))
(wttrin--requery-location "Zürich, CH")
(should (equal queried-location "Zürich, CH"))))
(test-wttrin-requery-teardown)))
@@ -113,7 +113,7 @@ to the core requery function."
(setq offered-collection collection)
"Paris"))
((symbol-function 'wttrin--requery-location)
- (lambda (_loc) nil)))
+ (lambda (_loc &rest _) nil)))
(wttrin-requery)
;; The collection is now a completion table (a function) that pins
;; the sentinel first; check the candidates it completes over.
@@ -134,7 +134,7 @@ to the core requery function."
(setq initial-input init)
"Solo City"))
((symbol-function 'wttrin--requery-location)
- (lambda (_loc) nil)))
+ (lambda (_loc &rest _) nil)))
(wttrin-requery)
(should (equal initial-input "Solo City"))))
(test-wttrin-requery-teardown)))
@@ -150,7 +150,7 @@ to the core requery function."
(setq initial-input init)
"Paris"))
((symbol-function 'wttrin--requery-location)
- (lambda (_loc) nil)))
+ (lambda (_loc &rest _) nil)))
(wttrin-requery)
(should-not initial-input)))
(test-wttrin-requery-teardown)))