help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Saving a elisp data structure into string and evaluating it back int


From: Pascal J. Bourguignon
Subject: Re: Saving a elisp data structure into string and evaluating it back into objects
Date: Wed, 07 Oct 2009 10:05:26 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
> Well, what I'm trying to do is, every time I exit emacs, the whole
> memory state (elisp object's tree) will be dumped to a file and
> reloaded when I restart emacs again.

This is not feasible using print and read, since not all lisp objects
are printable readably.

What you could do is to save the emacs lisp image, and use it to boot
emacs the next time.  This is a usual operation in other lisps, but
with emacs it's more rarely used (only at built time usually).

See the dump-emacs function.  Unfortunately, it is usable only in
batch mode.  This restriction should be removed...


> Invalid syntax "#".

Yes, that's the symptom of trying to read unreadable objects.


> My question is: How could I dump the contents of
> layout-configuration-alist it in a way that resume could eval and
> eval it back into first class elisp objects again?

An alternative would be not to try to save EVERYTHING, but only what
really matters to you, taking care of saving only readably printable
objects, or for which you write a serialization/deserialization
function pair.


Notice that there are already emacs features to save and restore some
of the state, such as the open files, etc.  See for example the
functions desktop-save and desktop-read.


-- 
__Pascal Bourguignon__


reply via email to

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