From: Marcelo de Moraes Serpa <celoserpa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Saving a elisp data structure into string and evaluating it back into objects
Date: Tue, 6 Oct 2009 18:08:25 -0500 [thread overview]
Message-ID: <1e5bcefd0910061608y54755a7ejbf5def5831443da7@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]
Hello list,
I'm trying to combine DeskTop, layout-restore.el and revive.el to create the
ultimate persistence experience :)
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.
Why am I trying to do this? Well, there are many settings in emacs that are
volatile, many vars that are not saved. I know that emacs has the capability
to save its vars into .emacs, but this depends on the mode and the var, no?
Anyway, the point is, I love how layout-restore.el works, and this is the
main reason I'm trying to do this. I want to persist all the state created
by layout-restore, meaning all the window layouts saved per buffer while I
was working in an emacs session. When I exit and start emacs again, I want
the very same layouts associated with the very same buffers.
I'm not an emacs/elisp guru, but I could find out that layout-restore saves
its state into the layout-configuration-alist global var. This var is a list
of buffer objects, here's a stringfied version of its contents (I saved a
layout using layout-save-current and it filled the var with this
data-structure):
*"((#<buffer *scratch*> #<window-configuration> (#<buffer *scratch*> .
\"*scratch*\") (#<buffer *Help*> . \"*Help*\")))"*
So far so good. I can get the value of the var into a string, and I also
have found out how to tell revive.el to also save the contents of this var:
To add this var's symbol to the list in revive:save-variables-global, like
this:
(setq revive:save-variables-global
'(layout-configuration-alist))
When I do M-x save-current-configuration, it does get the value of the var.
The following is an excerpt from ~/.revive.el:
((layout-configuration-alist (#<buffer dot.emacs.el> #<window-configuration>
(#<buffer dot.emacs.el> . "dot.emacs.el") (#<buffer *Help*> . "*Help*"))))
But, when I try to restore all this state by calling resume (M-x resume), it
fails with the following message:
Invalid syntax "#".
Well, it is pretty obvious that the string is not representing the objects
in a manner that can be revaluated. These are simple to_s (as in Ruby)
representations and not full data structures that could be used to
reconstruct the object in memory again.
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?
Thanks,
Marcelo.
[-- Attachment #2: Type: text/html, Size: 2763 bytes --]
next reply other threads:[~2009-10-06 23:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-06 23:08 Marcelo de Moraes Serpa [this message]
2009-10-07 12:57 ` Saving a elisp data structure into string and evaluating it back into objects 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-07 17:41 ` Saving a elisp data structure into string and evaluating itback " Drew Adams
2009-10-07 18:22 ` Marcelo de Moraes Serpa
2009-10-08 22:51 ` Saving a elisp data structure into string and evaluating it back " Lennart Borgman
[not found] <mailman.8197.1254884360.2239.help-gnu-emacs@gnu.org>
2009-10-07 8:05 ` Pascal J. Bourguignon
2009-10-07 16:44 ` 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
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=1e5bcefd0910061608y54755a7ejbf5def5831443da7@mail.gmail.com \
--to=celoserpa@gmail.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).