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