]> git.notmuchmail.org Git - notmuch-wiki/blob - faq.mdwn
add missing punctuation
[notmuch-wiki] / faq.mdwn
1 [[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
2 # Frequently Asked Questions
3
4 [[!toc levels=2]]
5
6 ## How come this query matches mails in folder:2013? `notmuch search --output=files folder:inbox`
7
8 You have duplicates of a message (or messages) in both folders.
9
10 Notmuch searches are message based. Multiple files may be associated
11 with the same message (i.e. the files have identical Message-ID). A
12 `folder:` search will match the folder of any of the files. The
13 `--output=files` option outputs all the files of all matching messages.
14
15 ## Shouldn't notmuch support inline PGP?
16
17 [Why it might not be a good idea](https://dkg.fifthhorseman.net/notes/inline-pgp-harmful/)
18
19 ## How do I delete messages
20
21 See [[excluding]].
22
23 ## How do I configure the citation line when replying in Emacs?
24
25         (setq message-citation-line-format "On %a, %d %b %Y, %f wrote:")
26         (setq message-citation-line-function 'message-insert-formatted-citation-line)
27
28 See help for `message-citation-line-format` for details.
29
30 ## What are sexp queries?
31
32 For the syntax of sexp queries, see [the manual
33 page](https://notmuchmail.org/doc/latest/man7/notmuch-sexp-queries.html).
34
35 To see if your version of notmuch supports them, run
36
37         $ notmuch config get built_with.sexp_queries
38
39 ## How do I search for messages that have no tags?
40
41 To do this directly, you need a recent notmuch compiled with sexp
42 queries (see above). You can then run
43
44         $ notmuch search --query=sexp --output=messages '(not (tag *))'
45
46 The same style of query should work for any prefix, even user defined
47 prefixes like `List` (see below).
48
49 Otherwise, it's possible to accomplish this using two searches in shell. First,
50 you need to query all tags in the database, and transform the result into a
51 query that matches messages that have none of those tags:
52
53         $ notmuch search --output=tags \* | sed 's/^/not tag:/;2~1s/^/and /'
54
55 Next, use that to query the messages:
56
57         $ notmuch search $(notmuch search --output=tags \* | \
58                 sed 's/^/not tag:/;2~1s/^/and /')
59
60 ## How do I search for punctuation, specific special characters, or regexp?
61
62 Please see the [notmuch-search-terms manual
63 page](https://notmuchmail.org/doc/latest/man7/notmuch-search-terms.html) first.
64
65 The main thing to understand is that Xapian, and therefore Notmuch, searches are
66 closer to natural language searches than regular expression
67 searches. Punctuation is mostly ignored.
68
69 The boolean prefix searches (see Boolean and Probabilistic Prefixes in the man
70 page), such as tag: or path: searches, need an exact match.
71
72 For [specific
73 fields](https://notmuchmail.org/doc/latest/man7/notmuch-search-terms.html#search-prefixes)
74 it is possible to use regex searches (although these are often
75 noticeably slower than native Xapian queries). The limited set of
76 fields is a quirk of implementation which requires a Xapian "value
77 slot" in the database schema. Adding regex support for more fields to
78 would require of adding more value slots to the schema. The
79 performance impact of that needs to be experimentally evaluated, and
80 assuming it is not too bad, some database upgrade code would need to
81 be written.
82
83 ## How do I search for folders or paths with spaces?
84
85 The spaces in the names must be escaped. For example if you use bash or zsh,
86 you can search for messages with tag `foo` in folder `INBOX/folder with spaces`
87 with this query:
88
89         $ notmuch search tag:foo 'folder:"INBOX/folder with spaces"'
90
91 ## How do I search for the `List-Id:` header?
92
93 See `index.header.<prefix>` in `notmuch-config(1)` for details. TLD;R:
94
95     notmuch config set index.header.List List-Id
96
97 ## Can I use notmuch with grsec?
98
99 Sure! It works out of the box. If you have TPE enabled (trusted path execution),
100 make sure the user is executing the script belongs to the
101 `kernel.grsecurity.tpe_gid` (in debian this is grsec-tpe).
102 This is required in order to run the `pre-new` and `post-new` hooks.
103
104 ## Can I tag threads?
105
106 No. Tagging is message based.
107
108 It is possible, however, to make tags propagate to all messages in a thread
109 using a little bit of scripting in the [post-new
110 hook](https://notmuchmail.org/doc/latest/man5/notmuch-hooks.html). For example, to add the muted tag to all
111 messages in threads that have at least one message with the muted tag:
112
113         THREAD_TAGS="muted"
114         for tag in "$THREAD_TAGS"; do
115                 notmuch tag +$tag $(notmuch search --output=threads tag:$tag)
116         done
117
118 You can add other tags to `THREAD_TAGS` as needed. Note that this is one way
119 only; you need to explicitly remove the tag from all the messages in a thread to
120 stop it from propagating again.
121
122
123 ## How can I extract a git patchset for an email thread?
124
125 See [notmuch-extract-patch](https://github.com/aaptel/notmuch-extract-patch).
126
127 ## T150-tagging.sh is failing with Xapian 1.4.6
128
129 This is (probably) a bug in this point release of Xapian, should be
130 fixed in 1.4.7.  Try reverting Xapian commit
131 `093999529acc2f86900d91fed0c7f7af301ab94a`, e.g. with the following
132 patch.
133
134
135     index 80e578b85..a47f14a68 100644
136     --- a/xapian-core/backends/glass/glass_postlist.cc
137     +++ b/xapian-core/backends/glass/glass_postlist.cc
138     @@ -759,7 +759,7 @@ GlassPostList::open_nearby_postlist(const std::string & term_,
139          (void)need_pos;
140          if (term_.empty())
141             RETURN(NULL);
142     -    if (!this_db.get() || this_db->postlist_table.is_modified())
143     +    if (!this_db.get() || this_db->postlist_table.is_writable())
144             RETURN(NULL);
145          RETURN(new GlassPostList(this_db, term_, cursor->clone()));
146      }
147