From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Saving a elisp data structure into string and evaluating it back into objects Date: Wed, 07 Oct 2009 10:05:26 +0200 Organization: Informatimago Message-ID: <87zl83tyrd.fsf@galatea.local> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1254904864 8739 80.91.229.12 (7 Oct 2009 08:41:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Oct 2009 08:41:04 +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 10:40:55 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 1MvS4s-000465-Lc for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 10:40:54 +0200 Original-Received: from localhost ([127.0.0.1]:34238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvS4s-0006yg-5d for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 04:40:54 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-X-Trace: individual.net qEi7VNbtCtQWcM3TqTvKngIQ87Ik/lrymXUS3r3eOA7hHF+WWJ Cancel-Lock: sha1:YmNjYThhYzBmYTc4NTJiZmFhNjQxZWFkMzdiM2QyOGVjZjJkOTZiZA== sha1:gyBMY78aeNs5Xe5bkqSuQi2y3m8= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Original-Xref: news.stanford.edu gnu.emacs.help:173623 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:68717 Archived-At: Marcelo de Moraes Serpa 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__