Skip to main content

7.1 Property Syntax

Properties are key–value pairs. When they are associated with a single entry or with a tree they need to be inserted into a special drawer (see Drawers) with the name ‘PROPERTIES’, which has to be located right below a headline, and its planning line (see Deadlines and Scheduling) when applicable. Each property is specified on a single line, with the key—surrounded by colons—first, and the value after it. Keys are case-insensitive. Here is an example:

* CD collection
** Classic
*** Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glenn Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:END:

Depending on the value of org-use-property-inheritance, a property set this way is associated either with a single entry, or with the sub-tree defined by the entry, see Property Inheritance.

You may define the allowed values for a particular property ‘Xyz’ by setting a property ‘Xyz_ALL’. This special property is inherited, so if you set it in a level 1 entry, it applies to the entire tree. When allowed values are defined, setting the corresponding property becomes easier and is less prone to typing errors. For the example with the CD collection, we can pre-define publishers and the number of disks in a box like this:

* CD collection
:PROPERTIES:
:NDisks_ALL: 1 2 3 4
:Publisher_ALL: "Deutsche Grammophon" Philips EMI
:END:

Properties can be inserted on buffer level. That means they apply before the first headline and can be inherited by all entries in a file. Property blocks defined before first headline needs to be located at the top of the buffer, allowing only comments above.

Properties can also be defined using lines like:

#+PROPERTY: NDisks_ALL 1 2 3 4

If you want to add to the value of an existing property, append a ‘+’ to the property name. The following results in the property ‘var’ having the value ‘foo=1 bar=2’.

#+PROPERTY: var  foo=1
#+PROPERTY: var+ bar=2

It is also possible to add to the values of inherited properties. The following results in the ‘Genres’ property having the value ‘Classic Baroque’ under the ‘Goldberg Variations’ subtree.

* CD collection
** Classic
:PROPERTIES:
:Genres: Classic
:END:
*** Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glenn Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:Genres+: Baroque
:END:

Note that a property can only have one entry per drawer.

Property values set with the global variable org-global-properties can be inherited by all entries in all Org files.

The following commands help to work with properties:

M-TAB (pcomplete)

After an initial colon in a line, complete property keys. All keys used in the current file are offered as possible completions.

C-c C-x p (org-set-property)

Set a property. This prompts for a property name and a value. If necessary, the property drawer is created as well.

C-u M-x org-insert-drawer

Insert a property drawer into the current entry. The drawer is inserted early in the entry, but after the lines with planning information like deadlines. If before first headline the drawer is inserted at the top of the drawer after any potential comments.

C-c C-c (org-property-action)

With point in a property drawer, this executes property commands.

C-c C-c s (org-set-property)

Set a property in the current entry. Both the property and the value can be inserted using completion.

S-RIGHT (org-property-next-allowed-values)

S-LEFT (org-property-previous-allowed-value)

Switch property at point to the next/previous allowed value.

C-c C-c d (org-delete-property)

Remove a property from the current entry.

C-c C-c D (org-delete-property-globally)

Globally remove a property, from all entries in the current file.

C-c C-c c (org-compute-property-at-point)

Compute the property at point, using the operator and scope from the nearest column format definition.