List of org-mode hooks - examples of use

{Back to Worg's index}

This is the list of Org-mode hooks and function variables, with their documentation strings:

Table of Contents

Hooks and Function variables

org-mode-hook

Defined in: org.el

Mode hook for Org-mode, run after the mode was turned on.

org-load-hook

Defined in: org.el

Hook that is run after org.el has been loaded.

org-pre-cycle-hook

Defined in: org.el

Hook that is run before visibility cycling is happening.
The function(s) in this hook must accept a single argument which indicates
the new state that will be set right after running this hook.  The
argument is a symbol.  Before a global state change, it can have the values
`overview', `content', or `all'.  Before a local state change, it can have
the values `folded', `children', or `subtree'.

org-cycle-hook

Defined in: org.el

Hook that is run after `org-cycle' has changed the buffer visibility.
The function(s) in this hook must accept a single argument which indicates
the new state that was set by the most recent `org-cycle' command.  The
argument is a symbol.  After a global state change, it can have the values
`overview', `content', or `all'.  After a local state change, it can have
the values `folded', `children', or `subtree'.

org-insert-heading-hook

Defined in: org.el

Hook being run after inserting a new heading.

org-occur-hook

Defined in: org.el

Hook that is run after `org-occur' has constructed a sparse tree.
This can be used to recenter the window to show as much of the structure
as possible.

org-make-link-description-function

Defined in: org.el

Function to use to generate link descriptions from links.
If nil the link location will be used.  This function must take
two parameters; the first is the link and the second the
description `org-insert-link' has generated, and should return the
description to use.

org-link-translation-function

Defined in: org.el

Function to translate links with different syntax to Org syntax.
This can be used to translate links created for example by the Planner
or emacs-wiki packages to Org syntax.
The function must accept two parameters, a TYPE containing the link
protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
which is everything after the link protocol.  It should return a cons
with possibly modified values of type and path.
Org contains a function for this, so if you set this variable to
`org-translate-link-from-planner', you should be able follow many
links created by planner.

org-follow-link-hook

Defined in: org.el

Hook that is run after a link has been followed.

org-confirm-shell-link-function

Defined in: org.el

Non-nil means ask for confirmation before executing shell links.
Shell links can be dangerous: just think about a link

     [[shell:rm -rf ~/*][Google Search]]

This link would show up in your Org-mode document as \"Google Search\",
but really it would remove your entire home directory.
Therefore we advise against setting this variable to nil.
Just change it to `y-or-n-p' if you want to confirm with a
single keystroke rather than having to type \"yes\".

org-confirm-elisp-link-function

Defined in: org.el

Non-nil means ask for confirmation before executing Emacs Lisp links.
Elisp links can be dangerous: just think about a link

     [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]

This link would show up in your Org-mode document as \"Google Search\",
but really it would remove your entire home directory.
Therefore we advise against setting this variable to nil.
Just change it to `y-or-n-p' if you want to confirm with a
single keystroke rather than having to type \"yes\".

org-refile-target-verify-function

Defined in: org.el

Function to verify if the headline at point should be a refile target.
The function will be called without arguments, with point at the
beginning of the headline.  It should return t and leave point
where it is if the headline is a valid target for refiling.

If the target should not be selected, the function must return nil.
In addition to this, it may move point to a place from where the search
should be continued.  For example, the function may decide that the entire
subtree of the current entry should be excluded and move point to the end
of the subtree.

org-after-todo-state-change-hook

Defined in: org.el

Hook which is run after the state of a TODO item was changed.
The new state (a string with a TODO keyword, or nil) is available in the
Lisp variable `state'.

org-blocker-hook

Defined in: org.el

Hook for functions that are allowed to block a state change.

Each function gets as its single argument a property list, see
`org-trigger-hook' for more information about this list.

If any of the functions in this hook returns nil, the state change
is blocked.

org-trigger-hook

Defined in: org.el

Hook for functions that are triggered by a state change.

Each function gets as its single argument a property list with at least
the following elements:

 (:type type-of-change :position pos-at-entry-start
  :from old-state :to new-state)

Depending on the type, more properties may be present.

This mechanism is currently implemented for:

TODO state changes
------------------
:type  todo-state-change
:from  previous state (keyword as a string), or nil, or a symbol
       'todo' or 'done', to indicate the general type of state.
:to    new state, like in :from

org-get-priority-function

Defined in: org.el

Function to extract the priority from a string.
The string is normally the headline.  If this is nil Org computes the
priority from the priority cookie like [#A] in the headline.  It returns
an integer, increasing by 1000 for each priority level.
The user can set a different function here, which should take a string
as an argument and return the numeric priority.

org-read-date-minibuffer-setup-hook

Defined in: org.el

Hook to be used to set up keys for the date/time interface.
Add key definitions to `minibuffer-local-map', which will be a temporary
copy.

org-tags-sort-function

Defined in: org.el

When set, tags are sorted using this function as a comparator.

org-after-tags-change-hook

Defined in: org.el

Hook that is run after the tags in a line have changed.

org-columns-modify-value-for-display-function

Defined in: org.el

Function that modifies values for display in column view.
For example, it can be used to cut out a certain part from a time stamp.
The function must take 2 arguments:

column-title    The title of the column (*not* the property name)
value           The value that should be modified.

The function should return the value that should be displayed,
or nil if the normal value should be used.

org-finish-function

Defined in: org.el

Function to be called when `C-c C-c' is used.
This is for getting out of special buffers like remember.

org-font-lock-hook

Defined in: org.el

Functions to be called for special font lock stuff.

org-font-lock-set-keywords-hook

Defined in: org.el

Functions that can manipulate `org-font-lock-extra-keywords'.
This is calles after `org-font-lock-extra-keywords' is defined, but before
it is installed to be used by font lock.  This can be useful if something
needs to be inserted at a specific position in the font-lock sequence.

org-after-demote-entry-hook

Defined in: org.el

Hook run after an entry has been demoted.
The cursor will be at the beginning of the entry.
When a subtree is being demoted, the hook will be called for each node.

org-after-promote-entry-hook

Defined in: org.el

Hook run after an entry has been promoted.
The cursor will be at the beginning of the entry.
When a subtree is being promoted, the hook will be called for each node.

org-after-sorting-entries-or-items-hook

Defined in: org.el

Hook that is run after a bunch of entries or items have been sorted.
When children are sorted, the cursor is in the parent line when this
hook gets called.  When a region or a plain list is sorted, the cursor
will be in the first entry of the sorted region/list.

org-store-link-functions

Defined in: org.el

List of functions that are called to create and store a link.
Each function will be called in turn until one returns a non-nil
value.  Each function should check if it is responsible for creating
this link (for example by looking at the major mode).
If not, it must exit and return nil.
If yes, it should return a non-nil value after a calling
`org-store-link-props' with a list of properties and values.
Special properties are:

:type         The link prefix, like \"http\".  This must be given.
:link         The link, like \"http://www.astro.uva.nl/~dominik\".
              This is obligatory as well.
:description  Optional default description for the second pair
              of brackets in an Org-mode link.  The user can still change
              this when inserting this link into an Org-mode buffer.

In addition to these, any additional properties can be specified
and then used in remember templates.

org-open-link-functions

Defined in: org.el

Hook for functions finding a plain text link.
These functions must take a single argument, the link content.
They will be called for links that look like [[link text][description]]
when LINK TEXT does not have a protocol like \"http:\" and does not look
like a filename (e.g. \"./blue.png\").

These functions will be called *before* Org attempts to resolve the
link by doing text searches in the current buffer - so if you want a
link \"[[target]]\" to still find \"<<target>>\", your function should
handle this as a special case.

When the function does handle the link, it must return a non-nil value.
If it decides that it is not responsible for this link, it must return
nil to indicate that that Org-mode can continue with other options
like exact and fuzzy text search.

org-open-at-point-functions

Defined in: org.el

Hook that is run when following a link at point.

Functions in this hook must return t if they identify and follow
a link at point.  If they don't find anything interesting at point,
they must return nil.

org-create-file-search-functions

Defined in: org.el

List of functions to construct the right search string for a file link.
These functions are called in turn with point at the location to
which the link should point.

A function in the hook should first test if it would like to
handle this file type, for example by checking the `major-mode'
or the file extension.  If it decides not to handle this file, it
should just return nil to give other functions a chance.  If it
does handle the file, it must return the search string to be used
when following the link.  The search string will be part of the
file link, given after a double colon, and `org-open-at-point'
will automatically search for it.  If special measures must be
taken to make the search successful, another function should be
added to the companion hook `org-execute-file-search-functions',
which see.

A function in this hook may also use `setq' to set the variable
`description' to provide a suggestion for the descriptive text to
be used for this link when it gets inserted into an Org-mode
buffer with \\[org-insert-link].

org-execute-file-search-functions

Defined in: org.el

List of functions to execute a file search triggered by a link.

Functions added to this hook must accept a single argument, the
search string that was part of the file link, the part after the
double colon.  The function must first check if it would like to
handle this search, for example by checking the `major-mode' or
the file extension.  If it decides not to handle this search, it
should just return nil to give other functions a chance.  If it
does handle the search, it must return a non-nil value to keep
other functions from trying.

Each function can access the current prefix argument through the
variable `current-prefix-argument'.  Note that a single prefix is
used to force opening a link in Emacs, so it may be good to only
use a numeric or double prefix to guide the search function.

In case this is needed, a function in this hook can also restore
the window configuration before `org-open-at-point' was called using:

    (set-window-configuration org-window-config-before-follow-link)

org-after-refile-insert-hook

Defined in: org.el

Hook run after `org-refile' has inserted its stuff at the new location.
Note that this is still *before* the stuff will be removed from
the *old* location.

org-todo-setup-filter-hook

Defined in: org.el

Hook for functions that pre-filter todo specs.
Each function takes a todo spec and returns either nil or the spec
transformed into canonical form." )

(defvar org-todo-get-default-hook nil
  "Hook for functions that get a default item for todo.
Each function takes arguments (NEW-MARK OLD-MARK) and returns either
nil or a string to be used for the todo mark." )

(defvar org-agenda-headline-snapshot-before-repeat)

(defun org-todo (&optional arg)
  "Change the TODO state of an item.
The state of an item is given by a keyword at the start of the heading,
like
     *** TODO Write paper
     *** DONE Call mom

The different keywords are specified in the variable `org-todo-keywords'.
By default the available states are \"TODO\" and \"DONE\".
So for this example: when the item starts with TODO, it is changed to DONE.
When it starts with DONE, the DONE is removed.  And when neither TODO nor
DONE are present, add TODO at the beginning of the heading.

With \\[universal-argument] prefix arg, use completion to determine the new \
state.
With numeric prefix arg, switch to that state.
With a double \\[universal-argument] prefix, switch to the next set of TODO \
keywords (nextset).
With a triple \\[universal-argument] prefix, circumvent any state blocking.

For calling through lisp, arg is also interpreted in the following way:
'none             -> empty state
\"\"(empty string)  -> switch to empty state
'done             -> switch to DONE
'nextset          -> switch to the next set of keywords
'previousset      -> switch to the previous set of keywords
\"WAITING\"         -> switch to the specified keyword, but only if it
                     really is a member of `org-todo-keywords'.

org-after-todo-statistics-hook

Defined in: org.el

Hook that is called after a TODO statistics cookie has been updated.
Each function is called with two arguments: the number of not-done entries
and the number of done entries.

For example, the following function, when added to this hook, will switch
an entry to DONE when all children are done, and back to TODO when new
entries are set to a TODO status.  Note that this hook is only called
when there is a statistics cookie in the headline!

 (defun org-summary-todo (n-done n-not-done)
   \"Switch entry to DONE when all subentries are done, to TODO otherwise.\"
   (let (org-log-done org-log-states)   ; turn off logging
     (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\"))))

org-todo-statistics-hook

Defined in: org.el

Hook that is run whenever Org thinks TODO statistics should be updated.
This hook runs even if there is no statistics cookie present, in which case
`org-after-todo-statistics-hook' would not run.

org-reveal-start-hook

Defined in: org.el

Hook run before revealing a location.

org-property-changed-functions

Defined in: org.el

Hook called when the value of a property has changed.
Each hook function should accept two arguments, the name of the property
and the new value.

org-property-allowed-value-functions

Defined in: org.el

Hook for functions supplying allowed values for a specific property.
The functions must take a single argument, the name of the property, and
return a flat list of allowed values.  If \":ETC\" is one of
the values, this means that these values are intended as defaults for
completion, but that other values should be allowed too.
The functions must return nil if they are not responsible for this
property.

org-speed-command-hook

Defined in: org.el

Hook for activating speed commands at strategic locations.
Hook functions are called in sequence until a valid handler is
found.

Each hook takes a single argument, a user-pressed command key
which is also a `self-insert-command' from the global map.

Within the hook, examine the cursor position and the command key
and return nil or a valid handler as appropriate. Handler could
be one of an interactive command, a function, or a form.

Set `org-use-speed-commands' to non-nil value to enable this
hook. The default setting is `org-speed-command-default-hook'.

org-ctrl-c-ctrl-c-hook

Defined in: org.el

Hook for functions attaching themselves to  `C-c C-c'.
This can be used to add additional functionality to the C-c C-c key which
executes context-dependent commands.
Each function will be called with no arguments.  The function must check
if the context is appropriate for it to act.  If yes, it should do its
thing and then return a non-nil value.  If the context is wrong,
just do nothing and return nil.

org-tab-first-hook

Defined in: org.el

Hook for functions to attach themselves to TAB.
See `org-ctrl-c-ctrl-c-hook' for more information.
This hook runs as the first action when TAB is pressed, even before
`org-cycle' messes around with the `outline-regexp' to cater for
inline tasks and plain list item folding.
If any function in this hook returns t, any other actions that
would have been caused by TAB (such as table field motion or visibility
cycling) will not occur.

org-tab-after-check-for-table-hook

Defined in: org.el

Hook for functions to attach themselves to TAB.
See `org-ctrl-c-ctrl-c-hook' for more information.
This hook runs after it has been established that the cursor is not in a
table, but before checking if the cursor is in a headline or if global cycling
should be done.
If any function in this hook returns t, not other actions like visibility
cycling will be done.

org-tab-after-check-for-cycling-hook

Defined in: org.el

Hook for functions to attach themselves to TAB.
See `org-ctrl-c-ctrl-c-hook' for more information.
This hook runs after it has been established that not table field motion and
not visibility should be done because of current context.  This is probably
the place where a package like yasnippets can hook in.

org-tab-before-tab-emulation-hook

Defined in: org.el

Hook for functions to attach themselves to TAB.
See `org-ctrl-c-ctrl-c-hook' for more information.
This hook runs after every other options for TAB have been exhausted, but
before indentation and \t insertion takes place.

org-metaleft-hook

Defined in: org.el

Hook for functions attaching themselves to `M-left'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-metaright-hook

Defined in: org.el

Hook for functions attaching themselves to `M-right'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-metaup-hook

Defined in: org.el

Hook for functions attaching themselves to `M-up'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-metadown-hook

Defined in: org.el

Hook for functions attaching themselves to `M-down'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftmetaleft-hook

Defined in: org.el

Hook for functions attaching themselves to `M-S-left'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftmetaright-hook

Defined in: org.el

Hook for functions attaching themselves to `M-S-right'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftmetaup-hook

Defined in: org.el

Hook for functions attaching themselves to `M-S-up'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftmetadown-hook

Defined in: org.el

Hook for functions attaching themselves to `M-S-down'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-metareturn-hook

Defined in: org.el

Hook for functions attaching themselves to `M-RET'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftup-hook

Defined in: org.el

Hook for functions attaching themselves to `S-up'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftup-final-hook

Defined in: org.el

Hook for functions attaching themselves to `S-up'.
This one runs after all other options except shift-select have been excluded.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftdown-hook

Defined in: org.el

Hook for functions attaching themselves to `S-down'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftdown-final-hook

Defined in: org.el

Hook for functions attaching themselves to `S-down'.
This one runs after all other options except shift-select have been excluded.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftleft-hook

Defined in: org.el

Hook for functions attaching themselves to `S-left'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftleft-final-hook

Defined in: org.el

Hook for functions attaching themselves to `S-left'.
This one runs after all other options except shift-select have been excluded.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftright-hook

Defined in: org.el

Hook for functions attaching themselves to `S-right'.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-shiftright-final-hook

Defined in: org.el

Hook for functions attaching themselves to `S-right'.
This one runs after all other options except shift-select have been excluded.
See `org-ctrl-c-ctrl-c-hook' for more information.

org-agenda-before-write-hook

Defined in: org-agenda.el

Hook run in temporary buffer before writing it to an export file.
A useful function is `org-agenda-add-entry-text'.

org-finalize-agenda-hook

Defined in: org-agenda.el

Hook run just before displaying an agenda buffer.

org-agenda-entry-text-cleanup-hook

Defined in: org-agenda.el

Hook that is run after basic cleanup of entry text to be shown in agenda.
This cleanup is done in a temporary buffer, so the function may inspect and
change the entire buffer.
Some default stuff like drawers and scheduling/deadline dates will already
have been removed when this is called, as will any matches for regular
expressions listed in `org-agenda-entry-text-exclude-regexps'.

org-agenda-day-face-function

Defined in: org-agenda.el

Function called to determine what face should be used to display a day.
The only argument passed to that function is the day. It should
returns a face, or nil if does not want to specify a face and let
the normal rules apply.

org-agenda-auto-exclude-function

Defined in: org-agenda.el

A function called with a tag to decide if it is filtered on '/ RET'.
The sole argument to the function, which is called once for each
possible tag, is a string giving the name of the tag.  The
function should return either nil if the tag should be included
as normal, or \"-<TAG>\" to exclude the tag.
Note that for the purpose of tag filtering, only the lower-case version of
all tags will be considered, so that this function will only ever see
the lower-case version of all tags.

org-agenda-mode-hook

Defined in: org-agenda.el

Hook for `org-agenda-mode', run after the mode is turned on.

org-agenda-skip-function

Defined in: org-agenda.el

Function to be called at each match during agenda construction.
If this function returns nil, the current match should not be skipped.
Otherwise, the function must return a position from where the search
should be continued.
This may also be a Lisp form, it will be evaluated.
Never set this variable using `setq' or so, because then it will apply
to all future agenda commands.  Instead, bind it with `let' to scope
it dynamically into the agenda-constructing command.  A good way to set
it is through options in `org-agenda-custom-commands'.

org-agenda-cleanup-fancy-diary-hook

Defined in: org-agenda.el

Hook run when the fancy diary buffer is cleaned up.

org-agenda-before-sorting-filter-function

Defined in: org-agenda.el

Function to be applied to agenda items prior to sorting.
Prior to sorting also means just before they are inserted into the agenda.

To aid sorting, you may revisit the original entries and add more text
properties which will later be used by the sorting functions.

The function should take a string argument, an agenda line.
It has access to the text properties in that line, which contain among
other things, the property `org-hd-marker' that points to the entry
where the line comes from.  Note that not all lines going into the agenda
have this property, only most.

The function should return the modified string.  It is probably best
to ONLY change text properties.

You can also use this function as a filter, by returning nil for lines
you don't want to have in the agenda at all.  For this application, you
could bind the variable in the options section of a custom command.

org-agenda-after-show-hook

Defined in: org-agenda.el

Normal hook run after an item has been shown from the agenda.
Point is in the buffer where the item originated.

org-export-ascii-final-hook

Defined in: org-ascii.el

Hook run at the end of ASCII export, in the new buffer.

org-capture-before-finalize-hook

Defined in: org-capture.el

Hook that is run right before a remember process is finalized.
The remember buffer is still current when this hook runs.

org-capture-mode-hook

Defined in: org-capture.el

Hook for the minor `org-capture-mode'.

org-clock-heading-function

Defined in: org-clock.el

When non-nil, should be a function to create `org-clock-heading'.
This is the string shown in the mode line when a clock is running.
The function is called with point at the beginning of the headline.

org-clock-in-prepare-hook

Defined in: org-clock.el

Hook run when preparing the clock.
This hook is run before anything happens to the task that
you want to clock in.  For example, you can use this hook
to add an effort property.

org-clock-in-hook

Defined in: org-clock.el

Hook run when starting the clock.

org-clock-out-hook

Defined in: org-clock.el

Hook run when stopping the current clock.

org-clock-cancel-hook

Defined in: org-clock.el

Hook run when cancelling the current clock.

org-clock-goto-hook

Defined in: org-clock.el

Hook run when selecting the currently clocked-in entry.

org-ctags-open-link-functions

Defined in: org-ctags.el

List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when ORG-CTAGS is active.

org-export-docbook-final-hook

Defined in: org-docbook.el

Hook run at the end of DocBook export, in the new buffer.

org-export-blocks-postblock-hook

Defined in: org-exp-blocks.el

Run after blocks have been processed with `org-export-blocks-preprocess'.

org-export-first-hook

Defined in: org-exp.el

Hook called as the first thing in each exporter.
Point will be still in the original buffer.
Good for general initialization

org-export-preprocess-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
Pretty much the first thing when exporting is running this hook.
Point will be in a temporary buffer that contains a copy of
the original buffer, or of the section that is being export.
All the other hooks in the org-export-preprocess... category
also work in that temporary buffer, already modified by various
stages of the processing.

org-export-preprocess-after-include-files-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This is run after the contents of included files have been inserted.

org-export-preprocess-after-tree-selection-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This is run after selection of trees to be exported has happened.
This selection includes tags-based selection, as well as removal
of commented and archived trees.

org-export-preprocess-after-headline-targets-hook

Defined in: org-exp.el

Hook for preprocessing export buffer.
This is run just after the headline targets have been defined and
the target-alist has been set up.

org-export-preprocess-before-selecting-backend-code-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This is run just before backend-specific blocks get selected.

org-export-preprocess-after-blockquote-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This is run after blockquote/quote/verse/center have been marked
with cookies.

org-export-preprocess-after-radio-targets-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This is run after radio target processing.

org-export-preprocess-before-normalizing-links-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This hook is run before links are normalized.

org-export-preprocess-before-backend-specifics-hook

Defined in: org-exp.el

Hook run before backend-specific functions are called during preprocessing.

org-export-preprocess-final-hook

Defined in: org-exp.el

Hook for preprocessing an export buffer.
This is run as the last thing in the preprocessing buffer, just before
returning the buffer string to the backend.

org-export-define-heading-targets-headline-hook

Defined in: org-exp.el

Hook that is run when a headline was matched during target search.
This is part of the preprocessing for export.

org-export-format-drawer-function

Defined in: org-exp.el

Function to be called to format the contents of a drawer.
The function must accept three parameters:
  NAME     the drawer name, like \"PROPERTIES\"
  CONTENT  the content of the drawer.
  BACKEND  one of the symbols html, docbook, latex, ascii, xoxo
The function should return the text to be inserted into the buffer.
If this is nil, `org-export-format-drawer' is used as a default.

org-feed-after-adding-hook

Defined in: org-feed.el

Hook that is run after new items have been added to a file.
Depending on `org-feed-save-after-adding', the buffer will already
have been saved.

org-export-html-after-blockquotes-hook

Defined in: org-html.el

Hook run during HTML export, after blockquote, verse, center are done.

org-export-html-final-hook

Defined in: org-html.el

Hook run at the end of HTML export, in the new buffer.

org-icalendar-verify-function

Defined in: org-icalendar.el

Function to verify entries for iCalendar export.
This can be set to a function that will be called at each entry that
is considered for export to iCalendar.  When the function returns nil,
the entry will be skipped.  When it returns a non-nil value, the entry
will be considered for export.
This is used internally when an agenda buffer is exported to an ics file,
to make sure that only entries currently listed in the agenda will end
up in the ics file.  But for normal iCalendar export, you can use this
for whatever you need.

org-before-save-iCalendar-file-hook

Defined in: org-icalendar.el

Hook run before  an iCalendar file has been saved.
This can be used to modify the result of the export.

org-after-save-iCalendar-file-hook

Defined in: org-icalendar.el

Hook run after an iCalendar file has been saved.
The iCalendar buffer is still current when this hook is run.
A good way to use this is to tell a desktop calendar application to re-read
the iCalendar file.

org-export-latex-after-initial-vars-hook

Defined in: org-latex.el

Hook run before LaTeX export.
The exact moment is after the initial variables like org-export-latex-class
have been determined from the environment.

org-export-latex-after-blockquotes-hook

Defined in: org-latex.el

Hook run during LaTeX export, after blockquote, verse, center are done.

org-export-latex-final-hook

Defined in: org-latex.el

Hook run in the finalized LaTeX buffer.

org-export-latex-after-save-hook

Defined in: org-latex.el

Hook run in the finalized LaTeX buffer, after it has been saved.

org-export-latex-format-toc-function

Defined in: org-latex.el

The function formatting returning the string to create the table of contents.
The function mus take one parameter, the depth of the table of contents.

org-checkbox-statistics-hook

Defined in: org-list.el

Hook that is run whenever Org thinks checkbox statistics should be updated.
This hook runs even if checkbox rule in
`org-list-automatic-rules' does not apply, so it can be used to
implement alternative ways of collecting statistics
information.

org-mobile-pre-push-hook

Defined in: org-mobile.el

Hook run before running `org-mobile-push'.
This could be used to clean up `org-mobile-directory', for example to
remove files that used to be included in the agenda but no longer are.
The presence of such files would not really be a problem, but after time
they may accumulate.

org-mobile-post-push-hook

Defined in: org-mobile.el

Hook run after running `org-mobile-push'.
If Emacs does not have direct write access to the WebDAV directory used
by the mobile device, this hook should be used to copy all files from the
local staging directory `org-mobile-directory' to the WebDAV directory,
for example using `rsync' or `scp'.

org-mobile-pre-pull-hook

Defined in: org-mobile.el

Hook run before executing `org-mobile-pull'.
If Emacs does not have direct write access to the WebDAV directory used
by the mobile device, this hook should be used to copy the capture file
`mobileorg.org' from the WebDAV location to the local staging
directory `org-mobile-directory'.

org-mobile-post-pull-hook

Defined in: org-mobile.el

Hook run after running `org-mobile-pull'.
If Emacs does not have direct write access to the WebDAV directory used
by the mobile device, this hook should be used to copy the emptied
capture file `mobileorg.org' back to the WebDAV directory, for example
using `rsync' or `scp'.

org-mobile-before-process-capture-hook

Defined in: org-mobile.el

Hook that is run after content was moved to `org-mobile-inbox-for-pull'.
The inbox file is visited by the current buffer, and the buffer is
narrowed to the newly captured data.

org-mouse-context-menu-function

Defined in: org-mouse.el

Function to create the context menu.
The value of this variable is the function invoked by
`org-mouse-context-menu' as the context menu.

org-publish-before-export-hook

Defined in: org-publish.el

Hook run before export on the Org file.
The hook may modify the file in arbitrary ways before publishing happens.
The original version of the buffer will be restored after publishing.

org-publish-after-export-hook

Defined in: org-publish.el

Hook run after export on the exported buffer.
Any changes made by this hook will be saved.

org-remember-before-finalize-hook

Defined in: org-remember.el

Hook that is run right before a remember process is finalized.
The remember buffer is still current when this hook runs.

org-remember-mode-hook

Defined in: org-remember.el

Hook for the minor `org-remember-mode'.

org-src-mode-hook

Defined in: org-src.el

Hook  run after Org switched a source code snippet to its Emacs mode.
This hook will run

- when editing a source code snippet with \"C-c '\".
- When formatting a source code snippet for export with htmlize.

You may want to use this hook for example to turn off `outline-minor-mode'
or similar things which you want to have when editing a source code file,
but which mess up the display of a snippet in Org exported files.

org-export-taskjuggler-final-hook

Defined in: org-taskjuggler.el

Hook run at the end of TaskJuggler export, in the new buffer.

org-timer-start-hook

Defined in: org-timer.el

Hook run after relative timer is started.

org-timer-stop-hook

Defined in: org-timer.el

Hook run before relative timer is stopped.

org-timer-pause-hook

Defined in: org-timer.el

Hook run before relative timer is paused.

org-timer-set-hook

Defined in: org-timer.el

Hook run after countdown timer is set.

org-timer-done-hook

Defined in: org-timer.el

Hook run after countdown timer reaches zero.

org-timer-cancel-hook

Defined in: org-timer.el

Hook run before countdown timer is canceled.

org-export-xoxo-final-hook

Defined in: org-xoxo.el

Hook run after XOXO export, in the new buffer.

Examples for using hooks

Feel free to give example of how do you use these hooks. Ideas for other hooks are also welcome.

org-follow-link-hook    bzg

If you want to display dormant article when following Gnus articles:

(add-hook 'org-follow-link-hook 
          (lambda () (if (eq major-mode 'gnus-summary-mode)
                         (gnus-summary-insert-dormant-articles))))

org-agenda-after-show-hook

To get a compact view during follow mode in the agenda, you could try this:

(defun my-compact-follow ()
  "Make the view compact, then show the necessary minimum."
  (ignore-errors
    (save-excursion
      (while (org-up-heading-safe))
      (hide-subtree)))
  (let ((org-show-siblings nil)
        (org-show-hierarchy-above t))
    (org-reveal))
  (save-excursion
    (org-back-to-heading t)
    (show-children)))

(add-hook 'org-agenda-after-show-hook 'my-compact-follow)

Documentation from the http://orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples are licensed under the GNU General Public License v3 or later.