1 #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TITLE: List of org-mode hooks - examples of use
6 #+EMAIL: bzg AT altern DOT org
11 # This file is the default header for new Org files in Worg. Feel free
12 # to tailor it to your needs.
14 [[file:index.org][{Back to Worg's index}]]
16 This is the list of Org-mode hooks and function variables, with their
17 documentation strings:
20 * Hooks and Function variables
25 Mode hook for Org-mode, run after the mode was turned on.
30 Hook that is run after org.el has been loaded.
32 ** =org-log-buffer-setup-hook=
35 Hook that is run after an Org log buffer is created.
37 ** =org-pre-cycle-hook=
40 Hook that is run before visibility cycling is happening.
41 The function(s) in this hook must accept a single argument which indicates
42 the new state that will be set right after running this hook. The
43 argument is a symbol. Before a global state change, it can have the values
44 `overview', `content', or `all'. Before a local state change, it can have
45 the values `folded', `children', or `subtree'.
50 Hook that is run after `org-cycle' has changed the buffer visibility.
51 The function(s) in this hook must accept a single argument which indicates
52 the new state that was set by the most recent `org-cycle' command. The
53 argument is a symbol. After a global state change, it can have the values
54 `overview', `content', or `all'. After a local state change, it can have
55 the values `folded', `children', or `subtree'.
57 ** =org-insert-heading-hook=
60 Hook being run after inserting a new heading.
65 Hook that is run after `org-occur' has constructed a sparse tree.
66 This can be used to recenter the window to show as much of the structure
69 ** =org-make-link-description-function=
72 Function to use to generate link descriptions from links.
73 If nil the link location will be used. This function must take
74 two parameters; the first is the link and the second the
75 description `org-insert-link' has generated, and should return the
78 ** =org-link-translation-function=
81 Function to translate links with different syntax to Org syntax.
82 This can be used to translate links created for example by the Planner
83 or emacs-wiki packages to Org syntax.
84 The function must accept two parameters, a TYPE containing the link
85 protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
86 which is everything after the link protocol. It should return a cons
87 with possibly modified values of type and path.
88 Org contains a function for this, so if you set this variable to
89 `org-translate-link-from-planner', you should be able follow many
90 links created by planner.
92 ** =org-follow-link-hook=
95 Hook that is run after a link has been followed.
97 ** =org-confirm-shell-link-function=
100 Non-nil means ask for confirmation before executing shell links.
101 Shell links can be dangerous: just think about a link
103 [[shell:rm -rf ~/*][Google Search]]
105 This link would show up in your Org-mode document as \"Google Search\",
106 but really it would remove your entire home directory.
107 Therefore we advise against setting this variable to nil.
108 Just change it to `y-or-n-p' if you want to confirm with a
109 single keystroke rather than having to type \"yes\".
111 ** =org-confirm-elisp-link-function=
114 Non-nil means ask for confirmation before executing Emacs Lisp links.
115 Elisp links can be dangerous: just think about a link
117 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
119 This link would show up in your Org-mode document as \"Google Search\",
120 but really it would remove your entire home directory.
121 Therefore we advise against setting this variable to nil.
122 Just change it to `y-or-n-p' if you want to confirm with a
123 single keystroke rather than having to type \"yes\".
125 ** =org-refile-target-verify-function=
128 Function to verify if the headline at point should be a refile target.
129 The function will be called without arguments, with point at the
130 beginning of the headline. It should return t and leave point
131 where it is if the headline is a valid target for refiling.
133 If the target should not be selected, the function must return nil.
134 In addition to this, it may move point to a place from where the search
135 should be continued. For example, the function may decide that the entire
136 subtree of the current entry should be excluded and move point to the end
139 ** =org-after-todo-state-change-hook=
142 Hook which is run after the state of a TODO item was changed.
143 The new state (a string with a TODO keyword, or nil) is available in the
144 Lisp variable `state'.
146 ** =org-blocker-hook=
149 Hook for functions that are allowed to block a state change.
151 Each function gets as its single argument a property list, see
152 `org-trigger-hook' for more information about this list.
154 If any of the functions in this hook returns nil, the state change
157 ** =org-trigger-hook=
160 Hook for functions that are triggered by a state change.
162 Each function gets as its single argument a property list with at least
163 the following elements:
165 (:type type-of-change :position pos-at-entry-start
166 :from old-state :to new-state)
168 Depending on the type, more properties may be present.
170 This mechanism is currently implemented for:
174 :type todo-state-change
175 :from previous state (keyword as a string), or nil, or a symbol
176 'todo' or 'done', to indicate the general type of state.
177 :to new state, like in :from
179 ** =org-get-priority-function=
182 Function to extract the priority from a string.
183 The string is normally the headline. If this is nil Org computes the
184 priority from the priority cookie like [#A] in the headline. It returns
185 an integer, increasing by 1000 for each priority level.
186 The user can set a different function here, which should take a string
187 as an argument and return the numeric priority.
189 ** =org-read-date-minibuffer-setup-hook=
192 Hook to be used to set up keys for the date/time interface.
193 Add key definitions to `minibuffer-local-map', which will be a temporary
196 ** =org-tags-sort-function=
199 When set, tags are sorted using this function as a comparator.
201 ** =org-after-tags-change-hook=
204 Hook that is run after the tags in a line have changed.
206 ** =org-columns-modify-value-for-display-function=
209 Function that modifies values for display in column view.
210 For example, it can be used to cut out a certain part from a time stamp.
211 The function must take 2 arguments:
213 column-title The title of the column (*not* the property name)
214 value The value that should be modified.
216 The function should return the value that should be displayed,
217 or nil if the normal value should be used.
219 ** =org-finish-function=
222 Function to be called when `C-c C-c' is used.
223 This is for getting out of special buffers like remember.
225 ** =org-font-lock-hook=
228 Functions to be called for special font lock stuff.
230 ** =org-font-lock-set-keywords-hook=
233 Functions that can manipulate `org-font-lock-extra-keywords'.
234 This is called after `org-font-lock-extra-keywords' is defined, but before
235 it is installed to be used by font lock. This can be useful if something
236 needs to be inserted at a specific position in the font-lock sequence.
238 ** =org-after-demote-entry-hook=
241 Hook run after an entry has been demoted.
242 The cursor will be at the beginning of the entry.
243 When a subtree is being demoted, the hook will be called for each node.
245 ** =org-after-promote-entry-hook=
248 Hook run after an entry has been promoted.
249 The cursor will be at the beginning of the entry.
250 When a subtree is being promoted, the hook will be called for each node.
252 ** =org-after-sorting-entries-or-items-hook=
255 Hook that is run after a bunch of entries or items have been sorted.
256 When children are sorted, the cursor is in the parent line when this
257 hook gets called. When a region or a plain list is sorted, the cursor
258 will be in the first entry of the sorted region/list.
260 ** =org-store-link-functions=
263 List of functions that are called to create and store a link.
264 Each function will be called in turn until one returns a non-nil
265 value. Each function should check if it is responsible for creating
266 this link (for example by looking at the major mode).
267 If not, it must exit and return nil.
268 If yes, it should return a non-nil value after a calling
269 `org-store-link-props' with a list of properties and values.
270 Special properties are:
272 :type The link prefix, like \"http\". This must be given.
273 :link The link, like \"http://www.astro.uva.nl/~dominik\".
274 This is obligatory as well.
275 :description Optional default description for the second pair
276 of brackets in an Org-mode link. The user can still change
277 this when inserting this link into an Org-mode buffer.
279 In addition to these, any additional properties can be specified
280 and then used in remember templates.
282 ** =org-open-link-functions=
285 Hook for functions finding a plain text link.
286 These functions must take a single argument, the link content.
287 They will be called for links that look like [[link text][description]]
288 when LINK TEXT does not have a protocol like \"http:\" and does not look
289 like a filename (e.g. \"./blue.png\").
291 These functions will be called *before* Org attempts to resolve the
292 link by doing text searches in the current buffer - so if you want a
293 link \"[[target]]\" to still find \"<<target>>\", your function should
294 handle this as a special case.
296 When the function does handle the link, it must return a non-nil value.
297 If it decides that it is not responsible for this link, it must return
298 nil to indicate that that Org-mode can continue with other options
299 like exact and fuzzy text search.
301 ** =org-open-at-point-functions=
304 Hook that is run when following a link at point.
306 Functions in this hook must return t if they identify and follow
307 a link at point. If they don't find anything interesting at point,
308 they must return nil.
310 ** =org-create-file-search-functions=
313 List of functions to construct the right search string for a file link.
314 These functions are called in turn with point at the location to
315 which the link should point.
317 A function in the hook should first test if it would like to
318 handle this file type, for example by checking the `major-mode'
319 or the file extension. If it decides not to handle this file, it
320 should just return nil to give other functions a chance. If it
321 does handle the file, it must return the search string to be used
322 when following the link. The search string will be part of the
323 file link, given after a double colon, and `org-open-at-point'
324 will automatically search for it. If special measures must be
325 taken to make the search successful, another function should be
326 added to the companion hook `org-execute-file-search-functions',
329 A function in this hook may also use `setq' to set the variable
330 `description' to provide a suggestion for the descriptive text to
331 be used for this link when it gets inserted into an Org-mode
332 buffer with \\[org-insert-link].
334 ** =org-execute-file-search-functions=
337 List of functions to execute a file search triggered by a link.
339 Functions added to this hook must accept a single argument, the
340 search string that was part of the file link, the part after the
341 double colon. The function must first check if it would like to
342 handle this search, for example by checking the `major-mode' or
343 the file extension. If it decides not to handle this search, it
344 should just return nil to give other functions a chance. If it
345 does handle the search, it must return a non-nil value to keep
346 other functions from trying.
348 Each function can access the current prefix argument through the
349 variable `current-prefix-argument'. Note that a single prefix is
350 used to force opening a link in Emacs, so it may be good to only
351 use a numeric or double prefix to guide the search function.
353 In case this is needed, a function in this hook can also restore
354 the window configuration before `org-open-at-point' was called using:
356 (set-window-configuration org-window-config-before-follow-link)
358 ** =org-after-refile-insert-hook=
361 Hook run after `org-refile' has inserted its stuff at the new location.
362 Note that this is still *before* the stuff will be removed from
365 ** =org-todo-setup-filter-hook=
368 Hook for functions that pre-filter todo specs.
369 Each function takes a todo spec and returns either nil or the spec
370 transformed into canonical form." )
372 (defvar org-todo-get-default-hook nil
373 "Hook for functions that get a default item for todo.
374 Each function takes arguments (NEW-MARK OLD-MARK) and returns either
375 nil or a string to be used for the todo mark." )
377 (defvar org-agenda-headline-snapshot-before-repeat)
379 (defun org-current-effective-time ()
380 "Return current time adjusted for `org-extend-today-until' variable
382 ** =org-after-todo-statistics-hook=
385 Hook that is called after a TODO statistics cookie has been updated.
386 Each function is called with two arguments: the number of not-done entries
387 and the number of done entries.
389 For example, the following function, when added to this hook, will switch
390 an entry to DONE when all children are done, and back to TODO when new
391 entries are set to a TODO status. Note that this hook is only called
392 when there is a statistics cookie in the headline!
394 (defun org-summary-todo (n-done n-not-done)
395 \"Switch entry to DONE when all subentries are done, to TODO otherwise.\"
396 (let (org-log-done org-log-states) ; turn off logging
397 (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\"))))
399 ** =org-todo-statistics-hook=
402 Hook that is run whenever Org thinks TODO statistics should be updated.
403 This hook runs even if there is no statistics cookie present, in which case
404 `org-after-todo-statistics-hook' would not run.
406 ** =org-reveal-start-hook=
409 Hook run before revealing a location.
411 ** =org-property-changed-functions=
414 Hook called when the value of a property has changed.
415 Each hook function should accept two arguments, the name of the property
418 ** =org-property-set-functions=
421 Property set function alist.
422 Each entry should have the following format:
424 (PROPERTY . READ-FUNCTION)
426 The read function will be called with the same argument as
427 `org-completing-read'.
429 ** =org-property-allowed-value-functions=
432 Hook for functions supplying allowed values for a specific property.
433 The functions must take a single argument, the name of the property, and
434 return a flat list of allowed values. If \":ETC\" is one of
435 the values, this means that these values are intended as defaults for
436 completion, but that other values should be allowed too.
437 The functions must return nil if they are not responsible for this
440 ** =org-speed-command-hook=
443 Hook for activating speed commands at strategic locations.
444 Hook functions are called in sequence until a valid handler is
447 Each hook takes a single argument, a user-pressed command key
448 which is also a `self-insert-command' from the global map.
450 Within the hook, examine the cursor position and the command key
451 and return nil or a valid handler as appropriate. Handler could
452 be one of an interactive command, a function, or a form.
454 Set `org-use-speed-commands' to non-nil value to enable this
455 hook. The default setting is `org-speed-command-default-hook'.
457 ** =org-ctrl-c-ctrl-c-hook=
460 Hook for functions attaching themselves to `C-c C-c'.
462 This can be used to add additional functionality to the C-c C-c
463 key which executes context-dependent commands. This hook is run
464 before any other test, while `org-ctrl-c-ctrl-c-final-hook' is
465 run after the last test.
467 Each function will be called with no arguments. The function
468 must check if the context is appropriate for it to act. If yes,
469 it should do its thing and then return a non-nil value. If the
470 context is wrong, just do nothing and return nil.
472 ** =org-ctrl-c-ctrl-c-final-hook=
475 Hook for functions attaching themselves to `C-c C-c'.
477 This can be used to add additional functionality to the C-c C-c
478 key which executes context-dependent commands. This hook is run
479 after any other test, while `org-ctrl-c-ctrl-c-hook' is run
480 before the first test.
482 Each function will be called with no arguments. The function
483 must check if the context is appropriate for it to act. If yes,
484 it should do its thing and then return a non-nil value. If the
485 context is wrong, just do nothing and return nil.
487 ** =org-tab-first-hook=
490 Hook for functions to attach themselves to TAB.
491 See `org-ctrl-c-ctrl-c-hook' for more information.
492 This hook runs as the first action when TAB is pressed, even before
493 `org-cycle' messes around with the `outline-regexp' to cater for
494 inline tasks and plain list item folding.
495 If any function in this hook returns t, any other actions that
496 would have been caused by TAB (such as table field motion or visibility
497 cycling) will not occur.
499 ** =org-tab-after-check-for-table-hook=
502 Hook for functions to attach themselves to TAB.
503 See `org-ctrl-c-ctrl-c-hook' for more information.
504 This hook runs after it has been established that the cursor is not in a
505 table, but before checking if the cursor is in a headline or if global cycling
507 If any function in this hook returns t, not other actions like visibility
508 cycling will be done.
510 ** =org-tab-after-check-for-cycling-hook=
513 Hook for functions to attach themselves to TAB.
514 See `org-ctrl-c-ctrl-c-hook' for more information.
515 This hook runs after it has been established that not table field motion and
516 not visibility should be done because of current context. This is probably
517 the place where a package like yasnippets can hook in.
519 ** =org-tab-before-tab-emulation-hook=
522 Hook for functions to attach themselves to TAB.
523 See `org-ctrl-c-ctrl-c-hook' for more information.
524 This hook runs after every other options for TAB have been exhausted, but
525 before indentation and \t insertion takes place.
527 ** =org-metaleft-hook=
530 Hook for functions attaching themselves to `M-left'.
531 See `org-ctrl-c-ctrl-c-hook' for more information.
533 ** =org-metaright-hook=
536 Hook for functions attaching themselves to `M-right'.
537 See `org-ctrl-c-ctrl-c-hook' for more information.
542 Hook for functions attaching themselves to `M-up'.
543 See `org-ctrl-c-ctrl-c-hook' for more information.
545 ** =org-metadown-hook=
548 Hook for functions attaching themselves to `M-down'.
549 See `org-ctrl-c-ctrl-c-hook' for more information.
551 ** =org-shiftmetaleft-hook=
554 Hook for functions attaching themselves to `M-S-left'.
555 See `org-ctrl-c-ctrl-c-hook' for more information.
557 ** =org-shiftmetaright-hook=
560 Hook for functions attaching themselves to `M-S-right'.
561 See `org-ctrl-c-ctrl-c-hook' for more information.
563 ** =org-shiftmetaup-hook=
566 Hook for functions attaching themselves to `M-S-up'.
567 See `org-ctrl-c-ctrl-c-hook' for more information.
569 ** =org-shiftmetadown-hook=
572 Hook for functions attaching themselves to `M-S-down'.
573 See `org-ctrl-c-ctrl-c-hook' for more information.
575 ** =org-metareturn-hook=
578 Hook for functions attaching themselves to `M-RET'.
579 See `org-ctrl-c-ctrl-c-hook' for more information.
581 ** =org-shiftup-hook=
584 Hook for functions attaching themselves to `S-up'.
585 See `org-ctrl-c-ctrl-c-hook' for more information.
587 ** =org-shiftup-final-hook=
590 Hook for functions attaching themselves to `S-up'.
591 This one runs after all other options except shift-select have been excluded.
592 See `org-ctrl-c-ctrl-c-hook' for more information.
594 ** =org-shiftdown-hook=
597 Hook for functions attaching themselves to `S-down'.
598 See `org-ctrl-c-ctrl-c-hook' for more information.
600 ** =org-shiftdown-final-hook=
603 Hook for functions attaching themselves to `S-down'.
604 This one runs after all other options except shift-select have been excluded.
605 See `org-ctrl-c-ctrl-c-hook' for more information.
607 ** =org-shiftleft-hook=
610 Hook for functions attaching themselves to `S-left'.
611 See `org-ctrl-c-ctrl-c-hook' for more information.
613 ** =org-shiftleft-final-hook=
616 Hook for functions attaching themselves to `S-left'.
617 This one runs after all other options except shift-select have been excluded.
618 See `org-ctrl-c-ctrl-c-hook' for more information.
620 ** =org-shiftright-hook=
623 Hook for functions attaching themselves to `S-right'.
624 See `org-ctrl-c-ctrl-c-hook' for more information.
626 ** =org-shiftright-final-hook=
629 Hook for functions attaching themselves to `S-right'.
630 This one runs after all other options except shift-select have been excluded.
631 See `org-ctrl-c-ctrl-c-hook' for more information.
633 ** =org-agenda-before-write-hook=
634 Defined in: /org-agenda.el/
636 Hook run in temporary buffer before writing it to an export file.
637 A useful function is `org-agenda-add-entry-text'.
639 ** =org-agenda-skip-function=
640 Defined in: /org-agenda.el/
642 Function to be called at each match during agenda construction.
643 If this function returns nil, the current match should not be skipped.
644 If the function decided to skip an agenda match, is must return the
645 buffer position from which the search should be continued.
646 This may also be a Lisp form, which will be evaluated.
648 This variable will be applied to every agenda match, including
649 tags/property searches and TODO lists. So try to make the test function
650 do its checking as efficiently as possible. To implement a skipping
651 condition just for specific agenda commands, use the variable
652 `org-agenda-skip-function' which can be set in the options section
653 of custom agenda commands.
655 ** =org-finalize-agenda-hook=
656 Defined in: /org-agenda.el/
658 Hook run just before displaying an agenda buffer.
660 ** =org-agenda-entry-text-cleanup-hook=
661 Defined in: /org-agenda.el/
663 Hook that is run after basic cleanup of entry text to be shown in agenda.
664 This cleanup is done in a temporary buffer, so the function may inspect and
665 change the entire buffer.
666 Some default stuff like drawers and scheduling/deadline dates will already
667 have been removed when this is called, as will any matches for regular
668 expressions listed in `org-agenda-entry-text-exclude-regexps'.
670 ** =org-agenda-day-face-function=
671 Defined in: /org-agenda.el/
673 Function called to determine what face should be used to display a day.
674 The only argument passed to that function is the day. It should
675 returns a face, or nil if does not want to specify a face and let
676 the normal rules apply.
678 ** =org-agenda-auto-exclude-function=
679 Defined in: /org-agenda.el/
681 A function called with a tag to decide if it is filtered on '/ RET'.
682 The sole argument to the function, which is called once for each
683 possible tag, is a string giving the name of the tag. The
684 function should return either nil if the tag should be included
685 as normal, or \"-<TAG>\" to exclude the tag.
686 Note that for the purpose of tag filtering, only the lower-case version of
687 all tags will be considered, so that this function will only ever see
688 the lower-case version of all tags.
690 ** =org-agenda-bulk-custom-functions=
691 Defined in: /org-agenda.el/
693 Alist of characters and custom functions for bulk actions.
694 For example, this value makes those two functions available:
699 With selected entries in an agenda buffer, `B R' will call
700 the custom function `set-category' on the selected entries.
701 Note that functions in this alist don't need to be quoted.
703 ** =org-agenda-mode-hook=
704 Defined in: /org-agenda.el/
706 Hook for `org-agenda-mode', run after the mode is turned on.
708 ** =org-agenda-skip-function=
709 Defined in: /org-agenda.el/
711 Function to be called at each match during agenda construction.
712 If this function returns nil, the current match should not be skipped.
713 Otherwise, the function must return a position from where the search
715 This may also be a Lisp form, it will be evaluated.
716 Never set this variable using `setq' or so, because then it will apply
717 to all future agenda commands. If you do want a global skipping condition,
718 use the option `org-agenda-skip-function-global' instead.
719 The correct usage for `org-agenda-skip-function' is to bind it with
720 `let' to scope it dynamically into the agenda-constructing command.
721 A good way to set it is through options in `org-agenda-custom-commands'.
723 ** =org-agenda-cleanup-fancy-diary-hook=
724 Defined in: /org-agenda.el/
726 Hook run when the fancy diary buffer is cleaned up.
728 ** =org-agenda-before-sorting-filter-function=
729 Defined in: /org-agenda.el/
731 Function to be applied to agenda items prior to sorting.
732 Prior to sorting also means just before they are inserted into the agenda.
734 To aid sorting, you may revisit the original entries and add more text
735 properties which will later be used by the sorting functions.
737 The function should take a string argument, an agenda line.
738 It has access to the text properties in that line, which contain among
739 other things, the property `org-hd-marker' that points to the entry
740 where the line comes from. Note that not all lines going into the agenda
741 have this property, only most.
743 The function should return the modified string. It is probably best
744 to ONLY change text properties.
746 You can also use this function as a filter, by returning nil for lines
747 you don't want to have in the agenda at all. For this application, you
748 could bind the variable in the options section of a custom command.
750 ** =org-agenda-after-show-hook=
751 Defined in: /org-agenda.el/
753 Normal hook run after an item has been shown from the agenda.
754 Point is in the buffer where the item originated.
756 ** =org-export-ascii-final-hook=
757 Defined in: /org-ascii.el/
759 Hook run at the end of ASCII export, in the new buffer.
761 ** =org-capture-before-finalize-hook=
762 Defined in: /org-capture.el/
764 Hook that is run right before a capture process is finalized.
765 The capture buffer is still current when this hook runs.
767 ** =org-capture-after-finalize-hook=
768 Defined in: /org-capture.el/
770 Hook that is run right after a capture process is finalized.
771 Suitable for window cleanup
773 ** =org-capture-mode-hook=
774 Defined in: /org-capture.el/
776 Hook for the minor `org-capture-mode'.
778 ** =org-clock-heading-function=
779 Defined in: /org-clock.el/
781 When non-nil, should be a function to create `org-clock-heading'.
782 This is the string shown in the mode line when a clock is running.
783 The function is called with point at the beginning of the headline.
785 ** =org-clock-in-prepare-hook=
786 Defined in: /org-clock.el/
788 Hook run when preparing the clock.
789 This hook is run before anything happens to the task that
790 you want to clock in. For example, you can use this hook
791 to add an effort property.
793 ** =org-clock-in-hook=
794 Defined in: /org-clock.el/
796 Hook run when starting the clock.
798 ** =org-clock-out-hook=
799 Defined in: /org-clock.el/
801 Hook run when stopping the current clock.
803 ** =org-clock-cancel-hook=
804 Defined in: /org-clock.el/
806 Hook run when cancelling the current clock.
808 ** =org-clock-goto-hook=
809 Defined in: /org-clock.el/
811 Hook run when selecting the currently clocked-in entry.
813 ** =org-clock-before-select-task-hook=
814 Defined in: /org-clock.el/
816 Hook called in task selection just before prompting the user.
818 ** =org-ctags-open-link-functions=
819 Defined in: /org-ctags.el/
821 List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when ORG-CTAGS is active.
823 ** =org-export-docbook-final-hook=
824 Defined in: /org-docbook.el/
826 Hook run at the end of DocBook export, in the new buffer.
828 ** =org-export-blocks-postblock-hook=
829 Defined in: /org-exp-blocks.el/
831 Run after blocks have been processed with `org-export-blocks-preprocess'.
833 ** =org-export-first-hook=
834 Defined in: /org-exp.el/
836 Hook called as the first thing in each exporter.
837 Point will be still in the original buffer.
838 Good for general initialization
840 ** =org-export-preprocess-hook=
841 Defined in: /org-exp.el/
843 Hook for preprocessing an export buffer.
844 Pretty much the first thing when exporting is running this hook.
845 Point will be in a temporary buffer that contains a copy of
846 the original buffer, or of the section that is being exported.
847 All the other hooks in the org-export-preprocess... category
848 also work in that temporary buffer, already modified by various
849 stages of the processing.
851 ** =org-export-preprocess-after-include-files-hook=
852 Defined in: /org-exp.el/
854 Hook for preprocessing an export buffer.
855 This is run after the contents of included files have been inserted.
857 ** =org-export-preprocess-after-tree-selection-hook=
858 Defined in: /org-exp.el/
860 Hook for preprocessing an export buffer.
861 This is run after selection of trees to be exported has happened.
862 This selection includes tags-based selection, as well as removal
863 of commented and archived trees.
865 ** =org-export-preprocess-after-headline-targets-hook=
866 Defined in: /org-exp.el/
868 Hook for preprocessing export buffer.
869 This is run just after the headline targets have been defined and
870 the target-alist has been set up.
872 ** =org-export-preprocess-before-selecting-backend-code-hook=
873 Defined in: /org-exp.el/
875 Hook for preprocessing an export buffer.
876 This is run just before backend-specific blocks get selected.
878 ** =org-export-preprocess-after-blockquote-hook=
879 Defined in: /org-exp.el/
881 Hook for preprocessing an export buffer.
882 This is run after blockquote/quote/verse/center have been marked
885 ** =org-export-preprocess-after-radio-targets-hook=
886 Defined in: /org-exp.el/
888 Hook for preprocessing an export buffer.
889 This is run after radio target processing.
891 ** =org-export-preprocess-before-normalizing-links-hook=
892 Defined in: /org-exp.el/
894 Hook for preprocessing an export buffer.
895 This hook is run before links are normalized.
897 ** =org-export-preprocess-before-backend-specifics-hook=
898 Defined in: /org-exp.el/
900 Hook run before backend-specific functions are called during preprocessing.
902 ** =org-export-preprocess-final-hook=
903 Defined in: /org-exp.el/
905 Hook for preprocessing an export buffer.
906 This is run as the last thing in the preprocessing buffer, just before
907 returning the buffer string to the backend.
909 ** =org-export-define-heading-targets-headline-hook=
910 Defined in: /org-exp.el/
912 Hook that is run when a headline was matched during target search.
913 This is part of the preprocessing for export.
915 ** =org-export-format-drawer-function=
916 Defined in: /org-exp.el/
918 Function to be called to format the contents of a drawer.
919 The function must accept two parameters:
920 NAME the drawer name, like \"PROPERTIES\"
921 CONTENT the content of the drawer.
922 You can check the export backend through `org-export-current-backend'.
923 The function should return the text to be inserted into the buffer.
924 If this is nil, `org-export-format-drawer' is used as a default.
926 ** =org-feed-after-adding-hook=
927 Defined in: /org-feed.el/
929 Hook that is run after new items have been added to a file.
930 Depending on `org-feed-save-after-adding', the buffer will already
933 ** =org-export-html-after-blockquotes-hook=
934 Defined in: /org-html.el/
936 Hook run during HTML export, after blockquote, verse, center are done.
938 ** =org-export-html-final-hook=
939 Defined in: /org-html.el/
941 Hook run at the end of HTML export, in the new buffer.
943 ** =org-icalendar-verify-function=
944 Defined in: /org-icalendar.el/
946 Function to verify entries for iCalendar export.
947 This can be set to a function that will be called at each entry that
948 is considered for export to iCalendar. When the function returns nil,
949 the entry will be skipped. When it returns a non-nil value, the entry
950 will be considered for export.
951 This is used internally when an agenda buffer is exported to an ics file,
952 to make sure that only entries currently listed in the agenda will end
953 up in the ics file. But for normal iCalendar export, you can use this
954 for whatever you need.
956 ** =org-before-save-iCalendar-file-hook=
957 Defined in: /org-icalendar.el/
959 Hook run before an iCalendar file has been saved.
960 This can be used to modify the result of the export.
962 ** =org-after-save-iCalendar-file-hook=
963 Defined in: /org-icalendar.el/
965 Hook run after an iCalendar file has been saved.
966 The iCalendar buffer is still current when this hook is run.
967 A good way to use this is to tell a desktop calendar application to re-read
970 ** =org-export-latex-after-initial-vars-hook=
971 Defined in: /org-latex.el/
973 Hook run before LaTeX export.
974 The exact moment is after the initial variables like org-export-latex-class
975 have been determined from the environment.
977 ** =org-export-latex-after-blockquotes-hook=
978 Defined in: /org-latex.el/
980 Hook run during LaTeX export, after blockquote, verse, center are done.
982 ** =org-export-latex-final-hook=
983 Defined in: /org-latex.el/
985 Hook run in the finalized LaTeX buffer.
987 ** =org-export-latex-after-save-hook=
988 Defined in: /org-latex.el/
990 Hook run in the finalized LaTeX buffer, after it has been saved.
992 ** =org-export-latex-format-toc-function=
993 Defined in: /org-latex.el/
995 The function formatting returning the string to create the table of contents.
996 The function must take one parameter, the depth of the table of contents.
998 ** =org-checkbox-statistics-hook=
999 Defined in: /org-list.el/
1001 Hook that is run whenever Org thinks checkbox statistics should be updated.
1002 This hook runs even if checkbox rule in
1003 `org-list-automatic-rules' does not apply, so it can be used to
1004 implement alternative ways of collecting statistics
1007 ** =org-mobile-pre-push-hook=
1008 Defined in: /org-mobile.el/
1010 Hook run before running `org-mobile-push'.
1011 This could be used to clean up `org-mobile-directory', for example to
1012 remove files that used to be included in the agenda but no longer are.
1013 The presence of such files would not really be a problem, but after time
1014 they may accumulate.
1016 ** =org-mobile-post-push-hook=
1017 Defined in: /org-mobile.el/
1019 Hook run after running `org-mobile-push'.
1020 If Emacs does not have direct write access to the WebDAV directory used
1021 by the mobile device, this hook should be used to copy all files from the
1022 local staging directory `org-mobile-directory' to the WebDAV directory,
1023 for example using `rsync' or `scp'.
1025 ** =org-mobile-pre-pull-hook=
1026 Defined in: /org-mobile.el/
1028 Hook run before executing `org-mobile-pull'.
1029 If Emacs does not have direct write access to the WebDAV directory used
1030 by the mobile device, this hook should be used to copy the capture file
1031 `mobileorg.org' from the WebDAV location to the local staging
1032 directory `org-mobile-directory'.
1034 ** =org-mobile-post-pull-hook=
1035 Defined in: /org-mobile.el/
1037 Hook run after running `org-mobile-pull'.
1038 If Emacs does not have direct write access to the WebDAV directory used
1039 by the mobile device, this hook should be used to copy the emptied
1040 capture file `mobileorg.org' back to the WebDAV directory, for example
1041 using `rsync' or `scp'.
1043 ** =org-mobile-before-process-capture-hook=
1044 Defined in: /org-mobile.el/
1046 Hook that is run after content was moved to `org-mobile-inbox-for-pull'.
1047 The inbox file is visited by the current buffer, and the buffer is
1048 narrowed to the newly captured data.
1050 ** =org-mouse-context-menu-function=
1051 Defined in: /org-mouse.el/
1053 Function to create the context menu.
1054 The value of this variable is the function invoked by
1055 `org-mouse-context-menu' as the context menu.
1057 ** =org-publish-before-export-hook=
1058 Defined in: /org-publish.el/
1060 Hook run before export on the Org file.
1061 The hook may modify the file in arbitrary ways before publishing happens.
1062 The original version of the buffer will be restored after publishing.
1064 ** =org-publish-after-export-hook=
1065 Defined in: /org-publish.el/
1067 Hook run after export on the exported buffer.
1068 Any changes made by this hook will be saved.
1070 ** =org-remember-before-finalize-hook=
1071 Defined in: /org-remember.el/
1073 Hook that is run right before a remember process is finalized.
1074 The remember buffer is still current when this hook runs.
1076 ** =org-remember-mode-hook=
1077 Defined in: /org-remember.el/
1079 Hook for the minor `org-remember-mode'.
1081 ** =org-src-mode-hook=
1082 Defined in: /org-src.el/
1084 Hook run after Org switched a source code snippet to its Emacs mode.
1087 - when editing a source code snippet with \"C-c '\".
1088 - When formatting a source code snippet for export with htmlize.
1090 You may want to use this hook for example to turn off `outline-minor-mode'
1091 or similar things which you want to have when editing a source code file,
1092 but which mess up the display of a snippet in Org exported files.
1094 ** =org-export-taskjuggler-final-hook=
1095 Defined in: /org-taskjuggler.el/
1097 Hook run at the end of TaskJuggler export, in the new buffer.
1099 ** =org-timer-start-hook=
1100 Defined in: /org-timer.el/
1102 Hook run after relative timer is started.
1104 ** =org-timer-stop-hook=
1105 Defined in: /org-timer.el/
1107 Hook run before relative timer is stopped.
1109 ** =org-timer-pause-hook=
1110 Defined in: /org-timer.el/
1112 Hook run before relative timer is paused.
1114 ** =org-timer-continue-hook=
1115 Defined in: /org-timer.el/
1117 Hook run after relative timer is continued.
1119 ** =org-timer-set-hook=
1120 Defined in: /org-timer.el/
1122 Hook run after countdown timer is set.
1124 ** =org-timer-done-hook=
1125 Defined in: /org-timer.el/
1127 Hook run after countdown timer reaches zero.
1129 ** =org-timer-cancel-hook=
1130 Defined in: /org-timer.el/
1132 Hook run before countdown timer is canceled.
1134 ** =org-export-xoxo-final-hook=
1135 Defined in: /org-xoxo.el/
1137 Hook run after XOXO export, in the new buffer.
1160 * Examples for using hooks
1162 Feel free to give example of how do you use these hooks. Ideas for
1163 other hooks are also welcome.
1165 ** org-follow-link-hook :bzg:
1167 If you want to display dormant article when following Gnus articles:
1169 #+BEGIN_SRC emacs-lisp
1170 (add-hook 'org-follow-link-hook
1171 (lambda () (if (eq major-mode 'gnus-summary-mode)
1172 (gnus-summary-insert-dormant-articles))))
1175 ** org-agenda-after-show-hook
1177 To get a compact view during follow mode in the agenda, you could try
1180 #+begin_src emacs-lisp
1181 (defun my-compact-follow ()
1182 "Make the view compact, then show the necessary minimum."
1185 (while (org-up-heading-safe))
1187 (let ((org-show-siblings nil)
1188 (org-show-hierarchy-above t))
1191 (org-back-to-heading t)
1194 (add-hook 'org-agenda-after-show-hook 'my-compact-follow)