unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Saving a elisp data structure into string and evaluating it back into objects
Date: Wed, 07 Oct 2009 10:05:26 +0200	[thread overview]
Message-ID: <87zl83tyrd.fsf@galatea.local> (raw)
In-Reply-To: mailman.8197.1254884360.2239.help-gnu-emacs@gnu.org

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	other threads:[~2009-10-07  8:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.8197.1254884360.2239.help-gnu-emacs@gnu.org>
2009-10-07  8:05 ` Pascal J. Bourguignon [this message]
2009-10-07 16:44   ` Saving a elisp data structure into string and evaluating it back into objects tomas
     [not found]   ` <mailman.8243.1254933762.2239.help-gnu-emacs@gnu.org>
2009-10-08 12:02     ` Pascal J. Bourguignon
2009-10-09 13:50       ` Kevin Rodgers
     [not found]       ` <mailman.8409.1255096239.2239.help-gnu-emacs@gnu.org>
2009-10-09 14:12         ` David Kastrup
2009-10-16  2:13           ` Kevin Rodgers
2009-10-12 16:54         ` Ted Zlatanov
2009-10-06 23:08 Marcelo de Moraes Serpa
2009-10-07 12:57 ` Kevin Rodgers
2009-10-07 15:09   ` Marcelo de Moraes Serpa
2009-10-07 15:33     ` Lennart Borgman
2009-10-07 16:23       ` Marcelo de Moraes Serpa
2009-10-08 22:51         ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zl83tyrd.fsf@galatea.local \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).