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 B9E40431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 04:48:39 -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 1+4BV2bKk9hk for <notmuch@notmuchmail.org>;
\r
18 Sat, 8 Dec 2012 04:48:39 -0800 (PST)
\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
20 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 23611431FAE
\r
23 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 04:48:39 -0800 (PST)
\r
24 Received: by mail-we0-f181.google.com with SMTP id t11so646760wey.26
\r
25 for <notmuch@notmuchmail.org>; Sat, 08 Dec 2012 04:48:38 -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:x-mailer:in-reply-to:references
\r
28 :mime-version:content-type:content-transfer-encoding;
\r
29 bh=4G9o5uz8HJDpQO+rw7wUt3bt5Yl+1HAl0KLaxP4vKhc=;
\r
30 b=JsQUEVNJ86dOhJiTOLSh2I6z8CxUinTB9aNSHV/F+i7bD2ORyy0I2S2Qe63Fo9925U
\r
31 s+3NEue3370mXoeOZoZNJuLDMC/TtKfsO/tqxNcXSs9aTjWL2mbJo3+V+mFdYO/ctqRh
\r
32 9eRZf4EwJo9QN9VtSfWIJlVXyhoBQwKiBJswn4ZLoUsGwgbvvmCzQkoGRqSet7Lj+hfe
\r
33 Bl6PyjGNRthWU6UMfvm6lluTUGc2qUKD0SG9q+nKca4udSBzFAWCE/xLys8j715FZs6l
\r
34 Se1Imte7+ii2OPC376XJcHQVhFohRGku2CKjIaOQghuvQjJCMAzb4mTrS3uh+VYKciE+
\r
36 Received: by 10.216.200.6 with SMTP id y6mr3324397wen.131.1354970918788;
\r
37 Sat, 08 Dec 2012 04:48:38 -0800 (PST)
\r
38 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
39 by mx.google.com with ESMTPS id bd7sm2417828wib.8.2012.12.08.04.48.37
\r
40 (version=TLSv1/SSLv3 cipher=OTHER);
\r
41 Sat, 08 Dec 2012 04:48:38 -0800 (PST)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH 1/2] contrib: pick: add thread based utility functions
\r
45 Date: Sat, 8 Dec 2012 12:48:33 +0000
\r
46 Message-Id: <1354970914-18342-2-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 In-Reply-To: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com>
\r
51 Content-Type: text/plain; charset=UTF-8
\r
52 Content-Transfer-Encoding: 8bit
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Sat, 08 Dec 2012 12:48:39 -0000
\r
67 Previously notmuch-pick had no thread based functionality. This adds a
\r
68 macro to iterate through all messages in a thread. To simplify this it
\r
69 adds a text-property marker to the first message of each thread.
\r
71 contrib/notmuch-pick/notmuch-pick.el | 28 ++++++++++++++++++++++++++++
\r
72 1 files changed, 28 insertions(+), 0 deletions(-)
\r
74 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
\r
75 index b474231..77e15bb 100644
\r
76 --- a/contrib/notmuch-pick/notmuch-pick.el
\r
77 +++ b/contrib/notmuch-pick/notmuch-pick.el
\r
78 @@ -552,6 +552,33 @@ than only the current message."
\r
79 (message (format "Command '%s' exited abnormally with code %d"
\r
80 shell-command exit-code)))))))
\r
82 +(defun notmuch-pick-thread-top ()
\r
84 + (while (not (notmuch-pick-get-prop :first))
\r
85 + (forward-line -1)))
\r
87 +(defmacro notmuch-pick-thread-mapc (function)
\r
88 + "Iterate through all messages in the current thread
\r
89 + and call FUNCTION for side effects."
\r
91 + (notmuch-pick-thread-top)
\r
93 + (funcall function)
\r
95 + while (and (notmuch-pick-get-message-properties)
\r
96 + (not (notmuch-pick-get-prop :first))))))
\r
98 +(defun notmuch-pick-get-messages-ids-thread ()
\r
99 + "Return all id: queries of messages in the current thread."
\r
100 + (let ((message-ids))
\r
101 + (notmuch-pick-thread-mapc
\r
102 + (lambda () (push (notmuch-pick-get-message-id) message-ids)))
\r
105 +(defun notmuch-pick-get-messages-ids-thread-search ()
\r
106 + "Return a search string for all message ids of messages in the
\r
108 + (mapconcat 'identity (notmuch-pick-get-messages-ids-thread) " or "))
\r
109 (defun notmuch-pick-clean-address (address)
\r
110 "Try to clean a single email ADDRESS for display. Return
\r
111 AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
\r
112 @@ -638,6 +665,7 @@ unchanged ADDRESS if parsing fails."
\r
113 (push "├" tree-status)))
\r
115 (push (concat (if replies "┬" "─") "►") tree-status)
\r
116 + (plist-put msg :first (and first (eq 0 depth)))
\r
117 (notmuch-pick-insert-msg (plist-put msg :tree-status tree-status))
\r