Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a0 / 914754f19744add6e383cb9fc6f84e69cff467
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 2EC7F429E28\r
6         for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 16:03:31 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \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 1XIOvgC1VpWy for <notmuch@notmuchmail.org>;\r
18         Sat, 28 Jan 2012 16:03:30 -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 37A63431FCF\r
23         for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 16:03:30 -0800 (PST)\r
24 Received: by mail-we0-f181.google.com with SMTP id b10so2751672wer.26\r
25         for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 16:03:30 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=nBzJtZ4zSaimCeB5V32DXI2qT7WcwbQ1JgB/R51C2Fc=;\r
29         b=DLgtkGwT2D2GK5OKOzvFDHUIIrauWarx+CjJqplROdrjZ8C8OTjno1fcny8Z0cVcxC\r
30         ZihHhRC3vuCVrGqYUhsLVpvny7VLS4cyPyjqM7p4CHzeFeaejLLZgeLPlR+Ib2tGvdob\r
31         jm/lbyEBR+bWXYQORCZIZ1+vtzlUnZhPJlT74=\r
32 Received: by 10.216.135.15 with SMTP id t15mr5026561wei.3.1327795409956;\r
33         Sat, 28 Jan 2012 16:03:29 -0800 (PST)\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
35  [94.192.233.223])      by mx.google.com with ESMTPS id\r
36  l6sm20810344wiv.11.2012.01.28.16.03.28 (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Sat, 28 Jan 2012 16:03:29 -0800 (PST)\r
38 From: Mark Walters <markwalters1009@gmail.com>\r
39 To: notmuch@notmuchmail.org,\r
40         amdragon@MIT.EDU\r
41 Subject: [PATCH 3/4] Add exclude flag\r
42 Date: Sun, 29 Jan 2012 00:04:03 +0000\r
43 Message-Id: <1327795444-18745-3-git-send-email-markwalters1009@gmail.com>\r
44 X-Mailer: git-send-email 1.7.2.3\r
45 In-Reply-To: <8739azqt2j.fsf@qmul.ac.uk>\r
46 References: <8739azqt2j.fsf@qmul.ac.uk>\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Sun, 29 Jan 2012 00:03:31 -0000\r
60 \r
61 Add the exclude flag to notmuch_query_search_threads\r
62 \r
63 ---\r
64  lib/notmuch-private.h |   17 +++++++++++------\r
65  lib/query.cc          |    1 +\r
66  lib/thread.cc         |   18 +++++++++++++++---\r
67  3 files changed, 27 insertions(+), 9 deletions(-)\r
68 \r
69 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
70 index 7bf153e..56b87c6 100644\r
71 --- a/lib/notmuch-private.h\r
72 +++ b/lib/notmuch-private.h\r
73 @@ -211,12 +211,8 @@ _notmuch_directory_get_document_id (notmuch_directory_t *directory);\r
74  \r
75  /* thread.cc */\r
76  \r
77 -notmuch_thread_t *\r
78 -_notmuch_thread_create (void *ctx,\r
79 -                       notmuch_database_t *notmuch,\r
80 -                       unsigned int seed_doc_id,\r
81 -                       notmuch_doc_id_set_t *match_set,\r
82 -                       notmuch_sort_t sort);\r
83 +/* Definition of _notmuch_thread_create moved later since now uses\r
84 + * string_list_t */\r
85  \r
86  /* message.cc */\r
87  \r
88 @@ -401,6 +397,7 @@ typedef struct _notmuch_message_list {\r
89   */\r
90  struct visible _notmuch_messages {\r
91      notmuch_bool_t is_of_list_type;\r
92 +    notmuch_doc_id_set_t *excluded_doc_ids;\r
93      notmuch_message_node_t *iterator;\r
94  };\r
95  \r
96 @@ -491,6 +488,14 @@ notmuch_filenames_t *\r
97  _notmuch_filenames_create (const void *ctx,\r
98                            notmuch_string_list_t *list);\r
99  \r
100 +notmuch_thread_t *\r
101 +_notmuch_thread_create (void *ctx,\r
102 +                       notmuch_database_t *notmuch,\r
103 +                       unsigned int seed_doc_id,\r
104 +                       notmuch_doc_id_set_t *match_set,\r
105 +                       notmuch_string_list_t *excluded_terms,\r
106 +                       notmuch_sort_t sort);\r
107 +\r
108  #pragma GCC visibility pop\r
109  \r
110  NOTMUCH_END_DECLS\r
111 diff --git a/lib/query.cc b/lib/query.cc\r
112 index 8ffafe5..de95745 100644\r
113 --- a/lib/query.cc\r
114 +++ b/lib/query.cc\r
115 @@ -456,6 +456,7 @@ notmuch_threads_get (notmuch_threads_t *threads)\r
116                                    threads->query->notmuch,\r
117                                    doc_id,\r
118                                    &threads->match_set,\r
119 +                                  threads->query->exclude_terms,\r
120                                    threads->query->sort);\r
121  }\r
122  \r
123 diff --git a/lib/thread.cc b/lib/thread.cc\r
124 index 0435ee6..6d65d52 100644\r
125 --- a/lib/thread.cc\r
126 +++ b/lib/thread.cc\r
127 @@ -214,7 +214,8 @@ _thread_cleanup_author (notmuch_thread_t *thread,\r
128   */\r
129  static void\r
130  _thread_add_message (notmuch_thread_t *thread,\r
131 -                    notmuch_message_t *message)\r
132 +                    notmuch_message_t *message,\r
133 +                    notmuch_string_list_t *exclude_terms)\r
134  {\r
135      notmuch_tags_t *tags;\r
136      const char *tag;\r
137 @@ -262,6 +263,15 @@ _thread_add_message (notmuch_thread_t *thread,\r
138          notmuch_tags_move_to_next (tags))\r
139      {\r
140         tag = notmuch_tags_get (tags);\r
141 +       /* mark excluded messages */\r
142 +       for (notmuch_string_node_t *term = exclude_terms->head; term;\r
143 +            term = term->next) {\r
144 +           /* we ignore initial 'K' */\r
145 +           if (strcmp(tag, (term->string + 1)) == 0) {\r
146 +               notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);\r
147 +               break;\r
148 +           }\r
149 +       }\r
150         g_hash_table_insert (thread->tags, xstrdup (tag), NULL);\r
151      }\r
152  }\r
153 @@ -321,7 +331,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,\r
154             _thread_set_subject_from_message (thread, message);\r
155      }\r
156  \r
157 -    thread->matched_messages++;\r
158 +    if (!notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED))\r
159 +       thread->matched_messages++;\r
160  \r
161      if (g_hash_table_lookup_extended (thread->message_hash,\r
162                             notmuch_message_get_message_id (message), NULL,\r
163 @@ -392,6 +403,7 @@ _notmuch_thread_create (void *ctx,\r
164                         notmuch_database_t *notmuch,\r
165                         unsigned int seed_doc_id,\r
166                         notmuch_doc_id_set_t *match_set,\r
167 +                       notmuch_string_list_t *exclude_terms,\r
168                         notmuch_sort_t sort)\r
169  {\r
170      notmuch_thread_t *thread;\r
171 @@ -467,7 +479,7 @@ _notmuch_thread_create (void *ctx,\r
172         if (doc_id == seed_doc_id)\r
173             message = seed_message;\r
174  \r
175 -       _thread_add_message (thread, message);\r
176 +       _thread_add_message (thread, message, exclude_terms);\r
177  \r
178         if ( _notmuch_doc_id_set_contains (match_set, doc_id)) {\r
179             _notmuch_doc_id_set_remove (match_set, doc_id);\r
180 -- \r
181 1.7.2.3\r
182 \r