From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/39675 Path: main.gmane.org!not-for-mail From: Per Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: new Mail-Followup-To patch...please take a look... Date: Wed, 24 Oct 2001 17:02:16 +0200 Organization: The Church of Emacs Sender: owner-ding@hpc.uh.edu Message-ID: References: <87wv1m9y6j.fsf@mclinux.com> <87bsixhk7t.fsf@mclinux.com> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035175349 29235 80.91.224.250 (21 Oct 2002 04:42:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 04:42:29 +0000 (UTC) Return-Path: Original-Received: (qmail 6420 invoked from network); 24 Oct 2001 15:04:51 -0000 Original-Received: from malifon.math.uh.edu (mail@129.7.128.13) by mastaler.com with SMTP; 24 Oct 2001 15:04:51 -0000 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 15wPYg-00067a-00; Wed, 24 Oct 2001 10:03:06 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Wed, 24 Oct 2001 10:02:43 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id KAA12012 for ; Wed, 24 Oct 2001 10:02:29 -0500 (CDT) Original-Received: (qmail 6352 invoked by alias); 24 Oct 2001 15:02:44 -0000 Original-Received: (qmail 6347 invoked from network); 24 Oct 2001 15:02:44 -0000 Original-Received: from sheridan.dina.kvl.dk (130.225.40.227) by gnus.org with SMTP; 24 Oct 2001 15:02:44 -0000 Original-Received: from ssv2.dina.kvl.dk (ssv2.dina.kvl.dk [130.225.40.226]) by sheridan.dina.kvl.dk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id RAA04080; Wed, 24 Oct 2001 17:02:16 +0200 Original-Received: from abraham by ssv2.dina.kvl.dk with local (Exim 3.12 #1 (Debian)) id 15wPXs-0004rb-00; Wed, 24 Oct 2001 17:02:16 +0200 Original-To: ding@gnus.org X-Face: +kRV2]2q}lixHkE{U)mY#+6]{AH=yN~S9@IFiOa@X6?GM|8MBp/ Original-Lines: 78 User-Agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.106 (i686-pc-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:39675 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:39675 Josh Huber writes: > This one incorporates (I think) all of the changes that people have > mentioned. Caching, defaulting to use the to-(address|list) unless a > not-subscribed group parameter is present, automatically inserting > this caching function into message-subscribed-address-functions on > startup, etc. I disagree with most of the changes. Caches tend to get out of sync and add complexity, much better to make the primary access functions fast. I have a included a version which I think is "fast enough" when byte compiled. I have committed gnus-group-fast-parameter to CVS. I already argued against "non-subscribed", and Emacs Lisp code should not modify user options. I don't know how to do the later right, but perhaps something like how message-post-method is implemented. Here is a fast (when byte-compiled) version of `gnus-find-subscribed-addresses': (defun gnus-expand-group-parameter (match value group) "Use MATCH to expand VALUE in GROUP." (with-temp-buffer (insert group) (goto-char (point-min)) (while (re-search-forward match nil t) (replace-match value)) (buffer-string))) (defun gnus-group-fast-parameter (group symbol &optional allow-list) "For GROUP, return the value of SYMBOL. You should call this in the `gnus-group-buffer' buffer. The function `gnus-group-find-parameter' will do that for you." ;; The speed trick: No cons'ing and quit early. (or (let ((params (funcall gnus-group-get-parameter-function group))) ;; Start easy, check the "real" group parameters. (gnus-group-parameter-value params symbol allow-list)) ;; We didn't found it there, try `gnus-parameters'. (let ((result nil) (head nil) (tail gnus-parameters)) ;; A good old-fashioned non-cl loop. (while tail (setq head (car tail) tail (cdr tail)) ;; The car is regexp matching for matching the group name. (when (string-match (car head) group) ;; The cdr is the parameters. (setq result (gnus-group-parameter-value (cdr head) symbol allow-list)) (when result ;; Expand if necessary. (if (and (stringp result) (string-match "\\\\" result)) (setq result (gnus-expand-group-parameter (car head) result group))) ;; Exit the loop early. tail nil))) ;; Done. result))) (defun gnus-find-subscribed-addresses () "Return a regexp matching the addresses of all subscribed mail groups. It consists of the `to-address' or `to-list' parameter of all groups with a nil `not-subscribed' parameter." (save-excursion (set-buffer gnus-group-buffer) (let ((addresses)) (mapc (lambda (entry) (let ((group (car entry))) (when (gnus-group-fast-parameter group 'subscribed) (let ((address (or (gnus-group-fast-parameter group 'to-address) (gnus-group-fast-parameter group 'to-list)))) (when address (setq addresses (cons address addresses))))))) (cdr gnus-newsrc-alist)) (mapconcat 'regexp-quote addresses "\\|"))))