--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 E5567431E64\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Mar 2013 11:40:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 aTEbxptbmDJ1 for <notmuch@notmuchmail.org>;\r
+ Sun, 31 Mar 2013 11:40:28 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 03F77431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Mar 2013 11:40:28 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 9C347100086;\r
+ Sun, 31 Mar 2013 21:40:26 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Daniel Bergey <bergey@alum.mit.edu>,\r
+ 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: <876207sa74.fsf@chladni.lan>\r
+References: <87lii62sk2.fsf@wonderlust.lan> <87ipa66pne.fsf@betacantrips.com>\r
+ <87ip92zc6m.fsf@wonderlust.lan> <87ip64gdpg.fsf@chladni.lan>\r
+ <m21uccsr3w.fsf@guru.guru-group.fi> <876207sa74.fsf@chladni.lan>\r
+User-Agent: Notmuch/0.15.2+50~g43fdda5 (http://notmuchmail.org) Emacs/24.2.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 31 Mar 2013 21:40:26 +0300\r
+Message-ID: <m26207wgyt.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Cc: Chris Thachuk <chris.thachuk@cs.ox.ac.uk>\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: Sun, 31 Mar 2013 18:40:29 -0000\r
+\r
+On Sun, Mar 31 2013, Daniel Bergey wrote:\r
+\r
+>>From fbaf5c568876a6f1e3d8c02446bd83331b6325f0 Mon Sep 17 00:00:00 2001\r
+> From: Daniel Bergey <bergey@alum.mit.edu>\r
+> Date: Thu, 26 Jul 2012 15:44:01 -0400\r
+> Subject: [PATCH] emacs: functions to import sender or recipients into BBDB\r
+>\r
+>>From a show buffer, notmuch-bbdb/snarf-from imports the sender into\r
+> bbdb. notmuch-bbdb/snarf-to imports all recipients. Newly imported\r
+> contacts are reported in the minibuffer / Messages buffer.\r
+>\r
+> Both functions use the BBDB parser to recognize email address formats.\r
+> ---\r
+\r
+LGTM, although git commit --amend is needed after git am to clean \r
+the junk in commit message (just deleting content).\r
+\r
+Tomi\r
+\r
+> This differs from the last version of the patch only in whitespace. In\r
+> addition to changes pointed out by Tomi Ollila, I fixed a ')' on a line\r
+> alone, and aligned the lines of notmuch-bbdb/header-by-name.\r
+>\r
+> I've been using this code (prior to whitespace changes) for a month and\r
+> a half, as far as testing goes.\r
+>\r
+> I wonder if I can get whitespace-mode to warn me about double-spacing....\r
+> emacs/notmuch-address.el | 41 +++++++++++++++++++++++++++++++++++++++++\r
+> 1 file changed, 41 insertions(+)\r
+>\r
+> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+> index 2bf762b..32c8490 100644\r
+> --- a/emacs/notmuch-address.el\r
+> +++ b/emacs/notmuch-address.el\r
+> @@ -96,6 +96,47 @@ line."\r
+> (when (notmuch-address-locate-command notmuch-address-command)\r
+> (notmuch-address-message-insinuate))\r
+> \r
+> +;; functions to add sender / recipients to BBDB\r
+> +\r
+> +(defun notmuch-bbdb/snarf-headers (headers)\r
+> + ;; Helper function to avoid code duplication in the two below\r
+> + ;; headers should have the same format as bbdb-get-addresses-headers\r
+> +\r
+> + ;; bbdb-get-addresses reads these\r
+> + ;; Ugh, pass-by-global\r
+> + (let ((addrs (bbdb-get-addresses nil nil 'notmuch-bbdb/get-header-content))\r
+> + (bbdb-get-addresses-headers headers) ; headers to read\r
+> + (bbdb-gag-messages t)) ; suppress m/n processed message)\r
+> + (bbdb-update-records addrs t t))\r
+> +\r
+> + (defun notmuch-bbdb/snarf-from ()\r
+> + "Import the sender of the current message into BBDB"\r
+> + (interactive)\r
+> + (notmuch-bbdb/snarf-headers\r
+> + (list (assoc 'authors bbdb-get-addresses-headers))))\r
+> +\r
+> +(defun notmuch-bbdb/snarf-to ()\r
+> + "Import all recipients of the current message into BBDB"\r
+> + (interactive)\r
+> + (notmuch-bbdb/snarf-headers\r
+> + (list (assoc 'recipients bbdb-get-addresses-headers))))\r
+> +\r
+> +(defvar notmuch-bbdb/header-by-name\r
+> + ;; both are case sensitive\r
+> + '( ("From" . :From)\r
+> + ("To" . :To)\r
+> + ("CC" . :Cc)\r
+> + ("BCC" . :Bcc)\r
+> + ("Resent-From" . nil)\r
+> + ("Reply-To" . nil)\r
+> + ("Resent-To" . nil)\r
+> + ("Resent-CC" . nil))\r
+> + "Alist for dispatching header symbols as used by notmuch-show-get-header\r
+> +from strings as used by bbdb-get-addresses")\r
+> +\r
+> +(defun notmuch-bbdb/get-header-content (name)\r
+> + (notmuch-show-get-header (cdr (assoc name notmuch-bbdb/header-by-name))))\r
+> +\r
+> ;;\r
+> \r
+> (provide 'notmuch-address)\r
+> -- \r
+> 1.7.10.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r