]> git.notmuchmail.org Git - notmuch/blob - doc/man1/notmuch-tag.rst
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / doc / man1 / notmuch-tag.rst
1 .. _notmuch-tag(1):
2
3 ===========
4 notmuch-tag
5 ===========
6
7 SYNOPSIS
8 ========
9
10 **notmuch** **tag** [options ...] +<*tag*>|-<*tag*> [--] <*search-term*> ...
11
12 **notmuch** **tag** **--batch** [--input=<*filename*>]
13
14 DESCRIPTION
15 ===========
16
17 Add/remove tags for all messages matching the search terms.
18
19 See :any:`notmuch-search-terms(7)` for details of the supported syntax for
20 <*search-term*\ >.
21
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
24 the command line.
25
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.
30
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.
34
35 Supported options for **tag** include
36
37 .. program:: tag
38
39 .. option:: --remove-all
40
41    Remove all tags from each message matching the search terms before
42    applying the tag changes appearing on the command line.  This
43    means setting the tags of each message to the tags to be added. If
44    there are no tags to be added, the messages will have no tags.
45
46 .. option:: --batch
47
48    Read batch tagging operations from a file (stdin by default).
49    This is more efficient than repeated **notmuch tag**
50    invocations. See `TAG FILE FORMAT <#tag_file_format>`__ below for
51    the input format. This option is not compatible with specifying
52    tagging on the command line.
53
54 .. option:: --input=<filename>
55
56    Read input from given file, instead of from stdin. Implies
57    ``--batch``.
58
59 TAG FILE FORMAT
60 ===============
61
62 The input must consist of lines of the format:
63
64 +<*tag*\ >\|-<*tag*\ > [...] [--] <*query*\ >
65
66 Each line is interpreted similarly to **notmuch tag** command line
67 arguments. The delimiter is one or more spaces ' '. Any characters in
68 <*tag*\ > **may** be hex-encoded with %NN where NN is the hexadecimal
69 value of the character. To hex-encode a character with a multi-byte
70 UTF-8 encoding, hex-encode each byte. Any spaces in <tag> **must** be
71 hex-encoded as %20. Any characters that are not part of <*tag*\ > **must
72 not** be hex-encoded.
73
74 In the future tag:"tag with spaces" style quoting may be supported for
75 <*tag*\ > as well; for this reason all double quote characters in
76 <*tag*\ > **should** be hex-encoded.
77
78 The <*query*\ > should be quoted using Xapian boolean term quoting
79 rules: if a term contains whitespace or a close paren or starts with a
80 double quote, it must be enclosed in double quotes (not including any
81 prefix) and double quotes inside the term must be doubled (see below for
82 examples).
83
84 Leading and trailing space ' ' is ignored. Empty lines and lines
85 beginning with '#' are ignored.
86
87 EXAMPLE
88 -------
89
90 The following shows a valid input to batch tagging. Note that only the
91 isolated '\*' acts as a wildcard. Also note the two different quotings
92 of the tag **space in tags**
93
94 ::
95
96     +winner *
97     +foo::bar%25 -- (One and Two) or (One and tag:winner)
98     +found::it -- tag:foo::bar%
99     # ignore this line and the next
100
101     +space%20in%20tags -- Two
102     # add tag '(tags)', among other stunts.
103     +crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"
104     +match*crazy -- tag:crazy{
105     +some_tag -- id:"this is ""nauty)"""
106
107 SEE ALSO
108 ========
109
110 :any:`notmuch(1)`,
111 :any:`notmuch-config(1)`,
112 :any:`notmuch-count(1)`,
113 :any:`notmuch-dump(1)`,
114 :any:`notmuch-hooks(5)`,
115 :any:`notmuch-insert(1)`,
116 :any:`notmuch-new(1)`,
117 :any:`notmuch-reply(1)`,
118 :any:`notmuch-restore(1)`,
119 :any:`notmuch-search(1)`,
120 :any:`notmuch-search-terms(7)`,
121 :any:`notmuch-show(1)`,