GNU bug report logs - #6017
23.1.96; savehist-printable for hash tables

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Fri, 23 Apr 2010 17:52:01 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6017 in the body.
You can then email your comments to 6017 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6017; Package emacs. (Fri, 23 Apr 2010 17:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 23 Apr 2010 17:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 23.1.96; savehist-printable for hash tables
Date: 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))))))

In GNU Emacs 23.1.96.1 (i386-mingw-nt5.1.2600)
 of 2010-04-20 on G41R2F1
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include'
 






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6017; Package emacs. (Fri, 23 Apr 2010 18:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 6017 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 6017 <at> debbugs.gnu.org
Subject: Re: bug#6017: 23.1.96; savehist-printable for hash tables
Date: Fri, 23 Apr 2010 14:15:45 -0400
> 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





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6017; Package emacs. (Fri, 23 Apr 2010 18:36:01 GMT) Full text and rfc822 format available.

Message #11 received at 6017 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> IRO.UMontreal.CA>
Cc: 6017 <at> debbugs.gnu.org
Subject: RE: bug#6017: 23.1.96; savehist-printable for hash tables
Date: Fri, 23 Apr 2010 11:34:55 -0700
> That won't check whether the contents of the has-table are
> themsevles printable.

Good point. I don't know how the support for printing & reading hash tables
works. If it just ensures that the top level is readable (the hash table
itself), then yes, there is no guarantee that its content is really readable.

Is this feature of hash-table print+read support specified anywhere, so we know
what the support really is? If not, could you please document it? 

It sounds like it is similar to printing a list - no guarantees about
readability of list members etc. If so, we should at least say that somewhere.





Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Sun, 25 Apr 2010 18:31:02 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Sun, 25 Apr 2010 18:31:02 GMT) Full text and rfc822 format available.

Message #16 received at 6017-done <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 6017-done <at> debbugs.gnu.org, 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#6017: 23.1.96; savehist-printable for hash tables
Date: Sun, 25 Apr 2010 14:30:35 -0400
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Is this feature of hash-table print+read support specified anywhere,
> so we know what the support really is? If not, could you please
> document it?

See `Creating Hash Tables' in the Lisp manual.





Message #17 received at 6017-done <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> stupidchicken.com>
Cc: 6017-done <at> debbugs.gnu.org, 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>
Subject: RE: bug#6017: 23.1.96; savehist-printable for hash tables
Date: Sun, 25 Apr 2010 11:59:45 -0700
> > Is this feature of hash-table print+read support specified anywhere,
> > so we know what the support really is? If not, could you please
> > document it?
> 
> See `Creating Hash Tables' in the Lisp manual.

That explanation seems clear and complete. Thx. 





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 May 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.