--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 85A66431FD2\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:37 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] 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 YjdwxszQjQsL for <notmuch@notmuchmail.org>;\r
+ Tue, 11 Mar 2014 21:10:33 -0700 (PDT)\r
+Received: from mail-we0-f174.google.com (mail-we0-f174.google.com\r
+ [74.125.82.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 08678431FBD\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:14 -0700 (PDT)\r
+Received: by mail-we0-f174.google.com with SMTP id t60so10749499wes.19\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:13 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=rrUeiRgkpA6faVReXIyxZLNBGvad/p5Ju8owu1KcQ6c=;\r
+ b=qNZ1NNAWObiuWcOOh3jR4CS57WrUswRxcUrJOEPJf2IjNu6TCRgLtT+45WSh33pGry\r
+ /fGFkFlF6hHe1rw5kiMUloDFf7Lel4owtOhcTs6bmnJ1Sq/KaK+IpwJqmGisFwv5ZSzG\r
+ 0m4emOSN0Ozdd9LJvNRyg7zcY79Co+NIDqb+770LU6Hq0qCX8jiiRPNN9lTsRxjZzQzf\r
+ esFg8ggVmXgGxvHzT61uNdvBmo3uDx76NF0NJrBXKLsMwPM1eQ4fIvT9xJSWB7Km8Xsu\r
+ 2rDnthOPOBiDg+r8UbBlEQgWTf7PuuZT9nUmMXiB8whAbco/c2enxQTDlv2EhLtWcQNb\r
+ vMAA==\r
+X-Received: by 10.194.21.193 with SMTP id x1mr39073151wje.33.1394597413934;\r
+ Tue, 11 Mar 2014 21:10:13 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id n3sm12266236wix.10.2014.03.11.21.10.12\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Tue, 11 Mar 2014 21:10:13 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ amdragon@mit.edu\r
+Subject: [Patch v3 7/8] emacs: search: use orig-tags in search\r
+Date: Wed, 12 Mar 2014 04:09:56 +0000\r
+Message-Id: <1394597397-8486-8-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1394597397-8486-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1394597397-8486-1-git-send-email-markwalters1009@gmail.com>\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: Wed, 12 Mar 2014 04:10:37 -0000\r
+\r
+This uses the recent functionality to show the tag changes in the\r
+search buffer. Currently this is only used to show changes the search\r
+buffer makes itself: i.e., it does not make display any changes\r
+reflecting tagging done by other notmuch-buffers.\r
+---\r
+ emacs/notmuch.el | 41 +++++++++++++++++++++++++----------------\r
+ 1 files changed, 25 insertions(+), 16 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 609f408..cb71381 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -753,24 +753,33 @@ (defun notmuch-search-insert-field (field format-string result)\r
+ format-string (notmuch-sanitize (plist-get result :authors))))\r
+ \r
+ ((string-equal field "tags")\r
+- (let ((tags (plist-get result :tags)))\r
+- (insert (format format-string (notmuch-tag-format-tags tags tags)))))))\r
++ (let ((tags (plist-get result :tags))\r
++ (orig-tags (plist-get result :orig-tags)))\r
++ (insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))\r
+ \r
+-(defun notmuch-search-show-result (result &optional pos)\r
+- "Insert RESULT at POS or the end of the buffer if POS is null."\r
++(defun notmuch-search-show-result (result pos)\r
++ "Insert RESULT at POS."\r
+ ;; Ignore excluded matches\r
+ (unless (= (plist-get result :matched) 0)\r
+- (let ((beg (or pos (point-max))))\r
+- (save-excursion\r
+- (goto-char beg)\r
+- (dolist (spec notmuch-search-result-format)\r
+- (notmuch-search-insert-field (car spec) (cdr spec) result))\r
+- (insert "\n")\r
+- (notmuch-search-color-line beg (point) (plist-get result :tags))\r
+- (put-text-property beg (point) 'notmuch-search-result result))\r
+- (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
+- (setq notmuch-search-target-thread "found")\r
+- (goto-char beg)))))\r
++ (save-excursion\r
++ (goto-char pos)\r
++ (dolist (spec notmuch-search-result-format)\r
++ (notmuch-search-insert-field (car spec) (cdr spec) result))\r
++ (insert "\n")\r
++ (notmuch-search-color-line pos (point) (plist-get result :tags))\r
++ (put-text-property pos (point) 'notmuch-search-result result))))\r
++\r
++(defun notmuch-search-append-result (result)\r
++ "Insert RESULT at the end of the buffer.\r
++\r
++This is only called when a result is first inserted so it also\r
++sets the :orig-tag property."\r
++ (let ((new-result (plist-put result :orig-tags (plist-get result :tags)))\r
++ (pos (point-max)))\r
++ (notmuch-search-show-result new-result pos)\r
++ (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
++ (setq notmuch-search-target-thread "found")\r
++ (goto-char pos))))\r
+ \r
+ (defun notmuch-search-process-filter (proc string)\r
+ "Process and filter the output of \"notmuch search\""\r
+@@ -784,7 +793,7 @@ (defun notmuch-search-process-filter (proc string)\r
+ (save-excursion\r
+ (goto-char (point-max))\r
+ (insert string))\r
+- (notmuch-sexp-parse-partial-list 'notmuch-search-show-result\r
++ (notmuch-sexp-parse-partial-list 'notmuch-search-append-result\r
+ results-buf)))))\r
+ \r
+ (defun notmuch-search-tag-all (tag-changes)\r
+-- \r
+1.7.9.1\r
+\r