unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Saving a elisp data structure into string and evaluating it back into objects
@ 2009-10-06 23:08 Marcelo de Moraes Serpa
  2009-10-07 12:57 ` Kevin Rodgers
  0 siblings, 1 reply; 13+ messages in thread
From: Marcelo de Moraes Serpa @ 2009-10-06 23:08 UTC (permalink / raw)
  To: help-gnu-emacs

[-- 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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-10-16  2:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.8197.1254884360.2239.help-gnu-emacs@gnu.org>
2009-10-07  8:05 ` Saving a elisp data structure into string and evaluating it back into objects 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
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

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).