Gnus development mailing list
 help / color / mirror / Atom feed
From: David Z Maze <dmaze@MIT.EDU>
Subject: Re: bbdb and nnmail-split-fancy
Date: Wed, 03 Apr 2002 19:49:17 -0500	[thread overview]
Message-ID: <y68bsd0gueq.fsf@multics.mit.edu> (raw)
In-Reply-To: <g08r8lw1ja4.fsf@zzz.cisco.com> (Michael Cook's message of "Wed, 03 Apr 2002 17:58:43 -0500")

Michael Cook <michael@waxrat.com> writes:
> does anyone know offhand how to get nnmail-split-fancy to pay
> attention to what's in my bbdb address book?
> that is, i want to say:
> 
>  if the message is addressed to me then
>     if the message is from someone in my address book
>        put the message into my inbox
>     else
>        put the message into the folder "other".

My .gnus file has the following construct:

(defun dzm-bbdb-split-fancy ()
  "Create a fancy mail split according to bbdb rules.
Look at entries in the bbdb.  For every entry with a \"mail-group\"
field, generate an appropriate split."
  (cons '&
	(apply 'nconc
	       (mapcan
		(lambda (rec)
		  (let ((nets (bbdb-record-net rec))
			(group (bbdb-record-getprop rec 'mail-group)))
		    (if group
			(cons
			 (mapcar
			  (lambda (net)
			    (list 'any (regexp-quote net) group))
			  nets)
			 nil))))
		(bbdb-records)))))

This looks rather Schemeful to me now, probably because I wrote it
around the time I was taking 6.001, MIT's introductory computer
science class, which apparently the esteemed Mr. Saklad hasn't had the
benefit of.  But the output of this can be dropped directly into
nnmail-split-fancy, like so:

(setq nnmail-split-fancy
      ;; Split to the first matching...
      `(|
        ;; Mailing lists...
        (&
         (any "ding@gnus\\.org" "mail.lists.ding")
         ;; etc.
        )
        ;; Individuals we know of from bbdb
        ,(dzm-bbdb-split-fancy)
        ;; Personal mail (or not)
        (any "dmaze@.*mit\\.edu" "mail.misc.personal")
        "mail.misc.impersonal"))

(Now, to figure out how to augment this recipe to use the new spam.el
stuff...)

-- 
David Maze             dmaze@mit.edu          http://www.mit.edu/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell




  reply	other threads:[~2002-04-04  0:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-03 22:58 Michael Cook
2002-04-04  0:49 ` David Z Maze [this message]
2002-04-06  7:07 ` Michael Cook
2002-04-06  7:39 ` Jack Twilley
2002-04-06 17:20   ` Michael Cook
2002-04-06 20:46     ` Jack Twilley

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=y68bsd0gueq.fsf@multics.mit.edu \
    --to=dmaze@mit.edu \
    /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).