]> git.notmuchmail.org Git - notmuch/blob - man/man1/notmuch-tag.1
e282bf23c92f3fc0f131f712bb9c0c39cf89a7df
[notmuch] / man / man1 / notmuch-tag.1
1 .TH NOTMUCH-TAG 1 2013-02-17 "Notmuch 0.15.2"
2 .SH NAME
3 notmuch-tag \- add/remove tags for all messages matching the search terms
4
5 .SH SYNOPSIS
6 .B notmuch tag
7 .RI [ options "...] +<" tag ">|\-<" tag "> [...] [\-\-] <" search-term "> [...]"
8
9 .B notmuch tag
10 .RI "--batch"
11 .RI "[ --input=<" filename "> ]"
12
13
14 .SH DESCRIPTION
15
16 Add/remove tags for all messages matching the search terms.
17
18 See \fBnotmuch-search-terms\fR(7)
19 for details of the supported syntax for
20 .RI < search-term >.
21
22 Tags prefixed by '+' are added while those prefixed by '\-' are
23 removed. For each message, tag changes are applied in the order they
24 appear on the command line.
25
26 The beginning of the search terms is recognized by the first
27 argument that begins with neither '+' nor '\-'. Support for
28 an initial search term beginning with '+' or '\-' is provided
29 by allowing the user to specify a "\-\-" argument to separate
30 the tags from the search terms.
31
32 .B "notmuch tag"
33 updates the maildir flags according to tag changes if the
34 .B "maildir.synchronize_flags"
35 configuration option is enabled. See \fBnotmuch-config\fR(1) for
36 details.
37
38 Supported options for
39 .B tag
40 include
41 .RS 4
42 .TP 4
43 .BR \-\-remove\-all
44
45 Remove all tags from each message matching the search terms before
46 applying the tag changes appearing on the command line. This means
47 setting the tags of each message to the tags to be added. If there are
48 no tags to be added, the messages will have no tags.
49 .RE
50
51 .RS 4
52 .TP 4
53 .BR \-\-batch
54
55 Read batch tagging operations from a file (stdin by default). This is more
56 efficient than repeated
57 .B notmuch tag
58 invocations. See
59 .B TAG FILE FORMAT
60 below for the input format. This option is not compatible with
61 specifying tagging on the command line.
62 .RE
63
64 .RS 4
65 .TP 4
66 .BR "\-\-input=" <filename>
67
68 Read input from given file, instead of from stdin. Implies
69 .BR --batch .
70
71 .SH TAG FILE FORMAT
72
73 The input must consist of lines of the format:
74
75 .RI "+<" tag ">|\-<" tag "> [...] [\-\-] <" query ">"
76
77 Each line is interpreted similarly to
78 .B notmuch tag
79 command line arguments. The delimiter is one or more spaces ' '. Any
80 characters in
81 .RI < tag >
82 .B may
83 be hex-encoded with %NN where NN is the hexadecimal value of the
84 character. To hex-encode a character with a multi-byte UTF-8 encoding,
85 hex-encode each byte.
86 Any spaces in <tag>
87 .B must
88 be hex-encoded as %20. Any characters that are not
89 part of
90 .RI  < tag >
91 .B must not
92 be hex-encoded.
93
94 In the future tag:"tag with spaces" style quoting may be supported for
95 .RI < tag >
96 as well;
97 for this reason all double quote characters in
98 .RI < tag >
99 .B should
100 be hex-encoded.
101
102 The
103 .RI < query >
104 should be quoted using Xapian boolean term quoting rules: if a term
105 contains whitespace or a close paren or starts with a double quote, it
106 must be enclosed in double quotes (not including any prefix) and
107 double quotes inside the term must be doubled (see below for
108 examples).
109
110 Leading and trailing space ' ' is ignored. Empty lines and lines
111 beginning with '#' are ignored.
112
113 .SS EXAMPLE
114
115 The following shows a valid input to batch tagging. Note that only the
116 isolated '*' acts as a wildcard. Also note the two different quotings
117 of the tag
118 .B space in tags
119 .
120 .RS
121 .nf
122 +winner *
123 +foo::bar%25 -- (One and Two) or (One and tag:winner)
124 +found::it -- tag:foo::bar%
125 # ignore this line and the next
126
127 +space%20in%20tags -- Two
128 # add tag '(tags)', among other stunts.
129 +crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"
130 +match*crazy -- tag:crazy{
131 +some_tag -- id:"this is ""nauty)"""
132 .fi
133 .RE
134
135 .SH SEE ALSO
136
137 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
138 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5),
139 \fBnotmuch-insert\fR(1), \fBnotmuch-new\fR(1),
140 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
141 \fBnotmuch-search\fR(1), \fBnotmuch-search-terms\fR(7),
142 \fBnotmuch-show\fR(1),