]> git.cworth.org Git - notmuch/blob - doc/man1/notmuch-tag.rst
doc: cross-reference notmuch man pages with actual links
[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 ``--remove-all``
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.
42
43 ``--batch``
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.
49
50 ``--input=``\ <filename>
51     Read input from given file, instead of from stdin. Implies
52     ``--batch``.
53
54 TAG FILE FORMAT
55 ===============
56
57 The input must consist of lines of the format:
58
59 +<*tag*\ >\|-<*tag*\ > [...] [--] <*query*\ >
60
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
67 not** be hex-encoded.
68
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.
72
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
77 examples).
78
79 Leading and trailing space ' ' is ignored. Empty lines and lines
80 beginning with '#' are ignored.
81
82 EXAMPLE
83 -------
84
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**
88
89 ::
90
91     +winner *
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
95
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)"""
101
102 SEE ALSO
103 ========
104
105 :any:`notmuch(1)`,
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)`,