vfclists · 2022-08-07 13:38
I have begun to accumulate a lot of savehist-additional-variables and want to place some of them in different files and load them when I needed them, but they should be save regularly just as with savehist.
Is there some package for this purpose or some guide to how I might write one myself?
helm05 · 2022-08-07 17:22
psession package does more or less this.
[https://github.com/thierryvolpiatto/psession](https://github.com/thierryvolpiatto/psession)
Note that you can control the length of your history variables with `history-length` and for each variable with e.g. `(put 'foo-history 'history-length 100)`.
karthink · 2022-08-07 17:31
Is the difference between savehist and what you're looking for that you want to load certain variables manually, and not automatically with savehist? I don't understand what you want to do that `savehist-additional-variables` doesn't.
vfclists · 2022-08-07 22:57
I don't want savehist to be overloaded, and I don't need all the variables to be loaded when Emacs starts.
I only want to load some of the variables when I need them.
I am looking at this link to get some idea of how to do it myself - https://stackoverflow.com/questions/2321904/elisp-how-to-save-data-in-a-file
karthink · 2022-08-07 23:38
Okay. If you have the time for it, I recommend the chapter in the Elisp reference manual on [reading and printing data](https://www.gnu.org/software/emacs/manual/html_node/elisp/Read-and-Print.html) for this.
The standard method for this is to use `prin1` inside a `with-temp-file` macro.
There are also packages besides savehist that handle persistence for you, like [persist](https://elpa.gnu.org/packages/persist.html), but these might be too coarse-grained for you.
00-11 · 2022-08-08 01:34
If you use [Bookmark+](https://www.emacswiki.org/emacs/BookmarkPlus) then you can create bookmarks, which are persistent, that restore [sets of variables](https://www.emacswiki.org/emacs/BookmarkPlus#FunctionSequenceVarlistBookmarks).
Jump to a bookmark to restore its recorded variable values.