help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loading hash-table from a file?


From: Teemu Likonen
Subject: Re: loading hash-table from a file?
Date: Thu, 05 Jan 2012 11:11:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

* 2012-01-05T10:35:18+02:00 * Valentin Baciu wrote:

> In my Emacs 24, I can read back a printed (simple) hash table. I am
> not sure weather using more complex data types as values will also
> work.
>
> ;; Writing the hash table to a "database" file
>
> (with-current-buffer (find-file-noselect "/tmp/x")
>   (let ((h (make-hash-table)))
>     (puthash 'a 0 h)
>     (puthash 'b 1 h)
>     (insert (format "%s" h))
>     (save-buffer)))

Use the %S format character to print objects in machine-readable (i.e.,
READ) format.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]