--- /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 C95C6431FBF\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 03:25:21 -0800 (PST)\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 KFdT5IXWynHc for <notmuch@notmuchmail.org>;\r
+ Sat, 22 Feb 2014 03:25:16 -0800 (PST)\r
+Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com\r
+ [74.125.82.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 20DD6431FBD for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 03:25:16 -0800\r
+ (PST)\r
+Received: by mail-wg0-f53.google.com with SMTP id x12so3317506wgg.20\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 03:25:13 -0800 (PST)\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=w3T2e1yG6IDIUzmBD/4U5ebMSeYBTdQs9hy1fpFmwcE=;\r
+ b=vf6TYMHo0+c8F7JeK1LFKDbiOKYLAdd6p6mQaVsTDYBcG+jiUVMtAEn7BVFjlrxDvW\r
+ MZ8lCAvG0ccPc2SDTuPOp8g4vNpYWV1sjDKRgGkp7xf9ZfAODK3ke7Y94ruFvmnRkEpH\r
+ AkuumjEsO4LIZoySOby9mazZN2JnpcQTxPP+4wTWQCbnRPoyv78sR4ZgA/cUbKOqVdAo\r
+ yg7mBP1cSlUr7LrabX9UUV5nocGuI4WMM13Y4EFGPnFX+WQkDPzGf5TCdxbULjRsC+AD\r
+ Wf+96cNE6dq1ihcVx6l/fsGSPVjeijsWpp91UeTob3YAB3AFpB6AefS2JffWq4mUJod3\r
+ xxvg==\r
+X-Received: by 10.180.106.40 with SMTP id gr8mr6603601wib.31.1393068312121;\r
+ Sat, 22 Feb 2014 03:25:12 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id ga20sm4020022wic.0.2014.02.22.03.25.11\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 22 Feb 2014 03:25:11 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2.1 6/7] emacs: search: use orig-tags in search\r
+Date: Sat, 22 Feb 2014 11:25:05 +0000\r
+Message-Id: <1393068305-1587-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1392841212-8494-7-git-send-email-markwalters1009@gmail.com>\r
+References: <1392841212-8494-7-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: Sat, 22 Feb 2014 11:25:21 -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
+This is a rewrite of this single patch. When trying to rebase my\r
+unread stuff on top of this series I realised that the previous\r
+version split the notmuch-search-show-result in a a strange place. In\r
+particular the code for "is this the target thread" so should only be\r
+called when building the buffer not when redisplaying a thread. Of\r
+course it works either way but I think this is cleaner.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+\r
+\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 04587c0..d1f1f0a 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -753,24 +753,33 @@ non-authors is found, assume that all of the authors match."\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 @@ non-authors is found, assume that all of the authors match."\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