Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / df / 3bd289b08aee96ea43f212d60cfac11e90e2cc
1 Return-Path: <bremner@tesseract.cs.unb.ca>\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 arlo.cworth.org (Postfix) with ESMTP id 6ACF86DE02B5\r
6  for <notmuch@notmuchmail.org>; Sat,  6 Aug 2016 06:52:59 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.652\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.652 tagged_above=-999 required=5 tests=[AWL=-0.662,\r
12   HEADER_FROM_DIFFERENT_DOMAINS=0.001, URI_HEX=1.313] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id uDEg8hXBA5n7 for <notmuch@notmuchmail.org>;\r
16  Sat,  6 Aug 2016 06:52:51 -0700 (PDT)\r
17 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id D88526DE00DF\r
19  for <notmuch@notmuchmail.org>; Sat,  6 Aug 2016 06:52:50 -0700 (PDT)\r
20 Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2)\r
21  (envelope-from <bremner@tesseract.cs.unb.ca>) id 1bW22B-0007DZ-LX\r
22  for notmuch@notmuchmail.org; Sat, 06 Aug 2016 09:53:03 -0400\r
23 Received: (nullmailer pid 4122 invoked by uid 1000);\r
24  Sat, 06 Aug 2016 13:52:44 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: notmuch@notmuchmail.org\r
27 Subject: v3 of message properties patches\r
28 Date: Sat,  6 Aug 2016 22:52:30 +0900\r
29 Message-Id: <1470491559-3946-1-git-send-email-david@tethera.net>\r
30 X-Mailer: git-send-email 2.8.1\r
31 X-BeenThere: notmuch@notmuchmail.org\r
32 X-Mailman-Version: 2.1.20\r
33 Precedence: list\r
34 List-Id: "Use and development of the notmuch mail system."\r
35  <notmuch.notmuchmail.org>\r
36 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
37  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
39 List-Post: <mailto:notmuch@notmuchmail.org>\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
41 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
42  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
43 X-List-Received-Date: Sat, 06 Aug 2016 13:52:59 -0000\r
44 \r
45 This obsoletes\r
46 \r
47      id:1470184228-12517-1-git-send-email-david@tethera.net\r
48 \r
49 In particular it fixes the compile errors (boo), and adds dkg's\r
50 has: queries, with minimal doc and tests.\r
51 \r
52 interdiff follows:\r
53 \r
54 diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst\r
55 index 075f88c..86d02ee 100644\r
56 --- a/doc/man7/notmuch-search-terms.rst\r
57 +++ b/doc/man7/notmuch-search-terms.rst\r
58 @@ -58,6 +58,8 @@ indicate user-supplied values):\r
59  \r
60  -  query:<name>\r
61  \r
62 +-  has:<key>=<value>\r
63 +\r
64  The **from:** prefix is used to match the name or address of the sender\r
65  of an email message.\r
66  \r
67 @@ -139,6 +141,11 @@ queries added with **notmuch-config(1)**. Named queries are only\r
68  available if notmuch is built with **Xapian Field Processors** (see\r
69  below).\r
70  \r
71 +The **has:** prefix searches for messages with a particular\r
72 +<key>=<value> property pair. Properties are used internally by notmuch\r
73 +(and extensions) to add metadata to messages. A given key can be\r
74 +present on a given message with several different values.\r
75 +\r
76  Operators\r
77  ---------\r
78  \r
79 @@ -217,7 +224,7 @@ exact matches like "tag:inbox"  or **probabilistic**, supporting a more flexible\r
80  \r
81  \r
82  Boolean\r
83 -   **tag:**, **id:**, **thread:**, **folder:**, **path:**\r
84 +   **tag:**, **id:**, **thread:**, **folder:**, **path:**, **has**\r
85  Probabilistic\r
86     **from:**, **to:**, **subject:**, **attachment:**, **mimetype:**\r
87  \r
88 diff --git a/lib/database.cc b/lib/database.cc\r
89 index 3a741f0..3bdbd07 100644\r
90 --- a/lib/database.cc\r
91 +++ b/lib/database.cc\r
92 @@ -97,6 +97,9 @@ typedef struct {\r
93   *                     STRING is the name of a file within that\r
94   *                     directory for this mail message.\r
95   *\r
96 + *      has:       Has a property with key=value\r
97 + *                 FIXME: if no = is present, should match on any value\r
98 + *\r
99   *    A mail document also has four values:\r
100   *\r
101   *     TIMESTAMP:      The time_t value corresponding to the message's\r
102 @@ -260,6 +263,7 @@ static prefix_t BOOLEAN_PREFIX_EXTERNAL[] = {\r
103      { "is",                    "K" },\r
104      { "id",                    "Q" },\r
105      { "path",                  "P" },\r
106 +    { "has",                   "XPROPERTY" },\r
107      /*\r
108       * Without the ":", since this is a multi-letter prefix, Xapian\r
109       * will add a colon itself if the first letter of the path is\r
110 diff --git a/notmuch-restore.c b/notmuch-restore.c\r
111 index 3cd8a40..d6429ef 100644\r
112 --- a/notmuch-restore.c\r
113 +++ b/notmuch-restore.c\r
114 @@ -83,7 +83,7 @@ process_properties_line (notmuch_database_t *notmuch, const char* line)\r
115         goto DONE;\r
116  \r
117      if (print_status_database ("notmuch restore", notmuch,\r
118 -                              notmuch_message_remove_all_properties (message)))\r
119 +                              notmuch_message_remove_all_properties (message, NULL)))\r
120         goto DONE;\r
121  \r
122      tok = id_p + id_len;\r
123 diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh\r
124 index 8952eb7..ee7910b 100755\r
125 --- a/test/T610-message-property.sh\r
126 +++ b/test/T610-message-property.sh\r
127 @@ -91,7 +91,7 @@ test_expect_equal_file EXPECTED OUTPUT\r
128  \r
129  test_begin_subtest "notmuch_message_remove_all_properties"\r
130  cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}\r
131 -EXPECT0(notmuch_message_remove_all_properties (message));\r
132 +EXPECT0(notmuch_message_remove_all_properties (message, NULL));\r
133  print_properties (message, "", FALSE);\r
134  EOF\r
135  cat <<'EOF' >EXPECTED\r
136 @@ -237,4 +237,15 @@ notmuch restore < BEFORE2\r
137  notmuch dump | grep '^#=' > OUTPUT\r
138  test_expect_equal_file PROPERTIES OUTPUT\r
139  \r
140 +test_begin_subtest "test 'has:' queries: empty"\r
141 +notmuch search has:testkey1=charles > OUTPUT\r
142 +test_expect_equal_file /dev/null OUTPUT\r
143 +\r
144 +test_begin_subtest "test 'has:' queries: single message"\r
145 +notmuch search --output=messages has:testkey1=alice > OUTPUT\r
146 +cat <<EOF >EXPECTED\r
147 +id:4EFC743A.3060609@april.org\r
148 +EOF\r
149 +test_expect_equal_file EXPECTED OUTPUT\r
150 +\r
151  test_done\r