aboutsummaryrefslogtreecommitdiff
path: root/tests/test-wttrin-favorite-override.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-02 22:37:06 -0400
committerCraig Jennings <c@cjennings.net>2026-07-02 22:37:06 -0400
commit8b461ecd3d4fae3be0a93523d19932e0a3d21c6c (patch)
treefdc4beb9d03b21b3655df8e2531d5f4efe4598b5 /tests/test-wttrin-favorite-override.el
parent6c808ff4a4c54d543e065b722bc8517fe5141b45 (diff)
downloademacs-wttrin-release/0.4.0.tar.gz
emacs-wttrin-release/0.4.0.zip
fix: persist runtime favorite and saved locations in a state filerelease/0.4.0
savehist rewrites its whole file on every save, keeping only the variables registered in the running process. Any Emacs that saved savehist without wttrin loaded (a batch tool, a session that never opened wttrin) silently deleted the persisted favorite and saved-location entries. A d-set default then reverted to the init value on the next restart. The runtime favorite and directory now live in wttrin-state-file, written only by wttrin: write-through on every location command, atomic temp-file + rename, UTF-8 pinned both ways, read with read (never eval), versioned plist. Values restore at load and re-assert on savehist-mode-hook, so a stale legacy savehist restore can't clobber them. With no state file present, legacy savehist values are adopted and written once, so existing users migrate with zero steps. Search history stays on savehist. It's scrub-tolerant throwaway data, exactly what savehist is for. Also: the README documents the mode-line tooltip forecast option, and the gitignore covers one more local tooling artifact.
Diffstat (limited to 'tests/test-wttrin-favorite-override.el')
-rw-r--r--tests/test-wttrin-favorite-override.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test-wttrin-favorite-override.el b/tests/test-wttrin-favorite-override.el
index 0236901..95916c7 100644
--- a/tests/test-wttrin-favorite-override.el
+++ b/tests/test-wttrin-favorite-override.el
@@ -64,15 +64,18 @@ with `d' reverted to the init value on restart."
(should (equal "New Orleans, LA" wttrin-favorite-location))
(should (equal "Paris, FR" (wttrin--favorite-location)))))
-;;; savehist registration targets the runtime vars, not the config defcustoms
+;;; savehist registration covers only the scrub-tolerant search history;
+;;; the runtime vars persist in `wttrin-state-file' (see test-wttrin-state-file.el)
-(ert-deftest test-wttrin-favorite-override-normal-savehist-registers-override ()
- "Normal: savehist persists the override, not the config defcustom."
+(ert-deftest test-wttrin-favorite-override-normal-savehist-excludes-runtime-vars ()
+ "Normal: savehist persists neither the runtime vars nor the config defcustoms.
+The runtime favorite and directory live in `wttrin-state-file' — a savehist
+entry would be scrubbed by any session that saves savehist without wttrin."
(require 'savehist)
(let ((savehist-additional-variables '(kill-ring)))
(wttrin--savehist-register)
- (should (memq 'wttrin--favorite-override savehist-additional-variables))
- (should (memq 'wttrin--saved-locations-runtime savehist-additional-variables))
+ (should-not (memq 'wttrin--favorite-override savehist-additional-variables))
+ (should-not (memq 'wttrin--saved-locations-runtime savehist-additional-variables))
(should-not (memq 'wttrin-favorite-location savehist-additional-variables))
(should-not (memq 'wttrin-saved-locations savehist-additional-variables))))