[PATCH] emacs: functions to import sender or recipient into BBDB
Daniel Bergey
bergey at alum.mit.edu
Sun Nov 18 16:08:49 PST 2012
On 2012-10-19 at 18:52, Ethan Glasser-Camp <ethan.glasser.camp at gmail.com> wrote:
> Daniel Bergey <bergey at alum.mit.edu> writes:
>
>> From a show buffer, bbdb/notmuch-snarf-from imports the sender into
>> bbdb. bbdb/notmuch-snarf-to attempts to import all recipients. BBDB
>> displays a buffer with each contact; C-g displays the next contact, or
>> returns to the notmuch-show buffer.
>>
>> This is my first notmuch patch. Comments very welcome.
>>
>> +(defun bbdb/snarf-between-commas ()
>> + ; What about names written "Surname, First M" <user at server.tld>?
>
> I do think more sophisticated parsing is necessary. If you're lucky,
> somebody else already has a library to parse email addresses in this
> form.
I spent the afternoon digging around in BBDB internals. They include a
function that parses the contents of a header, and handles commas
intelligently. It replaces essentially all the code in my small patch,
so I won't respond to your detailed comments, much as I appreciated
them.
I have working code using bbdb-get-addresses, but I have a few questions
before I email the revised patch.
1) Is there a canonical list of header names used by notmuch? I'm
trying to fill in this alist to match the BBDB interface. It should be
fine to leave blank any that notmuch doesn't handle.
(defvar bbdb/notmuch-header-by-name
;; both are case sensitive
'( ("From" . :From)
("To" . :To)
("CC" . :Cc)
("BCC" . :Bcc)
("Resent-From" . )
("Reply-To" . )
("Resent-To" . )
("Resent-CC" . ))
"Alist for dispatching header symbols as used by notmuch-show-get-header
from strings as used by notmuch-show-get-header")
2) What's the consensus on naming conventions? BBDB has functions for
other mail clients with names like bbdb/gnus-* and bbdb/vm-*. I
imitated this convention, but maybe it's better to leave the bbdb/*
namespace to BBDB itself, and use a prefix like notmuch-bbdb-* or
notmuch-bbdb/* (Regardless, I moved everything to notmuch-address.el, as
suggested)
Thanks,
Daniel
More information about the notmuch
mailing list