From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcelo de Moraes Serpa Newsgroups: gmane.emacs.help Subject: Saving a elisp data structure into string and evaluating it back into objects Date: Tue, 6 Oct 2009 18:08:25 -0500 Message-ID: <1e5bcefd0910061608y54755a7ejbf5def5831443da7@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=005045017561b2ec1d04754c4e68 X-Trace: ger.gmane.org 1254884560 25915 80.91.229.12 (7 Oct 2009 03:02:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Oct 2009 03:02:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 07 05:02:30 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MvMnM-00089W-Rd for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 05:02:30 +0200 Original-Received: from localhost ([127.0.0.1]:60532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvMnM-0003Fv-Bm for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Oct 2009 23:02:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvJ8x-00083c-Sf for help-gnu-emacs@gnu.org; Tue, 06 Oct 2009 19:08:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvJ8t-0007yt-B0 for help-gnu-emacs@gnu.org; Tue, 06 Oct 2009 19:08:31 -0400 Original-Received: from [199.232.76.173] (port=58003 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvJ8t-0007yq-7d for help-gnu-emacs@gnu.org; Tue, 06 Oct 2009 19:08:27 -0400 Original-Received: from mail-yw0-f172.google.com ([209.85.211.172]:63005) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvJ8s-0004E3-FE for help-gnu-emacs@gnu.org; Tue, 06 Oct 2009 19:08:26 -0400 Original-Received: by ywh2 with SMTP id 2so4519199ywh.27 for ; Tue, 06 Oct 2009 16:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=s/yNsEReMPLHElNlNBDmYnUQCzvlgj7QgZLr/DNRQaY=; b=fF9kttujbCI/65da9k1MwyPC9VMI7LN1QOKNE0kVpBONLWk+XGcSJZlDeu3JuWW1H0 AiUZfYRV0Wniz2US+S1kmMdd24995O4iRHqGu4xMx5BR+hiSaxeFNkpxSHiCo+18iadm QZmpwVa7uB99QSTN22Hv9FcACMlI0ZEPsS8d4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=pjLhtYPX3ckpl7GBl0L2siJmNCLN1VWmom6Iu962kA0pvxgJ1HjC3M3Ebl+EhkN5Zp FgKPDz7QklfY0iua6/9SjRchfBMDtYd5s6NV4y9xYCe6qKWZh6btPd068jipW+SvjnY/ MIJoEEg5EKdrjCpBYh+y3fU4wLaN29UzzeEyY= Original-Received: by 10.101.23.10 with SMTP id a10mr2206925anj.27.1254870505155; Tue, 06 Oct 2009 16:08:25 -0700 (PDT) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Tue, 06 Oct 2009 22:59:19 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:68715 Archived-At: --005045017561b2ec1d04754c4e68 Content-Type: text/plain; charset=ISO-8859-1 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): *"((# # (# . \"*scratch*\") (# . \"*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 (# # (# . "dot.emacs.el") (# . "*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. --005045017561b2ec1d04754c4e68 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello list,

I'm trying to combine DeskTop, layout-restore.el and= revive.el to create the ultimate persistence experience :)

Well, w= hat I'm trying to do is, every time I exit emacs, the whole memory stat= e (elisp object's tree) will be dumped to a file and reloaded when I re= start 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 capa= bility to save its vars into .emacs, but this depends on the mode and the v= ar, no?

Anyway, the point is, I love how layout-restore.el works, and this is t= he main reason I'm trying to do this. I want to persist all the state c= reated by layout-restore, meaning all the window layouts saved per buffer w= hile 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-resto= re 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 conten= ts (I saved a layout using layout-save-current and it filled the var with t= his data-structure):

"((#<buffer *scratch*> #<window-configuration> (#&l= t;buffer *scratch*> . \"*scratch*\") (#<buffer *Help*> .= \"*Help*\")))"

So far so good. I can get the val= ue of the var into a string, and I also have found out how to tell revive.e= l to also save the contents of this var: To add this var's symbol to th= e list in revive:save-variables-global, like this:

=A0=A0=A0 =A0=A0=A0 (setq revive:save-variables-global
=A0=A0=A0 =A0= =A0=A0 =A0=A0=A0=A0=A0 '(layout-configuration-alist))

When I do = M-x save-current-configuration, it does get the value of the var. The follo= wing 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 f= ollowing message:

Invalid syntax "#".

Well, it is pretty obvious that th= e 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 stru= ctures that could be used to reconstruct the object in memory again.

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

Thanks,

Marcelo.


--005045017561b2ec1d04754c4e68--