From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/63783 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.general Subject: gnus-registry: alist-to-hashtable, hashtable-to-alist (was: message registry for Gnus) Date: Thu, 28 Sep 2006 15:20:09 +0200 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> Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1159449860 17285 80.91.229.2 (28 Sep 2006 13:24:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Sep 2006 13:24:20 +0000 (UTC) Cc: Andreas Fuchs , Ted Zlatanov , Romain Francoise Original-X-From: ding-owner+m12310@lists.math.uh.edu Thu Sep 28 15:24:16 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 1GSvrk-0007DE-Ex for ding-account@gmane.org; Thu, 28 Sep 2006 15:23:53 +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 1GSvrf-00044f-00; Thu, 28 Sep 2006 08:23:47 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1GSvoS-00044a-00 for ding@lists.math.uh.edu; Thu, 28 Sep 2006 08:20:28 -0500 Original-Received: from quimby.gnus.org ([80.91.227.211]) by mx1.math.uh.edu with esmtp (Exim 4.52) id 1GSvoM-0004XT-TJ for ding@lists.math.uh.edu; Thu, 28 Sep 2006 08:20:28 -0500 Original-Received: from mail.uni-ulm.de ([134.60.1.1]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1GSvoK-0003rB-00 for ; Thu, 28 Sep 2006 15:20:20 +0200 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.123]) by mail.uni-ulm.de (8.13.8/8.13.8) with ESMTP id k8SDKADS017193; Thu, 28 Sep 2006 15:20:10 +0200 (MEST) Original-Received: by bridgekeeper.physik.uni-ulm.de (Postfix, from userid 170) id 8BD7112102; Thu, 28 Sep 2006 15:20:09 +0200 (CEST) Original-To: ding@gnus.org Mail-Followup-To: ding@gnus.org, Andreas Fuchs , Ted Zlatanov , Romain Francoise X-Face: :6KQZ[nyoS_edmB.%gw-=)BYth^|2+Y+^cu%I$FSx!&>-'om>3H7A|M&n(V7fIo3P.;yo.b yq4$p;ZaBtkv)\}biaiBQe"mD}iib1AA@99-fZ7i*bLhNRVC&0Wkxg9)SH?oWc@{ In-Reply-To: <87u1etsjil.fsf@eris.void.at> (Andreas Fuchs's message of "Mon\, 24 Feb 2003 16\:58\:14 +0000 \(UTC\)") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) X-DCC-CTc-dcc2-Metrics: gemini 1031; Body=4 Fuz1=4 Fuz2=4 X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:63783 Archived-At: [ 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! 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): ] --8<---------------cut here---------------start------------->8--- @@ -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)) --8<---------------cut here---------------end--------------->8--- Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/