Re: [PATCH] emacs: functions to import sender or recipient into BBDB
authorDaniel Bergey <bergey@alum.mit.edu>
Mon, 19 Nov 2012 00:08:49 +0000 (19:08 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:44 +0000 (09:50 -0800)
2a/1d5c2165430357c6bfd98fdae1e6930e69ee80 [new file with mode: 0644]

diff --git a/2a/1d5c2165430357c6bfd98fdae1e6930e69ee80 b/2a/1d5c2165430357c6bfd98fdae1e6930e69ee80
new file mode 100644 (file)
index 0000000..3eb715a
--- /dev/null
@@ -0,0 +1,119 @@
+Return-Path: <bergey@alum.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id BC6FB431FBD\r
+       for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 16:15:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Cv8QOG6t--a8 for <notmuch@notmuchmail.org>;\r
+       Sun, 18 Nov 2012 16:15:47 -0800 (PST)\r
+X-Greylist: delayed 414 seconds by postgrey-1.32 at olra;\r
+       Sun, 18 Nov 2012 16:15:47 PST\r
+Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com\r
+       [66.111.4.28])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D15D0431FB6\r
+       for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 16:15:47 -0800 (PST)\r
+Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45])\r
+       by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 2C3DD207B0;\r
+       Sun, 18 Nov 2012 19:08:51 -0500 (EST)\r
+Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161])\r
+       by compute5.internal (MEProxy); Sun, 18 Nov 2012 19:08:51 -0500\r
+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=\r
+       messagingengine.com; h=from:to:subject:in-reply-to:references\r
+       :date:message-id:mime-version:content-type; s=smtpout; bh=rKazuH\r
+       XK+WKxURGcsUm5HA1eoqM=; b=Be4nohlfPjHE4g4wL3XGJGZVnSaIuAXgE6efYv\r
+       dufsPEWPGHrnGEt2RW6ghEgxk1xjwoRHTapWwsmLcKJDMRk4/301ccjBit05peMB\r
+       BFBD/ctGQK6D++Eweqs9i52DuvEkTYdpTwsizx9tsuUpIAETz6ejfVgXgk5FEUyN\r
+       5/pUY=\r
+X-Sasl-enc: tDSlzH6XPZe9L+BIKs5T19fWzHuD4ABVuDkpS1VkWShY 1353283730\r
+Received: from localhost (unknown [66.80.90.109])\r
+       by mail.messagingengine.com (Postfix) with ESMTPA id D92E748263D;\r
+       Sun, 18 Nov 2012 19:08:50 -0500 (EST)\r
+From: Daniel Bergey <bergey@alum.mit.edu>\r
+To: Notmuch Mail List <notmuch@notmuchmail.org>,\r
+       Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+Subject: Re: [PATCH] emacs: functions to import sender or recipient into BBDB\r
+In-Reply-To: <87ipa66pne.fsf@betacantrips.com>\r
+References: <87lii62sk2.fsf@wonderlust.lan> <87ipa66pne.fsf@betacantrips.com>\r
+User-Agent: Notmuch/0.14 (http://notmuchmail.org) Emacs/24.2.1\r
+       (i486-pc-linux-gnu)\r
+Date: Sun, 18 Nov 2012 19:08:49 -0500\r
+Message-ID: <87ip92zc6m.fsf@wonderlust.lan>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 19 Nov 2012 00:15:52 -0000\r
+\r
+On 2012-10-19 at 18:52, Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> wrote:\r
+> Daniel Bergey <bergey@alum.mit.edu> writes:\r
+>\r
+>> From a show buffer, bbdb/notmuch-snarf-from imports the sender into\r
+>> bbdb.  bbdb/notmuch-snarf-to attempts to import all recipients.  BBDB\r
+>> displays a buffer with each contact; C-g displays the next contact, or\r
+>> returns to the notmuch-show buffer.\r
+>>\r
+>> This is my first notmuch patch.  Comments very welcome.\r
+>>\r
+>> +(defun bbdb/snarf-between-commas ()\r
+>> +  ; What about names written "Surname, First M" <user@server.tld>?\r
+>\r
+> I do think more sophisticated parsing is necessary. If you're lucky,\r
+> somebody else already has a library to parse email addresses in this\r
+> form.\r
+\r
+I spent the afternoon digging around in BBDB internals.  They include a\r
+function that parses the contents of a header, and handles commas\r
+intelligently.  It replaces essentially all the code in my small patch,\r
+so I won't respond to your detailed comments, much as I appreciated\r
+them.\r
+\r
+I have working code using bbdb-get-addresses, but I have a few questions\r
+before I email the revised patch.\r
+\r
+1) Is there a canonical list of header names used by notmuch?  I'm\r
+trying to fill in this alist to match the BBDB interface.  It should be\r
+fine to leave blank any that notmuch doesn't handle.\r
+\r
+(defvar bbdb/notmuch-header-by-name\r
+  ;; both are case sensitive\r
+  '( ("From" . :From)\r
+       ("To" . :To)\r
+       ("CC" . :Cc)\r
+       ("BCC" . :Bcc)\r
+       ("Resent-From" . )\r
+       ("Reply-To" . )\r
+       ("Resent-To" . )\r
+       ("Resent-CC" . ))\r
+  "Alist for dispatching header symbols as used by notmuch-show-get-header\r
+from strings as used by notmuch-show-get-header")\r
+\r
+2) What's the consensus on naming conventions?  BBDB has functions for\r
+other mail clients with names like bbdb/gnus-* and bbdb/vm-*.  I\r
+imitated this convention, but maybe it's better to leave the bbdb/*\r
+namespace to BBDB itself, and use a prefix like notmuch-bbdb-* or\r
+notmuch-bbdb/* (Regardless, I moved everything to notmuch-address.el, as\r
+suggested)\r
+\r
+Thanks,\r
+Daniel\r