unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 6017@debbugs.gnu.org
Subject: bug#6017: 23.1.96; savehist-printable for hash tables
Date: Fri, 23 Apr 2010 14:15:45 -0400	[thread overview]
Message-ID: <jwvaasughms.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <FD95ABFFD29E434B886CA8F33D1AFC9D@us.oracle.com> (Drew Adams's message of "Fri, 23 Apr 2010 10:49:22 -0700")

> IIUC, starting with Emacs 23.2, we can prin1 and read hash tables. If
> that's correct, then `savehist-printable' could presumably be updated to
> add this sexp to the cond: (hash-table-p value). IOW:
 
> (defun savehist-printable (value)
>   "Return non-nil if VALUE is printable."
>   (cond
>    ((stringp value))
>    ((numberp value))
>    ((symbolp value))
>    ((hash-table-p value))
>    (t
>     (with-temp-buffer
>       (condition-case nil
>    (let ((print-readably t) (print-level nil))
>    (prin1 value (current-buffer))
>    (read (point-min-marker))
>    t)
>  (error nil))))))

That won't check whether the contents of the has-table are
themsevles printable.


        Stefan







  reply	other threads:[~2010-04-23 18:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23 17:49 bug#6017: 23.1.96; savehist-printable for hash tables Drew Adams
2010-04-23 18:15 ` Stefan Monnier [this message]
2010-04-23 18:34   ` Drew Adams
2010-04-25 18:30     ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvaasughms.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=6017@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).