Jamie, Could you please apply this patch to bbdb-hooks.el to allow the use of pseudo-headers in the auto-notes-alist, and also to allow the STRING field of the auto-notes-alist entry to be either a string, integer, or a function ? The first part of the patch makes the bbdb-extract-field function stop at the start of the real message (i.e. past any pseudo-headers such as "Archive-name:") instead of at the formal start of the message. The second part of the patch allows the bbdb-auto-notes-hookd function to treat the STRING field of an auto-notes-alist entry as a function if it is not a string or an integer, and to call that function with the message field contents. I believe the addition of this patch will allow much more flexibility in the extraction of data from messages. Please let me know whether you will include it or not. The patch is against the bbdb-hooks.el included in bbdb-1.48. =================================================================== RCS file: /home/bing/rwhitby/cvs/elib/bbdb/bbdb-hooks.el,v retrieving revision 1.1.1.2 diff -c -r1.1.1.2 bbdb-hooks.el *** 1.1.1.2 1993/04/07 01:08:35 --- bbdb-hooks.el 1993/08/03 09:28:54 *************** *** 99,105 **** (setq field-name (concat (regexp-quote field-name) "[ \t]*:[ \t]*")) (let (done) (while (not (or done ! (looking-at "\n") ; we're at BOL (eobp))) (if (looking-at field-name) (progn --- 99,105 ---- (setq field-name (concat (regexp-quote field-name) "[ \t]*:[ \t]*")) (let (done) (while (not (or done ! (looking-at "^[^ \t][^:]+$") ; start of real message (eobp))) (if (looking-at field-name) (progn *************** *** 226,236 **** --- 226,241 ---- (\"Organization\" (\".*\" company \"\\\\&\")) \(Note you need two \\ to get a single \\ into a lisp string literal.\) + If STRING is an integer N, the N'th matching subexpression is used, so the above example could be written more efficiently as (\"Organization\" (\".*\" company 0)) + If STRING is neither a string or an integer, it should be a function + which is called with the contents of the field, and the result of the + function call is used. + If REPLACE-P is t, the string replaces the old contents instead of being appended to it. *************** *** 340,352 **** (not (string-match re fieldval)) t))))) ;; An integer as STRING is an index into match-data: (if did-match (setq string ! (if (integerp string) ; backward compat ! (substring fieldval ! (match-beginning string) ! (match-end string)) ! (bbdb-auto-expand-newtext fieldval string)))) ;; need expanded version of STRING here: (if (and did-match (not (and notes --- 345,362 ---- (not (string-match re fieldval)) t))))) ;; An integer as STRING is an index into match-data: + ;; A function as STRING calls the function on fieldval: (if did-match (setq string ! (cond ((integerp string) ; backward compat ! (substring fieldval ! (match-beginning string) ! (match-end string))) ! ((stringp string) ! (bbdb-auto-expand-newtext fieldval string)) ! (t ! (funcall string fieldval)) ! ))) ;; need expanded version of STRING here: (if (and did-match (not (and notes -- --------------------------------------------- _--_|\ | Rod Whitby ([EMAIL PROTECTED]) / \ | Canon Information Systems Research Australia \_.--._/ | 1 Thomas Holt Drive, North Ryde, N.S.W., 2113. v |