Hello Some weeks ago I asked about a function which would generate a entry in the nnimap-split-fancy method. This entry would be based on a relevant entry in the bbdb entry, in this example imap.
Now I digged out a function in google which almost does what I want. See below. However in generates a entry of the form (("From" "[EMAIL PROTECTED]" "testimap")) instead of ("From" "[EMAIL PROTECTED]" "testimap") I debugged the function and it seems the problem is (setq new-elmnt-list (cons (list Which seems to cause the (( Could anybody please give me a hint how to eliminate on of the parenthesis. Than I could just plug in that function into the gnus-splitting method, like nnimap-split-fancy '(| (: my:nnimap-folder-list-from-bbdb) Thanks Uwe Brauer Here comes the function. (defun my:nnimap-folder-list-from-bbdb () "Return a list of \(From email-regexp folder-name\) tuples based on the contents of the bbdb. The folder-name is the value of the 'imap attribute on the bbdb record; the email-regexp consists of all the email addresses for the bbdb record concatenated with with OR. bbdb records without a 'imap attribute are ignored. This function uses regexp-opt to generate the email-regexp which automatically regexp-quotes its arguments." ;(interactive) (let (;; the raw-notes attribute of a bbdb record notes-attr ;; the value of the 'imap attribute of a bbdb record folder-attr ;; strings to put before and after the folder-attr (folder-prefix "") (folder-postfix "") ;; a regexp matching all the email addresses from a bbdb record email-regexp ;; the list of (folder email) tuples to return new-elmnt-list ) ;; loop over the bbdb-records; if a imap attribute exists on ;; the record, generate a regexp matching all the email addresses ;; and add a tuple (folder email-regexp) to the new-elmnt-list (dolist (record (bbdb-records)) (setq notes-attr (bbdb-record-raw-notes record)) (when (and (listp notes-attr) (setq folder-attr (cdr (assq 'imap notes-attr)))) (setq email-regexp (regexp-opt (mapcar 'downcase (bbdb-record-net record)))) (unless (zerop (length email-regexp)) (setq new-elmnt-list (cons (list "From" email-regexp (concat folder-prefix folder-attr folder-postfix)) new-elmnt-list))))) new-elmnt-list)) ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/