Table of Contents

Next: , Previous: Global TODO list, Up: Built-in agenda views


10.3.3 Matching tags and properties

If headlines in the agenda files are marked with tags (see Tags), or have properties (see Properties), you can select headlines based on this metadata and collect them into an agenda buffer. The match syntax described here also applies when creating sparse trees with C-c / m. The commands available in the tags list are described in Agenda commands.

C-c a m
Produce a list of all headlines that match a given set of tags. The command prompts for a selection criterion, which is a boolean logic expression with tags, like ‘+work+urgent-withboss’ or ‘work|home’ (see Tags). If you often need a specific search, define a custom command for it (see Agenda dispatcher).
C-c a M
Like C-c a m, but only select headlines that are also TODO items.
Match syntax

A search string can use Boolean operators ‘&’ for AND and ‘|’ for OR. ‘&’ binds more strongly than ‘|’. Parentheses are currently not implemented. Each element in the search is either a tag, a regular expression matching tags, or an expression like PROPERTY OPERATOR VALUE with a comparison operator, accessing a property value. Each element may be preceded by ‘-’, to select against it, and ‘+’ is syntactic sugar for positive selection. The AND operator ‘&’ is optional when ‘+’ or ‘-’ is present. Here are some examples, using only tags.

+work-boss
Select headlines tagged ‘:work:’, but discard those also tagged ‘:boss:’.
work|laptop
Selects lines tagged ‘:work:’ or ‘:laptop:’.
work|laptop+night
Like before, but require the ‘:laptop:’ lines to be tagged also ‘:night:’.

You may also test for properties at the same time as matching tags, see the manual for more information.