emacs-devel
[Top][All Lists]
Advanced

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

Re: Incorporating caching into defgroup/defcustom/defvar for Emacs 25


From: Artur Malabarba
Subject: Re: Incorporating caching into defgroup/defcustom/defvar for Emacs 25
Date: Mon, 2 Feb 2015 10:08:44 +0000

On 2 Feb 2015 01:07, "Stephen J. Turnbull" <address@hidden> wrote:
>
> Sean Allred writes:
>
>  > Specifically, his point about defcustom is a good one. Such
>  > variables shouldn’t be cached in the same sense.
>
> Why not?  Custom provides a "reset" functionality if the user *wants*
> to reset.  It's not clear to me that a user wouldn't want changes to
> customizable variables to persist.

I wasn't saying defcustoms shouldn't be persistent, I was just saying they already have a great mechanism for that so they don't need to use this caching mechanism that is being suggested for internal variables.

Similarly, internal variables can't use the defcustom mechanism (at least, not without modifications) because (1) they'll show up in the customize interface and (2) they'll clutter up the user's init file.

>
>  > stash.el was and is designed as a patch for the lack of “internal
>  > persistent variables”. The additional keyword(s?) to defgroup and a
>  > defvar* macro would suffice.
>
> What does stash provide that a session manager such as desktop.el
> doesn't?  That wasn't clear to me from your long email.

With stash, a package can specify that a global variable is supposed to be persistent, and this variable will automatically be saved/loaded from disk.

I understand desktop.el provides similar functionality, but, IIUC, desktop.el is more of a user interface. By that I mean sessions are only saved/loaded if desktop-mode is enabled, and desktop-mode might just be disabled because the user doesn't want to restore open buffers/files. Some packages need a way to store persistent data regardless of desktop-mode (see abbrevs and bookmarks, for instance), and so far they've all been doing that manually.

Stash provides a simple abstraction for a variable that will be persistent accross sessions. You just declare a variable to be persistent (Sean suggested a `defvar*' macro, but I prefer something more specific like `defstash') and its value will be saved to disk during a session and loaded from disk at the start of each session (very similar to what desktop.el does, but without relying on desktop-mode).


reply via email to

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