* Re: Saving a elisp data structure into string and evaluating it back into objects
[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>
0 siblings, 2 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2009-10-07 8:05 UTC (permalink / raw)
To: help-gnu-emacs
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__
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
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>
1 sibling, 0 replies; 13+ messages in thread
From: tomas @ 2009-10-07 16:44 UTC (permalink / raw)
To: Pascal J. Bourguignon; +Cc: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, Oct 07, 2009 at 10:05:26AM +0200, Pascal J. Bourguignon wrote:
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
[...]
> This is not feasible using print and read, since not all lisp objects
> are printable readably.
^^^^^^^^^^^^^^^^^^
Wow, Pascal. Nice phrase. May I use it from time to time?
;-)
Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFKzMVSBcgs9XrR2kYRAmQfAJsHIlJR2YLPJEkhEnRLcvGl5pFdMQCeKSbP
jnX0vmppvE/NCU+rY1tCw+s=
=evf9
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <mailman.8243.1254933762.2239.help-gnu-emacs@gnu.org>]
* Re: Saving a elisp data structure into string and evaluating it back into objects
[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>
0 siblings, 2 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2009-10-08 12:02 UTC (permalink / raw)
To: help-gnu-emacs
tomas@tuxteam.de writes:
> On Wed, Oct 07, 2009 at 10:05:26AM +0200, Pascal J. Bourguignon wrote:
>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>
> [...]
>
>> This is not feasible using print and read, since not all lisp objects
>> are printable readably.
> ^^^^^^^^^^^^^^^^^^
>
> Wow, Pascal. Nice phrase. May I use it from time to time?
Sure. It is standard lisp jargon.
http://www.lispworks.com/documentation/HyperSpec/Body/v_pr_rda.htm
http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_r.htm#readably
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
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>
1 sibling, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2009-10-09 13:50 UTC (permalink / raw)
To: help-gnu-emacs
Pascal J. Bourguignon wrote:
> tomas@tuxteam.de writes:
>
>> On Wed, Oct 07, 2009 at 10:05:26AM +0200, Pascal J. Bourguignon wrote:
>>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>> [...]
>>
>>> This is not feasible using print and read, since not all lisp objects
>>> are printable readably.
>> ^^^^^^^^^^^^^^^^^^
>>
>> Wow, Pascal. Nice phrase. May I use it from time to time?
As a native speaker, I think that should be "readably printable".
> Sure. It is standard lisp jargon.
>
> http://www.lispworks.com/documentation/HyperSpec/Body/v_pr_rda.htm
> http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_r.htm#readably
Thanks for the links!
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <mailman.8409.1255096239.2239.help-gnu-emacs@gnu.org>]
* Re: Saving a elisp data structure into string and evaluating it back into objects
[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
1 sibling, 1 reply; 13+ messages in thread
From: David Kastrup @ 2009-10-09 14:12 UTC (permalink / raw)
To: help-gnu-emacs
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
> Pascal J. Bourguignon wrote:
>> tomas@tuxteam.de writes:
>>
>>> On Wed, Oct 07, 2009 at 10:05:26AM +0200, Pascal J. Bourguignon wrote:
>>>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>>> [...]
>>>
>>>> This is not feasible using print and read, since not all lisp objects
>>>> are printable readably.
>>> ^^^^^^^^^^^^^^^^^^
>>>
>>> Wow, Pascal. Nice phrase. May I use it from time to time?
>
> As a native speaker, I think that should be "readably printable".
I don't think so, because readability is the result, not the manner of
printing. "readily printable", but "printable readably". It is
"printable in a readable manner", not "in a readable manner printable".
--
David Kastrup
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
2009-10-09 14:12 ` David Kastrup
@ 2009-10-16 2:13 ` Kevin Rodgers
0 siblings, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2009-10-16 2:13 UTC (permalink / raw)
To: help-gnu-emacs
David Kastrup wrote:
> Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
>
>> Pascal J. Bourguignon wrote:
>>> tomas@tuxteam.de writes:
>>>
>>>> On Wed, Oct 07, 2009 at 10:05:26AM +0200, Pascal J. Bourguignon wrote:
>>>>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>>>> [...]
>>>>
>>>>> This is not feasible using print and read, since not all lisp objects
>>>>> are printable readably.
>>>> ^^^^^^^^^^^^^^^^^^
>>>>
>>>> Wow, Pascal. Nice phrase. May I use it from time to time?
>> As a native speaker, I think that should be "readably printable".
>
> I don't think so, because readability is the result, not the manner of
> printing. "readily printable", but "printable readably". It is
> "printable in a readable manner", not "in a readable manner printable".
Ah, yes!
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
[not found] ` <mailman.8409.1255096239.2239.help-gnu-emacs@gnu.org>
2009-10-09 14:12 ` David Kastrup
@ 2009-10-12 16:54 ` Ted Zlatanov
1 sibling, 0 replies; 13+ messages in thread
From: Ted Zlatanov @ 2009-10-12 16:54 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, 09 Oct 2009 07:50:09 -0600 Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote:
KR> As a native speaker, I think that should be "readably printable".
"printably readably printable"? ;)
Ted
^ permalink raw reply [flat|nested] 13+ messages in thread
* 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
* Re: 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
2009-10-07 15:09 ` Marcelo de Moraes Serpa
0 siblings, 1 reply; 13+ messages in thread
From: Kevin Rodgers @ 2009-10-07 12:57 UTC (permalink / raw)
To: help-gnu-emacs
Marcelo de Moraes Serpa wrote:
> 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?
C-h v desktop-globals-to-save
C-h v desktop-locals-to-save
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
2009-10-07 12:57 ` Kevin Rodgers
@ 2009-10-07 15:09 ` Marcelo de Moraes Serpa
2009-10-07 15:33 ` Lennart Borgman
0 siblings, 1 reply; 13+ messages in thread
From: Marcelo de Moraes Serpa @ 2009-10-07 15:09 UTC (permalink / raw)
To: Kevin Rodgers; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]
Thank you all for taking your time to reply!
@Kevin: I've added "layout-configuration-alist" to this var, and indeed, it
saved, but here's what it wrote:
(setq layout-configuration-alist '(("Unprintable entity" "Unprintable
> entity" ("Unprintable entity" . "revive.el")) ("Unprintable entity"
> "Unprintable entity" ("Unprintable entity" . "dot.emacs.el") ("Unprintable
> entity" . "dot.emacs.el"))))
>
"Unprintable entity". Any way I could fix it from the top of your head?
@Pascal: Thanks for the comprehensive answer!
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.
>
Well, you are absolutely right -- actually, the only thing that interests me
is saving and restoring the value of "layout-configuration-alist", so I can
have my buffer-indexed window layouts persisted.
How could I go and write a serialization/deserialization function pair? And
where would I integrate it?
Thanks,
Marcelo.
On Wed, Oct 7, 2009 at 7:57 AM, Kevin Rodgers <kevin.d.rodgers@gmail.com>wrote:
> Marcelo de Moraes Serpa wrote:
>
>> 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?
>>
>
> C-h v desktop-globals-to-save
> C-h v desktop-locals-to-save
>
> --
> Kevin Rodgers
> Denver, Colorado, USA
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 2886 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
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
0 siblings, 1 reply; 13+ messages in thread
From: Lennart Borgman @ 2009-10-07 15:33 UTC (permalink / raw)
To: Marcelo de Moraes Serpa; +Cc: help-gnu-emacs, Kevin Rodgers
On Wed, Oct 7, 2009 at 5:09 PM, Marcelo de Moraes Serpa
<celoserpa@gmail.com> wrote:
>
> Well, you are absolutely right -- actually, the only thing that interests me
> is saving and restoring the value of "layout-configuration-alist", so I can
> have my buffer-indexed window layouts persisted.
>
> How could I go and write a serialization/deserialization function pair? And
> where would I integrate it?
Is something like winsav.el in nXhtml what you want? If not, could you
please explain what you are missing there?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
2009-10-07 15:33 ` Lennart Borgman
@ 2009-10-07 16:23 ` Marcelo de Moraes Serpa
2009-10-08 22:51 ` Lennart Borgman
0 siblings, 1 reply; 13+ messages in thread
From: Marcelo de Moraes Serpa @ 2009-10-07 16:23 UTC (permalink / raw)
To: Lennart Borgman; +Cc: help-gnu-emacs, Kevin Rodgers
[-- Attachment #1: Type: text/plain, Size: 783 bytes --]
I want to save the memory state for layout-restore.el, and this happens to
be in the layout-configuration-alist variable. That's all, actually.
On Wed, Oct 7, 2009 at 10:33 AM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:
> On Wed, Oct 7, 2009 at 5:09 PM, Marcelo de Moraes Serpa
> <celoserpa@gmail.com> wrote:
> >
> > Well, you are absolutely right -- actually, the only thing that interests
> me
> > is saving and restoring the value of "layout-configuration-alist", so I
> can
> > have my buffer-indexed window layouts persisted.
> >
> > How could I go and write a serialization/deserialization function pair?
> And
> > where would I integrate it?
>
>
> Is something like winsav.el in nXhtml what you want? If not, could you
> please explain what you are missing there?
>
[-- Attachment #2: Type: text/html, Size: 1189 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Saving a elisp data structure into string and evaluating it back into objects
2009-10-07 16:23 ` Marcelo de Moraes Serpa
@ 2009-10-08 22:51 ` Lennart Borgman
0 siblings, 0 replies; 13+ messages in thread
From: Lennart Borgman @ 2009-10-08 22:51 UTC (permalink / raw)
To: Marcelo de Moraes Serpa; +Cc: help-gnu-emacs, Kevin Rodgers
Oh, I thought that was window and frame configuration you wanted to
save and restore. My bad if that is not what you want.
On Wed, Oct 7, 2009 at 6:23 PM, Marcelo de Moraes Serpa
<celoserpa@gmail.com> wrote:
> I want to save the memory state for layout-restore.el, and this happens to
> be in the layout-configuration-alist variable. That's all, actually.
>
>
> On Wed, Oct 7, 2009 at 10:33 AM, Lennart Borgman <lennart.borgman@gmail.com>
> wrote:
>>
>> On Wed, Oct 7, 2009 at 5:09 PM, Marcelo de Moraes Serpa
>> <celoserpa@gmail.com> wrote:
>> >
>> > Well, you are absolutely right -- actually, the only thing that
>> > interests me
>> > is saving and restoring the value of "layout-configuration-alist", so I
>> > can
>> > have my buffer-indexed window layouts persisted.
>> >
>> > How could I go and write a serialization/deserialization function pair?
>> > And
>> > where would I integrate it?
>>
>>
>> Is something like winsav.el in nXhtml what you want? If not, could you
>> please explain what you are missing there?
>
>
^ 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).