10 **notmuch** **tag** [options ...] +<*tag*>|-<*tag*> [--] <*search-term*> ...
12 **notmuch** **tag** **--batch** [--input=<*filename*>]
17 Add/remove tags for all messages matching the search terms.
19 See :any:`notmuch-search-terms(7)` for details of the supported syntax for
22 Tags prefixed by '+' are added while those prefixed by '-' are removed.
23 For each message, tag changes are applied in the order they appear on
26 The beginning of the search terms is recognized by the first argument
27 that begins with neither '+' nor '-'. Support for an initial search term
28 beginning with '+' or '-' is provided by allowing the user to specify a
29 "--" argument to separate the tags from the search terms.
31 **notmuch tag** updates the maildir flags according to tag changes if
32 the **maildir.synchronize\_flags** configuration option is enabled. See
33 :any:`notmuch-config(1)` for details.
35 Supported options for **tag** include
38 Remove all tags from each message matching the search terms before
39 applying the tag changes appearing on the command line. This
40 means setting the tags of each message to the tags to be added. If
41 there are no tags to be added, the messages will have no tags.
44 Read batch tagging operations from a file (stdin by default).
45 This is more efficient than repeated **notmuch tag**
46 invocations. See `TAG FILE FORMAT <#tag_file_format>`__ below for
47 the input format. This option is not compatible with specifying
48 tagging on the command line.
50 ``--input=``\ <filename>
51 Read input from given file, instead of from stdin. Implies
57 The input must consist of lines of the format:
59 +<*tag*\ >\|-<*tag*\ > [...] [--] <*query*\ >
61 Each line is interpreted similarly to **notmuch tag** command line
62 arguments. The delimiter is one or more spaces ' '. Any characters in
63 <*tag*\ > **may** be hex-encoded with %NN where NN is the hexadecimal
64 value of the character. To hex-encode a character with a multi-byte
65 UTF-8 encoding, hex-encode each byte. Any spaces in <tag> **must** be
66 hex-encoded as %20. Any characters that are not part of <*tag*\ > **must
69 In the future tag:"tag with spaces" style quoting may be supported for
70 <*tag*\ > as well; for this reason all double quote characters in
71 <*tag*\ > **should** be hex-encoded.
73 The <*query*\ > should be quoted using Xapian boolean term quoting
74 rules: if a term contains whitespace or a close paren or starts with a
75 double quote, it must be enclosed in double quotes (not including any
76 prefix) and double quotes inside the term must be doubled (see below for
79 Leading and trailing space ' ' is ignored. Empty lines and lines
80 beginning with '#' are ignored.
85 The following shows a valid input to batch tagging. Note that only the
86 isolated '\*' acts as a wildcard. Also note the two different quotings
87 of the tag **space in tags**
92 +foo::bar%25 -- (One and Two) or (One and tag:winner)
93 +found::it -- tag:foo::bar%
94 # ignore this line and the next
96 +space%20in%20tags -- Two
97 # add tag '(tags)', among other stunts.
98 +crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"
99 +match*crazy -- tag:crazy{
100 +some_tag -- id:"this is ""nauty)"""
106 :any:`notmuch-config(1)`,
107 :any:`notmuch-count(1)`,
108 :any:`notmuch-dump(1)`,
109 :any:`notmuch-hooks(5)`,
110 :any:`notmuch-insert(1)`,
111 :any:`notmuch-new(1)`,
112 :any:`notmuch-reply(1)`,
113 :any:`notmuch-restore(1)`,
114 :any:`notmuch-search(1)`,
115 :any:`notmuch-search-terms(7)`,
116 :any:`notmuch-show(1)`,