diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-02 22:37:06 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-02 22:37:06 -0400 |
| commit | 8b461ecd3d4fae3be0a93523d19932e0a3d21c6c (patch) | |
| tree | fdc4beb9d03b21b3655df8e2531d5f4efe4598b5 /tests/test-wttrin-saved-locations.el | |
| parent | 6c808ff4a4c54d543e065b722bc8517fe5141b45 (diff) | |
| download | emacs-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-saved-locations.el')
| -rw-r--r-- | tests/test-wttrin-saved-locations.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test-wttrin-saved-locations.el b/tests/test-wttrin-saved-locations.el index 1a08aaf..b41d7ee 100644 --- a/tests/test-wttrin-saved-locations.el +++ b/tests/test-wttrin-saved-locations.el @@ -159,13 +159,14 @@ Two names with the same query share a key; the name never leaks into the key." ;;; savehist -(ert-deftest test-wttrin-saved-locations-integration-savehist-registers () - "Integration: the runtime directory is registered for savehist persistence, -not the `wttrin-saved-locations' defcustom (which the user sets in init)." +(ert-deftest test-wttrin-saved-locations-integration-savehist-excludes-runtime () + "Integration: the runtime directory is not registered with savehist. +It persists in `wttrin-state-file' instead — a savehist entry would be +scrubbed by any Emacs session that saves savehist without wttrin loaded." (require 'savehist) (let ((savehist-additional-variables '(kill-ring))) (wttrin--savehist-register) - (should (memq 'wttrin--saved-locations-runtime savehist-additional-variables)) + (should-not (memq 'wttrin--saved-locations-runtime savehist-additional-variables)) (should-not (memq 'wttrin-saved-locations savehist-additional-variables)))) ;;; wttrin--coordinates-p |
