Gnus development mailing list
 help / color / mirror / Atom feed
From: Per Abrahamsen <abraham@dina.kvl.dk>
Subject: Re: new Mail-Followup-To patch...please take a look...
Date: Wed, 24 Oct 2001 17:02:16 +0200	[thread overview]
Message-ID: <rjadyhytc7.fsf@ssv2.dina.kvl.dk> (raw)
In-Reply-To: <87bsixhk7t.fsf@mclinux.com>

Josh Huber <huber@alum.wpi.edu> 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 "\\|"))))



  reply	other threads:[~2001-10-24 15:02 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-23 15:24 Josh Huber
2001-10-23 15:42 ` Josh Huber
2001-10-23 16:32 ` Paul Jarc
2001-10-23 16:54   ` Josh Huber
2001-10-23 17:45     ` Paul Jarc
2001-10-23 18:54       ` Matt Armstrong
2001-10-23 19:53         ` Paul Jarc
2001-10-24  0:34           ` Josh Huber
2001-10-24 11:35         ` Per Abrahamsen
2001-10-24 12:48           ` Josh Huber
2001-10-24 16:31           ` Paul Jarc
2001-10-24 17:08             ` Per Abrahamsen
2001-10-24 17:18               ` Paul Jarc
2001-10-26  6:24           ` Kai Großjohann
2001-10-27 23:23           ` Florian Weimer
2001-10-23 16:56   ` Josh Huber
2001-10-23 17:32     ` Per Abrahamsen
2001-10-23 23:53       ` Josh Huber
2001-10-23 22:40   ` Davide G. M. Salvetti
2001-10-24  1:40     ` Paul Jarc
2001-10-24 12:45       ` Davide G. M. Salvetti
2001-10-24 13:44         ` Samuel Padgett
2001-10-24 15:23           ` Paul Jarc
2001-10-24 15:42             ` Per Abrahamsen
2001-10-24 15:51             ` Samuel Padgett
2001-10-26  6:28     ` Kai Großjohann
2001-10-27  1:19       ` Barry Fishman
2001-10-29 14:49         ` Kai Großjohann
2001-10-27 22:27     ` Florian Weimer
2001-10-24  1:59 ` Josh Huber
2001-10-24 15:02   ` Per Abrahamsen [this message]
2001-10-24 16:48     ` Paul Jarc
2001-10-24 17:13       ` Per Abrahamsen
2001-10-25  1:52     ` Josh Huber
2001-10-24 16:13   ` Paul Jarc
2001-10-24 17:19     ` Per Abrahamsen
2001-10-24 17:28       ` Paul Jarc
2001-10-24 17:38         ` Per Abrahamsen
2001-10-25  1:45           ` Josh Huber
2001-10-25 18:48           ` Josh Huber
2001-10-29 21:58             ` Matt Armstrong
2001-10-29 22:19               ` Josh Huber
2001-10-29 22:31                 ` Paul Jarc
2001-10-30  2:47                   ` Josh Huber
2001-10-30  3:11                     ` Paul Jarc
2001-10-30  3:49                   ` Matt Armstrong
2001-10-30 12:55             ` Per Abrahamsen
2001-10-30 15:31               ` Josh Huber
2001-10-31 13:44             ` ShengHuo ZHU
2001-10-31 17:28               ` Matt Armstrong
2001-10-31 17:51                 ` Josh Huber
2001-10-31 18:22                 ` ShengHuo ZHU
2001-10-26  6:34         ` Kai Großjohann
2001-10-26  9:07           ` Per Abrahamsen

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=rjadyhytc7.fsf@ssv2.dina.kvl.dk \
    --to=abraham@dina.kvl.dk \
    /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).