From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/63784 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: gnus-registry: alist-to-hashtable, hashtable-to-alist Date: Thu, 28 Sep 2006 10:21:51 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: References: <4n3cn9i6kq.fsf@lockgroove.bwh.harvard.edu> <4nznopxxn5.fsf@lockgroove.bwh.harvard.edu> <4nbs11wv0q.fsf@chubby.bwh.harvard.edu> <87u1etsjil.fsf@eris.void.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1159453633 32321 80.91.229.2 (28 Sep 2006 14:27:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Sep 2006 14:27:13 +0000 (UTC) Cc: Andreas Fuchs , Romain Francoise Original-X-From: ding-owner+m12311@lists.math.uh.edu Thu Sep 28 16:27:11 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GSwqI-0008Ed-Nr for ding-account@gmane.org; Thu, 28 Sep 2006 16:26:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1GSwqE-0004HL-00; Thu, 28 Sep 2006 09:26:22 -0500 Original-Received: from nas02.math.uh.edu ([129.7.128.40]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1GSwma-0004HF-00 for ding@lists.math.uh.edu; Thu, 28 Sep 2006 09:22:36 -0500 Original-Received: from quimby.gnus.org ([80.91.227.211]) by nas02.math.uh.edu with esmtp (Exim 4.52) id 1GSwmU-0002qN-W6 for ding@lists.math.uh.edu; Thu, 28 Sep 2006 09:22:36 -0500 Original-Received: from fw01.cmbrmaks.akamai.com ([80.67.64.10] helo=smtp2.akamai.com) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1GSwmO-0004e8-00 for ; Thu, 28 Sep 2006 16:22:24 +0200 Original-Received: from smtp2.akamai.com (vwall.kendall.corp.akamai.com [172.17.4.35]) by smtp2.akamai.com (8.13.8/8.12.10) with ESMTP id k8SEMZwO026587 for ; Thu, 28 Sep 2006 10:22:35 -0400 (EDT) Original-Received: from CN1374059D0130.kendall.corp.akamai.com (CN1374059D0130.kendall.corp.akamai.com [172.16.36.21]) by smtp2.akamai.com (8.13.8/8.12.10) with ESMTP id k8SEMYH1026584; Thu, 28 Sep 2006 10:22:34 -0400 (EDT) Original-To: ding@gnus.org 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" Mail-Followup-To: ding@gnus.org, Andreas Fuchs , Romain Francoise In-Reply-To: (Reiner Steib's message of "Thu, 28 Sep 2006 15:20:09 +0200") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:63784 Archived-At: On 28 Sep 2006, reinersteib+gmane@imap.cc wrote: > [ Digging up a very old message. Therefore Cc-ing involved people.... ] > > On Mon, Feb 24 2003, Andreas Fuchs wrote: > >> Today, Ted Zlatanov wrote: >>> Could something like hashtable-to-alist-string and >>> hashtable-from-alist-string be added to the Gnus core? It would make >>> my life easier, and I'm definitely not the person to write reliable >>> versions of these functions :) >> >> Me neither, but will these help: > ^^^^^^^^^^^^ ??? > > Who actually wrote these functions? ChangeLog.2 says: > > ,----[ ChangeLog.2 ] > | 2003-03-28 Teodor Zlatanov > | > | [...] > | > | * gnus-registry.el (gnus-registry-translate-to-alist) > | (gnus-registry-translate-from-alist, alist-to-hashtable) > | (hashtable-to-alist): new functions > | (gnus-register-spool-action): add a spool item to the registry > `---- > > If Andreas wrote them, it should have been documented it in the > ChangeLog as follows: > > ,---- > | 2003-03-28 Andreas Fuchs > | > | * gnus-registry.el (alist-to-hashtable, hashtable-to-alist): New > | functions. > `---- > > (Andreas has papers on file, so no need to think about "tiny change"). > If Andreas didn't write them, we need to know where they came from. > > We really must be more careful about these issues! I guess it was my mistake. Sorry. > Later these were moved to gnus-util.el and Romain added the following > comment: > > ,----[ gnus-util.el ] > | ;; The following two functions are used in gnus-registry. > | ;; They were contributed by Andreas Fuchs . > `---- > > ,----[ ChangeLog ] > | 2006-04-13 Romain Francoise > | > | * gnus-util.el (gnus-alist-to-hashtable, gnus-hashtable-to-alist): > | Moved here (and renamed) from gnus-registry.el. > | > | * gnus-registry.el: Require gnus-util. > | Use `gnus-alist-to-hashtable' and `gnus-hashtable-to-alist'. > `---- > > [ I'd like to put this change in v5-10 as well, because Gnus functions > should use the "gnus-" prefix. ] > >> (defun alist-to-hashtable (alist) >> "Build a hashtable from the values in ALIST." >> (let ((ht (make-hash-table))) >> (mapc >> (lambda (kv-pair) >> (puthash (car kv-pair) (cdr kv-pair) ht)) >> alist) >> ht)) >> >> (defun hashtable-to-alist (hash) >> "Build an alist from the values in HASH." >> (let ((list nil)) >> (maphash >> (lambda (key value) >> (setq list (cons (cons key value) list)))))) > > [ The current code in gnus-utils.el looks slightly different (see > rev. 6.7): ] > @@ -1,16 +1,21 @@ > -(defun alist-to-hashtable (alist) > +;; The following two functions are used in gnus-registry. > +;; They were contributed by Andreas Fuchs . > +(defun gnus-alist-to-hashtable (alist) > "Build a hashtable from the values in ALIST." > - (let ((ht (make-hash-table))) > + (let ((ht (make-hash-table > + :size 4096 > + :test 'equal))) > (mapc > (lambda (kv-pair) > (puthash (car kv-pair) (cdr kv-pair) ht)) > alist) > ht)) > > -(defun hashtable-to-alist (hash) > +(defun gnus-hashtable-to-alist (hash) > "Build an alist from the values in HASH." > (let ((list nil)) > (maphash > (lambda (key value) > - (setq list (cons (cons key value) list)))))) > - > + (setq list (cons (cons key value) list))) > + hash) > + list)) The newer version of gnus-hashtable-to-alist is correct. The older version is, I think, broken (maphash is called with a nil argument). gnus-alist-to-hashtable is also better in the newer version. I'm OK with all these changes, backported into 5.10 as well. I intended to revise and document gnus-registry.el in addition to working on spam.el again, but my second child born 3 months ago has made my free time very scarce. If someone wants to pick up maintenance of either gnus-registry.el or spam.el, they are welcome to it--otherwise I'll continue to support them as time allows. Thanks Ted