emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Turning on savehist-mode by default


From: Drew Adams
Subject: RE: [External] : Turning on savehist-mode by default
Date: Sun, 19 Nov 2023 16:42:35 +0000

> > FWIW, `savehist.el' is a general way to save variable
> > values, not just a way to save values of minibuffer
> > history variables.  It's often recommended (including
> > by me) as a way to persist any variables you like.
> 
> Please don't forget there is also `desktop.el'
> that is a superset of `savehist.el'

Oh, I don't forget.  That has advantages and
disadvantages compared to savehist.  You can
have any number of desktop files, which can
be in different directories (+).  But it
(always?) saves a lot more than just vars
(-, if you just want to save vars).

> > Why isn't it written with that foremost in mind, i.e.,
> > as a general variable-persisting feature?
> 
> A general variable-persisting feature already exists:
> `define-multisession-variable'.

Looks like that Emacs 29+ feature (like
desktop but in other ways) is also more
than, or different from, just saving vars.

You need to define those vars - and even
access them - in special ways - they're
not ordinary vars.  And it looks like (?)
each such var is stored in its own file
(or in a DB).

I looked at it superficially, however.

It really looks like overkill for just
saving variables.  The use cases we're
talking about, I think, include saving
ordinary variables, of any kind, anytime.

When I mentioned having a simple feature
for just persisting/restoring variables
I meant a simple feature - something like
what savehist does, without separating
out `savehist-additional-variables'.
___

But the existence of multiple ways of
persisting variables suggests that maybe
we should have a doc section about the
topic in the Elisp manual.

That could include simple, ad hoc, saving:
write one or more vars to a file (e.g.
`with-temp-file'); std ways to save a set
of vars (e.g. savehist), std way to define,
save, access `multisession' vars; std ways
to save vars along with other stuff (e.g.
desktop).
___

There are also bookmarks (in Bookmark+, at
least) that just save sets of vars.  You
can have multiple bookmark files, anywhere,
and they can, but need not, be limited to
variable-set bookmarks.  Just jump to a
bookmark to restore a set of vars.

(It's also Bookmark+ that lets you create
desktop files anywhere, including multiple
ones in the same directory.  And lets you
bookmark desktops - just jump to restore.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]