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