From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.help Subject: Re: print hash table to disk and reread in hash table Date: Thu, 28 Aug 2008 09:03:53 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <86od3dfd86.fsf@lifelogs.com> References: <34f9604c-a23b-4ad9-9c84-f45884a6df23@x16g2000prn.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1219934743 32733 80.91.229.12 (28 Aug 2008 14:45:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Aug 2008 14:45:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 28 16:46:37 2008 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 1KYikZ-00063U-2i for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2008 16:45:27 +0200 Original-Received: from localhost ([127.0.0.1]:49341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KYijZ-0008Cp-MO for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2008 10:44:25 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.straub-nv.de!news.albasani.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-X-Trace: news.albasani.net EkJfd8WfRsnmI/9Cvccs//wCKgMgg+GmGvRWowkVib3BKOxd5j6k8BzCfBFC8nLrbTBXGJlDL4OdDQRBI7gGkEO4O1dLZ3Z7qpcRykvTdIbrFltqO0ku+VXKt91yJIhB Original-X-Complaints-To: abuse@albasani.net Original-NNTP-Posting-Date: Thu, 28 Aug 2008 13:58:43 +0000 (UTC) X-User-ID: BbnvGT14HSHVopYNh29uS3xyW+NptS5v5JZCN44gDsA= X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Cancel-Lock: sha1:PSHW04/AYmEWHbuA/9MKcYKmhdg= sha1:LCG+4dyJkTdIpOinqgkBCo/TnBY= User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-NNTP-Posting-Host: pgCqdYgh2nJ6u25g6tE82W0alyqRZccjfq1GYYP5cHw= Original-Xref: news.stanford.edu gnu.emacs.help:161716 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:57049 Archived-At: On Wed, 27 Aug 2008 22:27:47 -0700 (PDT) Xah wrote: X> but is there a function or lib to save hashtable to disk? i.e. X> sometimes called serializing? No. It's easy to convert a hashtable to a list, and Emacs makes it easy to serialize a list, so that's what people do. I have code in gnus-registry.el (copied in part from the way Gnus saves its newsrc file) to do this. The combination of two easy things is not, unfortunately, simple anymore. I like the (puthash ...) approach suggested by Thierry Volpiatto but it's a lot of function calls for a large hashtable (which the Gnus registry creates). So I'm not sure it's the right approach either. BBDB has a similar problem; it saves vectors instead of lists. If there's no library for serialization, it should definitely be written. Emacs Lisp has only a few basic data types, and not all of them have to be supported anyhow. Ted