From: Ted Zlatanov <tzz@lifelogs.com>
Cc: Andreas Fuchs <asf@void.at>, Romain Francoise <romain@orebokech.com>
Subject: Re: gnus-registry: alist-to-hashtable, hashtable-to-alist
Date: Thu, 28 Sep 2006 10:21:51 -0400 [thread overview]
Message-ID: <g69ven8t6kg.fsf@CN1374059D0130.kendall.corp.akamai.com> (raw)
In-Reply-To: <v9psdgw2k6.fsf_-_@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Thu, 28 Sep 2006 15:20:09 +0200")
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 <tzz@lifelogs.com> 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 <tzz@lifelogs.com>
> |
> | [...]
> |
> | * 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 <asf@void.at>
> |
> | * 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 <asf@void.at>.
> `----
>
> ,----[ ChangeLog ]
> | 2006-04-13 Romain Francoise <romain@orebokech.com>
> |
> | * 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 <asf@void.at>.
> +(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
next prev parent reply other threads:[~2006-09-28 14:21 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-31 17:15 message registry for Gnus Ted Zlatanov
2003-02-01 10:28 ` Kai Großjohann
2003-02-01 16:39 ` Lars Magne Ingebrigtsen
2003-02-01 20:20 ` Ted Zlatanov
2003-02-02 12:10 ` Lars Magne Ingebrigtsen
2003-02-02 15:14 ` Ted Zlatanov
2003-02-07 12:20 ` Lars Magne Ingebrigtsen
2003-02-02 16:54 ` Kai Großjohann
2003-02-03 20:47 ` Ted Zlatanov
2003-02-04 15:25 ` Simon Josefsson
2003-02-04 19:57 ` Ted Zlatanov
2003-02-05 5:56 ` Simon Josefsson
2003-02-07 20:43 ` Ted Zlatanov
2003-02-02 0:35 ` Raja R Harinath
2003-02-02 1:30 ` Ted Zlatanov
2003-02-02 17:15 ` Raja R Harinath
2003-02-07 20:48 ` Ted Zlatanov
2003-02-07 21:10 ` Lars Magne Ingebrigtsen
2003-02-07 22:45 ` Ted Zlatanov
2003-02-08 20:39 ` Lars Magne Ingebrigtsen
2003-02-21 19:05 ` Ted Zlatanov
2003-02-22 22:20 ` Lars Magne Ingebrigtsen
2003-02-24 15:36 ` Ted Zlatanov
2003-02-24 16:58 ` Andreas Fuchs
2006-09-28 13:20 ` gnus-registry: alist-to-hashtable, hashtable-to-alist (was: message registry for Gnus) Reiner Steib
2006-09-28 14:21 ` Ted Zlatanov [this message]
2006-09-28 16:03 ` gnus-registry: alist-to-hashtable, hashtable-to-alist CHENG Gao
2006-09-28 16:58 ` Reiner Steib
2003-02-24 21:57 ` message registry for Gnus Lars Magne Ingebrigtsen
2003-02-24 22:14 ` Ted Zlatanov
2003-02-25 7:19 ` Kai Großjohann
2003-02-25 17:57 ` Ted Zlatanov
2003-03-28 9:20 ` Ted Zlatanov
2003-04-16 20:35 ` Ted Zlatanov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=g69ven8t6kg.fsf@CN1374059D0130.kendall.corp.akamai.com \
--to=tzz@lifelogs.com \
--cc=asf@void.at \
--cc=romain@orebokech.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.
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 NNTP newsgroup(s).