Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id BC6FB431FBD for ; Sun, 18 Nov 2012 16:15:51 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cv8QOG6t--a8 for ; Sun, 18 Nov 2012 16:15:47 -0800 (PST) X-Greylist: delayed 414 seconds by postgrey-1.32 at olra; Sun, 18 Nov 2012 16:15:47 PST Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D15D0431FB6 for ; Sun, 18 Nov 2012 16:15:47 -0800 (PST) Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 2C3DD207B0; Sun, 18 Nov 2012 19:08:51 -0500 (EST) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute5.internal (MEProxy); Sun, 18 Nov 2012 19:08:51 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:in-reply-to:references :date:message-id:mime-version:content-type; s=smtpout; bh=rKazuH XK+WKxURGcsUm5HA1eoqM=; b=Be4nohlfPjHE4g4wL3XGJGZVnSaIuAXgE6efYv dufsPEWPGHrnGEt2RW6ghEgxk1xjwoRHTapWwsmLcKJDMRk4/301ccjBit05peMB BFBD/ctGQK6D++Eweqs9i52DuvEkTYdpTwsizx9tsuUpIAETz6ejfVgXgk5FEUyN 5/pUY= X-Sasl-enc: tDSlzH6XPZe9L+BIKs5T19fWzHuD4ABVuDkpS1VkWShY 1353283730 Received: from localhost (unknown [66.80.90.109]) by mail.messagingengine.com (Postfix) with ESMTPA id D92E748263D; Sun, 18 Nov 2012 19:08:50 -0500 (EST) From: Daniel Bergey To: Notmuch Mail List , Ethan Glasser-Camp Subject: Re: [PATCH] emacs: functions to import sender or recipient into BBDB In-Reply-To: <87ipa66pne.fsf@betacantrips.com> References: <87lii62sk2.fsf@wonderlust.lan> <87ipa66pne.fsf@betacantrips.com> User-Agent: Notmuch/0.14 (http://notmuchmail.org) Emacs/24.2.1 (i486-pc-linux-gnu) Date: Sun, 18 Nov 2012 19:08:49 -0500 Message-ID: <87ip92zc6m.fsf@wonderlust.lan> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 00:15:52 -0000 On 2012-10-19 at 18:52, Ethan Glasser-Camp wrote: > Daniel Bergey 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" ? > > 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