1 Return-Path: <markwalters1009@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id C95C6431FBF
\r
6 for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 03:25:21 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id KFdT5IXWynHc for <notmuch@notmuchmail.org>;
\r
18 Sat, 22 Feb 2014 03:25:16 -0800 (PST)
\r
19 Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com
\r
20 [74.125.82.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 20DD6431FBD for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 03:25:16 -0800
\r
24 Received: by mail-wg0-f53.google.com with SMTP id x12so3317506wgg.20
\r
25 for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 03:25:13 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
28 bh=w3T2e1yG6IDIUzmBD/4U5ebMSeYBTdQs9hy1fpFmwcE=;
\r
29 b=vf6TYMHo0+c8F7JeK1LFKDbiOKYLAdd6p6mQaVsTDYBcG+jiUVMtAEn7BVFjlrxDvW
\r
30 MZ8lCAvG0ccPc2SDTuPOp8g4vNpYWV1sjDKRgGkp7xf9ZfAODK3ke7Y94ruFvmnRkEpH
\r
31 AkuumjEsO4LIZoySOby9mazZN2JnpcQTxPP+4wTWQCbnRPoyv78sR4ZgA/cUbKOqVdAo
\r
32 yg7mBP1cSlUr7LrabX9UUV5nocGuI4WMM13Y4EFGPnFX+WQkDPzGf5TCdxbULjRsC+AD
\r
33 Wf+96cNE6dq1ihcVx6l/fsGSPVjeijsWpp91UeTob3YAB3AFpB6AefS2JffWq4mUJod3
\r
35 X-Received: by 10.180.106.40 with SMTP id gr8mr6603601wib.31.1393068312121;
\r
36 Sat, 22 Feb 2014 03:25:12 -0800 (PST)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPSA id ga20sm4020022wic.0.2014.02.22.03.25.11
\r
39 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Sat, 22 Feb 2014 03:25:11 -0800 (PST)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH v2.1 6/7] emacs: search: use orig-tags in search
\r
45 Date: Sat, 22 Feb 2014 11:25:05 +0000
\r
46 Message-Id: <1393068305-1587-1-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 In-Reply-To: <1392841212-8494-7-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1392841212-8494-7-git-send-email-markwalters1009@gmail.com>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Sat, 22 Feb 2014 11:25:21 -0000
\r
64 This uses the recent functionality to show the tag changes in the
\r
65 search buffer. Currently this is only used to show changes the search
\r
66 buffer makes itself: i.e., it does not make display any changes
\r
67 reflecting tagging done by other notmuch-buffers.
\r
69 This is a rewrite of this single patch. When trying to rebase my
\r
70 unread stuff on top of this series I realised that the previous
\r
71 version split the notmuch-search-show-result in a a strange place. In
\r
72 particular the code for "is this the target thread" so should only be
\r
73 called when building the buffer not when redisplaying a thread. Of
\r
74 course it works either way but I think this is cleaner.
\r
86 emacs/notmuch.el | 41 +++++++++++++++++++++++++----------------
\r
87 1 files changed, 25 insertions(+), 16 deletions(-)
\r
89 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
90 index 04587c0..d1f1f0a 100644
\r
91 --- a/emacs/notmuch.el
\r
92 +++ b/emacs/notmuch.el
\r
93 @@ -753,24 +753,33 @@ non-authors is found, assume that all of the authors match."
\r
94 format-string (notmuch-sanitize (plist-get result :authors))))
\r
96 ((string-equal field "tags")
\r
97 - (let ((tags (plist-get result :tags)))
\r
98 - (insert (format format-string (notmuch-tag-format-tags tags tags)))))))
\r
99 + (let ((tags (plist-get result :tags))
\r
100 + (orig-tags (plist-get result :orig-tags)))
\r
101 + (insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))
\r
103 -(defun notmuch-search-show-result (result &optional pos)
\r
104 - "Insert RESULT at POS or the end of the buffer if POS is null."
\r
105 +(defun notmuch-search-show-result (result pos)
\r
106 + "Insert RESULT at POS."
\r
107 ;; Ignore excluded matches
\r
108 (unless (= (plist-get result :matched) 0)
\r
109 - (let ((beg (or pos (point-max))))
\r
112 - (dolist (spec notmuch-search-result-format)
\r
113 - (notmuch-search-insert-field (car spec) (cdr spec) result))
\r
115 - (notmuch-search-color-line beg (point) (plist-get result :tags))
\r
116 - (put-text-property beg (point) 'notmuch-search-result result))
\r
117 - (when (string= (plist-get result :thread) notmuch-search-target-thread)
\r
118 - (setq notmuch-search-target-thread "found")
\r
119 - (goto-char beg)))))
\r
122 + (dolist (spec notmuch-search-result-format)
\r
123 + (notmuch-search-insert-field (car spec) (cdr spec) result))
\r
125 + (notmuch-search-color-line pos (point) (plist-get result :tags))
\r
126 + (put-text-property pos (point) 'notmuch-search-result result))))
\r
128 +(defun notmuch-search-append-result (result)
\r
129 + "Insert RESULT at the end of the buffer.
\r
131 +This is only called when a result is first inserted so it also
\r
132 +sets the :orig-tag property."
\r
133 + (let ((new-result (plist-put result :orig-tags (plist-get result :tags)))
\r
134 + (pos (point-max)))
\r
135 + (notmuch-search-show-result new-result pos)
\r
136 + (when (string= (plist-get result :thread) notmuch-search-target-thread)
\r
137 + (setq notmuch-search-target-thread "found")
\r
138 + (goto-char pos))))
\r
140 (defun notmuch-search-process-filter (proc string)
\r
141 "Process and filter the output of \"notmuch search\""
\r
142 @@ -784,7 +793,7 @@ non-authors is found, assume that all of the authors match."
\r
144 (goto-char (point-max))
\r
146 - (notmuch-sexp-parse-partial-list 'notmuch-search-show-result
\r
147 + (notmuch-sexp-parse-partial-list 'notmuch-search-append-result
\r
150 (defun notmuch-search-tag-all (tag-changes)
\r