1NOTMUCH-TAG(1) notmuch NOTMUCH-TAG(1)
2
3
4
6 notmuch-tag - add/remove tags for all messages matching the search
7 terms
8
10 notmuch tag [options ...] +<tag>|-<tag> [--] <search-term> ...
11
12 notmuch tag --batch [--input=<filename>]
13
15 Add/remove tags for all messages matching the search terms.
16
17 See notmuch-search-terms for details of the supported syntax for
18 <search-term>.
19
20 Tags prefixed by '+' are added while those prefixed by '-' are removed.
21 For each message, tag changes are applied in the order they appear on
22 the command line.
23
24 The beginning of the search terms is recognized by the first argument
25 that begins with neither '+' nor '-'. Support for an initial search
26 term beginning with '+' or '-' is provided by allowing the user to
27 specify a "--" argument to separate the tags from the search terms.
28
29 notmuch tag updates the maildir flags according to tag changes if the
30 maildir.synchronize_flags configuration option is enabled. See
31 notmuch-config for details.
32
33 Supported options for tag include
34
35 --remove-all
36 Remove all tags from each message matching the search terms be‐
37 fore applying the tag changes appearing on the command line.
38 This means setting the tags of each message to the tags to be
39 added. If there are no tags to be added, the messages will have
40 no tags.
41
42 --batch
43 Read batch tagging operations from a file (stdin by default).
44 This is more efficient than repeated notmuch tag invocations.
45 See TAG FILE FORMAT below for the input format. This option is
46 not compatible with specifying tagging on the command line.
47
48 --input=<filename>
49 Read input from given file, instead of from stdin. Implies
50 --batch.
51
53 The input must consist of lines of the format:
54
55 +<tag>|-<tag> [...] [--] <query>
56
57 Each line is interpreted similarly to notmuch tag command line argu‐
58 ments. The delimiter is one or more spaces ' '. Any characters in <tag>
59 may be hex-encoded with %NN where NN is the hexadecimal value of the
60 character. To hex-encode a character with a multi-byte UTF-8 encoding,
61 hex-encode each byte. Any spaces in <tag> must be hex-encoded as %20.
62 Any characters that are not part of <tag> must not be hex-encoded.
63
64 In the future tag:"tag with spaces" style quoting may be supported for
65 <tag> as well; for this reason all double quote characters in <tag>
66 should be hex-encoded.
67
68 The <query> should be quoted using Xapian boolean term quoting rules:
69 if a term contains whitespace or a close paren or starts with a double
70 quote, it must be enclosed in double quotes (not including any prefix)
71 and double quotes inside the term must be doubled (see below for exam‐
72 ples).
73
74 Leading and trailing space ' ' is ignored. Empty lines and lines begin‐
75 ning with '#' are ignored.
76
77 EXAMPLE
78 The following shows a valid input to batch tagging. Note that only the
79 isolated '*' acts as a wildcard. Also note the two different quotings
80 of the tag space in tags
81
82 +winner *
83 +foo::bar%25 -- (One and Two) or (One and tag:winner)
84 +found::it -- tag:foo::bar%
85 # ignore this line and the next
86
87 +space%20in%20tags -- Two
88 # add tag '(tags)', among other stunts.
89 +crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"
90 +match*crazy -- tag:crazy{
91 +some_tag -- id:"this is ""nauty)"""
92
94 notmuch, notmuch-config, notmuch-count, notmuch-dump, notmuch-hooks,
95 notmuch-insert, notmuch-new, notmuch-reply, notmuch-restore,
96 notmuch-search, notmuch-search-terms, notmuch-show,
97
99 Carl Worth and many others
100
102 2009-2022, Carl Worth and many others
103
104
105
106
1070.37 Aug 22, 2022 NOTMUCH-TAG(1)