--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\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 4F2BA431FC2\r
+ for <notmuch@notmuchmail.org>; Sat, 17 Jan 2015 06:49:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 I7ioCcmDBLet for <notmuch@notmuchmail.org>;\r
+ Sat, 17 Jan 2015 06:49:37 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 15C9A431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 17 Jan 2015 06:49:37 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1YCUgw-0007Yi-A4; Sat, 17 Jan 2015 10:49:34 -0400\r
+Received: (nullmailer pid 13963 invoked by uid 1000); Sat, 17 Jan 2015\r
+ 14:49:28 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: David Bremner <david@tethera.net>, Michal Sojka <sojkam1@fel.cvut.cz>,\r
+ notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: convert notmuch-address-harvester to use\r
+ notmuch-address\r
+Date: Sat, 17 Jan 2015 15:49:14 +0100\r
+Message-Id: <1421506154-13886-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1421503031-25797-1-git-send-email-david@tethera.net>\r
+References: <1421503031-25797-1-git-send-email-david@tethera.net>\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: Sat, 17 Jan 2015 14:49:40 -0000\r
+\r
+No attempt is made to optimize anything here, just drop in the new\r
+command. In particular the use of --output=recipients is known to be\r
+slower than --output=senders, but it fit the existing logic better.\r
+---\r
+Let us never speak of the parent message again.\r
+ emacs/notmuch-address.el | 25 ++++++++-----------------\r
+ 1 file changed, 8 insertions(+), 17 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+index 9f6711b..d54a8bb 100644\r
+--- a/emacs/notmuch-address.el\r
++++ b/emacs/notmuch-address.el\r
+@@ -20,7 +20,6 @@\r
+ ;; Authors: David Edmondson <dme@dme.org>\r
+ \r
+ (require 'message)\r
+-(require 'notmuch-query)\r
+ (require 'notmuch-parser)\r
+ \r
+ ;;\r
+@@ -148,21 +147,12 @@ external commands."\r
+ (not (file-directory-p bin))))\r
+ (throw 'found-command bin))))))))\r
+ \r
+-(defun notmuch-address-harvest-msg (msg)\r
+- (let* ((headers (plist-get msg :headers))\r
+- (to (ignore-errors (mail-extract-address-components (plist-get headers :To) t)))\r
+- (cc (ignore-errors (mail-extract-address-components (plist-get headers :Cc) t)))\r
+- (bcc (ignore-errors (mail-extract-address-components (plist-get headers :Bcc) t))))\r
+- (mapc (lambda (parts)\r
+- (let* ((name (car parts))\r
+- (email (cadr parts))\r
+- (entry (if name (format "%s <%s>" name email) email)))\r
+- (puthash entry t notmuch-address-completions)))\r
+- (append to cc bcc))\r
+- nil))\r
++(defun notmuch-address-harvest-addr (result)\r
++ (let ((name-addr (plist-get result :name-addr)))\r
++ (puthash name-addr t notmuch-address-completions)))\r
+ \r
+ (defun notmuch-address-harvest-handle-result (obj)\r
+- (notmuch-query-map-threads 'notmuch-address-harvest-msg (list obj)))\r
++ (notmuch-address-harvest-addr obj))\r
+ \r
+ (defun notmuch-address-harvest-filter (proc string)\r
+ (when (buffer-live-p (process-buffer proc))\r
+@@ -188,10 +178,11 @@ called when harvesting finishes."\r
+ (query (if filter-query\r
+ (format "(%s) and (%s)" from-me-query filter-query)\r
+ from-me-query))\r
+- (args `("show" "--format=sexp" "--format-version=2"\r
+- "--body=false" "--entire-thread=false" ,query)))\r
++ (args `("address" "--format=sexp" "--format-version=2"\r
++ "--output=recipients"\r
++ ,query)))\r
+ (if synchronous\r
+- (notmuch-query-map-threads 'notmuch-address-harvest-msg\r
++ (mapc #'notmuch-address-harvest-addr\r
+ (apply 'notmuch-call-notmuch-sexp args))\r
+ ;; Asynchronous\r
+ (when notmuch-address-harvest-proc\r
+-- \r
+2.1.4\r
+\r