--- /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 9B05F429E29\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:59 -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 fZ0hQbfCUiTy for <notmuch@notmuchmail.org>;\r
+ Wed, 19 Feb 2014 12:20:54 -0800 (PST)\r
+Received: from mail-we0-f175.google.com (mail-we0-f175.google.com\r
+ [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 9CE34431FD6\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:42 -0800 (PST)\r
+Received: by mail-we0-f175.google.com with SMTP id q59so755199wes.20\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:41 -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=BS4YuF+JhlxmG7PCK2TmAJvuRPC1Zb1+hBTbJdB1wwo=;\r
+ b=qpzyxfI35AuPKZ+DXbVLLc/U8cuOs7P4aVWuHpXwYQJaIp455yiSlrDjGFZJn980Sz\r
+ PE4XjqK7EQu7i6Sxuh68AEFT6LQTKeOysL01rQYMai6L/6nH5mcB77xzsVtwpGWbbRZ4\r
+ Ci2AG5XoM+BLRkCBMNK+NP9kzJuVo5G4aS00FK4Fi5Q5+eLAIbO9UDd10maKIfCDL2T4\r
+ 2TkTdoIHNApSlNyLzJ6NlS62mhiy6TRt9p+6nEXAargmrL4Ka0U+q9qUSNghNMd5OaNC\r
+ /XHMqF+S2k/ghbP06sL83axREUk1SnE1xADmwT7zPUamvkBtL9/Bquu8WeN4iyjfKx5Z\r
+ NKIg==\r
+X-Received: by 10.180.107.136 with SMTP id hc8mr3428001wib.11.1392841241449;\r
+ Wed, 19 Feb 2014 12:20:41 -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 ee5sm4677221wib.8.2014.02.19.12.20.40\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Wed, 19 Feb 2014 12:20:40 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 6/7] emacs: search: use orig-tags in search\r
+Date: Wed, 19 Feb 2014 20:20:11 +0000\r
+Message-Id: <1392841212-8494-7-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1392841212-8494-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, 19 Feb 2014 20:20:59 -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 | 40 ++++++++++++++++++++++++----------------\r
+ 1 files changed, 24 insertions(+), 16 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 04587c0..d8aef27 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -753,24 +753,32 @@ 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 beg)\r
++ "Insert RESULT at BEG."\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 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
++\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
++ (notmuch-search-show-result new-result (point-max))))\r
+ \r
+ (defun notmuch-search-process-filter (proc string)\r
+ "Process and filter the output of \"notmuch search\""\r
+@@ -784,7 +792,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