2 #+AUTHOR: Carsten Dominik
4 #+DATE: {{{modification-time}}}
5 #+SUBTITLE: Release {{{version}}}
6 #+SUBAUTHOR: with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan Davison, Eric Schulte, Thomas Dye and Jambunathan K.
9 #+OPTIONS: H:4 num:t toc:t \n:nil ::t |:t ^:nil -:t f:t *:t <:t
10 #+OPTIONS: d:nil todo:nil pri:nil tags:not-in-toc
12 #+EXCLUDE_TAGS: noexport
14 #+TEXINFO_DIR_CATEGORY: Emacs editing modes
15 #+TEXINFO_DIR_TITLE: Org Mode: (org)
16 #+TEXINFO_DIR_DESC: Outline-based notes management and organizer
18 # Use proper quote and backtick for code sections in PDF output
19 # Cf. Texinfo manual 14.2
20 #+TEXINFO_HEADER: @set txicodequoteundirected
21 #+TEXINFO_HEADER: @set txicodequotebacktick
24 #+TEXINFO_HEADER: @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
25 #+TEXINFO_HEADER: @set MAINTAINER Carsten Dominik
26 #+TEXINFO_HEADER: @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
27 #+TEXINFO_HEADER: @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
35 :DESCRIPTION: Getting started
37 #+cindex: introduction
41 :DESCRIPTION: Brief summary of what Org-mode does
45 Org is a mode for keeping notes, maintaining TODO lists, and doing
46 project planning with a fast and effective plain-text system.
48 Org develops organizational tasks around NOTES files that contain
49 lists or information about projects as plain text. Org is implemented
50 on top of Outline mode, which makes it possible to keep the content of
51 large files well structured. Visibility cycling and structure editing
52 help to work with the tree. Tables are easily created with a built-in
53 table editor. Org supports TODO items, deadlines, timestamps, and
54 scheduling. It dynamically compiles entries into an agenda that
55 utilizes and smoothly integrates much of the Emacs calendar and diary.
56 Plain text URL-like links connect to websites, emails, Usenet
57 messages, BBDB entries, and any files related to the projects. For
58 printing and sharing of notes, an Org file can be exported as a
59 structured ASCII file, as HTML, or as an iCalendar file.[fn:1] It can
60 also serve as a publishing tool for a set of linked web pages.
62 As a project planning environment, Org works by adding metadata to
63 outline nodes. Based on this data, specific entries can be extracted
64 in queries and create dynamic /agenda views/.
66 Org mode contains the Org Babel environment which allows you to work
67 with embedded source code blocks in a file, to facilitate code
68 evaluation, documentation, and literate programming techniques.
70 Org's automatic, context-sensitive table editor with spreadsheet
71 capabilities can be integrated into any major mode by activating the
72 minor Orgtbl mode. Using a translation step, it can be used to
73 maintain tables in arbitrary file types, for example in LaTeX. The
74 structure editing and list creation capabilities can be used outside
75 Org with the minor Orgstruct mode.
77 Org keeps simple things simple. When first fired up, it should feel
78 like a straightforward, easy to use outliner. Complexity is not
79 imposed, but a large amount of functionality is available when you
80 need it. Org is a toolbox and can be used in different ways and for
81 different ends, for example:
83 - an outline extension with visibility cycling and structure editing
84 - an ASCII system and table editor for taking structured notes
86 - a full agenda and planner with deadlines and work scheduling
87 #+pindex: GTD, Getting Things Done
88 - an environment in which to implement David Allen's GTD system
89 - a simple hypertext system, with HTML and LaTeX export
90 - a publishing tool to create a set of interlinked web pages
91 - an environment for literate programming
95 There is a [[http://orgmode.org][website for Org]] that provides links to the newest version
96 of Org, as well as additional information, frequently asked questions
97 (FAQ), links to tutorials, etc.
99 #+cindex: print edition
101 Version 7.3 of this manual is available as a [[http://www.network-theory.co.uk/org/manual/][paperback book from
102 Network Theory Ltd.]]
108 :DESCRIPTION: How to install a downloaded version of Org-mode
111 #+cindex: installation
114 *Important:* If you have the version of Org that comes with Emacs or
115 as a XEmacs package, please skip this section and go directly to
116 [[Activation]]. If you downloaded Org as an ELPA package, please read the
117 instructions on the [[http://orgmode.org/elpa.html][Org ELPA page]]. To see what version of Org (if any)
118 is part of your Emacs distribution, type {{{kbd(M-x org-version)}}}.[fn:2]
120 Installation of Org mode uses a build system, which is described in more
121 detail on [[http://orgmode.org/worg/dev/org-build-system.html][Worg]].
123 If you have downloaded Org from the Web as a distribution {{{file(.zip)}}} or
124 {{{file(.tar.gz)}}} archive, take the following steps to install it:
126 - Unpack the distribution archive
127 - Change into (~cd~) the Org directory
128 - Run ~make help config~ and then check and edit the file
129 {{{file(local.mk)}}} if the default configuration does not match
132 - Set the name of the Emacs binary (likely either
133 {{{file(emacs)}}} or {{{file(xemacs)}}}), and the paths to the
134 directories where local Lisp and Info files will be installed
135 - If the Emacs binary is not in your path, give the full path to
137 - Avoid spaces in any path names
139 - Run ~make config~ again to check the configuration
140 - Run ~make install~ or ~sudo make install~ to build and install Org
143 If you use a cloned Git repository, then the procedure is slightly
144 different. The following description assumes that you are using the
145 ~master~ branch.[fn:3] You could also use the ~maint~ branch instead,
146 where the release versions are published, just replace ~master~ with
147 ~maint~ in the description below.
149 - Change into (~cd~) the Org repository
150 - Run ~git checkout master~ to switch to the ~master~ branch of the
152 - Run ~make help~ and then check and edit the file {{{file(local.mk)}}}
154 - You must set the name of the Emacs binary
155 (likely either {{{file(emacs)}}} or {{{file(xemacs)}}}), and the
156 paths to the directories where local Lisp and Info files will be
158 - If the Emacs binary is not in your path, you must give
159 the full path to the executable
160 - Avoid spaces in any path names
162 - Run ~make config~ to check the configuration
163 - Optionally run ~make test~ to build Org mode and then run the full
165 - Run ~make update2~ or ~make up2~ to update the Git repository and
166 build and install Org mode. The latter invocation runs the
167 complete test suite before installation and installs only if the
168 build passes all tests
170 If you don't have access to the system-wide directories and you don't
171 want to install somewhere into your home directory, you can run Org
172 directly from the distribution directory or Org repository by
173 compiling Org mode in place:
175 - Change into (~cd~) the Org repository
176 - Run ~git checkout master~ to switch to the ~master~ branch of the
180 Last but not least you can also run Org mode directly from an Org repository
181 without any compilation. Simply replace the last step in the recipe above
182 with ~make uncompiled~.
184 Then add the following line to {{{file(.emacs)}}}:
186 #+header: :exports code
188 #+begin_src emacs-lisp
189 (add-to-list 'load-path "~/path/to/orgdir/lisp")
193 If you plan to use code files from the {{{file(contrib)}}} subdirectory without
194 compiling them, do a similar step for this directory:
196 #+header: :exports code
198 #+begin_src emacs-lisp
199 (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
202 If you want to include those files with the build and install, please
203 customize the variable ~ORG_ADD_CONTRIB~ instead in your
204 ~local.mk~ file. For more details please see this
205 [[http://orgmode.org/worg/dev/org-build-system.html#sec-4-1-2][description on Worg]].
207 Installing Info files is system dependent, because of differences in
208 the {{{file(install-info)}}} program. The Info documentation is
209 installed together with the rest of Org mode. If you don't install Org
210 mode, it is possible to install the Info documentation separately if you
211 have install-info on your system.[fn:4]
213 The command to do this is:
219 Do not forget to activate Org as described in the following section.
224 :DESCRIPTION: How to activate Org-mode for certain buffers
229 #+cindex: global key bindings
230 #+cindex: key bindings, global
232 #+findex: org-capture
233 #+findex: org-store-link
234 #+findex: org-iswitchb
236 Since Emacs 22.2, files with the {{{file(.org)}}} extension use Org mode by
237 default. If you are using an earlier version of Emacs, add this line to your
238 {{{file(.emacs)}}} file:
240 #+header: :exports code
242 #+begin_src emacs-lisp
243 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
246 Org mode buffers need font-lock to be turned on - this is the default in
249 There are compatibility issues between Org mode and some other Elisp
250 packages, please take the time to check the list (see [[Conflicts]]).
252 The four Org commands {{{command(org-store-link)}}},
253 {{{command(org-capture)}}}, {{{command(org-agenda)}}}, and
254 {{{command(org-iswitchb)}}} should be accessible through global keys
255 (i.e., anywhere in Emacs, not just in Org buffers). Here are
256 suggested bindings for these keys, please modify the keys to your own
259 #+header: :exports code
261 #+begin_src emacs-lisp
262 (global-set-key "\C-cl" 'org-store-link)
263 (global-set-key "\C-cc" 'org-capture)
264 (global-set-key "\C-ca" 'org-agenda)
265 (global-set-key "\C-cb" 'org-iswitchb)
268 #+cindex: Org mode, turning on
269 With this setup, all files with extension {{{samp(.org)}}} will be put
270 into Org mode. As an alternative, make the first line of a file look
274 MY PROJECTS -*- mode: org; -*-
277 #+vindex: org-insert-mode-line-in-empty-file
279 which will select Org mode for this buffer no matter what the file's
280 name is. See also the variable
281 ~org-insert-mode-line-in-empty-file~.
283 Many commands in Org work on the region if the region is /active/. To
284 make use of this, you need to have ~transient-mark-mode~
285 (~zmacs-regions~ in XEmacs) turned on. In Emacs 23 this is the
286 default, in Emacs 22 you need to do this yourself with
288 #+header: :exports code
290 #+begin_src emacs-lisp
291 (transient-mark-mode 1)
294 {{{noindent}}} If you do not like ~transient-mark-mode~, you can
295 create an active region by using the mouse to select a region, or
296 pressing {{{kbdkey(C-,SPC)}}} twice before moving the cursor.
300 :DESCRIPTION: Bug reports, ideas, patches, etc.
303 #+cindex: bug reports
307 If you find problems with Org, or if you have questions, remarks, or
308 ideas about it, please mail to the Org mailing list
309 [[mailto:emacs-orgmode@gnu.org]]. If you are not a member of
310 the mailing list, your mail will be passed to the list after a
311 moderator has approved it.[fn:6]
313 For bug reports, please first try to reproduce the bug with the latest
314 version of Org available---if you are running an outdated version, it
315 is quite possible that the bug has been fixed already. If the bug
316 persists, prepare a report and provide as much information as
317 possible, including the version information of Emacs ({{{kbdspckey(M-x
318 emacs-version,RET)}}}) and Org ({{{kbdspckey(M-x org-version,RET)}}}),
319 as well as the Org related setup in {{{file(.emacs)}}}. The easiest
320 way to do this is to use the command {{{kbd(M-x
321 org-submit-bug-report)}}}, which will put all this information into an
322 Emacs mail buffer so that you only need to add your description. If
323 you are not sending the Email from within Emacs, please copy and paste
324 the content into your Email program.
326 Sometimes you might face a problem due to an error in your Emacs or
327 Org mode setup. Before reporting a bug, it is very helpful to start
328 Emacs with minimal customizations and reproduce the problem. Doing so
329 often helps you determine if the problem is with your customization or
330 with Org mode itself. You can start a typical minimal session with a
331 command like the example below.
333 #+begin_src sh :exports code
334 $ emacs -Q -l /path/to/minimal-org.el
337 However if you are using Org mode distributed with Emacs, a minimal
338 setup is not necessary. In that case it is sufficient to start Emacs
339 as ~emacs -Q~. The ~minimal-org.el~ setup
340 file can have contents as shown below.
342 #+header: :exports code
344 #+begin_src emacs-lisp
345 ;;; Minimal setup to load latest `org-mode'
347 ;; activate debugging
348 (setq debug-on-error t
352 ;; add latest org-mode to load path
353 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
354 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
357 If an error occurs, a backtrace can be very useful (see [[How to
358 create a useful backtrace]]). Often a small example file helps, along
359 with clear information about:
361 1. What exactly did you do?
362 2. What did you expect to happen?
363 3. What happened instead?
365 {{{noindent}}} Thank you for helping to improve this program.
367 ** How to create a useful backtrace
369 :DESCRIPTION: The best way to report an error
372 #+cindex: backtrace of an error
374 If working with Org produces an error with a message you don't
375 understand, you may have hit a bug. The best way to report this is by
376 providing, in addition to what was mentioned above, a /backtrace/.
377 This is information from the built-in debugger about where and how the
378 error occurred. Here is how to produce a useful backtrace:
380 1. Reload uncompiled versions of all Org mode Lisp files. The
381 backtrace contains much more information if it is produced with
382 uncompiled code. To do this, use
383 {{{kbdspckey(C-u M-x org-reload,RET)}}} or select
384 ~Org -> Refresh/Reload -> Reload Org uncompiled~ from the menu.
386 2. Go to the ~Options~ menu and select ~Enter Debugger on Error~
387 (XEmacs has this option in the ~Troubleshooting~ sub-menu).
389 3. Do whatever you have to do to hit the error. Don't forget to
390 document the steps you take.
392 4. When you hit the error, a {{{file(*Backtrace*)}}} buffer will
393 appear on the screen. Save this buffer to a file (for example
394 using {{{kbd(C-x C-w)}}}) and attach it to your bug report.
398 :DESCRIPTION: Typesetting conventions in the manual
401 Conventions for typesetting keywords, keybindings, and commands in
402 this manual are described.
404 *** Three types of keywords
406 :DESCRIPTION: TODO, tags, and properties
409 Org mainly uses three types of keywords: TODO keywords, tags and property
410 names. In this manual we use the following conventions:
412 - TODO, WAITING :: TODO keywords are written with all capitals, even if they
414 - boss, ARCHIVE :: User-defined tags are written in lowercase; built-in
415 tags with special meaning are written with all capitals.
416 - Release, PRIORITY :: User-defined properties are capitalized; built-in
417 properties with special meaning are written with all capitals.
419 Moreover, Org uses /option keywords/ (like ~#+TITLE~ to set the title)
420 and /environment keywords/ (like ~#+BEGIN_HTML~ to start a ~HTML~
421 environment). They are written in uppercase in the manual to enhance
422 its readability, but you can use lowercase in your Org files.[fn:7]
424 *** Keybindings and commands
426 :DESCRIPTION: Bind useful commands to keys
432 #+findex: org-capture
434 The manual suggests two global keybindings: {{{kbd(C-c a)}}} for
435 ~org-agenda~ and {{{kbd(C-c c)}}} for ~org-capture~. These are only
436 suggestions, but the rest of the manual assumes that you are using
439 Also, the manual lists both the keys and the corresponding commands
440 for accessing a functionality. Org mode often uses the same key for
441 different functions, depending on context. The command that is bound
442 to such keys has a generic name, like ~org-metaright~. In the manual
443 we will, wherever possible, give the function that is internally
444 called by the generic command. For example, in the chapter on document
445 structure, {{{kbdkey(M-,right)}}} will be listed to call
446 ~org-do-demote~, while in the chapter on tables, it will be listed to
447 call ~org-table-move-column-right~.
449 # If you prefer, you can compile the manual without the command names by unsetting the flag ~cmdnames~ in {{{file(org.texi)}}}.
453 :DESCRIPTION: A tree works like your brain
454 :ALT_TITLE: Document Structure
456 #+cindex: document structure
457 #+cindex: structure of document
459 Org is based on Outline mode and provides flexible commands to
460 edit the structure of the document.
464 :DESCRIPTION: Org mode is based on Outline mode
467 #+cindex: Outline mode
469 Org is implemented on top of Outline mode. Outlines allow a document
470 to be organized in a hierarchical structure, which (at least for me)
471 is the best representation of notes and thoughts. An overview of this
472 structure is achieved by folding (hiding) large parts of the document
473 to show only the general document structure and the parts currently
474 being worked on. Org greatly simplifies the use of outlines by
475 compressing the entire show/hide functionality into a single command,
476 {{{command(org-cycle)}}}, which is bound to the {{{key(TAB)}}} key.
480 :DESCRIPTION: How to typeset Org tree headlines
483 #+cindex: outline tree
484 #+vindex: org-special-ctrl-a/e
485 #+vindex: org-special-ctrl-k
486 #+vindex: org-ctrl-k-protect-subtree
488 Headlines define the structure of an outline tree. The headlines in Org
489 start with one or more stars, on the left margin.[fn:8] For example:
492 ,* Top level headline
498 ,* Another top level headline
501 {{{noindent}}} Some people find the many stars too noisy and would
502 prefer an outline that has whitespace followed by a single star as
503 headline starters. A setup to realize this is described in the
504 section, [[Clean view]].
506 #+vindex: org-cycle-separator-lines
507 An empty line after the end of a subtree is considered part of it and
508 will be hidden when the subtree is folded. However, if you leave at
509 least two empty lines, one empty line will remain visible after folding
510 the subtree, in order to structure the collapsed view. See the
511 variable ~org-cycle-separator-lines~ to modify this behavior.
513 ** Visibility cycling
515 :DESCRIPTION: Show and hide, much simplified
516 :ALT_TITLE: Visibility cycling
518 #+cindex: cycling, visibility
519 #+cindex: visibility cycling
520 #+cindex: trees, visibility
521 #+cindex: show hidden text
524 Outlines make it possible to hide parts of the text in the buffer.
525 Org uses just two commands, bound to {{{key(TAB)}}} and
526 {{{kbdkey(S-,TAB)}}} to change the visibility in the buffer.
528 #+cindex: subtree visibility states
529 #+cindex: subtree cycling
530 #+cindex: folded, subtree visibility state
531 #+cindex: children, subtree visibility state
532 #+cindex: subtree, subtree visibility state
534 #+attr_texinfo: :table-type table :indic @asis
535 - {{{key(TAB)}}}, ~org-cycle~ :: Subtrees can be cycled through three
541 ,-> FOLDED -> CHILDREN -> SUBTREE --.
542 '-----------------------------------'
545 #+vindex: org-cycle-emulate-tab
546 #+vindex: org-cycle-global-at-bob
548 By default, the cursor must be on a headline for this to work,
549 but this behavior can be modified with the
550 ~org-cycle-emulate-tab~ option. When the cursor is at the
551 beginning of the buffer and the first line is not a headline,
552 then {{{key(TAB)}}} actually runs global cycling (see
553 below).[fn:9] Also, when called with a prefix argument
554 ({{{kbdspckey(C-u,TAB)}}}), global cycling is invoked.
556 - {{{kbdkey(S-,TAB)}}} or {{{kbdspckey(C-u,TAB)}}}, ~org-global-cycle~ ::
557 Global cycling: Rotate the entire buffer among the states
559 #+cindex: global visibility states
560 #+cindex: global cycling
561 #+cindex: overview, global visibility state
562 #+cindex: contents, global visibility state
563 #+cindex: show all, global visibility state
566 #+findex: org-global-cycle
569 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
570 '--------------------------------------'
573 When {{{kbdkey(S-,TAB)}}} is called with a numeric prefix
574 argument, ~N~, the CONTENTS view up to headlines of level N will
575 be shown. Note that inside tables, {{{kbdkey(S-,TAB)}}} jumps
576 to the previous field.
578 - {{{kbdspckey(C-u C-u C-u,TAB)}}}, ~show-all~ :: Show all, including
581 #+kindex: C-u C-u C-u TAB
583 #+cindex: show all, command
584 - {{{kbd(C-c C-r)}}}, ~org-reveal~ :: Reveal context around point,
585 showing the current entry, the following heading and the
586 hierarchy above. Useful for working near a location that has
587 been exposed by a sparse tree command (see [[Sparse trees]]) or an
588 agenda command (see [[Agenda commands]]). With a prefix argument
589 show, on each level, all sibling headings. With a double prefix
590 argument, also show the entire subtree of the parent.
592 #+cindex: revealing context
595 - {{{kbd(C-c C-k)}}}, ~show-branches~ :: Expose all the headings of
596 the subtree, CONTENT view for just one subtree.
599 #+findex: show-branches
600 #+cindex: show branches, command
601 - {{{kbdspckey(C-c,TAB)}}}, ~show-children~ :: Expose all direct
602 children of the subtree. With a numeric prefix argument, ~N~,
603 expose all children down to level N.
606 #+findex: show-children
607 #+cindex: show children, command
608 - {{{kbd(C-c C-x b)}}}, ~org-tree-to-indirect-buffer~ :: Show the
609 current subtree in an indirect buffer.[fn:10] With a numeric
610 prefix argument, ~N~, go up to level N and then take that tree.
611 If N is negative then go up that many levels. With a
612 {{{kbd(C-u)}}} prefix, do not remove the previously used indirect
616 #+findex: org-tree-to-indirect-buffer
617 - {{{kbd(C-c C-x v)}}}, ~org-copy-visible~ :: Copy the /visible/ text
618 in the region into the kill ring.
620 #+vindex: org-startup-folded
621 #+cindex: ~overview~, STARTUP keyword
622 #+cindex: ~content~, STARTUP keyword
623 #+cindex: ~showall~, STARTUP keyword
624 #+cindex: ~showeverything~, STARTUP keyword
626 When Emacs first visits an Org file, the global state is set to
627 OVERVIEW, i.e., only the top level headlines are visible. This can be
628 configured through the variable ~org-startup-folded~, or on a
629 per-file basis by adding one of the following lines anywhere in the
636 ,#+STARTUP: showeverything
639 #+cindex: property, VISIBILITY
641 {{{noindent}}} Furthermore, any entries with a {{{samp(VISIBILITY)}}}
642 property (see [[Properties and columns]]) will get their visibility
643 adapted accordingly. Allowed values for this property are ~folded~,
644 ~children~, ~content~, and ~all~.
646 #+attr_texinfo: :indic @asis
647 - {{{kbdspckey(C-u C-u,TAB)}}}, ~org-set-startup-visibility~ :: Switch
648 back to the startup visibility of the buffer, i.e., whatever is
649 requested by startup options and {{{samp(VISIBILITY)}}}
650 properties in individual entries.
654 :DESCRIPTION: Jumping to other headlines
656 #+cindex: motion, between headlines
657 #+cindex: jumping, to headlines
658 #+cindex: headline navigation
659 The following commands jump to other headlines in the buffer.
661 #+attr_texinfo: :table-type table :indic @asis
662 - {{{kbd(C-c C-n)}}}, ~outline-next-visible-heading~ :: Next heading.
664 #+findex: outline-next-visible-heading
665 - {{{kbd(C-c C-p)}}}, ~outline-previous-visible-heading~ :: Previous heading.
667 #+findex: outline-previous-visible-heading
668 - {{{kbd(C-c C-f)}}}, ~org-forward-same-level~ :: Next heading same level.
670 #+findex: org-forward-same-level
671 - {{{kbd(C-c C-b)}}}, ~org-backward-same-level~ :: Previous heading same level.
673 #+findex: org-backward-same-level
674 - {{{kbd(C-c C-u)}}}, ~outline-up-heading~ :: Backward to higher level heading.
676 #+findex: outline-up-heading
677 - {{{kbd(C-c C-j)}}}, ~org-goto~ :: Jump to a different place without
678 changing the current outline visibility. Shows the document
679 structure in a temporary buffer, where you can use the
680 following keys to find your destination:
684 #+vindex: org-goto-auto-isearch
685 - {{{key(TAB)}}} :: Cycle visibility.
686 - {{{key(down)}}} / {{{key(up)}}} :: Next/previous visible headline.
687 - {{{key(RET)}}} :: Select this location.
688 - {{{kbd(/)}}} :: Do a Sparse-tree search
689 The following keys work if you turn off ~org-goto-auto-isearch~
690 - n / p :: Next/previous visible headline.
691 - f / b :: Next/previous headline same level.
693 - 0--9 :: Digit argument.
696 #+vindex: org-goto-interface
697 {{{noindent}}} See also the variable ~org-goto-interface~.
701 :DESCRIPTION: Changing sequence and level of headlines
702 :ALT_TITLE: Structure editing
704 #+cindex: structure editing
705 #+cindex: headline, promotion and demotion
706 #+cindex: promotion, of subtrees
707 #+cindex: demotion, of subtrees
708 #+cindex: subtree, cut and paste
709 #+cindex: pasting, of subtrees
710 #+cindex: cutting, of subtrees
711 #+cindex: copying, of subtrees
712 #+cindex: sorting, of subtrees
713 #+cindex: subtrees, cut and paste
715 #+attr_texinfo: :table-type table :indic @asis
716 - {{{kbdkey(M-,RET)}}}, ~org-insert-heading~ :: Insert new heading
717 with same level as current. If the cursor is in a plain list
718 item, a new item is created (see [[Plain lists]]). To force
719 creation of a new headline, use a prefix argument. When this
720 command is used in the middle of a line, the line is split and
721 the rest of the line becomes the new headline.[fn:11] If the
722 command is used at the beginning of a headline, the new
723 headline is created before the current line. If at the
724 beginning of any other line, the content of that line is made
725 the new heading. If the command is used at the end of a folded
726 subtree (i.e., behind the ellipses at the end of a headline),
727 then a headline like the current one will be inserted after the
731 #+findex: org-insert-heading
732 #+vindex: org-M-RET-may-split-line
733 - {{{kbdkey(C-,RET)}}}, ~org-insert-heading-respect-content~ :: Just
734 like {{{kbdkey(M-,RET)}}}, except when adding a new heading
735 below the current heading, the new heading is placed after the
736 body instead of before it. This command works from anywhere in
740 #+findex: org-insert-heading-respect-content
741 - {{{kbdkey(M-S-,RET)}}}, ~org-insert-todo-heading~ :: Insert new
742 TODO entry with same level as current heading. See also the
743 variable ~org-treat-insert-todo-heading-as-state-change~.
746 #+findex: org-insert-todo-heading
747 #+vindex: org-treat-insert-todo-heading-as-state-change
748 - {{{kbdkey(C-S-,RET)}}}, ~org-insert-todo-heading-respect-content~ :: Insert
749 new TODO entry with same level as current heading. Like
750 {{{kbdkey(C-,RET)}}}, the new headline will be inserted after
754 #+findex: org-insert-todo-heading-respect-content
755 - {{{key(TAB)}}}, ~org-cycle~ :: In a new entry with no text
756 yet, the first {{{key(TAB)}}} demotes the entry to become a
757 child of the previous one. The next {{{key(TAB)}}} makes it a
758 parent, and so on, all the way to top level. Yet another
759 {{{key(TAB)}}}, and you are back to the initial level.
763 - {{{kbdkey(M-,left)}}}, ~org-do-promote~ :: Promote current heading
767 #+findex: org-do-promote
768 - {{{kbdkey(M-,right)}}}, ~org-do-demote~ :: Demote current heading
772 #+findex: org-do-demote
773 - {{{kbdkey(M-S-,left)}}}, ~org-promote-subtree~ :: Promote the
774 current subtree by one level.
777 #+findex: org-promote-subtree
778 - {{{kbdkey(M-S-,right)}}}, ~org-demote-subtree~ :: Demote the
779 current subtree by one level.
782 #+findex: org-demote-subtree
783 - {{{kbdkey(M-S-,up)}}}, ~org-move-subtree-up~ :: Move subtree up
784 (swap with previous subtree of same level).
787 #+findex: org-move-subtree-up
788 - {{{kbdkey(M-S-,down)}}}, ~org-move-subtree-down~ :: Move subtree
789 down (swap with next subtree of same level).
792 #+findex: org-move-subtree-down
793 - {{{kbd(C-c C-x C-w)}}}, ~org-cut-subtree~ :: Kill subtree, i.e.,
794 remove it from buffer but save in kill ring. With a numeric
795 prefix argument N, kill N sequential subtrees.
797 #+kindex: C-c C-x C-w
798 #+findex: org-cut-subtree
799 - {{{kbd(C-c C-x M-w)}}}, ~org-copy-subtree~ :: Copy subtree to kill
800 ring. With a numeric prefix argument N, copy the N sequential
803 #+kindex: C-c C-x M-w
804 #+findex: org-copy-subtree
805 - {{{kbd(C-c C-x C-y)}}}, ~org-paste-subtree~ :: Yank subtree from
806 kill ring. This does modify the level of the subtree to make
807 sure the tree fits in nicely at the yank position. The yank
808 level can also be specified with a numeric prefix argument, or
809 by yanking after a headline marker like {{{samp(****)}}}.
811 #+kindex: C-c C-x C-y
812 #+findex: org-paste-subtree
813 - {{{kbd(C-y)}}}, ~org-yank~ :: Depending on the variables
814 ~org-yank-adjusted-subtrees~ and ~org-yank-folded-subtrees~,
815 Org's internal ~yank~ command will paste subtrees folded and in
816 a clever way, using the same command as {{{kbd(C-c C-x C-y)}}}.
817 With the default settings, no level adjustment will take place,
818 but the yanked tree will be folded unless doing so would
819 swallow text previously visible. Any prefix argument to this
820 command will force a normal ~yank~ to be executed, with the
821 prefix passed along. A good way to force a normal yank is
822 {{{kbd(C-u C-y)}}}. If you use ~yank-pop~ after a yank, it
823 will yank previous kill items plainly, without adjustment and
828 #+vindex: org-yank-adjusted-subtrees
829 #+vindex: org-yank-folded-subtrees
830 - {{{kbd(C-c C-x c)}}}, ~org-clone-subtree-with-time-shift~ :: Clone
831 a subtree by making a number of sibling copies of it. You will
832 be prompted for the number of copies to make, and you can also
833 specify if any timestamps in the entry should be shifted. This
834 can be useful, for example, to create a number of tasks related
835 to a series of lectures to prepare. For more details, see the
836 docstring of the command ~org-clone-subtree-with-time-shift~.
839 #+findex: org-clone-subtree-with-time-shift
840 - {{{kbd(C-c C-w)}}}, ~org-refile~ :: Refile entry or region to a
841 different location. See [[Refile and copy]].
845 - {{{kbd(C-c ^)}}}, ~org-sort~ :: Sort same-level entries. When
846 there is an active region, all entries in the region will be
847 sorted. Otherwise the children of the current headline are
848 sorted. The command prompts for the sorting method, which can
849 be alphabetically, numerically, by time (first timestamp with
850 active preferred, creation time, scheduled time, deadline
851 time), by priority, by TODO keyword (in the sequence the
852 keywords have been defined in the setup) or by the value of a
853 property. Reverse sorting is possible as well. You can also
854 supply your own function to extract the sorting key. With a
855 {{{kbd(C-u)}}} prefix, sorting will be case-sensitive.
859 - {{{kbd(C-x n s)}}}, ~org-narrow-to-subtree~ :: Narrow buffer to
863 #+findex: org-narrow-to-subtree
864 - {{{kbd(C-x n b)}}}, ~org-narrow-to-block~ :: Narrow buffer to
868 #+findex: org-narrow-to-block
869 - {{{kbd(C-x n w)}}}, ~widen~ :: Widen buffer to remove narrowing.
873 - {{{kbd(C-c *)}}}, ~org-toggle-heading~ :: Turn a normal line or
874 plain list item into a headline (so that it becomes a
875 subheading at its location). Also turn a headline into a normal
876 line by removing the stars. If there is an active region, turn
877 all lines in the region into headlines. If the first line in
878 the region was an item, turn only the item lines into
879 headlines. Finally, if the first line is a headline, remove the
880 stars from all headlines in the region.
883 #+findex: org-toggle-heading
885 #+cindex: region, active
886 #+cindex: active region
887 #+cindex: transient mark mode
889 When there is an active region (Transient Mark mode), promotion and
890 demotion work on all headlines in the region. To select a region of
891 headlines, it is best to place both point and mark at the beginning of
892 a line, mark at the beginning of the first headline, and point at the
893 line just after the last headline to change. Note that when the
894 cursor is inside a table (see [[Tables]]), the Meta-Cursor keys have
895 different functionality.
899 :DESCRIPTION: Matches embedded in context
900 :ALT_TITLE: Sparse trees
902 #+cindex: sparse trees
903 #+cindex: trees, sparse
904 #+cindex: folding, sparse trees
905 #+cindex: occur, command
906 #+vindex: org-show-hierarchy-above
907 #+vindex: org-show-following-heading
908 #+vindex: org-show-siblings
909 #+vindex: org-show-entry-below
911 An important feature of Org mode is the ability to construct /sparse
912 trees/ for selected information in an outline tree, so that the entire
913 document is folded as much as possible, but the selected information
914 is made visible along with the headline structure above it.[fn:12]
915 Just try it out and you will see immediately how it works.
917 Org mode contains several commands creating such trees, all these
918 commands can be accessed through a dispatcher:
920 #+attr_texinfo: :table-type table :indic @asis
921 - {{{kbd(C-c /)}}}, ~org-sparse-tree~ :: This prompts for an extra
922 key to select a sparse-tree creating command.
925 #+findex: org-sparse-tree
926 - {{{kbd(C-c / r)}}}, ~org-occur~ :: Prompts for a regexp and shows a
927 sparse tree with all matches. If the match is in a headline,
928 the headline is made visible. If the match is in the body of an
929 entry, headline and body are made visible. In order to provide
930 minimal context, also the full hierarchy of headlines above the
931 match is shown, as well as the headline following the
932 match. Each match is also highlighted; the highlights disappear
933 when the buffer is changed by an editing command, or by
934 pressing {{{kbd(C-c C-c)}}}.[fn:13] When called with a {{{kbd(C-u)}}}
935 prefix argument, previous highlights are kept, so several calls
936 to this command can be stacked.
940 #+vindex: org-remove-highlights-with-change
941 - {{{kbd(M-g n)}}}, ~next-error~ ::
942 @@info:@itemx@@ {{{kbd(M-g M-n)}}}
944 Jump to the next sparse tree match in this buffer.
949 - {{{kbd(M-g p)}}}, ~previous-error~ ::
950 @@info:@itemx@@ {{{kbd(M-g M-p)}}}
952 Jump to the previous sparse tree match in this buffer.
956 #+findex: previous-error
957 #+vindex: org-agenda-custom-commands
959 {{{noindent}}} For frequently used sparse trees of specific search
960 strings, you can use the variable ~org-agenda-custom-commands~ to
961 define fast keyboard access to specific sparse trees. These commands
962 will then be accessible through the agenda dispatcher
963 (see [[Agenda dispatcher]]). For example:
965 #+header: :exports code
967 #+begin_src emacs-lisp
968 (setq org-agenda-custom-commands
969 '(("f" occur-tree "FIXME")))
972 {{{noindent}}} will define the key {{{kbd(C-c a f)}}} as a
973 shortcut for creating a sparse tree matching the string
976 The other sparse tree commands select headings based on TODO keywords,
977 tags, or properties and will be discussed later in this manual.
980 #+cindex: printing sparse trees
981 #+cindex: visible text, printing
983 To print a sparse tree, you can use the Emacs command
984 ~ps-print-buffer-with-faces~ which does not print
985 invisible parts of the document.[fn:14] Or you can use the command
986 {{{kbd(C-c C-e v)}}} to export only the visible part of the
987 document and print the resulting file.
991 :DESCRIPTION: Additional structure within an entry
992 :ALT_TITLE: Plain lists
994 #+cindex: plain lists
995 #+cindex: lists, plain
996 #+cindex: lists, ordered
997 #+cindex: ordered lists
999 Within an entry of the outline tree, hand-formatted lists can provide
1000 additional structure. They also provide a way to create lists of
1001 checkboxes (see [[Checkboxes]]). Org supports editing
1002 such lists, and every exporter (see [[Exporting]])
1003 can parse and format them.
1005 Org knows ordered lists, unordered lists, and description lists.
1007 #+attr_texinfo: :table-type table :indic @bullet
1008 - /Unordered/ list items start with ~-~, ~+~, or ~*~ as bullets.[fn:15]
1010 - /Ordered/ list items start with a numeral followed by either a
1011 period or a right parenthesis,[fn:16] such as
1012 ~1.~ or ~1~.[fn:170] If you want a list to
1013 start with a different value (e.g., 20), start the text of the
1014 item with ~[@20]~.[fn:17] Those constructs can be used
1015 in any item of the list in order to enforce a particular
1017 #+vindex: org-plain-list-ordered-item-terminator
1018 #+vindex: org-alphabetical-lists
1020 - /Description/ list items are unordered list items, and contain the
1021 separator {{{samp( :: )}}} to distinguish the description
1022 /term/ from the description.
1025 Items belonging to the same list must have the same indentation on the
1026 first line. In particular, if an ordered list reaches number
1027 {{{samp(10.)}}}, then the 2--digit numbers must be written
1028 left-aligned with the other numbers in the list. An item ends before
1029 the next line that is less or equally indented than its bullet/number.
1031 #+vindex: org-empty-line-terminates-plain-lists
1032 A list ends whenever every item has ended, which means before any line less
1033 or equally indented than items at top level. It also ends before two blank
1034 lines.[fn:171] In that case, all items are closed. Here is an example:
1037 ,** Lord of the Rings
1038 My favorite scenes are (in this order)
1039 1. The attack of the Rohirrim
1040 2. Eowyn's fight with the witch king
1041 + this was already my favorite scene in the book
1042 + I really like Miranda Otto.
1043 3. Peter Jackson being shot by Legolas
1045 He makes a really funny face when it happens.
1046 But in the end, no individual scenes matter but the film as a whole.
1047 Important actors in this film are:
1048 - @b{Elijah Wood} :: He plays Frodo
1049 - @b{Sean Austin} :: He plays Sam, Frodo's friend. I still remember
1050 him very well from his role as Mikey Walsh in @i{The Goonies}.
1053 Org supports these lists by tuning filling and wrapping commands to
1054 deal with them correctly.[fn:18] To turn this on, put into
1055 {{{file(.emacs)}}}: ~(require 'filladapt)~}, and by exporting them
1056 properly (see [[Exporting]]). Since indentation is
1057 what governs the structure of these lists, many structural constructs
1058 like ~#+BEGIN_ ...~ blocks can be indented to signal that they belong
1059 to a particular item.
1061 #+vindex: org-list-demote-modify-bullet
1062 #+vindex: org-list-indent-offset
1063 If you find that using a different bullet for a sub-list (than that used for
1064 the current list-level) improves readability, customize the variable
1065 ~org-list-demote-modify-bullet~. To get a greater difference of
1066 indentation between items and theirs sub-items, customize
1067 ~org-list-indent-offset~.
1069 #+vindex: org-list-automatic-rules
1070 The following commands act on items when the cursor is in the first line of
1071 an item (the line with the bullet or number). Some of them imply the
1072 application of automatic rules to keep list structure intact. If some of
1073 these actions get in your way, configure ~org-list-automatic-rules~
1074 to disable them individually.
1077 #+attr_texinfo: :table-type table :indic @asis
1078 - {{{key(TAB)}}}, ~org-cycle~ ::
1079 #+cindex: cycling, in plain lists
1082 #+vindex: org-cycle-include-plain-lists
1084 Items can be folded just like headline levels. Normally this
1085 works only if the cursor is on a plain list item. For more
1086 details, see the variable ~org-cycle-include-plain-lists~. If
1087 this variable is set to ~integrate~, plain list items will be
1088 treated like low-level headlines. The level of an item is then
1089 given by the indentation of the bullet/number. Items are always
1090 subordinate to real headlines, however; the hierarchies remain
1091 completely separated. In a new item with no text yet, the first
1092 {{{key(TAB)}}} demotes the item to become a child of the
1093 previous one. Subsequent {{{key(TAB)}}}s move the item to
1094 meaningful levels in the list and eventually get it back to its
1097 - {{{kbdkey(M-,RET)}}}, ~org-insert-heading~ ::
1099 #+findex: org-insert-heading
1100 #+vindex: org-M-RET-may-split-line
1101 #+vindex: org-list-automatic-rules
1103 Insert new item at current level. With a prefix argument, force
1104 a new heading (see [[Structure editing]]). If this command is used
1105 in the middle of an item, that item is /split/ in two, and the
1106 second part becomes the new item.[fn:19] If this command is
1107 executed /before item's body/, the new item is created /before/
1110 - {{{kbdkey(M-S-,RET)}}} ::
1113 Insert a new item with a checkbox (see [[Checkboxes]]).
1115 - {{{kbdkey(S-,up)}}} ::
1116 @@info:@itemx@@ {{{kbdkey(S-,down)}}}
1118 Jump to the previous/next item in the current list, but
1119 only if ~org-support-shift-select~ is off.[fn:20] If not, you can
1120 still use paragraph jumping commands like {{{kbdkey(C-,up)}}}
1121 and {{{kbdkey(C-,down)}}} to quite similar effect.
1125 #+cindex: shift-selection-mode
1126 #+vindex: org-support-shift-select
1127 #+vindex: org-list-use-circular-motion
1128 - {{{kbdkey(M-,up)}}} ::
1129 @@info:@itemx@@ {{{kbdkey(M-,down)}}}
1131 Move the item including subitems up/down (swap with
1132 previous/next item of same indentation).[fn:21] If the list is
1133 ordered, renumbering is automatic.
1137 - {{{kbdkey(M-,left)}}} ::
1138 @@info:@itemx@@ {{{kbdkey(M-,right)}}}
1140 Decrease/increase the indentation of an item, leaving children
1145 - {{{kbdkey(M-S-,left)}}} ::
1146 @@info:@itemx@@ {{{kbdkey(M-S-,right)}}}
1148 Decrease/increase the indentation of the item, including
1149 subitems. Initially, the item tree is selected based on
1150 current indentation. When these commands are executed several
1151 times in direct succession, the initially selected region is
1152 used, even if the new indentation would imply a different
1153 hierarchy. To use the new hierarchy, break the command chain
1154 with a cursor motion or so.
1159 As a special case, using this command on the very first item of
1160 a list will move the whole list. This behavior can be disabled
1161 by configuring ~org-list-automatic-rules~. The global
1162 indentation of a list has no influence on the text /after/ the
1164 - {{{kbd(C-c C-c)}}} :: If there is a checkbox (see [[Checkboxes]]) in
1165 the item line, toggle the state of the checkbox. In any case,
1166 verify bullets and indentation consistency in the whole list.
1169 - {{{kbd(C-c -)}}} :: Cycle the entire list level through the
1170 different itemize/enumerate bullets ({{{samp(-)}}},
1171 {{{samp(+)}}}, {{{samp(*)}}}, {{{samp(1.)}}}, {{{samp(1))}}})
1172 or a subset of them, depending on
1173 ~org-plain-list-ordered-item-terminator~, the type of list, and
1174 its indentation. With a numeric prefix argument N, select the
1175 Nth bullet from this list. If there is an active region when
1176 calling this, selected text will be changed into an item. With
1177 a prefix argument, all lines will be converted to list items.
1178 If the first line already was a list item, any item marker will
1179 be removed from the list. Finally, even without an active
1180 region, a normal line will be converted into a list item.
1183 #+vindex: org-plain-list-ordered-item-terminator
1184 - {{{kbd(C-c *)}}} :: Turn a plain list item into a headline (so
1185 that it becomes a subheading at its location). See
1186 [[Structure editing]], for a detailed explanation.
1189 - {{{kbd(C-c C-*)}}} :: Turn the whole plain list into a subtree of
1190 the current heading. Checkboxes (see [[Checkboxes]]) will become
1191 TODO (resp. DONE) keywords when unchecked (resp. checked).
1194 - {{{kbd(S-left/right)}}} :: This command also cycles bullet styles
1195 when the cursor in on the bullet or anywhere in an item line,
1196 details depending on ~org-support-shift-select~.
1198 #+vindex: org-support-shift-select
1201 - {{{kbd(C-c ^)}}} :: Sort the plain list. You will be prompted for
1202 the sorting method: numerically, alphabetically, by time, or by
1209 :DESCRIPTION: Tucking stuff away
1213 #+cindex: visibility cycling, drawers
1215 #+vindex: org-drawers
1216 #+cindex: org-insert-drawer
1218 Sometimes you want to keep information associated with an entry, but you
1219 normally don't want to see it. For this, Org mode has /drawers/.
1220 Drawers need to be configured with the variable
1221 ~org-drawers~.[fn:172] Drawers
1225 ,** This is a headline
1226 Still outside the drawer
1228 This is inside the drawer.
1234 You can interactively insert drawers at point by calling
1235 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}.
1236 With an active region, this command will put the region inside the
1237 drawer. With a prefix argument, this command calls
1238 ~org-insert-property-drawer~ and add a property drawer right
1239 below the current headline. Completion over drawer keywords is also
1240 possible using {{{key(M-TAB)}}}.
1242 Visibility cycling (see [[Visibility cycling]]) on the headline
1243 will hide and show the entry, but keep the drawer collapsed to a
1244 single line. In order to look inside the drawer, you need to move the
1245 cursor to the drawer line and press {{{key(TAB)}}} there. Org mode
1246 uses the ~PROPERTIES~ drawer for storing properties
1247 (see [[Properties and columns]]), and you can also arrange for
1248 state change notes (see [[Tracking TODO state changes]) and
1249 clock times (see [[Clocking work time]) to be stored in a drawer
1250 ~LOGBOOK~. If you want to store a quick note in the LOGBOOK
1251 drawer, in a similar way to state changes, use
1253 #+attr_texinfo: :table-type table :indic @asis
1254 - {{{kbd(C-c C-z)}}} :: Add a time-stamped note to the LOGBOOK
1261 :DESCRIPTION: Folding blocks
1263 #+vindex: org-hide-block-startup
1264 #+cindex: blocks, folding
1266 Org mode uses ~begin~ ... ~end~ blocks for various purposes from including
1267 source code examples (see [[Literal examples]]) to capturing time logging
1268 information (see [[Clocking work time]]). These blocks can be folded
1269 and unfolded by pressing TAB in the begin line. You can also get all
1270 blocks folded at startup by configuring the variable
1271 ~org-hide-block-startup~ or on a per-file basis by using
1273 #+cindex: @code{hideblocks}, STARTUP keyword
1274 #+cindex: @code{nohideblocks}, STARTUP keyword
1276 ,#+STARTUP: hideblocks
1277 ,#+STARTUP: nohideblocks
1280 ** Creating footnotes
1282 :DESCRIPTION: Define footnotes in Org syntax
1286 Org mode supports the creation of footnotes. In contrast to the
1287 {{{file(footnote.el)}}} package, Org mode's footnotes are designed for
1288 work on a larger document, not only for one-off documents like emails.
1289 The basic syntax is similar to the one used by
1290 {{{file(footnote.el)}}}, i.e., a footnote is defined in a paragraph
1291 that is started by a footnote marker in square brackets in column 0,
1292 no indentation allowed. If you need a paragraph break inside a
1293 footnote, use the LaTeX idiom ~\par~. The footnote reference is simply
1294 the marker in square brackets, inside text. For example:
1297 The Org homepage[fn:1] now looks a lot better than it used to.
1299 [fn:1] The link is: http://orgmode.org
1302 Org mode extends the number-based syntax to /named/ footnotes and
1303 optional inline definition. Using plain numbers as markers (as
1304 {{{file(footnote.el)}}} does) is supported for backward compatibility,
1305 but not encouraged because of possible conflicts with LaTeX
1306 snippets (see [[Embedded LaTeX]]). Here are
1307 the valid references:
1309 #+attr_texinfo: :table-type table :indic @asis
1310 - ~[1]~ :: A plain numeric footnote marker. Compatible with
1311 {{{file(footnote.el)}}}, but not recommended because
1312 something like ~[1]~ could easily be part of a
1315 - ~[fn:name]~ :: A named footnote reference, where ~name~ is
1316 a unique label word, or, for simplicity of automatic
1318 - ~[fn:: This is the inline definition of this footnote]~ :: A
1319 LaTeX-like anonymous footnote where the definition
1320 is given directly at the reference point.
1321 - ~[fn:name: a definition]~ :: An inline definition of a footnote,
1322 which also specifies a name for the note. Since Org allows
1323 multiple references to the same note, you can then use
1324 ~[fn:name]~ to create additional references.
1327 #+vindex: org-footnote-auto-label
1328 Footnote labels can be created automatically, or you can create names
1329 yourself. This is handled by the variable
1330 ~org-footnote-auto-label~ and its corresponding
1331 ~#+STARTUP~ keywords. See the docstring of that variable for
1334 {{{noindent}}} The following command handles footnotes:
1336 #+attr_texinfo: :table-type table :indic @asis
1337 - {{{kbd(C-c C-x f)}}} :: The footnote action command.
1340 When the cursor is on a footnote reference, jump to the
1341 definition. When it is at a definition, jump to the
1344 #+vindex: org-footnote-define-inline
1345 #+vindex: org-footnote-section
1346 #+vindex: org-footnote-auto-adjust
1348 Otherwise, create a new footnote. Depending on the
1349 variable ~org-footnote-define-inline~, the
1350 definition will be placed right into the text as part
1351 of the reference, or separately into the location
1352 determined by the variable ~org-footnote-section~.[fn:173]
1354 When this command is called with a prefix argument, a
1355 menu of additional options is offered:
1357 - {{{kbd(s)}}} :: Sort the footnote definitions by reference sequence.
1358 During editing, Org makes no effort to sort footnote
1359 definitions into a particular sequence. If you want them
1360 sorted, use this command, which will also move entries
1361 according to ~org-footnote-section~. Automatic sorting
1362 after each insertion/deletion can be configured using the
1363 variable ~org-footnote-auto-adjust~.
1364 - {{{kbd(r)}}} :: Renumber the simple ~fn:N~ footnotes. Automatic
1365 renumbering after each insertion/deletion can be
1366 configured using the variable ~org-footnote-auto-adjust~.
1367 - {{{kbd(S)}}} :: Short for first ~r~, then ~s~ action.
1368 - {{{kbd(n)}}} :: Normalize the footnotes by collecting all definitions
1369 (including inline definitions) into a special section, and
1370 then numbering them in sequence. The references will then
1371 also be numbers. This is meant to be the final step
1372 before finishing a document (e.g., sending off an email).
1373 The exporters do this automatically, and so could
1374 something like ~message-send-hook~.
1375 - {{{kbd(d)}}} :: Delete the footnote at point, and all definitions of and
1378 Depending on the variable ~org-footnote-auto-adjust~, renumbering
1379 and sorting footnotes can be automatic after each insertion or
1382 - {{{kbd(C-c C-c)}}} :: If the cursor is on a footnote reference, jump to the
1383 definition. If it is a the definition, jump back to
1384 the reference. When called at a footnote location with
1385 a prefix argument, offer the same menu as {{{kbd(C-c C-x f)}}}.
1389 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} :: Footnote labels are also
1390 links to the corresponding definition/reference, and you can
1391 use the usual commands to follow these links.
1399 :DESCRIPTION: Structure editing outside Org
1400 :ALT_TITLE: Orgstruct mode
1402 #+cindex: Orgstruct mode
1403 #+cindex: minor mode for structure editing
1405 If you like the intuitive way the Org mode structure editing and list
1406 formatting works, you might want to use these commands in other modes
1407 like Text mode or Mail mode as well. The minor mode ~orgstruct-mode~
1408 makes this possible. Toggle the mode with {{{kbd(M-x orgstruct-mode)}}}, or turn it on by default, for example in Message
1411 #+header: :exports code
1413 #+begin_src emacs-lisp
1414 (add-hook 'message-mode-hook 'turn-on-orgstruct)
1415 (add-hook 'message-mode-hook 'turn-on-orgstruct++)
1418 When this mode is active and the cursor is on a line that looks to Org
1419 like a headline or the first line of a list item, most structure
1420 editing commands will work, even if the same keys normally have
1421 different functionality in the major mode you are using. If the
1422 cursor is not in one of those special lines, Orgstruct mode lurks
1423 silently in the shadows. When you use ~orgstruct++-mode~, Org will
1424 also export indentation and autofill settings into that mode, and
1425 detect item context after the first line of an item.
1429 :DESCRIPTION: Pure magic for quick formatting
1432 #+cindex: editing tables
1434 Org comes with a fast and intuitive table editor. Spreadsheet-like
1435 calculations are supported using the Emacs {{{file(calc)}}} package
1438 ** Built-in table editor
1440 :DESCRIPTION: Simple tables
1442 #+cindex: table editor, built-in
1444 Org makes it easy to format tables in plain ASCII. Any line with
1445 {{{samp(|)}}} as the first non-whitespace character is considered part
1446 of a table. {{{samp(|)}}} is also the column separator.[fn:22] A table
1447 might look like this:
1450 | Name | Phone | Age |
1451 |-------+-------+-----|
1452 | Peter | 1234 | 17 |
1453 | Anna | 4321 | 25 |
1457 A table is re-aligned automatically each time you press {{{key(TAB)}}}
1458 or {{{key(RET)}}} or {{{kbd(C-c C-c)}}} inside the table.
1459 {{{key(TAB)}}} also moves to the next field ({{{key(RET)}}} to the
1460 next row) and creates new table rows at the end of the table or before
1461 horizontal lines. The indentation of the table is set by the first
1462 line. Any line starting with {{{samp(|-)}}} is considered as a
1463 horizontal separator line and will be expanded on the next re-align to
1464 span the whole table width. So, to create the above table, you would
1473 {{{noindent}}} and then press {{{key(TAB)}}} to align the table and
1474 start filling in fields. Even faster would be to type
1475 ~|Name|Phone|Age~ followed by {{{kbdspckey(C-c,RET)}}}.
1477 #+vindex: org-enable-table-editor
1478 #+vindex: org-table-auto-blank-field
1480 When typing text into a field, Org treats {{{key(DEL)}}},
1481 {{{key(Backspace)}}}, and all character keys in a special way, so that
1482 inserting and deleting avoids shifting other fields. Also, when
1483 typing /immediately/ after the cursor was moved into a new field with
1484 {{{key(TAB)}}}, {{{kbdkey(S-,TAB)}}} or {{{key(RET)}}}, the field is
1485 automatically made blank. If this behavior is too unpredictable for
1486 you, configure the variables ~org-enable-table-editor~ and
1487 ~org-table-auto-blank-field~.
1488 *** Creation and conversion
1490 :DESCRIPTION: Creating tabular data in Org
1492 #+attr_texinfo: :table-type table :indic @asis
1493 - {{{kbd(C-c |)}}}, ~org-table-create-or-convert-from-region~ :: Convert
1494 the active region to table. If every line contains at least one
1495 {{{key(TAB)}}} character, the function assumes that the material
1496 is tab separated. If every line contains a comma, comma-separated
1497 values (CSV) are assumed. If not, lines are split at whitespace
1498 into fields. You can use a prefix argument to force a specific
1499 separator: {{{kbd(C-u)}}} forces CSV, {{{kbd(C-u C-u)}}} forces
1500 {{{key(TAB)}}}, and a numeric argument ~N~ indicates that at
1501 least N consecutive spaces, or alternatively a {{{key(TAB)}}}
1502 will be the separator. If there is no active region, this command
1503 creates an empty Org table. But it is easier just to start
1504 typing, like {{{kbdspckey(|Name|Phone|Age,RET)}}} {{{kbdkey(|-
1508 #+findex: org-table-create-or-convert-from-region
1510 *** Re-aligning and field motion
1512 :DESCRIPTION: Navigating and tidying
1514 #+attr_texinfo: :table-type table :indic @asis
1515 - {{{kbd(C-c C-c)}}}, ~org-table-align~ :: Re-align the table without
1519 #+findex: org-table-align
1520 - {{{kbd(<TAB>)}}}, ~org-table-next-field~ :: Re-align the table, move
1521 to the next field. Creates a new row if necessary.
1524 #+findex: org-table-next-field
1525 - {{{kbdkey(S-,TAB)}}}, ~org-table-previous-field~ :: Re-align, move to
1529 #+findex: org-table-previous-field
1530 - {{{key(RET)}}}, ~org-table-next-row~ :: Re-align the table and move
1531 down to next row. Creates a new row if necessary. At the
1532 beginning or end of a line, {{{key(RET)}}} still does NEWLINE, so
1533 it can be used to split a table.
1536 #+findex: org-table-next-row
1537 - {{{kbd(M-a)}}}, ~org-table-beginning-of-field~ :: Move to beginning
1538 of the current table field, or on to the previous field.
1541 #+findex: org-table-beginning-of-field
1542 - {{{kbd(M-e)}}}, ~org-table-end-of-field~ :: Move to end of the
1543 current table field, or on to the next field.
1546 #+findex: org-table-end-of-field
1548 *** Column and row editing
1550 :DESCRIPTION: Insert, kill, or move
1552 #+attr_texinfo: :table-type table :indic @asis
1553 - {{{kbdkey(M-,left)}}}, ~org-table-move-column-left~ ::
1555 #+findex: org-table-move-column-left
1557 Move the current column left.
1559 - {{{kbdkey(M-,right)}}}, ~org-table-move-column-right~ ::
1561 #+findex: org-table-move-column-right
1563 Move the current column right.
1565 - {{{kbdkey(M-S-,left)}}}, ~org-table-delete-column~ ::
1567 #+findex: org-table-delete-column
1569 Kill the current column.
1571 - {{{kbdkey(M-S-,right)}}}, ~org-table-insert-column~ ::
1573 #+findex: org-table-insert-column
1575 Insert a new column to the left of the cursor position.
1577 - {{{kbdkey(M-,up)}}}, ~org-table-move-row-up~ ::
1579 #+findex: org-table-move-row-up
1581 Move the current row up.
1583 - {{{kbdkey(M-,down)}}}, ~org-table-move-row-down~ ::
1585 #+findex: org-table-move-row-down
1587 Move the current row down.
1589 - {{{kbdkey(M-S-,up)}}}, ~org-table-kill-row~ :: Kill the current row
1593 #+findex: org-table-kill-row
1595 - {{{kbdkey(M-S-,down)}}}, ~org-table-insert-row~ :: Insert a new row
1596 above the current row. With a prefix argument, the line is
1597 created below the current one.
1600 #+findex: org-table-insert-row
1602 - {{{kbd(C-c -)}}}, ~org-table-insert-hline~ :: Insert a horizontal
1603 line below current row. With a prefix argument, the line is
1604 created above the current line.
1607 #+findex: org-table-insert-hline
1609 - {{{kbdspckey(C-c,RET)}}}, ~org-table-hline-and-move~ :: Insert a
1610 horizontal line below current row, and move the cursor into the
1611 row below that line.
1614 #+findex: org-table-hline-and-move
1616 - {{{kbd(C-c ^)}}}, ~org-table-sort-lines~ :: Sort the table lines in
1617 the region. The position of point indicates the column to be
1618 used for sorting, and the range of lines is the range between the
1619 nearest horizontal separator lines, or the entire table. If
1620 point is before the first column, you will be prompted for the
1621 sorting column. If there is an active region, the mark specifies
1622 the first line and the sorting column, while point should be in
1623 the last line to be included into the sorting. The command
1624 prompts for the sorting type (alphabetically, numerically, or by
1625 time). When called with a prefix argument, alphabetic sorting
1626 will be case-sensitive.
1629 #+findex: org-table-sort-lines
1632 :DESCRIPTION: Manipulate parts of a table
1634 #+attr_texinfo: :table-type table :indic @asis
1635 - {{{kbd(C-c C-x M-w)}}}, ~org-table-copy-region~ :: Copy a rectangular
1636 region from a table to a special clipboard. Point and mark
1637 determine edge fields of the rectangle. If there is no active
1638 region, copy just the current field. The process ignores
1639 horizontal separator lines.
1641 #+kindex: C-c C-x M-w
1642 #+findex: org-table-copy-region
1643 - {{{kbd(C-c C-x C-w)}}}, ~org-table-cut-region~ :: Copy a rectangular
1644 region from a table to a special clipboard, and blank all fields
1645 in the rectangle. So this is the ``cut'' operation.
1647 #+kindex: C-c C-x C-w
1648 #+findex: org-table-cut-region
1649 - {{{kbd(C-c C-x C-y)}}}, ~org-table-paste-rectangle~ :: Paste a
1650 rectangular region into a table. The upper left corner ends up
1651 in the current field. All involved fields will be overwritten.
1652 If the rectangle does not fit into the present table, the table
1653 is enlarged as needed. The process ignores horizontal separator
1656 #+kindex: C-c C-x C-y
1657 #+findex: org-table-paste-rectangle
1658 - {{{kbdkey(M-,RET)}}}, ~org-table-wrap-region~ :: Split the current
1659 field at the cursor position and move the rest to the line below.
1660 If there is an active region, and both point and mark are in the
1661 same column, the text in the column is wrapped to minimum width
1662 for the given number of lines. A numeric prefix argument may be
1663 used to change the number of desired lines. If there is no
1664 region, but you specify a prefix argument, the current field is
1665 made blank, and the content is appended to the field above.
1668 #+findex: org-table-wrap-region
1671 :DESCRIPTION: Sum and copy
1673 #+cindex: formula, in tables
1674 #+cindex: calculations, in tables
1675 #+cindex: region, active
1676 #+cindex: active region
1677 #+cindex: transient mark mode
1679 #+attr_texinfo: :table-type table :indic @asis
1680 - {{{kbd(C-c +)}}}, ~org-table-sum~ :: Sum the numbers in the current
1681 column, or in the rectangle defined by the active region. The
1682 result is shown in the echo area and can be inserted with
1686 #+findex: org-table-sum
1687 - {{{kbdkey(S-,RET)}}}, ~org-table-copy-down~ :: When current field is
1688 empty, copy from first non-empty field above. When not empty,
1689 copy current field down to next row and move cursor along with
1690 it. Depending on the variable ~org-table-copy-increment~,
1691 integer field values will be incremented during copy. Integers
1692 that are too large will not be incremented. Also, a ~0~ prefix
1693 argument temporarily disables the increment. This key is also
1694 used by shift-selection and related modes (see [[Conflicts]]).
1697 #+findex: org-table-copy-down
1698 #+vindex: org-table-copy-increment
1702 :DESCRIPTION: Some other useful operations
1704 #+attr_texinfo: :table-type table :indic @asis
1705 - {{{kbd(C-c `)}}}, ~org-table-edit-field~ :: Edit the current field in
1706 a separate window. This is useful for fields that are not fully
1707 visible (see [[Column width and alignment]]). When called with a
1708 {{{kbd(C-u)}}} prefix, just make the full field visible, so that
1709 it can be edited in place. When called with two {{{kbd(C-u)}}}
1710 prefixes, make the editor window follow the cursor through the
1711 table and always show the current field. The follow mode exits
1712 automatically when the cursor leaves the table, or when you
1713 repeat this command with {{{kbd(C-u C-u C-c `)}}}.
1716 #+findex: org-table-edit-field
1717 - {{{kbd(M-x org-table-import)}}} :: Import a file as a table. The
1718 table should be TAB or whitespace separated. Use, for example,
1719 to import a spreadsheet table or data from a database, because
1720 these programs generally can write TAB-separated text files.
1721 This command works by inserting the file into the buffer and then
1722 converting the region to a table. Any prefix argument is passed
1723 on to the converter, which uses it to determine the separator.
1725 - {{{kbd(C-c |)}}}, ~org-table-create-or-convert-from-region~ :: Tables
1726 can also be imported by pasting tabular text into the Org buffer,
1727 selecting the pasted text with {{{kbd(C-x C-x)}}} and then using
1728 the {{{kbd(C-c |)}}} command (see [[Creation and conversion]]).
1731 #+findex: org-table-create-or-convert-from-region
1732 - {{{kbd(M-x org-table-export)}}} :: Export the table, by default as a
1733 TAB-separated file. Use for data exchange with, for example,
1734 spreadsheet or database programs. The format used to export the
1735 file can be configured in the variable
1736 ~org-table-export-default-format~. You may also use properties
1737 ~TABLE_EXPORT_FILE~ and ~TABLE_EXPORT_FORMAT~ to specify the file
1738 name and the format for table export in a subtree. Org supports
1739 quite general formats for exported tables. The exporter format
1740 is the same as the format used by Orgtbl radio tables, see
1741 [[Translator functions], for a detailed description.
1743 #+findex: org-table-export
1744 #+vindex: org-table-export-default-format
1746 If you don't like the automatic table editor because it gets in your
1747 way on lines which you would like to start with {{{samp(|)}}}, you can
1750 #+header: :exports code
1752 #+begin_src emacs-lisp
1753 (setq org-enable-table-editor nil)
1757 {{{noindent}}} Then the only table command that still works is
1758 {{{kbd(C-c C-c)}}} to do a manual re-align.
1760 ** Column width and alignment
1762 :DESCRIPTION: Overrule the automatic settings
1764 #+cindex: narrow columns in tables
1765 #+cindex: alignment in tables
1767 The width of columns is automatically determined by the table editor.
1768 And also the alignment of a column is determined automatically from
1769 the fraction of number-like versus non-number fields in the column.
1771 Sometimes a single field or a few fields need to carry more text,
1772 leading to inconveniently wide columns. Or maybe you want to make a
1773 table with several columns having a fixed width, regardless of
1774 content. To set the width of a column, one field anywhere in the
1775 column may contain just the string ~<N>~ where ~N~
1776 is an integer specifying the width of the column in characters.[fn:23]
1777 The next re-align will then set the width of this column to this
1781 |---+------------------------------| |---+--------|
1783 | 1 | one | | 1 | one |
1784 | 2 | two | ----\ | 2 | two |
1785 | 3 | This is a long chunk of text | ----/ | 3 | This=> |
1786 | 4 | four | | 4 | four |
1787 |---+------------------------------| |---+--------|
1790 {{{noindent}}} Fields that are wider become clipped and end in the
1791 string {{{samp(=>)}}}. Note that the full text is still in the buffer
1792 but is hidden. To see the full text, hold the mouse over the
1793 field---a tool-tip window will show the full content. To edit such a
1794 field, use the command {{{kbd(C-c `)}}} (that is {{{kbd(C-c)}}}
1795 followed by the backquote). This will open a new window with the full
1796 field. Edit it and finish with {{{kbd(C-c C-c)}}}.
1798 #+vindex: org-startup-align-all-tables
1800 When visiting a file containing a table with narrowed columns, the
1801 necessary character hiding has not yet happened, and the table needs
1802 to be aligned before it looks nice. Setting the option
1803 ~org-startup-align-all-tables~ will realign all tables in a file upon
1804 visiting, but also slow down startup. You can also set this option on
1805 a per-file basis with:
1812 If you would like to overrule the automatic alignment of number-rich
1813 columns to the right and of string-rich columns to the left, you can
1814 use ~<r>~, ~<c>~ or ~<l>~ in a similar fashion.[fn:24] You may also
1815 combine alignment and field width like this: ~<l10>~.
1817 A line that only contains these formatting cookies will be removed
1818 automatically when exporting the document.
1822 :DESCRIPTION: Grouping to trigger vertical lines
1824 #+cindex: grouping columns in tables
1826 When Org exports tables, it does so by default without vertical lines
1827 because that is visually more satisfying in general. Occasionally
1828 however, vertical lines can be useful to structure a table into groups
1829 of columns, much like horizontal lines can do for groups of rows. In
1830 order to specify column groups, you can use a special row where the
1831 first field contains only {{{samp(/)}}}. The further fields can either
1832 contain ~<~ to indicate that this column should start a group,
1833 ~>~ to indicate the end of a column, or ~<>~ (no space
1834 between ~<~ and ~>~) to make a column a group of its own. Boundaries
1835 between column groups will upon export be marked with vertical lines.
1839 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1840 |---+-----+-----+-----+---------+------------|
1841 | / | < | | > | < | > |
1842 | 1 | 1 | 1 | 1 | 1 | 1 |
1843 | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1844 | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1845 |---+-----+-----+-----+---------+------------|
1846 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
1849 It is also sufficient to just insert the column group starters after
1850 every vertical line you would like to have:
1853 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1854 |----+-----+-----+-----+---------+------------|
1858 ** The Orgtbl mode minor mode
1860 :DESCRIPTION: The table editor as minor mode
1861 :ALT_TITLE: Ogtbl mode
1863 #+cindex: Orgtbl mode
1864 #+cindex: minor mode for tables
1866 If you like the intuitive way the Org table editor works, you might
1867 also want to use it in other modes like Text mode or Mail mode. The
1868 minor mode Orgtbl mode makes this possible. You can always toggle the
1869 mode with {{{kbd(M-x orgtbl-mode)}}}. To turn it on by default, for
1870 example in Message mode, use
1872 #+header: :exports code
1874 #+begin_src emacs-lisp
1875 (add-hook 'message-mode-hook 'turn-on-orgtbl)
1878 Furthermore, with some special setup, it is possible to maintain
1879 tables in arbitrary syntax with Orgtbl mode. For example, it is
1880 possible to construct LaTeX tables with the underlying ease and
1881 power of Orgtbl mode, including spreadsheet capabilities. For
1882 details, see [[Tables in arbitrary syntax]].
1886 :DESCRIPTION: The table editor has spreadsheet capabilities
1888 #+cindex: calculations, in tables
1889 #+cindex: spreadsheet capabilities
1890 #+cindex: @file{calc} package
1892 The table editor makes use of the Emacs {{{file(calc)}}} package to
1893 implement spreadsheet-like capabilities. It can also evaluate Emacs
1894 Lisp forms to derive fields from other fields. While fully featured,
1895 Org's implementation is not identical to other spreadsheets. For
1896 example, Org knows the concept of a /column formula/ that will be
1897 applied to all non-header fields in a column without having to copy
1898 the formula to each relevant field. There is also a formula debugger,
1899 and a formula editor with features for highlighting fields in the
1900 table corresponding to the references at the point in the formula,
1901 moving these references by arrow keys
1905 :DESCRIPTION: How to refer to another field or range
1907 #+cindex: references
1909 To compute fields in the table from other fields, formulas must
1910 reference other fields or ranges. In Org, fields can be referenced by
1911 name, by absolute coordinates, and by relative coordinates. To find
1912 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in
1913 that field, or press {{{kbd(C-c })}}} to toggle the display of a
1916 **** Field references
1918 :DESCRIPTION: Refer to a particular field
1920 #+cindex: field references
1921 #+cindex: references, to fields
1923 Formulas can reference the value of another field in two ways. Like
1924 in any other spreadsheet, you may reference fields with a
1925 letter/number combination like ~B3~, meaning the 2nd field in the 3rd
1928 #+vindex: org-table-use-standard-references
1929 However, Org prefers to use another, more general representation that
1930 looks like this:[fn:25]
1936 Column specifications can be absolute like ~$1~, ~$2~, ..., ~$N~, or
1937 relative to the current column (i.e., the column of the field which is
1938 being computed) like ~$+1~ or ~$-2~. ~$<~ and ~$>~ are immutable
1939 references to the first and last column, respectively, and you can use
1940 ~$>>>~ to indicate the third column from the right.
1942 The row specification only counts data lines and ignores horizontal
1943 separator lines (hlines). Like with columns, you can use absolute row
1944 numbers ~@1~, ~@2~, ..., ~@N~, and row numbers relative to the current
1945 row like ~@+3~ or ~@-1~. ~@<~ and ~@>~ are immutable references the
1946 first and last row in the table, respectively.[fn:26] You may also
1947 specify the row relative to one of the hlines: ~@I~ refers to the
1948 first hline, ~@II~ to the second, etc. ~@-I~ refers to the first such
1949 line above the current line, ~@+I~ to the first such line below the
1950 current line. You can also write ~@III+2~ which is the second data
1951 line after the third hline in the table.
1953 ~@0~ and ~$0~ refer to the current row and column, respectively, i.e.,
1954 to the row/column for the field being computed. Also, if you omit
1955 either the column or the row part of the reference, the current
1956 row/column is implied.
1958 Org's references with /unsigned/ numbers are fixed references in the
1959 sense that if you use the same reference in the formula for two
1960 different fields, the same field will be referenced each time. Org's
1961 references with /signed/ numbers are floating references because the
1962 same reference operator can reference different fields depending on
1963 the field being calculated by the formula.
1965 Here are a few examples:
1967 #+attr_texinfo: :table-type table :indic @code
1968 - @2$3 :: 2nd row, 3rd column (same as ~C2~)
1969 - $5 :: column 5 in the current row (same as ~E&~)
1970 - @2 :: current column, row 2
1971 - @-1$-3 :: the field one row up, three columns to the left
1972 - @-I$2 :: field just under hline above current row, column 2
1973 - @>$5 :: field in the last row, in column 5
1975 **** Range references
1977 :DESCRIPTION: Refer to a range of fields
1979 #+cindex: range references
1980 #+cindex: references, to ranges
1982 You may reference a rectangular range of fields by specifying two
1983 field references connected by two dots ~..~. If both fields are in
1984 the current row, you may simply use ~$2..$7~, but if at least one
1985 field is in a different row, you need to use the general ~@row$column~
1986 format at least for the first field (i.e., the reference must start
1987 with ~@~ in order to be interpreted correctly). Examples:
1989 #+attr_texinfo: :table-type table :indic @code
1990 - $1..$3 :: first three fields in the current row
1991 - $P..$Q :: range, using column names (see under Advanced)
1992 - $<<<..$>> :: start in third column, continue to the one but last
1993 - @2$1..@4$3 :: six fields between these two fields (same as
1995 - @-1$-2..@-1 :: three numbers from the column to the left, 2 up to
1997 - @I..II :: between first and second hline, short for ~@I..@II~
2000 {{{noindent}}} Range references return a vector of values that can be
2001 fed into Calc vector functions. Empty fields in ranges are normally
2002 suppressed, so that the vector contains only the non-empty fields (but
2003 see the ~E~ mode switch below). If there are no non-empty fields,
2004 ~[0]~ is returned to avoid syntax errors in formulas.
2006 **** Field coordinates in formulas
2008 :DESCRIPTION: Refer to fields in Lisp or Calc
2010 #+cindex: field coordinates
2011 #+cindex: coordinates, of field
2012 #+cindex: row, of field coordinates
2013 #+cindex: column, of field coordinates
2015 For Calc formulas and Lisp formulas ~@#~ and ~$#~ can be used to get
2016 the row or column number of the field where the formula result goes.
2017 The traditional Lisp formula equivalents are ~org-table-current-dline~
2018 and ~org-table-current-column~. Examples:
2020 #+attr_texinfo: :table-type table :indic @code
2021 - if(@# % 2, $#, string("")) :: column number on odd lines only
2022 - $3 = remote(FOO, @#$2) :: copy column 2 from table FOO into
2023 column 3 of the current table
2025 {{{noindent}}} For the second example, table FOO must have at least as
2026 many rows as the current table. Note that this is inefficient for
2027 large number of rows.[fn:27]
2029 **** Named references
2031 :DESCRIPTION: Name columns or constants
2033 #+cindex: named references
2034 #+cindex: references, named
2035 #+cindex: name, of column or field
2036 #+cindex: constants, in calculations
2037 #+cindex: #+CONSTANTS
2038 #+vindex: org-table-formula-constants
2040 {{{samp($name)}}} is interpreted as the name of a column, parameter or
2041 constant. Constants are defined globally through the variable
2042 ~org-table-formula-constants~, and locally (for the file) through a
2043 line like this example:
2046 ,#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2050 #+vindex: constants-unit-system
2051 #+pindex: constants.el
2053 Also, properties (see [[Properties and columns]]) can be used as constants
2054 in table formulas: for a property ~:Xyz:~ use the name ~$PROP_Xyz~,
2055 and the property will be searched in the current outline entry and in
2056 the hierarchy above it. If you have the {{{file(constants.el)}}}
2057 package, it will also be used to resolve constants, including natural
2058 constants like ~$h~ for Planck's constant, and units like ~$km~ for
2059 kilometers. Column names and parameters can be specified in special
2060 table lines. These are described in the section, [[Advanced features]].
2061 All names must start with a letter, and further consist of letters and
2064 **** Remote references
2066 :DESCRIPTION: Refer to information in other tables
2068 #+cindex: remote references
2069 #+cindex: references, remote
2070 #+cindex: references, to a different table
2071 #+cindex: name, of column or field
2072 #+cindex: constants, in calculations
2075 You may also reference constants, fields and ranges from a different
2076 table, either in the current file or even in a different file. The
2080 remote(NAME-OR-ID,REF)
2083 {{{noindent}}} where NAME can be the name of a table in the current
2084 file as set by a ~#+TBLNAME: NAME~ line before the table. It can also
2085 be the ID of an entry, even in a different file, and the reference
2086 then refers to the first table in that entry. REF is an absolute field
2087 or range reference as described above for example ~@3$3~ or
2088 ~$somename~, valid in the referenced table.
2090 *** Formula syntax for Calc
2092 :DESCRIPTION: Using Calc to compute stuff
2094 #+cindex: formula syntax, Calc
2095 #+cindex: syntax, of formulas
2097 A formula can be any algebraic expression understood by the Emacs
2098 {{{file(Calc)}}} package.[fn:28] Before evaluation by ~calc-eval~ (see
2099 [[info:calc#Calling Calc from Your Programs][Calling Calc from Your Lisp Programs]]), variable substitution takes
2100 place according to the rules described above.
2102 #+cindex: vectors, in table calculations
2103 The range vectors can be directly fed into the Calc vector functions
2104 like ~vmean~ and ~vsum~.
2106 #+cindex: format specifier
2107 #+cindex: mode, for @file{calc}
2108 #+vindex: org-calc-default-modes
2110 A formula can contain an optional mode string after a semicolon. This
2111 string consists of flags to influence Calc and other modes during
2112 execution. By default, Org uses the standard Calc modes (precision
2113 12, angular units degrees, fraction and symbolic modes off). The
2114 display format, however, has been changed to ~(float 8)~ to keep
2115 tables compact. The default settings can be configured using the
2116 variable ~org-calc-default-modes~.
2118 #+attr_texinfo: :table-type table :indic @code
2119 - p20 :: set the internal Calc calculation precision to 20 digits
2120 - n3 s3 e2 f4 :: normal, scientific, engineering, or fixed format of
2121 the result of Calc passed back to Org. Calc
2122 formatting is unlimited in precision as long as the
2123 Calc calculation precision is greater.
2124 - D R :: angle modes: degrees, radians
2125 - F S :: fraction and symbolic modes
2126 - N :: interpret all fields as numbers, use 0 for non-numbers
2127 - E :: keep empty fields in ranges
2130 {{{noindent}}} Unless you use large integer numbers or
2131 high-precision-calculation and -display for floating point numbers you
2132 may alternatively provide a ~printf~ format specifier to reformat the
2133 Calc result after it has been passed back to Org instead of letting
2134 Calc already do the formatting.[fn:29] A few examples:
2136 #+attr_texinfo: :table-type table :indic @code
2137 - $1+$2 :: Sum of first and second field
2138 - $1+$2;%.2f :: Same, format result to two decimals
2139 - exp($2)+exp($1) :: Math functions can be used
2140 - $0;%.1f :: Reformat current cell to 1 decimal
2141 - ($3-32)*5/9 :: Degrees F -> C conversion
2142 - $c/$1/$cm :: Hz -> cm conversion, using
2143 {{{file(constants.el)}}}
2144 - tan($1);Dp3s1 :: Compute in degrees, precision 3, display SCI 1
2145 - sin($1);Dp3%.1e :: Same, but use ~printf~ specifier for display
2146 - vmean($2..$7) :: Compute column range mean, using vector
2148 - vmean($2..$7);EN :: Same, but treat empty fields as 0
2149 - taylor($3,x=7,2) :: Taylor series of $3, at x=7, second degree
2151 Calc also contains a complete set of logical operations. For example
2153 #+attr_texinfo: :table-type table :indic @code
2154 - if($1<20,teen,string("")) :: "teen" if age $1 less than 20, else empty
2157 Note that you can also use two org-specific flags ~T~ and ~t~ for
2158 durations computations [[Duration and time values]].
2160 You can add your own Calc functions defined in Emacs Lisp with
2161 ~defmath~ and use them in formula syntax for Calc.
2163 *** Emacs Lisp forms as formulas
2165 :DESCRIPTION: Writing formulas in Emacs Lisp
2166 :ALT_TITLE: Formula syntax for Lisp
2168 #+cindex: Lisp forms, as table formulas
2170 It is also possible to write a formula in Emacs Lisp. This can be
2171 useful for string manipulation and control structures, if Calc's
2172 functionality is not enough.
2174 If a formula starts with a single-quote followed by an opening
2175 parenthesis, then it is evaluated as a Lisp form. The evaluation
2176 should return either a string or a number. Just as with
2177 {{{file(calc)}}} formulas, you can specify modes and a printf format
2180 With Emacs Lisp forms, you need to be conscious about the way field
2181 references are interpolated into the form. By default, a reference
2182 will be interpolated as a Lisp string (in double-quotes) containing
2183 the field. If you provide the {{{samp(N)}}} mode switch, all
2184 referenced elements will be numbers (non-number fields will be zero)
2185 and interpolated as Lisp numbers, without quotes. If you provide the
2186 {{{samp(L)}}} flag, all fields will be interpolated literally, without
2187 quotes. I.e., if you want a reference to be interpreted as a string by
2188 the Lisp form, enclose the reference operator itself in double-quotes,
2189 like ~"$3"~. Ranges are inserted as space-separated fields, so you can
2190 embed them in list or vector syntax.
2192 Here are a few examples---note how the {{{samp(N)}}} mode is used when
2193 we do computations in Lisp.
2195 Swap the first two characters of the content of column 1:
2196 #+header: :exports code
2198 #+begin_src emacs-lisp
2199 '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
2202 Add columns 1 and 2, equivalent to Calc's ~$1+$2~:
2203 #+header: :exports code
2205 #+begin_src emacs-lisp
2209 Compute the sum of columns 1-4, like Calc's ~vsum($1..$4)~}:
2210 #+header: :exports code
2212 #+begin_src emacs-lisp
2213 '(apply '+ '($1..$4));N
2216 *** Duration and time values
2218 :DESCRIPTION: How to compute duration and time values
2220 #+cindex: Duration, computing
2221 #+cindex: Time, computing
2222 #+vindex: org-table-duration-custom-format
2224 If you want to compute time values use the ~T~ flag, either in Calc
2225 formulas or Elisp formulas:
2228 | Task 1 | Task 2 | Total |
2229 |---------+----------+----------|
2230 | 2:12 | 1:47 | 03:59:00 |
2231 | 3:02:20 | -2:07:00 | 0.92 |
2232 #+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;t
2235 Input duration values must be of the form ~[HH:MM[:SS]~, where seconds
2236 are optional. With the ~T~ flag, computed durations will be displayed
2237 as ~HH:MM:SS~ (see the first formula above). With the ~t~ flag,
2238 computed durations will be displayed according to the value of the
2239 variable ~org-table-duration-custom-format~, which defaults to
2240 ~'hours~ and will display the result as a fraction of hours (see the
2241 second formula in the example above).
2243 Negative duration values can be manipulated as well, and integers will
2244 be considered as seconds in addition and subtraction.
2246 *** Field and range formulas
2248 :DESCRIPTION: Formulas for specific (ranges of) fields
2250 #+cindex: field formula
2251 #+cindex: range formula
2252 #+cindex: formula, for individual table field
2253 #+cindex: formula, for range of fields
2255 To assign a formula to a particular field, type it directly into the
2256 field, preceded by ~:=~, for example ~vsum(@II..III)~. When you press
2257 {{{key(TAB)}}} or {{{key(RET)}}} or {{{kbd(C-c C-c)}}} with the cursor
2258 still in the field, the formula will be stored as the formula for this
2259 field, evaluated, and the current field will be replaced with the
2263 Formulas are stored in a special line starting with ~#+TBLFM:~
2264 directly below the table. If you type the equation in the fourth field
2265 of the third data line in the table, the formula will look like
2266 ~@3$4=$1+$2~. When inserting/deleting/swapping column and rows with
2267 the appropriate commands, /absolute references/ (but not relative
2268 ones) in stored formulas are modified in order to still reference the
2269 same field. To avoid this from happening, in particular in range
2270 references, anchor ranges at the table borders (using ~@<~, ~@>~,
2271 ~$<~, ~$>~), or at hlines using the ~@I~ notation. Automatic
2272 adaptation of field references does of course not happen if you edit
2273 the table structure with normal editing commands---then you must fix
2274 the equations yourself.
2276 Instead of typing an equation into the field, you may also use the
2279 #+attr_texinfo: :table-type table :indic @asis
2280 - {{{kbd(C-u C-c =)}}}, ~org-table-eval-formula~ :: Install a new
2281 formula for the current field. The command prompts for a
2282 formula with default taken from the {{{samp(#+TBLFM:)}}} line,
2283 applies it to the current field, and stores it.
2286 #+findex: org-table-eval-formula
2287 The left-hand side of a formula can also be a special expression in
2288 order to assign the formula to a number of different fields. There is
2289 no keyboard shortcut to enter such range formulas. To add them, use
2290 the formula editor (see [[Editing and debugging formulas]]) or edit the
2291 ~#+TBLFM:~ line directly.
2293 #+attr_texinfo: :table-type table :indic @code
2294 - $2= :: Column formula, valid for the entire column. This is so
2295 common that Org treats these formulas in a special way, see
2296 [[Column formulas]].
2297 - @3= :: Row formula, applies to all fields in the specified row.
2298 ~@@>=~ means the last row.
2299 - @1$2..@4$3= :: Range formula, applies to all fields in the given
2300 rectangular range. This can also be used to
2301 assign a formula to some but not all fields in a
2303 - $name= :: Named field, see [[Advanced features]].
2307 :DESCRIPTION: Formulas valid for an entire column
2309 #+cindex: column formula
2310 #+cindex: formula, for table column
2312 When you assign a formula to a simple column reference like ~$3=~, the
2313 same formula will be used in all fields of that column, with the
2314 following very convenient exceptions:
2316 - If the table contains horizontal separator hlines with rows above
2317 and below, everything before the first such hline is considered
2318 part of the table /header/ and will not be modified by column
2319 formulas. Therefore a header is mandatory when you use column
2320 formulas and want to add hlines to group rows, like for example
2321 to separate a total row at the bottom from the summand rows
2324 - Fields that already get a value from a field/range formula will
2325 be left alone by column formulas. These conditions make column
2326 formulas very easy to use.
2328 To assign a formula to a column, type it directly into any field in
2329 the column, preceded by an equal sign, like {{{samp(=$1+$2)}}}. When
2330 you press {{{key(TAB)}}} or {{{key(RET)}}} or {{{kbd(C-c C-c)}}} with
2331 the cursor still in the field, the formula will be stored as the
2332 formula for the current column, evaluated and the current field
2333 replaced with the result. If the field contains only {{{samp(=)}}},
2334 the previously stored formula for this column is used. For each
2335 column, Org will only remember the most recently used formula. In the
2336 {{{samp(#+TBLFM:)}}} line, column formulas will look like
2337 {{{samp($4=$1+$2)}}}. The left-hand side of a column formula can not
2338 be the name of column, it must be the numeric column reference or
2341 Instead of typing an equation into the field, you may also use the
2344 #+attr_texinfo: :table-type table :indic @asis
2345 - {{{kbd(C-c =)}}}, ~org-table-eval-formula~ :: Install a new formula
2346 for the current column and replace current field with the
2347 result of the formula. The command prompts for a formula, with
2348 default taken from the {{{samp(#+TBLFM)}}} line, applies it to
2349 the current field and stores it. With a numeric prefix
2350 argument(e.g., {{{kbd(C-5 C-c =)}}}) the command will apply it
2351 to that many consecutive fields in the current column.
2354 #+findex: org-table-eval-formula
2355 *** Lookup functions
2357 :DESCRIPTION: Lookup functions for searching tables
2359 #+cindex: lookup functions in tables
2360 #+cindex: table lookup functions
2362 Org has three predefined Emacs Lisp functions for lookups in tables.
2364 #+attr_texinfo: :table-type table :indic @code
2365 - (org-lookup-first VAL S-LIST R-LIST &optional PREDICATE) :: Searches
2366 for the first element ~S~ in list ~S-LIST~ for which
2368 #+findex: org-lookup-first
2370 #+header: :exports code
2372 #+begin_src emacs-lisp
2375 is ~t~; returns the value from the corresponding position in
2376 list ~R-LIST~. The default ~PREDICATE~ is ~equal~. Note that
2377 the parameters ~VAL~ and ~S~ are passed to ~PREDICATE~ in the
2378 same order as the correspoding parameters are in the call to
2379 ~org-lookup-first~, where ~VAL~ precedes ~S-LIST~. If ~R-LIST~
2380 is ~nil~, the matching element ~S~ of ~S-LIST~ is returned.
2381 - (org-lookup-last VAL S-LIST R-LIST &optional PREDICATE) :: Similar
2382 to ~org-lookup-first~ above, but searches for the /last/
2383 element for which ~PREDICATE~ is ~t~.
2385 #+findex: org-lookup-last
2386 - (org-lookup-all VAL S-LIST R-LIST &optional PREDICATE) :: Similar
2387 to ~org-lookup-first~, but searches for /all/ elements for
2388 which ~PREDICATE~ is ~t~, and returns /all/ corresponding
2389 values. This function can not be used by itself in a formula,
2390 because it returns a list of values. However, powerful lookups
2391 can be built when this function is combined with other Emacs
2394 #+findex: org-lookup-all
2396 If the ranges used in these functions contain empty fields, the ~E~
2397 mode for the formula should usually be specified: otherwise empty
2398 fields will not be included in ~S-LIST~ and/or ~R-LIST~ which can, for
2399 example, result in an incorrect mapping from an element of ~S-LIST~ to
2400 the corresponding element of ~R-LIST~.
2402 These three functions can be used to implement associative arrays,
2403 count matching cells, rank results, group data, etc. For practical
2404 examples see [[http://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]].
2406 *** Editing and debugging formulas
2408 :DESCRIPTION: Fixing formulas
2410 #+cindex: formula editing
2411 #+cindex: editing, of table formulas
2413 #+vindex: org-table-use-standard-references You can edit
2414 individual formulas in the minibuffer or directly in the field. Org
2415 can also prepare a special buffer with all active formulas of a table.
2416 When offering a formula for editing, Org converts references to the
2417 standard format (like ~B3~ or ~D&~) if possible. If you prefer to
2418 only work with the internal format (like ~@3$2~ or ~$4~), configure
2419 the variable ~org-table-use-standard-references~.
2421 #+attr_texinfo: :table-type table :indic @asis
2422 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}}, ~org-table-eval-formula~ ::
2424 Edit the formula associated with the current column/field in the
2425 minibuffer. See [[Column formulas]], and [[Field and range formulas]].
2429 #+findex: org-table-eval-formula
2430 - {{{kbd(C-u C-u C-c =)}}}, ~org-table-eval-formula~ :: Re-insert the
2431 active formula (either a field formula, or a column formula)
2432 into the current field, so that you can edit it directly in the
2433 field. The advantage over editing in the minibuffer is that
2434 you can use the command {{{kbd(C-c ?)}}}.
2436 #+kindex: C-u C-u C-c =
2437 #+findex: org-table-eval-formula
2439 - {{{kbd(C-c ?)}}}, ~org-table-field-info~ :: While editing a formula
2440 in a table field, highlight the field(s) referenced by the
2441 reference at the cursor position in the formula.
2444 #+findex: org-table-field-info
2446 - {{{kbd(C-c })}}}, ~org-table-toggle-coordinate-overlays~ :: Toggle
2447 the display of row and column numbers for a table, using
2448 overlays ({{{command(org-table-toggle-coordinate-overlays)}}}).
2449 These are updated each time the table is aligned; you can force
2450 it with {{{kbd(C-c C-c)}}}.
2453 #+findex: org-table-toggle-coordinate-overlays
2455 - {{{kbd(C-c {)}}}, ~org-table-toggle-formula-debugger~ :: Toggle
2456 the formula debugger on and off. See below.
2459 #+findex: org-table-toggle-formula-debugger
2461 - {{{kbd(C-c ')}}}, ~org-table-edit-formulas~ :: Edit all formulas
2462 for the current table in a special buffer, where the formulas
2463 will be displayed one per line. If the current field has an
2464 active formula, the cursor in the formula editor will mark it.
2465 While inside the special buffer, Org will automatically
2466 highlight any field or range reference at the cursor position.
2467 You may edit, remove and add formulas, and use the following
2471 #+findex: org-table-edit-formulas
2473 #+attr_texinfo: :table-type table :indic @asis
2474 - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}}, ~org-table-fedit-finish~ ::
2476 Exit the formula editor and store the modified formulas. With
2477 {{{kbd(C-u)}}} prefix, also apply the new formulas to the
2482 #+findex: org-table-fedit-finish
2483 - {{{kbd(C-c C-q)}}}, ~org-table-fedit-abort~ :: Exit the formula
2484 editor without installing changes.
2487 #+findex: org-table-fedit-abort
2488 - {{{kbd(C-c C-r)}}}, ~org-table-fedit-toggle-ref-type~ :: Toggle all
2489 references in the formula editor between standard (like ~B3~)
2490 and internal (like ~@3$2~).
2493 #+findex: org-table-fedit-toggle-ref-type
2494 - {{{key(TAB)}}}, ~org-table-fedit-lisp-indent~ :: Pretty-print or
2495 indent Lisp formula at point. When in a line containing a Lisp
2496 formula, format the formula according to Emacs Lisp rules.
2497 Another {{{key(TAB)}}} collapses the formula back again. In
2498 the open formula, {{{key(TAB)}}} re-indents just like in Emacs
2502 #+findex: org-table-fedit-lisp-indent
2503 - {{{kbdkey(M-,TAB)}}}, ~lisp-complete-symbol~ :: Complete Lisp
2504 symbols, just like in Emacs Lisp mode.
2507 #+findex: lisp-complete-symbol
2508 - {{{kbdkey(S-,up)}}}/{{{key(down)}}}/{{{key(left)}}}/{{{key(right)}}} :: Shift
2509 the reference at point. For example, if the reference is ~B3~
2510 and you press {{{kbdkey(S-,right)}}}, it will become ~C3~.
2511 This also works for relative references and for hline
2518 #+findex: org-table-fedit-ref-up
2519 #+findex: org-table-fedit-ref-down
2520 #+findex: org-table-fedit-ref-left
2521 #+findex: org-table-fedit-ref-right
2522 - {{{kbdkey(M-S-,up)}}}, ~org-table-fedit-line-up~ ::
2524 Move the test line for column formulas up in the Org buffer.
2527 #+findex: org-table-fedit-line-up
2529 - {{{kbdkey(M-S-,down)}}}, ~org-table-fedit-line-down~ ::
2531 Move the test line for column formulas down in the Org buffer.
2534 #+findex: org-table-fedit-line-down
2536 - {{{kbdkey(M-,up)}}}, ~org-table-fedit-scroll-up~ ::
2538 Scroll up the window displaying the table.
2541 #+findex: org-table-fedit-scroll-up
2543 - {{{kbdkey(M-,down)}}}, ~org-table-fedit-scroll-down~ ::
2545 Scroll down the window displaying the table.
2548 #+findex: org-table-fedit-scroll-down
2550 - {{{kbd(C-c })}}} :: Turn the coordinate grid in the table on and
2554 #+findex: org-table-toggle-coordinate-overlays
2556 Making a table field blank does not remove the formula associated with
2557 the field, because that is stored in a different line (the
2558 {{{samp(#+TBLFM)}}} line)---during the next recalculation the field
2559 will be filled again. To remove a formula from a field, you have to
2560 give an empty reply when prompted for the formula, or to edit the
2561 {{{samp(#+TBLFM)}}} line.
2564 You may edit the {{{samp(#+TBLFM)}}} directly and re-apply the changed
2565 equations with {{{kbd(C-c C-c)}}} in that line or with the normal
2566 recalculation commands in the table.
2568 *** Debugging formulas
2570 :DESCRIPTION: Help fixing formulas
2573 #+cindex: formula debugging
2574 #+cindex: debugging, of table formulas
2576 When the evaluation of a formula leads to an error, the field content
2577 becomes the string {{{samp(#ERROR)}}}. If you would like see what is
2578 going on during variable substitution and calculation in order to find
2579 a bug, turn on formula debugging in the ~Tbl~ menu and repeat the
2580 calculation, for example by pressing {{{kbdspckey(C-u C-u C-c =,RET)}}}
2581 in a field. Detailed information will be displayed.
2583 *** Updating the table
2585 :DESCRIPTION: Recomputing all dependent fields
2587 #+cindex: recomputing table fields
2588 #+cindex: updating, table
2590 Recalculation of a table is normally not automatic, but needs to be
2591 triggered by a command. See [[Advanced features]], for a way to make
2592 recalculation at least semi-automatic.
2594 In order to recalculate a line of a table or the entire table, use the
2597 #+attr_texinfo: :table-type table :indic @asis
2598 - {{{kbd(C-c *)}}}, ~org-table-recalculate~ :: Recalculate the
2599 current row by first applying the stored column formulas from
2600 left to right, and all field/range formulas in the current row.
2603 #+findex: org-table-recalculate
2604 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} :: Recompute the
2605 entire table, line by line. Any lines before the first hline
2606 are left alone, assuming that these are part of the table
2610 #+kindex: C-u C-c C-c
2611 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}}, ~org-table-iterate~ ::
2613 Iterate the table by recomputing it until no further changes
2614 occur. This may be necessary if some computed fields use the
2615 value of other fields that are computed /later/ in the
2616 calculation sequence.
2618 #+kindex: C-u C-u C-c *
2619 #+kindex: C-u C-u C-c C-c
2620 #+findex: org-table-iterate
2621 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} :: Recompute
2622 all tables in the current buffer.
2624 #+findex: org-table-recalculate-buffer-tables
2625 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} :: Iterate all
2626 tables in the current buffer, in order to converge
2627 table-to-table dependencies.
2629 #+findex: org-table-iterate-buffer-tables
2630 *** Advanced features
2632 :DESCRIPTION: Field and column names, parameters, and automatic recalc
2634 If you want the recalculation of fields to happen automatically, or if
2635 you want to be able to assign /names/ to fields and columns,
2636 you need to reserve the first column of the table for special marking
2639 #+attr_texinfo: :table-type table :indic @asis
2640 - {{{kbd(C-#)}}}, ~org-table-rotate-recalc-marks~ :: Rotate the
2641 calculation mark in first column through the states {{{samp( )}}}, {{{samp(#)}}}, {{{samp(*)}}}, {{{samp(!)}}},
2642 {{{samp($)}}}. When there is an active region, change all
2643 marks in the region.
2646 #+findex: org-table-rotate-recalc-marks
2647 Here is an example of a table that collects exam results of students
2648 and makes use of these features:
2651 |---+---------+--------+--------+--------+-------+------|
2652 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2653 |---+---------+--------+--------+--------+-------+------|
2654 | ! | | P1 | P2 | P3 | Tot | |
2655 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2656 | ^ | | m1 | m2 | m3 | mt | |
2657 |---+---------+--------+--------+--------+-------+------|
2658 | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2659 | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2660 |---+---------+--------+--------+--------+-------+------|
2661 | | Average | | | | 25.0 | |
2662 | ^ | | | | | at | |
2663 | $ | max=50 | | | | | |
2664 |---+---------+--------+--------+--------+-------+------|
2665 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f
2668 {{{noindent}}} Important: please note that for these special tables,
2669 recalculating the table with {{{kbd(C-u C-c *)}}} will only affect
2670 rows that are marked ~#~ or ~*~, and fields that
2671 have a formula assigned to the field itself. The column formulas are
2672 not applied in rows with empty first field.
2674 #+cindex: marking characters, tables
2675 The marking characters have the following meaning:
2676 #+attr_texinfo: :table-type table :indic @samp
2677 - ! :: The fields in this line define names for the columns, so that
2678 you may refer to a column as {{{samp($Tot)}}} instead of
2680 - ^ :: This row defines names for the fields @emph{above} the row.
2681 With such a definition, any formula in the table may use
2682 {{{samp($m1)}}} to refer to the value {{{samp(10)}}}. Also,
2683 if you assign a formula to a names field, it will be stored
2685 - _ :: Similar to {{{samp(^)}}}, but defines names for the fields in
2687 - $ :: Fields in this row can define /parameters/ for formulas. For
2688 example, if a field in a {{{samp($)}}} row contains
2689 {{{samp(max=50)}}}, then formulas in this table can refer to
2690 the value 50 using {{{samp($max)}}}. Parameters work exactly
2691 like constants, only that they can be defined on a per-table
2693 - # :: Fields in this row are automatically recalculated when
2694 pressing {{{key(TAB)}}} or {{{key(RET)}}} or
2695 {{{kbdkey(S-,TAB)}}} in this row. Also, this row is selected
2696 for a global recalculation with {{{kbd(C-u C-c *)}}}.
2697 Unmarked lines will be left alone by this command.
2698 - * :: Selects this line for global recalculation with {{{kbd(C-u C-c *)}}}, but not for automatic recalculation. Use this
2699 when automatic recalculation slows down editing too much.
2700 - \nbsp :: Unmarked lines are exempt from recalculation with {{{kbd(C-u C-c *)}}}. All lines that should be recalculated should be
2701 marked with ~#~ or ~*~.
2702 - / :: Do not export this line. Useful for lines that contain the
2703 narrowing ~<N>~ markers or column group markers.
2706 Finally, just to whet your appetite for what can be done with the
2707 fantastic {{{file(calc.el)}}} package, here is a table that computes
2708 the Taylor series of degree ~n~ at location ~x~ for a couple of
2712 |---+-------------+---+-----+--------------------------------------|
2713 | | Func | n | x | Result |
2714 |---+-------------+---+-----+--------------------------------------|
2715 | # | exp(x) | 1 | x | 1 + x |
2716 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2717 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2718 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2719 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2720 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2721 |---+-------------+---+-----+--------------------------------------|
2722 ,#+TBLFM: $5=taylor($2,$4,$3);n3
2727 :DESCRIPTION: Plotting from Org tables
2729 #+cindex: graph, in tables
2730 #+cindex: plot tables using Gnuplot
2733 Org-Plot can produce 2D and 3D graphs of information stored in org
2734 tables using [[http://www.gnuplot.info/][Gnuplot]] and [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][gnuplot-mode]]. To see this in action, ensure
2735 that you have both Gnuplot and Gnuplot-mode installed on your system,
2736 then call ~org-plot/gnuplot~ on the following table.
2739 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
2740 | Sede | Max cites | H-index |
2741 |-----------+-----------+---------|
2742 | Chile | 257.72 | 21.39 |
2743 | Leeds | 165.77 | 19.68 |
2744 | Sao Paolo | 71.00 | 11.50 |
2745 | Stockholm | 134.19 | 14.33 |
2746 | Morels | 257.56 | 17.67 |
2749 Notice that Org Plot is smart enough to apply the table's headers as
2750 labels. Further control over the labels, type, content, and appearance
2751 of plots can be exercised through the ~#+PLOT:~ lines preceding a
2752 table. See below for a complete list of Org-plot options. For more
2753 information and examples see the [[http://orgmode.org/worg/org-tutorials/org-plot.html][Org-plot tutorial]].
2755 Org-Plot recognizes the following options:
2757 #+attr_texinfo: :table-type table :indic @code
2758 - set :: Specify any {{{command(gnuplot)}}} option to be set when
2760 - title :: Specify the title of the plot.
2761 - ind :: Specify which column of the table to use as the ~x~ axis.
2762 - deps :: Specify the columns to graph as a Lisp style list,
2763 surrounded by parentheses and separated by spaces for
2764 example ~dep:(3 4)~ to graph the third and fourth columns
2765 (defaults to graphing all other columns aside from the
2767 - type :: Specify whether the plot will be ~2d~, ~3d~, or ~grid~.
2768 - with :: Specify a ~with~ option to be inserted for every col being
2769 plotted (e.g., ~lines~, ~points~, ~boxes~, ~impulses~,
2770 etc.). Defaults to ~lines~.
2771 - file :: If you want to plot to a file, specify
2772 ~"{path/to/desired/output-file}"~.
2773 - labels :: List of labels to be used for the ~deps~ (defaults to
2774 the column headers if they exist).
2775 - line :: Specify an entire line to be inserted in the Gnuplot
2777 - map :: When plotting ~3d~ or ~grid~ types, set this to ~t~ to
2778 graph a flat mapping rather than a ~3d~ slope.
2779 - timefmt :: Specify format of Org mode timestamps as they will be
2780 parsed by Gnuplot. Defaults to
2781 {{{samp(%Y-%m-%d-%H:%M:%S)}}}.
2782 - script :: If you want total control, you can specify a script file
2783 (place the file name between double-quotes) which will
2784 be used to plot. Before plotting, every instance of
2785 ~$datafile~ in the specified script will be replaced
2786 with the path to the generated data file. Note: even if
2787 you set this option, you may still want to specify the
2788 plot type, as that can impact the content of the data
2793 :DESCRIPTION: Notes in context
2796 #+cindex: hyperlinks
2798 Like HTML, Org provides links inside a file, external links to
2799 other files, Usenet articles, emails, and much more.
2803 :DESCRIPTION: How links in Org are formatted
2805 #+cindex: link format
2806 #+cindex: format, of links
2808 Org will recognize plain URL-like links and activate them as clickable
2809 links. The general link format, however, looks like this:
2812 [[link][description]] or [[link]]
2816 {{{noindent}}} Once a link in the buffer is complete (all brackets
2817 present), Org will change the display so that {{{samp(description)}}}
2818 is displayed instead of ~[[link][description]]~ and {{{samp(link)}}}
2819 is displayed instead of ~[[link]]~. Links will be highlighted
2820 in the face ~org-link~, which by default is an underlined face. You
2821 can directly edit the visible part of a link. Note that this can be
2822 either the {{{samp(link)}}} part (if there is no description) or the
2823 {{{samp(description)}}} part. To edit also the invisible
2824 {{{samp(link)}}} part, use {{{kbd(C-c C-l)}}} with the cursor on the
2827 If you place the cursor at the beginning or just behind the end of the
2828 displayed text and press {{{key(BACKSPACE)}}}, you will remove the
2829 (invisible) bracket at that location. This makes the link incomplete
2830 and the internals are again displayed as plain text. Inserting the
2831 missing bracket hides the link internals again. To show the internal
2832 structure of all links, use the menu entry ~Org->Hyperlinks->Literal
2837 :DESCRIPTION: Links to other places in the current file
2839 #+cindex: internal links
2840 #+cindex: links, internal
2841 #+cindex: targets, for links
2842 #+cindex: property, CUSTOM_ID
2844 If the link does not look like a URL, it is considered to be internal
2845 in the current file. The most important case is a link like
2846 ~[[#my-custom-id]]~ which will link to the entry with the
2847 ~CUSTOM_ID~ property {{{samp(my-custom-id)}}}. Such custom IDs are
2848 very good for HTML export (see [[HTML export]]) where they produce pretty
2849 section links. You are responsible yourself to make sure these custom
2850 IDs are unique in a file.
2852 Links such as the two in the following example:
2855 [[My Target]] or [[My Target][Find my target]]
2858 {{{noindent}}} lead to a text search in the current file.
2860 The link can be followed with {{{kbd(C-c C-o)}}} when the cursor is on
2861 the link, or with a mouse click (see [[Handling links]]). Links to custom
2862 IDs will point to the corresponding headline. The preferred match for
2863 a text link is a /dedicated target/: the same string in double angular
2864 brackets. Targets may be located anywhere; sometimes it is convenient
2865 to put them into a comment line. For example
2871 {{{noindent}}} In HTML export (see [[HTML export]]), such targets will
2872 become named anchors for direct access through {{{samp(http)}}}
2875 If no dedicated target exists, Org will search for a headline that is
2876 exactly the link text but may also include a TODO keyword and
2877 tags.[fn:32] In non-Org files, the search will look for the words in
2878 the link text. In the above example the search would be for ~my target~.
2880 Following a link pushes a mark onto Org's own mark ring. You can
2881 return to the previous position with {{{kbd(C-c &)}}}. Using this
2882 command several times in direct succession goes back to positions
2887 :DESCRIPTION: Automatically create internal links
2889 #+cindex: radio targets
2890 #+cindex: targets, radio
2891 #+cindex: links, radio targets
2893 Org can automatically turn any occurrences of certain target names in
2894 normal text into a link. So without explicitly creating a link, the
2895 text connects to the target radioing its position. Radio targets are
2896 enclosed by triple angular brackets. For example, a target
2897 ~<<<My Target>>>~ causes each occurrence of ~my target~ in
2898 normal text to become activated as a link. The Org file is scanned
2899 automatically for radio targets only when the file is first loaded
2900 into Emacs. To update the target list during editing, press
2901 {{{kbd(C-c C-c)}}} with the cursor on or at a target.
2905 :DESCRIPTION: URL-like links to the world
2907 #+cindex: links, external
2908 #+cindex: external links
2909 #+cindex: links, external
2910 #+cindex: Gnus links
2911 #+cindex: BBDB links
2914 #+cindex: file links
2916 #+cindex: RMAIL links
2917 #+cindex: WANDERLUST links
2918 #+cindex: MH-E links
2919 #+cindex: USENET links
2920 #+cindex: SHELL links
2921 #+cindex: Info links
2922 #+cindex: Elisp links
2924 Org supports links to files, websites, Usenet and email messages, BBDB
2925 database entries and links to both IRC conversations and their logs.
2926 External links are URL-like locators. They start with a short
2927 identifying string followed by a colon. There can be no space after
2928 the colon. The following list shows examples for each link type.
2930 #+attr_texinfo: :table-type table :indic @asis
2931 - ~http://www.astro.uva.nl/~dominik~ :: on the web
2932 - ~doi:10.1000/182~ :: DOI for an electronic resource
2933 - ~file:/home/dominik/images/jupiter.jpg~ :: file, absolute path
2934 - ~/home/dominik/images/jupiter.jpg~ :: same as above
2935 - ~file:papers/last.pdf~ :: file, relative path
2936 - ~./papers/last.pdf~ :: same as above
2937 - ~file:/myself@some.where:papers/last.pdf~ :: file, path on remote machine
2938 - ~/myself@some.where:papers/last.pdf~ :: same as above
2939 - ~file:sometextfile::NNN~ :: file, jump to line number
2940 - ~file:projects.org~ :: another Org file
2941 - ~file:projects.org::some words~ :: text search in Org file[fn:33]
2942 - ~file:projects.org::*task title~ :: heading search in Org file
2943 - ~file+sys:/path/to/file~ :: open via OS, like double-click
2944 - ~file+emacs:/path/to/file~ :: force opening by Emacs
2945 - ~docview:papers/last.pdf::NNN~ :: open in doc-view mode at page
2946 - ~id:B7423F4D-2E8A-471B-8810-C40F074717E9~ :: Link to heading by ID
2947 - ~news:comp.emacs~ :: Usenet link
2948 - ~mailto:adent@galaxy.net~ :: Mail link
2949 - ~vm:folder~ :: VM folder link
2950 - ~vm:folder#id~ :: VM message link
2951 - ~vm://myself@some.where.org/folder#id~ :: VM on remote machine
2952 - ~vm-imap:account:folder~ :: VM IMAP folder link
2953 - ~vm-imap:account:folder#id~ :: VM IMAP message link
2954 - ~wl:folder~ :: WANDERLUST folder link
2955 - ~wl:folder#id~ :: WANDERLUST message link
2956 - ~mhe:folder~ :: MH-E folder link
2957 - ~mhe:folder#id~ :: MH-E message link
2958 - ~rmail:folder~ :: RMAIL folder link
2959 - ~rmail:folder#id~ :: RMAIL message link
2960 - ~gnus:group~ :: Gnus group link
2961 - ~gnus:group#id~ :: Gnus article link
2962 - ~bbdb:R.*Stallman~ :: BBDB link (with regexp)
2963 - ~irc:/irc.com/#emacs/bob~ :: IRC link
2964 - ~info:org#External links~ :: Info node link
2965 - ~shell:ls *.org~ :: A shell command
2966 - ~elisp:org-agenda~ :: Interactive Elisp command
2967 - ~elisp:(find-file-other-frame "Elisp.org")~ :: Elisp form to evaluate
2970 For customizing Org to add new link types [[Adding hyperlink types]].
2972 A link should be enclosed in double brackets and may contain a
2973 descriptive text to be displayed instead of the URL (see [[Link format]]),
2977 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2980 {{{noindent}}} If the description is a file name or URL that points to
2981 an image, HTML export (see [[HTML export]]) will inline the image as a
2982 clickable button. If there is no description at all and the link
2983 points to an image, that image will be inlined into the exported HTML
2986 #+cindex: square brackets, around links
2987 #+cindex: plain text external links
2989 Org also finds external links in the normal text and activates them as
2990 links. If spaces must be part of the link (for example in
2991 {{{samp(bbdb:Richard Stallman)}}}), or if you need to remove
2992 ambiguities about the end of the link, enclose them in square
2997 :DESCRIPTION: URL-like links to the world
2999 #+cindex: links, handling
3001 Org provides methods to create a link in the correct syntax, to
3002 insert it into an Org file, and to follow the link.
3004 #+attr_texinfo: :table-type table :indic @asis
3005 - {{{kbd(C-c l)}}}, ~org-store-link~ :: Store a link to the current
3006 location. This is a /global/ command (you must create the key
3007 binding yourself) which can be used in any buffer to create a
3008 link. The link will be stored for later insertion into an Org
3009 buffer (see below). What kind of link will be created depends
3010 on the current buffer:
3012 #+cindex: storing links
3014 #+findex: org-store-link
3015 - Org mode buffers :: For Org files, if there is a
3016 ~<<target>>~ at the cursor, the link points to the
3017 target. Otherwise it points to the current headline, which
3018 will also be the description.[fn:34]
3020 #+vindex: org-link-to-org-use-id
3021 #+cindex: property, CUSTOM_ID
3022 #+cindex: property, ID
3024 If the headline has a ~CUSTOM_ID~ property, a link to this
3025 custom ID will be stored. In addition or alternatively
3026 (depending on the value of ~org-link-to-org-use-id~), a
3027 globally unique ~ID~ property will be created and/or used to
3028 construct a link.[fn:176] So using this command in Org buffers will
3029 potentially create two links: a human-readable link from the
3030 custom ID, and one that is globally unique and works even if
3031 the entry is moved from file to file. Later, when inserting
3032 the link, you need to decide which one to use.
3034 - Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus :: Pretty
3035 much all Emacs mail clients are supported. The link will
3036 point to the current article, or, in some GNUS buffers, to
3037 the group. The description is constructed from the author
3040 - Web browsers: W3 and W3M :: Here the link will be the current
3041 URL, with the page title as description.
3043 - Contacts: BBDB :: Links created in a BBDB buffer will point to
3045 - Chat: IRC :: For IRC links, if you set the variable
3046 ~org-irc-link-to-logs~ to ~t~, a ~file:~
3047 style link to the relevant point in the logs for
3048 the current conversation is created. Otherwise an
3049 ~irc:/~ style link to the
3050 user/channel/server under the point will be stored.
3052 #+vindex: org-irc-link-to-logs
3054 - Other files :: For any other files, the link will point to the
3055 file, with a search string (see [[Search options]])
3056 pointing to the contents of the current line. If
3057 there is an active region, the selected words
3058 will form the basis of the search string. If the
3059 automatically created link is not working
3060 correctly or accurately enough, you can write
3061 custom functions to select the search string and
3062 to do the search for particular file types---see
3063 [[Custom searches]]. The key binding {{{kbd(C-c l)}}}
3064 is only a suggestion---see [[Installation]].
3066 - Agenda view :: When the cursor is in an agenda view, the created
3067 link points to the entry referenced by the
3070 - {{{kbd(C-c C-l)}}}, ~org-insert-link~ :: Insert a link.[fn:35] This
3071 prompts for a link to be inserted into the buffer. You can just
3072 type a link, using text for an internal link, or one of the
3073 link type prefixes mentioned in the examples above. The link
3074 will be inserted into the buffer, along with a
3075 descriptive text.[fn:36] If some text was selected when this command
3076 is called, the selected text becomes the default description.
3078 #+cindex: link completion
3079 #+cindex: completion, of links
3080 #+cindex: inserting links
3081 #+vindex: org-keep-stored-link-after-insertion
3083 #+findex: org-insert-link
3084 - Inserting stored links :: All links stored during the current
3085 session are part of the history for this prompt, so you can
3086 access them with {{{key(up)}}} and {{{key(down)}}} (or
3089 - Completion support :: Completion with {{{key(TAB)}}} will help
3090 you to insert valid link prefixes like ~http:~ or
3091 ~ftp:~, including the prefixes defined through link
3092 abbreviations (see [[Link abbreviations]]). If you press
3093 {{{key(RET)}}} after inserting only the
3094 {{{var(prefix)}}}, Org will offer specific completion
3095 support for some link types.[fn:37] For example, if you type
3096 {{{kbdspckey(file,RET)}}}, file name completion (alternative
3097 access: {{{kbd(C-u C-c C-l)}}}, see below) will be offered,
3098 and after {{{kbdspckey(bbdb,RET)}}} you can complete contact
3101 - {{{kbd(C-u C-c C-l)}}} :: When {{{kbd(C-c C-l)}}} is called with a
3102 {{{kbd(C-u)}}} prefix argument, a link to a file will be
3103 inserted and you may use file name completion to select the
3104 name of the file. The path to the file is inserted relative to
3105 the directory of the current Org file, if the linked file is in
3106 the current directory or in a sub-directory of it, or if the
3107 path is written relative to the current directory using
3108 {{{samp(../)}}}. Otherwise an absolute path is used, if
3109 possible with {{{samp(~/)}}} for your home directory. You can
3110 force an absolute path with two {{{kbd(C-u)}}} prefixes.
3112 #+cindex: file name completion
3113 #+cindex: completion, of file names
3114 #+kindex: C-u C-c C-l
3116 - {{{kbd(C-c C-l)}}} (with cursor on existing link) :: When the
3117 cursor is on an existing link, {{{kbd(C-c C-l)}}} allows you to
3118 edit the link and description parts of the link.
3120 #+cindex: following links
3122 - {{{kbd(C-c C-o)}}}, ~org-open-at-point~ :: Open link at
3123 point. This will launch a web browser for URLs (using
3124 {{{command(browse-url-at-point)}}}), run
3125 VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for the corresponding
3126 links, and execute the command in a shell link. When the
3127 cursor is on an internal link, this command runs the
3128 corresponding search. When the cursor is on a TAG list in a
3129 headline, it creates the corresponding TAGS view. If the
3130 cursor is on a timestamp, it compiles the agenda for that
3131 date. Furthermore, it will visit text and remote files in
3132 ~file:~ links with Emacs and select a suitable
3133 application for local non-text files. Classification of files
3134 is based on file extension only. See option ~org-file-apps~.
3135 If you want to override the default application and visit the
3136 file with Emacs, use a {{{kbd(C-u)}}} prefix. If you want to
3137 avoid opening in Emacs, use a {{{kbd(C-u C-u)}}} prefix. If
3138 the cursor is on a headline, but not on a link, offer all
3139 links in the headline and entry text. If you want to setup
3140 the frame configuration for following links, customize
3141 ~org-link-frame-setup~.
3143 #+vindex: org-file-apps
3144 #+vindex: org-link-frame-setup
3146 #+findex: org-open-at-point
3147 - {{{key(RET)}}} :: When ~org-return-follows-link~ is set,
3148 {{{key(RET)}}} will also follow the link at
3151 #+vindex: org-return-follows-link
3153 - {{{key(mouse-2)}}} or {{{key(mouse-1)}}} :: On links,
3154 {{{kbd(mouse-2)}}} will open the link just as {{{kbd(C-c C-o)}}} would. Under Emacs 22 and later, {{{kbd(mouse-1)}}}
3155 will also follow a link.
3159 - {{{key(mouse-3)}}} :: Like {{{kbd(mouse-2)}}}, but force file
3160 links to be opened with Emacs, and internal links to be
3161 displayed in another window.[fn:38]
3163 #+vindex: org-display-internal-link-with-indirect-buffer
3165 - {{{kbd(C-c C-x C-v)}}}, ~org-toggle-inline-images~ ::
3166 #+cindex: inlining images
3167 #+cindex: images, inlining
3168 #+vindex: org-startup-with-inline-images
3169 #+cindex: ~inlineimages~, STARTUP keyword
3170 #+cindex: ~noinlineimages~, STARTUP keyword
3171 #+kindex: C-c C-x C-v
3172 #+findex: org-toggle-inline-images
3174 Toggle the inline display of linked images. Normally this
3175 will only inline images that have no description part in the
3176 link, i.e., images that will also be inlined during export.
3177 When called with a prefix argument, also display images that
3178 do have a link description. You can ask for inline images to
3179 be displayed at startup by configuring the variable
3180 ~org-startup-with-inline-images~.[fn:177]
3182 - {{{kbd(C-c %)}}}, ~org-mark-ring-push~ ::
3184 #+findex: org-mark-ring-push
3187 Push the current position onto the mark ring, to be able to
3188 return easily. Commands following an internal link do this
3191 - {{{kbd(C-c &)}}}, ~org-mark-ring-goto~ ::
3193 #+findex: org-mark-ring-goto
3194 #+cindex: links, returning to
3196 Jump back to a recorded position. A position is recorded by
3197 the commands following internal links, and by {{{kbd(C-c %)}}}. Using this command several times in direct succession
3198 moves through a ring of previously recorded positions.
3200 - {{{kbd(C-c C-x C-n)}}}, ~org-next-link~ ::
3201 @@info:@itemx@@ {{{kbd(C-c C-x C-p)}}}, ~org-previous-link~
3202 #+cindex: links, finding next/previous
3204 #+kindex: C-c C-x C-p
3205 #+findex: org-previous-link
3206 #+kindex: C-c C-x C-n
3207 #+findex: org-next-link
3209 Move forward/backward to the next link in the buffer. At the
3210 limit of the buffer, the search fails once, and then wraps
3211 around. The key bindings for this are really too long; you
3212 might want to bind this also to {{{kbd(C-n)}}} and
3215 #+header: :exports code
3217 #+begin_src emacs-lisp
3218 (add-hook 'org-load-hook
3220 (define-key org-mode-map "\C-n" 'org-next-link)
3221 (define-key org-mode-map "\C-p" 'org-previous-link)))
3224 ** Using links outside Org
3226 :DESCRIPTION: Linking from my C source code?
3229 You can insert and follow links that have Org syntax not only in Org,
3230 but in any Emacs buffer. For this, you should create two global
3231 commands, like this (please select suitable global keys yourself):
3233 #+header: :exports code
3235 #+begin_src emacs-lisp
3236 (global-set-key "\C-c L" 'org-insert-link-global)
3237 (global-set-key "\C-c o" 'org-open-at-point-global)
3240 ** Link abbreviations
3242 :DESCRIPTION: Shortcuts for writing complex links
3244 #+cindex: link abbreviations
3245 #+cindex: abbreviation, links
3247 Long URLs can be cumbersome to type, and often many similar links are
3248 needed in a document. For this you can use link abbreviations. An
3249 abbreviated link looks like this
3252 [[linkword:tag][description]]
3255 #+vindex: org-link-abbrev-alist
3257 {{{noindent}}} where the tag is optional. The /linkword/ must be a
3258 word, starting with a letter, followed by letters, numbers,
3259 {{{samp(-)}}}, and {{{samp(_)}}}. Abbreviations are resolved
3260 according to the information in the variable ~org-link-abbrev-alist~
3261 that relates the linkwords to replacement text. Here is an example:
3263 #+header: :exports code
3265 #+begin_src emacs-lisp
3266 (setq org-link-abbrev-alist
3267 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
3268 ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
3269 ("google" . "http://www.google.com/search?q=")
3270 ("gmap" . "http://maps.google.com/maps?q=%s")
3271 ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
3272 ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
3275 If the replacement text contains the string {{{samp(%s)}}}, it will be
3276 replaced with the tag. Using {{{samp(%h)}}} instead of {{{samp(%s)}}}
3277 will url-encode the tag (see the example above, where we need to
3278 encode the URL parameter.) Using {{{samp(%(my-function))}}} will pass
3279 the tag to a custom function, and replace it by the resulting string.
3281 If the replacement text don't contain any specifier, it will simply be
3282 appended to the string in order to create the link.
3284 Instead of a string, you may also specify a function that will be
3285 called with the tag as the only argument to create the link.
3287 With the above setting, you could link to a specific bug with
3288 ~[[bugzilla:129]]~, search the web for {{{samp(OrgMode)}}} with
3289 ~[[google:OrgMode]]~, show the map location of the Free Software
3290 Foundation ~[[gmap:51 Franklin Street, Boston]]~ or of Carsten office
3291 ~[[omap:Science Park 904, Amsterdam, The Netherlands]]~ and find out what
3292 the Org author is doing besides Emacs hacking with ~[[ads:Dominik,C]]~.
3294 If you need special abbreviations just for a single Org buffer, you
3295 can define them in the file with
3299 ,#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
3300 ,#+LINK: google http://www.google.com/search?q=%s
3303 {{{noindent}}} In-buffer completion (see [[Completion]]) can be used
3304 after {{{samp([)}}} to complete link abbreviations. You may also
3305 define a function that implements special (e.g., completion) support
3306 for inserting such a link with {{{kbd(C-c C-l)}}}. Such a function
3307 should not accept any arguments, and return the full link with
3308 prefix. You can set the link completion function like this:
3310 #+BEGIN_SRC emacs-lisp
3311 (org-link-set-parameter "type" :complete #'some-completion-function)
3316 :DESCRIPTION: Linking to a specific location
3318 #+cindex: search option in file links
3319 #+cindex: file links, searching
3321 File links can contain additional information to make Emacs jump to a
3322 particular location in the file when following a link. This can be a
3323 line number or a search option after a double colon.[fn:39]
3324 For example, when the command {{{kbd(C-c l)}}} creates a link (see
3325 [[Handling links]]) to a file, it encodes the words in the current line as
3326 a search string that can be used to find this line back later when
3327 following the link with {{{kbd(C-c C-o)}}}.
3329 Here is the syntax of the different ways to attach a search to a file
3330 link, together with an explanation:
3333 [[file:~/code/main.c::255]]
3334 [[file:~/xx.org::My Target]]
3335 [[file:~/xx.org::*My Target]]
3336 [[file:~/xx.org::#my-custom-id]]
3337 [[file:~/xx.org::/regexp/]]
3340 #+attr_texinfo: :indic @code
3341 - 255 :: Jump to line 255.
3342 - My Target :: Search for a link target ~<<My Target>>~, or do a text search for {{{samp(my target)}}},
3343 similar to the search in internal links, see [[Internal links]].
3344 In HTML export (see [[HTML export]]), such a file link will
3345 become a HTML reference to the corresponding named anchor in the
3347 - *My Target :: In an Org file, restrict search to headlines.
3348 - #my-custom-id :: Link to a heading with a ~CUSTOM_ID~ property
3349 - /regexp/ :: Do a regular expression search for ~regexp~. This
3350 uses the Emacs command ~occur~ to list all matches
3351 in a separate window. If the target file is in
3352 Org mode, ~org-occur~ is used to create a sparse
3353 tree with the matches. @c If the target file is a
3354 directory, @c ~grep~ will be used to search all
3355 files in the directory.
3357 As a degenerate case, a file link with an empty file name can be used
3358 to search the current file. For example, ~[[file:::find me]]~ does a
3359 search for ~find me~ in the current file, just as
3360 ~[[find me]]~ would.
3364 :DESCRIPTION: When the default search is not enough
3366 #+cindex: custom search strings
3367 #+cindex: search strings, custom
3369 The default mechanism for creating search strings and for doing the
3370 actual search related to a file link may not work correctly in all
3371 cases. For example, BibTeX database files have many entries like
3372 {{{samp(year="1993")}}} which would not result in good search strings,
3373 because the only unique identification for a BibTeX entry is the
3376 #+vindex: org-create-file-search-functions
3377 #+vindex: org-execute-file-search-functions
3379 If you come across such a problem, you can write custom functions to
3380 set the right search string for a particular file type, and to do the
3381 search for the string in the file. Using ~add-hook~, these functions
3382 need to be added to the hook variables
3383 ~org-create-file-search-functions~ and
3384 ~org-execute-file-search-functions~. See the docstring for these
3385 variables for more information. Org actually uses this mechanism for
3386 BibTeX database files, and you can use the corresponding code as an
3387 implementation example. See the file {{{file(org-bibtex.el)}}}.
3391 :DESCRIPTION: Every tree branch can be a TODO item
3392 :ALT_TITLE: TODO Items
3394 #+cindex: TODO items
3396 Org mode does not maintain TODO lists as separate documents.[fn:40]
3397 Instead, TODO items are an integral part of the notes file, because
3398 TODO items usually come up while taking notes! With Org mode, simply
3399 mark any entry in a tree as being a TODO item. In this way,
3400 information is not duplicated, and the entire context from which the
3401 TODO item emerged is always present.
3403 Of course, this technique for managing TODO items scatters them
3404 throughout your notes file. Org mode compensates for this by providing
3405 methods to give you an overview of all the things that you have to do.
3409 :DESCRIPTION: Marking and displaying TODO entries
3410 :TITLE: Basic TODO functionality
3413 Any headline becomes a TODO item when it starts with the word
3414 {{{samp(TODO)}}}, for example:
3417 ,*** TODO Write letter to Sam Fortune
3420 {{{noindent}}} The most important commands to work with TODO entries
3423 #+attr_texinfo: :table-type table :indic @asis
3424 - {{{kbd(C-c C-t)}}}, ~org-todo~ ::
3426 #+cindex: cycling, of TODO states
3428 Rotate the TODO state of the current item among
3431 ,-> (unmarked) -> TODO -> DONE --.
3432 '--------------------------------'
3435 The same rotation can also be done ``remotely'' from the timeline and
3436 agenda buffers with the {{{kbd(t)}}} command key (see [[Agenda commands]]).
3438 - {{{kbd(C-u C-c C-t)}}} ::
3439 #+kindex: C-u C-c C-t
3441 Select a specific keyword using completion or (if it has been set up)
3442 the fast selection interface. For the latter, you need to assign keys
3443 to TODO states, see [[Per-file keywords]], and [[Setting tags]], for
3446 #+kindex: S-@key{right}
3447 #+kindex: S-@key{left}
3449 - {{{kbdkey(S-,right)}}} {{{kbdkey(S-,left)}}} ::
3451 #+vindex: org-treat-S-cursor-todo-selection-as-state-change
3453 Select the following/preceding TODO state, similar to cycling.
3454 Useful mostly if more than two TODO states are possible
3455 (see [[TODO extensions]]). See also [[Conflicts]], for a discussion of the
3456 interaction with ~shift-selection-mode~. See also the variable
3457 ~org-treat-S-cursor-todo-selection-as-state-change~.
3459 - {{{kbd(C-c / t)}}}, ~org-show-todo-tree~ ::
3462 #+cindex: sparse tree, for TODO
3463 #+vindex: org-todo-keywords
3465 View TODO items in a /sparse tree/ (see [[Sparse trees]]). Folds the entire
3466 buffer, but shows all TODO items (with not-DONE state) and the
3467 headings hierarchy above them. With a prefix argument (or by using
3468 {{{kbd(C-c / T)}}}), search for a specific TODO. You will be
3469 prompted for the keyword, and you can also give a list of keywords
3470 like ~KWD1|KWD2|...~ to list entries that match any one of these
3471 keywords. With a numeric prefix argument N, show the tree for the
3472 Nth keyword in the variable ~org-todo-keywords~. With two prefix
3473 arguments, find all TODO states, both un-done and done.
3475 - {{{kbd(C-c a t)}}}, ~org-todo-list~ ::
3478 Show the global TODO list. Collects the TODO items (with not-DONE states)
3479 from all agenda files (see [[Agenda views]]) into a single buffer. The new
3480 buffer will be in ~agenda-mode~, which provides commands to examine and
3481 manipulate the TODO entries from the new buffer (see [[Agenda commands]]).
3482 See [[Global TODO list]], for more information.
3484 - {{{kbdkey(S-M-,RET)}}}, ~org-insert-todo-heading~ ::
3485 #+kindex: S-M-@key{RET}
3487 Insert a new TODO entry below the current one.
3491 #+vindex: org-todo-state-tags-triggers
3492 Changing a TODO state can also trigger tag changes. See the docstring of the
3493 option ~org-todo-state-tags-triggers~ for details.
3497 :DESCRIPTION: Work flow and assignments
3498 :TITLE: Extended use of TODO keywords
3501 #+cindex: extended TODO keywords
3503 #+vindex: org-todo-keywords
3505 By default, marked TODO entries have one of only two states: TODO and
3506 DONE. Org mode allows you to classify TODO items in more complex ways
3507 with /TODO keywords/ (stored in ~org-todo-keywords~). With special
3508 setup, the TODO keyword system can work differently in different
3511 Note that /tags/ are another way to classify headlines in general and
3512 TODO items in particular (see [[Tags]]).
3516 :DESCRIPTION: From TODO to DONE in steps
3517 :TITLE: TODO keywords as workflow states
3519 #+cindex: TODO workflow
3520 #+cindex: workflow states as TODO keywords
3522 You can use TODO keywords to indicate different /sequential/ states
3523 in the process of working on an item, for example:[fn:41]
3525 #+header: :exports code
3527 #+begin_src emacs-lisp
3528 (setq org-todo-keywords
3529 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3532 The vertical bar separates the TODO keywords (states that /need
3533 action/) from the DONE states (which need /no further action/). If
3534 you don't provide the separator bar, the last state is used as the DONE
3537 #+cindex: completion, of TODO keywords
3539 With this setup, the command {{{kbd(C-c C-t)}}} will cycle an entry
3540 from TODO to FEEDBACK, then to VERIFY, and finally to DONE and
3541 DELEGATED. You may also use a numeric prefix argument to quickly
3542 select a specific state. For example {{{kbd(C-3 C-c C-t)}}} will
3543 change the state immediately to VERIFY. Or you can use
3544 {{{kbdkey(S-,left)}}} to go backward through the sequence. If you
3545 define many keywords, you can use in-buffer completion (see [[Completion]]) or
3546 even a special one-key selection scheme (see [[Fast access to TODO states]])
3547 to insert these words into the buffer. Changing a TODO state can be
3548 logged with a timestamp, see [[Tracking TODO state changes]], for
3553 :DESCRIPTION: I do this, Fred does the rest
3554 :TITLE: TODO keywords as types
3556 #+cindex: TODO types
3557 #+cindex: names as TODO keywords
3558 #+cindex: types as TODO keywords
3560 The second possibility is to use TODO keywords to indicate different
3561 /types/ of action items. For example, you might want to indicate
3562 that items are for ``work'' or ``home''. Or, when you work with several
3563 people on a single project, you might want to assign action items
3564 directly to persons, by using their names as TODO keywords. This would
3565 be set up like this:
3567 #+header: :exports code
3569 #+begin_src emacs-lisp
3570 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3573 In this case, different keywords do not indicate a sequence, but rather
3574 different types. So the normal work flow would be to assign a task to a
3575 person, and later to mark it DONE. Org mode supports this style by adapting
3576 the workings of the command {{{kbd(C-c C-t)}}}.[fn:42] When used several
3577 times in succession, it will still cycle through all names, in order to first
3578 select the right type for a task. But when you return to the item after some
3579 time and execute {{{kbd(C-c C-t)}}} again, it will switch from any name directly
3580 to DONE. Use prefix arguments or completion to quickly select a specific
3581 name. You can also review the items of a specific TODO type in a sparse tree
3582 by using a numeric prefix to {{{kbd(C-c / t)}}}. For example, to see all things
3583 Lucy has to do, you would use {{{kbd(C-3 C-c / t)}}}. To collect Lucy's items
3584 from all agenda files into a single buffer, you would use the numeric prefix
3585 argument as well when creating the global TODO list: {{{kbd(C-3 C-c a t)}}}.
3587 *** Multiple sets in one file
3589 :DESCRIPTION: Mixing it all, and still finding your way
3590 :TITLE: Multiple keyword sets in one file
3592 #+cindex: TODO keyword sets
3594 Sometimes you may want to use different sets of TODO keywords in
3595 parallel. For example, you may want to have the basic
3596 ~TODO~ / ~DONE~, but also a workflow for bug fixing, and a
3597 separate state indicating that an item has been canceled (so it is not
3598 DONE, but also does not require action). Your setup would then look
3601 #+header: :exports code
3603 #+begin_src emacs-lisp
3604 (setq org-todo-keywords
3605 '((sequence "TODO" "|" "DONE")
3606 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3607 (sequence "|" "CANCELED")))
3610 The keywords should all be different, this helps Org mode to keep track
3611 of which subsequence should be used for a given entry. In this setup,
3612 {{{kbd(C-c C-t)}}} only operates within a subsequence, so it switches from
3613 ~DONE~ to (nothing) to ~TODO~, and from ~FIXED~ to
3614 (nothing) to ~REPORT~. Therefore you need a mechanism to initially
3615 select the correct sequence. Besides the obvious ways like typing a
3616 keyword or using completion, you may also apply the following commands:
3618 #+kindex: C-S-@key{right}
3619 #+kindex: C-S-@key{left}
3620 #+kindex: C-u C-u C-c C-t
3621 #+attr_texinfo: :table-type table :indic @asis
3622 - {{{kbd(C-u C-u C-c C-t)}}} {{{kbdkey(C-S-,right)}}} {{{kbdkey(C-S-,left)}}} ::
3624 These keys jump from one TODO subset to the next. In the above
3625 example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbdkey(C-S-,right)}}}
3626 would jump from ~TODO~ or ~DONE~ to ~REPORT~, and any of the
3627 words in the second row to ~CANCELED~. Note that the
3628 {{{kbd(C-S-)}}} key binding conflict with ~shift-selection-mode~
3629 (see [[Conflicts]]).
3631 - {{{kbdkey(S-,right)}}} {{{kbdkey(S-,left)}}} ::
3632 #+kindex: S-@key{right}
3633 #+kindex: S-@key{left}
3635 {{{kbdkey(S-,left)}}} and {{{kbdkey(S-,right)}}} walk through /all/
3636 keywords from all sets, so for example {{{kbdkey(S-,right)}}} would switch
3637 from ~DONE~ to ~REPORT~ in the example above. See also
3638 [[Conflicts]], for a discussion of the interaction with
3639 ~shift-selection-mode~.
3641 *** Fast access to TODO states
3643 :DESCRIPTION: Single letter selection of state
3645 If you would like to quickly change an entry to an arbitrary TODO state
3646 instead of cycling through the states, you can set up keys for single-letter
3647 access to the states. This is done by adding the selection character after
3648 each keyword, in parentheses.[fn:43] For example:
3650 #+header: :exports code
3652 #+begin_src emacs-lisp
3653 (setq org-todo-keywords
3654 '((sequence "TODO(t)" "|" "DONE(d)")
3655 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3656 (sequence "|" "CANCELED(c)")))
3659 #+vindex: org-fast-tag-selection-include-todo
3661 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
3662 the entry will be switched to this state. {{{kbd(SPC)}}} can be used
3663 to remove any TODO keyword from an entry.[fn:44]
3665 *** Per-file keywords
3667 :DESCRIPTION: Different files, different requirements
3668 :TITLE: Setting up keywords for individual files
3670 #+cindex: keyword options
3671 #+cindex: per-file keywords
3673 #+cindex: #+TYP_TODO
3674 #+cindex: #+SEQ_TODO
3676 It can be very useful to use different aspects of the TODO mechanism in
3677 different files. For file-local settings, you need to add special lines
3678 to the file which set the keywords and interpretation for that file
3679 only. For example, to set one of the two examples discussed above, you
3680 need one of the following lines, starting in column zero anywhere in the
3684 ,#+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3687 {{{noindent}}} (you may also write ~#+SEQ_TODO~ to be explicit about the
3688 interpretation, but it means the same as ~#+TODO~), or
3691 ,#+TYP_TODO: Fred Sara Lucy Mike | DONE
3694 A setup for using several sets in parallel would be:
3697 ,#+TODO: TODO | DONE
3698 ,#+TODO: REPORT BUG KNOWNCAUSE | FIXED
3702 #+cindex: completion, of option keywords
3703 #+kindex: M-@key{TAB}
3704 {{{noindent}}} To make sure you are using the correct keyword, type
3705 {{{samp(#+)}}} into the buffer and then use {{{kbdkey(M-,TAB)}}} completion.
3707 #+cindex: DONE, final TODO keyword
3708 Remember that the keywords after the vertical bar (or the last keyword
3709 if no bar is there) must always mean that the item is DONE (although you
3710 may use a different word). After changing one of these lines, use
3711 {{{kbd(C-c C-c)}}} with the cursor still in the line to make the changes
3712 known to Org mode.[fn:45]
3714 *** Faces for TODO keywords
3716 :DESCRIPTION: Highlighting states
3718 #+cindex: faces, for TODO keywords
3719 #+vindex: org-todo @r{(face)}
3720 #+vindex: org-done @r{(face)}
3721 #+vindex: org-todo-keyword-faces
3723 Org mode highlights TODO keywords with special faces: ~org-todo~
3724 for keywords indicating that an item still has to be acted upon, and
3725 ~org-done~ for keywords indicating that an item is finished. If
3726 you are using more than 2 different states, you might want to use
3727 special faces for some of them. This can be done using the variable
3728 ~org-todo-keyword-faces~. For example:
3730 #+header: :exports code
3732 #+begin_src emacs-lisp
3733 (setq org-todo-keyword-faces
3734 '(("TODO" . org-warning) ("STARTED" . "yellow")
3735 ("CANCELED" . (:foreground "blue" :weight bold))))
3738 While using a list with face properties as shown for CANCELED /should/
3739 work, this does not always seem to be the case. If necessary, define a
3740 special face and use that. A string is interpreted as a color. The variable
3741 ~org-faces-easy-properties~ determines if that color is interpreted as a
3742 foreground or a background color.
3744 *** TODO dependencies
3746 :DESCRIPTION: When one task needs to wait for others
3748 #+cindex: TODO dependencies
3749 #+cindex: dependencies, of TODO states
3750 #+vindex: org-enforce-todo-dependencies
3751 #+cindex: property, ORDERED
3753 The structure of Org files (hierarchy and lists) makes it easy to define TODO
3754 dependencies. Usually, a parent TODO task should not be marked DONE until
3755 all subtasks (defined as children tasks) are marked as DONE. And sometimes
3756 there is a logical sequence to a number of (sub)tasks, so that one task
3757 cannot be acted upon before all siblings above it are done. If you customize
3758 the variable ~org-enforce-todo-dependencies~, Org will block entries
3759 from changing state to DONE while they have children that are not DONE.
3760 Furthermore, if an entry has a property ~ORDERED~, each of its children
3761 will be blocked until all earlier siblings are marked DONE. Here is an
3765 ,* TODO Blocked until (two) is done
3774 ,** TODO b, needs to wait for (a)
3775 ,** TODO c, needs to wait for (a) and (b)
3778 #+attr_texinfo: :table-type table :indic @asis
3779 - {{{kbd(C-c C-x o)}}}, ~org-toggle-ordered-property~ ::
3781 #+vindex: org-track-ordered-property-with-tag
3782 #+cindex: property, ORDERED
3784 Toggle the ~ORDERED~ property of the current entry. A property is used
3785 for this behavior because this should be local to the current entry, not
3786 inherited like a tag. However, if you would like to /track/ the value of
3787 this property with a tag for better visibility, customize the variable
3788 ~org-track-ordered-property-with-tag~.
3789 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
3790 #+kindex: C-u C-u C-u C-c C-t
3792 Change TODO state, circumventing any state blocking.
3795 #+vindex: org-agenda-dim-blocked-tasks
3797 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
3798 that cannot be closed because of such dependencies will be shown in a dimmed
3799 font or even made invisible in agenda views (see [[Agenda views]]).
3801 #+cindex: checkboxes and TODO dependencies
3802 #+vindex: org-enforce-todo-dependencies
3804 You can also block changes of TODO states by looking at checkboxes
3805 (see [[Checkboxes]]). If you set the variable
3806 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
3807 checkboxes will be blocked from switching to DONE.
3809 If you need more complex dependency structures, for example dependencies
3810 between entries in different trees or files, check out the contributed
3811 module {{{file(org-depend.el)}}}.
3817 :DESCRIPTION: Dates and notes for progress
3819 #+cindex: progress logging
3820 #+cindex: logging, of progress
3822 Org mode can automatically record a timestamp and possibly a note when
3823 you mark a TODO item as DONE, or even each time you change the state of
3824 a TODO item. This system is highly configurable, settings can be on a
3825 per-keyword basis and can be localized to a file or even a subtree. For
3826 information on how to clock working time for a task, see [[Clocking work time]].
3830 :DESCRIPTION: When was this entry marked DONE?
3833 The most basic logging is to keep track of /when/ a certain TODO
3834 item was finished. This is achieved with:[fn:46]
3836 #+header: :exports code
3838 #+begin_src emacs-lisp
3839 (setq org-log-done 'time)
3842 {{{noindent}}} Then each time you turn an entry from a TODO (not-done)
3843 state into any of the DONE states, a line {{{samp(CLOSED: [timestamp])}}} will be inserted just after the headline. If you turn
3844 the entry back into a TODO item through further state cycling, that
3845 line will be removed again. If you want to record a note along with
3846 the timestamp, use:[fn:47]
3848 #+header: :exports code
3850 #+begin_src emacs-lisp
3851 (setq org-log-done 'note)
3854 {{{noindent}}} You will then be prompted for a note, and that note
3855 will be stored below the entry with a {{{samp(Closing Note)}}}
3858 In the timeline (see [[Timeline for a single file]]) and in the agenda
3859 (see [[Weekly/daily agenda]]), you can then use the {{{kbd(l)}}} key to
3860 display the TODO items with a {{{samp(CLOSED)}}} timestamp on each
3861 day, giving you an overview of what has been done.
3863 *** Tracking TODO state changes
3865 :DESCRIPTION: When did the status change?
3867 #+cindex: drawer, for state change recording
3868 #+vindex: org-log-states-order-reversed
3869 #+vindex: org-log-into-drawer
3870 #+cindex: property, LOG_INTO_DRAWER
3872 When TODO keywords are used as workflow states (see [[Workflow
3873 states]]), you might want to keep track of when a state change occurred
3874 and maybe take a note about this change. You can either record just a
3875 timestamp, or a time-stamped note for a change. These records will be
3876 inserted after the headline as an itemized list, newest first.[fn:48]
3877 When taking a lot of notes, you might want to get the notes out of the
3878 way into a drawer (see [[Drawers]]). Customize the variable
3879 ~org-log-into-drawer~ to get this behavior---the recommended drawer
3880 for this is called ~LOGBOOK~.[fn:178] You can also overrule the setting
3881 of this variable for a subtree by setting a ~LOG_INTO_DRAWER~
3884 Since it is normally too much to record a note for every state, Org
3885 mode expects configuration on a per-keyword basis for this. This is
3886 achieved by adding special markers {{{samp(!)}}} (for a timestamp) or
3887 {{{samp(@)}}} (for a note with timestamp) in parentheses after each
3888 keyword. For example, with the setting:
3890 #+header: :exports code
3892 #+begin_src emacs-lisp
3893 (setq org-todo-keywords
3894 '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
3898 #+vindex: org-log-done
3900 you not only define global TODO keywords and fast access keys, but
3901 also request that a time is recorded when the entry is set to
3902 DONE, and that a note is recorded when switching to WAIT or
3903 CANCELED.[fn:49] The setting for WAIT is even more special: the {{{samp(!)}}}
3904 after the slash means that in addition to the note taken when entering
3905 the state, a timestamp should be recorded when /leaving/ the WAIT
3906 state, if and only if the /target/ state does not configure logging
3907 for entering it. So it has no effect when switching from WAIT to DONE,
3908 because DONE is configured to record a timestamp only. But when
3909 switching from WAIT back to TODO, the {{{samp(/!)}}} in the WAIT
3910 setting now triggers a timestamp even though TODO has no logging
3913 To record a timestamp without a note for TODO keywords configured with
3914 {{{samp(@)}}}, just type {{{kbd(C-c C-c)}}} to enter a blank note
3917 You can use the exact same syntax for setting logging preferences local
3921 ,#+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
3924 #+cindex: property, LOGGING
3926 In order to define logging settings that are local to a subtree or a
3927 single item, define a LOGGING property in this entry. Any non-empty
3928 LOGGING property resets all logging settings to nil. You may then turn
3929 on logging for this specific tree using STARTUP keywords like
3930 ~lognotedone~ or ~logrepeat~, as well as adding state specific
3931 settings like ~TODO(!)~. For example:
3934 ,* TODO Log each state with only a time
3936 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3938 ,* TODO Only log when switching to WAIT, and when repeating
3940 :LOGGING: WAIT(@) logrepeat
3942 ,* TODO No logging at all
3948 *** Tracking your habits
3950 :DESCRIPTION: How consistent have you been?
3953 - State "DONE" from "DONE" [2013-01-07 Mon 14:10]
3954 - State "DONE" from "" [2013-01-07 Mon 14:10]
3958 Org has the ability to track the consistency of a special category of TODOs,
3959 called "habits." A habit has the following properties:
3961 1. You have enabled the ~habits~ module by customizing the variable
3964 2. The habit is a TODO item, with a TODO keyword representing an
3967 3. The property ~STYLE~ is set to the value ~habit~.
3969 4. The TODO has a scheduled date, usually with a ~.+~ style repeat
3970 interval. A ~++~ style may be appropriate for habits with time
3971 constraints, e.g., must be done on weekends, or a ~+~ style for
3972 an unusual habit that can have a backlog, e.g., weekly reports.
3974 5. The TODO may also have minimum and maximum ranges specified by
3975 using the syntax {{{samp(.+2d/3d)}}}, which says that you want to
3976 do the task at least every three days, but at most every two
3979 6. You must also have state logging for the ~DONE~ state enabled
3980 (see [[Tracking TODO state changes]]), in order for historical
3981 data to be represented in the consistency graph. If it is not
3982 enabled it is not an error, but the consistency graphs will be
3983 largely meaningless.
3986 To give you an idea of what the above rules look like in action, here's an
3987 actual habit with some history:
3991 SCHEDULED: <2009-10-17 Sat .+2d/4d>
3992 - State "DONE" from "TODO" [2009-10-15 Thu]
3993 - State "DONE" from "TODO" [2009-10-12 Mon]
3994 - State "DONE" from "TODO" [2009-10-10 Sat]
3995 - State "DONE" from "TODO" [2009-10-04 Sun]
3996 - State "DONE" from "TODO" [2009-10-02 Fri]
3997 - State "DONE" from "TODO" [2009-09-29 Tue]
3998 - State "DONE" from "TODO" [2009-09-25 Fri]
3999 - State "DONE" from "TODO" [2009-09-19 Sat]
4000 - State "DONE" from "TODO" [2009-09-16 Wed]
4001 - State "DONE" from "TODO" [2009-09-12 Sat]
4004 :LAST_REPEAT: [2009-10-19 Mon 00:36]
4008 What this habit says is: I want to shave at most every 2 days (given
4009 by the ~SCHEDULED~ date and repeat interval) and at least every 4
4010 days. If today is the 15th, then the habit first appears in the agenda
4011 on Oct 17, after the minimum of 2 days has elapsed, and will appear
4012 overdue on Oct 19, after four days have elapsed.
4014 What's really useful about habits is that they are displayed along
4015 with a consistency graph, to show how consistent you've been at
4016 getting that task done in the past. This graph shows every day that
4017 the task was done over the past three weeks, with colors for each day.
4018 The colors used are:
4020 #+attr_texinfo: :table-type table :indic @asis
4021 - ~Blue~ :: If the task wasn't to be done yet on that day.
4022 - ~Green~ :: If the task could have been done on that day.
4023 - ~Yellow~ :: If the task was going to be overdue the next day.
4024 - ~Red~ :: If the task was overdue on that day.
4027 In addition to coloring each day, the day is also marked with an
4028 asterisk if the task was actually done that day, and an exclamation
4029 mark to show where the current day falls in the graph.
4031 There are several configuration variables that can be used to change
4032 the way habits are displayed in the agenda.
4034 #+attr_texinfo: :table-type table :indic @asis
4035 - ~org-habit-graph-column~ :: The buffer column at which the
4036 consistency graph should be drawn. This will overwrite any text
4037 in that column, so it is a good idea to keep your habits'
4038 titles brief and to the point.
4040 - ~org-habit-preceding-days~ :: The amount of history, in days before
4041 today, to appear in consistency graphs.
4043 - ~org-habit-following-days~ :: The number of days after today that
4044 will appear in consistency graphs.
4046 - ~org-habit-show-habits-only-for-today~ :: If non-nil, only show
4047 habits in today's agenda view. This is set to true by default.
4050 Lastly, pressing {{{kbd(K)}}} in the agenda buffer will cause habits
4051 to temporarily be disabled and they won't appear at all. Press
4052 {{{kbd(K)}}} again to bring them back. They are also subject to tag
4053 filtering, if you have habits which should only be done in certain
4054 contexts, for example.
4058 :DESCRIPTION: Some things are more important than others
4060 #+cindex: priorities
4062 If you use Org mode extensively, you may end up with enough TODO items that
4063 it starts to make sense to prioritize them. Prioritizing can be done by
4064 placing a /priority cookie/ into the headline of a TODO item, like this:
4067 ,*** TODO [#A] Write letter to Sam Fortune
4070 #+vindex: org-priority-faces
4072 {{{noindent}}} By default, Org mode supports three priorities: {{{samp(A)}}},
4073 {{{samp(B)}}}, and {{{samp(C)}}}. {{{samp(A)}}} is the highest
4074 priority. An entry without a cookie is treated just like priority
4075 {{{samp(B)}}}. Priorities make a difference only for sorting in the
4076 agenda (see [[Weekly/daily agenda]]); outside the agenda, they have no
4077 inherent meaning to Org mode. The cookies can be highlighted with
4078 special faces by customizing the variable ~org-priority-faces~.
4080 Priorities can be attached to any outline node; they do not need to be TODO
4083 #+attr_texinfo: :table-type table :indic @asis
4084 - {{{kbd(C-c XXX)}}} ::
4086 # #+kindex: @key{C-c ,}
4087 # Preceding line won't export to pdf
4088 #+findex: org-priority
4090 Set the priority of the current headline (~org-priority~). The
4091 command prompts for a priority character {{{samp(A)}}}, {{{samp(B)}}}
4092 or {{{samp(C)}}}. When you press {{{key(SPC)}}}} instead, the priority
4093 cookie is removed from the headline. The priorities can also be
4094 changed ``remotely'' from the timeline and agenda buffer with the
4095 {{{kbd(\,)}}} command (see [[Agenda commands]]).
4097 - {{{kbdkey(S-,up)}}}, {{{kbdkey(S-,down)}}}, {{{command(org-priority-up)}}}, {{{command(org-priority-down)}}} ::
4098 #+vindex: org-priority-start-cycle-with-default
4100 Increase/decrease priority of current headline.[fn:50] Note
4101 that these keys are also used to modify timestamps
4102 (see [[Creating timestamps]]). See also [[Conflicts]], for a
4103 discussion of the interaction with ~shift-selection-mode~.
4106 #+vindex: org-highest-priority
4107 #+vindex: org-lowest-priority
4108 #+vindex: org-default-priority
4110 You can change the range of allowed priorities by setting the
4111 variables ~org-highest-priority~, ~org-lowest-priority~, and
4112 ~org-default-priority~. For an individual buffer, you may set these
4113 values (highest, lowest, default) like this (please make sure that the
4114 highest priority is earlier in the alphabet than the lowest priority):
4116 #+cindex: #+PRIORITIES
4119 ,#+PRIORITIES: A C B
4122 ** Breaking down tasks
4124 :DESCRIPTION: Splitting a task into manageable pieces
4126 #+cindex: tasks, breaking down
4127 #+cindex: statistics, for TODO items
4128 #+vindex: org-agenda-todo-list-sublevels
4130 It is often advisable to break down large tasks into smaller,
4131 manageable subtasks. You can do this by creating an outline tree below
4132 a TODO item, with detailed subtasks on the tree.[fn:51] To keep the
4133 overview over the fraction of subtasks that are already completed,
4134 insert either {{{samp([/])}}} or {{{samp([%])}}} anywhere in the
4135 headline. These cookies will be updated each time the TODO status of a
4136 child changes, or when pressing {{{kbd(C-c C-c)}}} on the cookie. For
4140 ,* Organize Party [33%]
4141 ,** TODO Call people [1/2]
4145 ,** DONE Talk to neighbor
4148 #+cindex: property, COOKIE_DATA
4150 If a heading has both checkboxes and TODO children below it, the
4151 meaning of the statistics cookie become ambiguous. Set the property
4152 ~COOKIE_DATA~ to either {{{samp(checkbox)}}} or {{{samp(todo)}}} to
4155 #+vindex: org-hierarchical-todo-statistics
4157 If you would like to have the statistics cookie count any TODO entries
4158 in the subtree (not just direct children), configure the variable
4159 ~org-hierarchical-todo-statistics~. To do this for a single subtree,
4160 include the word {{{samp(recursive)}}} into the value of the
4161 ~COOKIE_DATA~ property.
4164 ,* Parent capturing statistics [2/20]
4166 :COOKIE_DATA: todo recursive
4170 If you would like a TODO entry to automatically change to DONE
4171 when all children are done, you can use the following setup:
4173 #+header: :exports code
4175 #+begin_src emacs-lisp
4176 (defun org-summary-todo (n-done n-not-done)
4177 "Switch entry to DONE when all subentries are done, to TODO otherwise."
4178 (let (org-log-done org-log-states) ; turn off logging
4179 (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
4181 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
4184 Another possibility is the use of checkboxes to identify (a hierarchy
4185 of) a large number of subtasks (see [[Checkboxes]]).
4189 :DESCRIPTION: Tick-off lists
4192 #+cindex: checkboxes
4193 #+vindex: org-list-automatic-rules
4195 Every item in a plain list (see [[Plain lists]]) can be made into a
4196 checkbox by starting it with the string {{{samp([ ])}}}.[fn:52] This
4197 feature is similar to TODO items (see [[TODO items]]), but is more
4198 lightweight. Checkboxes are not included into the global TODO list, so
4199 they are often great to split a task into a number of simple steps. Or
4200 you can use them in a shopping list. To toggle a checkbox, use
4201 {{{kbd(C-c C-c)}}}, or use the mouse (thanks to Piotr Zielinski's
4202 {{{file(org-mouse.el)}}}).
4204 Here is an example of a checkbox list.
4207 ,* TODO Organize party [2/4]
4208 - [-] call people [1/3]
4213 - [ ] think about what music to play
4214 - [X] talk to the neighbors
4217 Checkboxes work hierarchically, so if a checkbox item has children
4218 that are checkboxes, toggling one of the children checkboxes will make
4219 the parent checkbox reflect if none, some, or all of the children are
4222 #+cindex: statistics, for checkboxes
4223 #+cindex: checkbox statistics
4224 #+cindex: property, COOKIE_DATA
4225 #+vindex: org-hierarchical-checkbox-statistics
4227 The {{{samp([2/4])}}} and {{{samp([1/3])}}} in the first and second
4228 line are cookies indicating how many checkboxes present in this entry
4229 have been checked off, and the total number of checkboxes present.
4230 This can give you an idea on how many checkboxes remain, even without
4231 opening a folded entry. The cookies can be placed into a headline or
4232 into (the first line of) a plain list item. Each cookie covers
4233 checkboxes of direct children structurally below the headline/item on
4234 which the cookie appears.[fn:53] You have to insert the cookie
4235 yourself by typing either {{{samp([/])}}} or {{{samp([%])}}}. With
4236 {{{samp([/])}}} you get an {{{samp(n out of m)}}} result, as in the
4237 examples above. With {{{samp([%])}}} you get information about the
4238 percentage of checkboxes checked (in the above example, this would be
4239 {{{samp([50%])}}} and {{{samp([33%])}}}, respectively). In a headline,
4240 a cookie can count either checkboxes below the heading or TODO states
4241 of children, and it will display whatever was changed last. Set the
4242 property ~COOKIE_DATA~ to either {{{samp(checkbox)}}} or
4243 {{{samp(todo)}}} to resolve this issue.
4245 #+cindex: blocking, of checkboxes
4246 #+cindex: checkbox blocking
4247 #+cindex: property, ORDERED
4249 If the current outline node has an ~ORDERED~ property, checkboxes must
4250 be checked off in sequence, and an error will be thrown if you try to
4251 check off a box while there are unchecked boxes above it.
4253 {{{noindent}}} The following commands work with checkboxes:
4255 #+attr_texinfo: :table-type table :indic @asis
4256 - {{{kbd(C-c C-c)}}}, ~org-toggle-checkbox~ :: Toggle checkbox status
4257 or (with prefix arg) checkbox presence at point. With a single
4258 prefix argument, add an empty checkbox or remove the current
4259 one.[fn:54] With a double prefix argument, set it to
4260 {{{samp([-])}}}, which is considered to be an intermediate state.
4262 - {{{kbd(C-c C-x C-b)}}}, ~org-toggle-checkbox~ :: Toggle checkbox
4263 status or (with prefix arg) checkbox presence at point. With
4264 double prefix argument, set it to {{{samp([-])}}}, which is
4265 considered to be an intermediate state.
4267 - If there is an active region, toggle the first checkbox in the region
4268 and set all remaining boxes to the same status as the first. With a prefix
4269 arg, add or remove the checkbox for all items in the region.
4271 - If the cursor is in a headline, toggle checkboxes in the region
4272 between this headline and the next (so /not/ the entire subtree).
4274 - If there is no active region, just toggle the checkbox at point.
4277 - {{{kbdkey(M-S-,RET)}}}, ~org-insert-todo-heading~ :: Insert a new
4278 item with a checkbox. This works only if the cursor is already in
4279 a plain list item (see [[Plain lists]]).
4281 - {{{kbd(C-c C-x o)}}}, ~org-toggle-ordered-property~ ::
4283 #+vindex: org-track-ordered-property-with-tag
4284 #+cindex: property, ORDERED
4286 Toggle the ~ORDERED~ property of the entry, to toggle if checkboxes
4287 must be checked off in sequence. A property is used for this
4288 behavior because this should be local to the current entry, not
4289 inherited like a tag. However, if you would like to /track/ the
4290 value of this property with a tag for better visibility,
4291 customize the variable ~org-track-ordered-property-with-tag~.
4293 - {{{kbd(C-c #)}}}, ~org-update-statistics-cookies~ ::
4296 Update the statistics cookie in the current outline entry. When
4297 called with a {{{kbd(C-u)}}} prefix, update the entire file.
4298 Checkbox statistic cookies are updated automatically if you
4299 toggle checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
4300 {{{kbdkey(M-S-,RET)}}}. TODO statistics cookies update when
4301 changing TODO states. If you delete boxes/entries or add/change
4302 them by hand, use this command to get things back into sync.
4306 :DESCRIPTION: Tagging headlines and matching sets of tags
4309 #+cindex: headline tagging
4310 #+cindex: matching, tags
4311 #+cindex: sparse tree, tag based
4313 An excellent way to implement labels and contexts for
4314 cross-correlating information is to assign /tags/ to headlines. Org
4315 mode has extensive support for tags.
4317 #+vindex: org-tag-faces
4319 Every headline can contain a list of tags; they occur at the end of
4320 the headline. Tags are normal words containing letters, numbers,
4321 {{{samp(_)}}}, and {{{samp(@)}}}. Tags must be preceded and followed
4322 by a single colon, e.g., {{{samp(:work:)}}}. Several tags can be
4323 specified, as in {{{samp(:work:urgent:)}}}. Tags will by default be in
4324 bold face with the same color as the headline. You may specify special
4325 faces for specific tags using the variable ~org-tag-faces~, in much
4326 the same way as you can for TODO keywords (see [[Faces for TODO keywords]]).
4330 :DESCRIPTION: Tags use the tree structure of an outline
4332 #+cindex: tag inheritance
4333 #+cindex: inheritance, of tags
4334 #+cindex: sublevels, inclusion into tags match
4336 /Tags/ make use of the hierarchical structure of outline trees. If a
4337 heading has a certain tag, all subheadings will inherit the tag as
4338 well. For example, in the list
4341 ,* Meeting with the French group :work:
4342 ,** Summary by Frank :boss:notes:
4343 ,*** TODO Prepare slides for him :action:
4346 {{{noindent}}} the final heading will have the tags
4347 {{{samp(:work:)}}}, {{{samp(:boss:)}}}, {{{samp(:notes:)}}}, and
4348 {{{samp(:action:)}}} even though the final heading is not explicitly
4349 marked with those tags. You can also set tags that all entries in a
4350 file should inherit just as if these tags were defined in a
4351 hypothetical level zero that surrounds the entire file. Use a line
4354 #+cindex: #+FILETAGS
4356 ,#+FILETAGS: :Peter:Boss:Secret:
4359 #+vindex: org-use-tag-inheritance
4360 #+vindex: org-tags-exclude-from-inheritance
4362 {{{noindent}}} To limit tag inheritance to specific tags, or to turn
4363 it off entirely, use the variables ~org-use-tag-inheritance~ and
4364 ~org-tags-exclude-from-inheritance~.
4366 #+vindex: org-tags-match-list-sublevels
4368 When a headline matches during a tags search while tag inheritance is
4369 turned on, all the sublevels in the same tree will (for a simple match
4370 form) match as well.[fn:56] The list of matches may then become very
4371 long. If you only want to see the first tags match in a subtree,
4372 configure the variable ~org-tags-match-list-sublevels~ (not
4377 :DESCRIPTION: How to assign tags to a headline
4379 #+cindex: setting tags
4380 #+cindex: tags, setting
4381 #+kindex: M-@key{TAB}
4383 Tags can simply be typed into the buffer at the end of a headline.
4384 After a colon, {{{kbdkey(M-,TAB)}}} offers completion on tags. There is
4385 also a special command for inserting tags:
4387 #+attr_texinfo: :table-type table :indic @asis
4388 - {{{kbd(C-c C-q)}}}, ~org-set-tags-command~ ::
4391 #+cindex: completion, of tags
4392 #+vindex: org-tags-column
4394 Enter new tags for the current headline. Org mode will either offer
4395 completion or a special single-key interface for setting tags, see
4396 below. After pressing {{{key(RET)}}}, the tags will be inserted and aligned
4397 to ~org-tags-column~. When called with a {{{kbd(C-u)}}} prefix, all
4398 tags in the current buffer will be aligned to that column, just to make
4399 things look nice. TAGS are automatically realigned after promotion,
4400 demotion, and TODO state changes (see [[TODO basics]]).
4402 - {{{kbd(C-c C-c)}}}, ~org-set-tags-command~ ::
4405 When the cursor is in a headline, this does the same as {{{kbd(C-c C-q)}}}.
4408 #+vindex: org-tag-alist
4410 Org supports tag insertion based on a /list of tags/. By default this
4411 list is constructed dynamically, containing all tags currently used in
4412 the buffer. You may also globally specify a hard list of tags with the
4413 variable ~org-tag-alist~. Finally you can set the default tags for a
4414 given file with lines like
4418 ,#+TAGS: @work @home @tennisclub
4419 ,#+TAGS: laptop car pc sailboat
4422 If you have globally defined your preferred set of tags using the
4423 variable ~org-tag-alist~, but would like to use a dynamic tag list
4424 in a specific file, add an empty TAGS option line to that file:
4430 #+vindex: org-tag-persistent-alist
4432 If you have a preferred set of tags that you would like to use in
4433 every file, in addition to those defined on a per-file basis by TAGS
4434 option lines, then you may specify a list of tags with the variable
4435 ~org-tag-persistent-alist~. You may turn this off on a per-file basis
4436 by adding a STARTUP option line to that file:
4442 By default Org mode uses the standard minibuffer completion facilities
4443 for entering tags. However, it also implements another, quicker, tag
4444 selection method called /fast tag selection/. This allows you to
4445 select and deselect tags with just a single key press. For this to
4446 work well you should assign unique letters to most of your commonly
4447 used tags. You can do this globally by configuring the variable
4448 ~org-tag-alist~ in your {{{file(.emacs)}}} file. For example, you may
4449 find the need to tag many items in different files with
4450 {{{samp(:@home:)}}}. In this case you can set something like:
4453 #+header: :exports code
4454 #+begin_src emacs-lisp
4455 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
4458 {{{noindent}}} If the tag is only relevant to the file you are working
4459 on, then you can instead set the TAGS option line as:
4462 ,#+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p)
4465 {{{noindent}}} The tags interface will show the available tags in a splash
4466 window. If you want to start a new line after a specific tag, insert
4467 ~\n~ into the tag list, like this:
4470 ,#+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)
4473 {{{noindent}}} or write them in two lines:
4476 ,#+TAGS: @work(w) @home(h) @tennisclub(t)
4477 ,#+TAGS: laptop(l) pc(p)
4481 You can also group together tags that are mutually exclusive by using
4485 ,#+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p)
4488 {{{noindent}}} you indicate that at most one of {{{samp(@work)}}},
4489 {{{samp(@home)}}}, and {{{samp(@tennisclub)}}} should be selected.
4490 Multiple such groups are allowed.
4492 {{{noindent}}} Don't forget to press {{{kbd(C-c C-c)}}} with the
4493 cursor in one of these lines to activate any changes.
4495 {{{noindent}}} To set these mutually exclusive groups in the variable
4496 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
4497 ~:endgroup~ instead of the braces. Similarly, you can use ~:newline~
4498 to indicate a line break. The previous example would be set globally
4499 by the following configuration:
4502 #+header: :exports code
4503 #+begin_src emacs-lisp
4504 (setq org-tag-alist '((:startgroup . nil)
4505 ("@@work" . ?w) ("@@home" . ?h)
4506 ("@@tennisclub" . ?t)
4508 ("laptop" . ?l) ("pc" . ?p)))
4511 If at least one tag has a selection key then pressing {{{kbd(C-c C-c)}}} will
4512 automatically present you with a special interface, listing inherited tags,
4513 the tags of the current headline, and a list of all valid tags with
4514 corresponding keys.[fn:57] In this interface, you can use the following
4517 #+attr_texinfo: :table-type table :indic @asis
4518 - {{{kbd(a-z...)}}} ::
4521 Pressing keys assigned to tags will add or remove them from the list of
4522 tags in the current line. Selecting a tag in a group of mutually
4523 exclusive tags will turn off any other tags from that group.
4528 Enter a tag in the minibuffer, even if the tag is not in the predefined
4529 list. You will be able to complete on all tags present in the buffer.
4530 You can also add several tags: just separate them with a comma.
4535 Clear all tags for this line.
4540 Accept the modified set.
4544 Abort without installing changes.
4548 If {{{kbd(q)}}} is not assigned to a tag, it aborts like {{{kbd(C-g)}}}.
4552 Turn off groups of mutually exclusive tags. Use this to (as an
4553 exception) assign several tags from such a group.
4557 Toggle auto-exit after the next change (see below).
4558 If you are using expert mode, the first {{{kbd(C-c)}}} will display the
4562 {{{noindent}}} This method lets you assign tags to a headline with
4563 very few keys. With the above setup, you could clear the current tags
4564 and set {{{samp(@home)}}}, {{{samp(laptop)}}} and {{{samp(pc)}}} tags
4565 with just the following keys: {{{ksksksk(C-c C-c,SPC,h l p,RET)}}}. Switching from {{{samp(@home)}}} to
4566 {{{samp(@work)}}} would be done with {{{kbdspckey(C-c C-c w,RET)}}} or
4567 alternatively with {{{kbd(C-c C-c C-c w)}}}. Adding the non-predefined
4568 tag {{{samp(Sarah)}}} could be done with
4569 {{{ksksksksk(C-c C-c,TAB,S a r a h,RET,RET)}}}.
4571 #+vindex: org-fast-tag-selection-single-key
4573 If you find that most of the time you need only a single key press to
4574 modify your list of tags, set the variable
4575 ~org-fast-tag-selection-single-key~. Then you no longer have to press
4576 {{{key(RET)}}} to exit fast tag selection---it will immediately exit after
4577 the first change. If you then occasionally need more keys, press
4578 {{{kbd(C-c)}}} to turn off auto-exit for the current tag selection
4579 process (in effect: start selection with {{{kbd(C-c C-c C-c)}}}
4580 instead of {{{kbd(C-c C-c)}}}). If you set the variable to the value
4581 ~expert~, the special window is not even shown for single-key tag
4582 selection, it comes up only when you press an extra {{{kbd(C-c)}}}.
4586 :DESCRIPTION: Searching for combinations of tags
4588 #+cindex: tag searches
4589 #+cindex: searching for tags
4591 Once a system of tags has been set up, it can be used to collect related
4592 information into special lists.
4594 #+attr_texinfo: :table-type table :indic @asis
4595 - {{{kbd(C-c / m)}}}, ~C-c \~ ~org-match-sparse-tree~ ::
4597 Create a sparse tree with all headlines matching a tags search. With a
4598 {{{kbd(C-u)}}} prefix argument, ignore headlines that are not a TODO
4601 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
4604 Create a global list of tag matches from all agenda files.
4605 See [[Matching tags and properties]].
4607 - {{{kbd(C-c a M)}}}, ~org-tags-view~ ::
4609 #+vindex: org-tags-match-list-sublevels
4611 Create a global list of tag matches from all agenda files, but check
4612 only TODO items and force checking subitems (see variable
4613 ~org-tags-match-list-sublevels~).
4616 These commands all prompt for a match string which allows basic
4617 Boolean logic like {{{samp(+boss+urgent-project1)}}}, to find entries
4618 with tags {{{samp(boss)}}} and {{{samp(urgent)}}}, but not
4619 {{{samp(project1)}}}, or {{{samp(Kathy|Sally)}}} to find entries which
4620 are tagged, like {{{samp(Kathy)}}} or {{{samp(Sally)}}}. The full
4621 syntax of the search string is rich and allows also matching against
4622 TODO keywords, entry levels and properties. For a complete description
4623 with many examples, see [[Matching tags and properties]].
4625 * Properties and columns
4627 :DESCRIPTION: Storing information about an entry
4628 :ALT_TITLE: Properties and Columns
4630 #+cindex: properties
4632 A property is a key-value pair associated with an entry. Properties
4633 can be set so they are associated with a single entry, with every
4634 entry in a tree, or with every entry in an Org mode file.
4636 There are two main applications for properties in Org mode. First,
4637 properties are like tags, but with a value. Imagine maintaining a file
4638 where you document bugs and plan releases for a piece of software.
4639 Instead of using tags like ~:release_1:~, ~:release_2:~, you can use a
4640 property, say ~:Release:~, that in different subtrees has different
4641 values, such as ~1.0~ or ~2.0~. Second, you can use properties to
4642 implement (very basic) database capabilities in an Org buffer. Imagine
4643 keeping track of your music CDs, where properties could be things such
4644 as the album, artist, date of release, number of tracks, and so on.
4646 Properties can be conveniently edited and viewed in column view
4647 (see [[Column view]]).
4651 :DESCRIPTION: How properties are spelled out
4653 #+cindex: property syntax
4654 #+cindex: drawer, for properties
4656 Properties are key-value pairs. When they are associated with a single
4657 entry or with a tree they need to be inserted into a special drawer
4658 (see [[Drawers]]) with the name ~PROPERTIES~. Each property is specified
4659 on a single line, with the key (surrounded by colons) first, and the
4660 value after it. Here is an example:
4665 ,*** Goldberg Variations
4667 , :Title: Goldberg Variations
4668 , :Composer: J.S. Bach
4669 , :Artist: Glen Gould
4670 , :Publisher: Deutsche Grammophon
4675 Depending on the value of ~org-use-property-inheritance~, a property
4676 set this way will either be associated with a single entry, or the
4677 sub-tree defined by the entry, see [[Property inheritance]].
4679 You may define the allowed values for a particular property
4680 {{{samp(:Xyz:)}}} by setting a property {{{samp(:Xyz_ALL:)}}}. This
4681 special property is /inherited/, so if you set it in a level 1 entry,
4682 it will apply to the entire tree. When allowed values are defined,
4683 setting the corresponding property becomes easier and is less prone to
4684 typing errors. For the example with the CD collection, we can
4685 predefine publishers and the number of disks in a box like this:
4690 , :NDisks_ALL: 1 2 3 4
4691 , :Publisher_ALL: "Deutsche Grammophon" Philips EMI
4695 If you want to set properties that can be inherited by any entry in a
4696 file, use a line like:
4698 #+cindex: property, _ALL
4699 #+cindex: #+PROPERTY
4701 ,#+PROPERTY: NDisks_ALL 1 2 3 4
4704 If you want to add to the value of an existing property, append a ~+~
4705 to the property name. The following results in the property ~var~
4706 having the value ``foo=1 bar=2''.
4708 #+cindex: property, +
4710 ,#+PROPERTY: var foo=1
4711 ,#+PROPERTY: var+ bar=2
4714 It is also possible to add to the values of inherited properties. The
4715 following results in the ~genres~ property having the value ``Classic
4716 Baroque'' under the ~Goldberg Variations~ subtree.
4718 #+cindex: property, +
4725 ,*** Goldberg Variations
4727 , :Title: Goldberg Variations
4728 , :Composer: J.S. Bach
4729 , :Artist: Glen Gould
4730 , :Publisher: Deutsche Grammophon
4735 Note that a property can only have one entry per Drawer.
4737 #+vindex: org-global-properties
4739 Property values set with the global variable ~org-global-properties~
4740 can be inherited by all entries in all Org files.
4743 The following commands help to work with properties:
4745 #+attr_texinfo: :table-type table :indic @asis
4746 - {{{kbdkey(M-,TAB)}}}, ~pcomplete~ ::
4747 #+kindex: M-@key{TAB}
4749 After an initial colon in a line, complete property keys. All keys
4750 used in the current file will be offered as possible completions.
4752 - {{{kbd(C-c C-x p)}}}, ~org-set-property~ ::
4755 Set a property. This prompts for a property name and a value. If
4756 necessary, the property drawer is created as well.
4758 - C-u M-x org-insert-drawer RET ::
4759 #+cindex: org-insert-drawer
4761 Insert a property drawer into the current entry. The drawer will be
4762 inserted early in the entry, but after the lines with planning
4763 information like deadlines.
4765 - {{{kbd(C-c C-c)}}}, ~org-property-action~ ::
4768 With the cursor in a property drawer, this executes property commands.
4770 - {{{kbd(C-c C-c s)}}}, ~org-set-property~ ::
4773 Set a property in the current entry. Both the property and the value
4774 can be inserted using completion.
4776 - {{{kbdkey(S-,right)}}} {{{kbdkey(S-,left)}}}, ~org-property-next-allowed-value~ ~org-property-previous-allowed-value~ ::
4777 #+kindex: S-@key{right}
4779 Switch property at point to the next/previous allowed value.
4781 - {{{kbd(C-c C-c d)}}}, ~org-delete-property~ ::
4784 Remove a property from the current entry.
4786 - {{{kbd(C-c C-c D)}}}, ~org-delete-property-globally~ ::
4789 Globally remove a property, from all entries in the current file.
4791 - {{{kbd(C-c C-c c)}}}, ~org-compute-property-at-point~ ::
4794 Compute the property at point, using the operator and scope from the
4795 nearest column format definition.
4797 ** Special properties
4799 :DESCRIPTION: Access to other Org mode features
4801 #+cindex: properties, special
4803 Special properties provide an alternative access method to Org mode
4804 features, like the TODO state or the priority of an entry, discussed
4805 in the previous chapters. This interface exists so that you can
4806 include these states in a column view (see [[Column view]]), or to use
4807 them in queries. The following property names are special and (except
4808 for ~:CATEGORY:~) should not be used as keys in the properties drawer:
4810 #+cindex: property, special, ID
4811 #+cindex: property, special, TODO
4812 #+cindex: property, special, TAGS
4813 #+cindex: property, special, ALLTAGS
4814 #+cindex: property, special, CATEGORY
4815 #+cindex: property, special, PRIORITY
4816 #+cindex: property, special, DEADLINE
4817 #+cindex: property, special, SCHEDULED
4818 #+cindex: property, special, CLOSED
4819 #+cindex: property, special, TIMESTAMP
4820 #+cindex: property, special, TIMESTAMP_IA
4821 #+cindex: property, special, CLOCKSUM
4822 #+cindex: property, special, CLOCKSUM_T
4823 #+cindex: property, special, BLOCKED
4824 # guessing that ITEM is needed in this area; also, should this list be sorted?
4825 #+cindex: property, special, ITEM
4826 #+cindex: property, special, FILE
4828 #+attr_texinfo: :columns 0.3 0.7
4829 | ID | A globally unique ID used for synchronization during |
4830 | | iCalendar or MobileOrg export. |
4831 | TODO | The TODO keyword of the entry. |
4832 | TAGS | The tags defined directly in the headline. |
4833 | ALLTAGS | All tags, including inherited ones. |
4834 | CATEGORY | The category of an entry. |
4835 | PRIORITY | The priority of the entry, a string with a single letter. |
4836 | DEADLINE | The deadline time string, without the angular brackets. |
4837 | SCHEDULED | The scheduling timestamp, without the angular brackets. |
4838 | CLOSED | When was this entry closed? |
4839 | TIMESTAMP | The first keyword-less timestamp in the entry. |
4840 | TIMESTAMP_IA | The first inactive timestamp in the entry. |
4841 | CLOCKSUM | The sum of CLOCK intervals in the subtree. ~org-clock-sum~ |
4842 | | must be run first to compute the values in the current buffer. |
4843 | CLOCKSUM_T | The sum of CLOCK intervals in the subtree for today. |
4844 | | ~org-clock-sum-today~ must be run first to compute the |
4845 | | values in the current buffer. |
4846 | BLOCKED | "t" if task is currently blocked by children or siblings |
4847 | ITEM | The headline of the entry. |
4848 | FILE | The filename the entry is located in. |
4850 ** Property searches
4852 :DESCRIPTION: Matching property values
4854 #+cindex: properties, searching
4855 #+cindex: searching, of properties
4857 To create sparse trees and special lists with selection based on properties,
4858 the same commands are used as for tag searches (see [[Tag searches]]).
4860 #+attr_texinfo: :table-type table :indic @asis
4861 - {{{kbd(C-c / m)}}}, ~C-c \~ ~org-match-sparse-tree~ ::
4864 Create a sparse tree with all matching entries. With a {{{kbd(C-u)}}}
4865 prefix argument, ignore headlines that are not a TODO line.
4867 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
4870 Create a global list of tag/property matches from all agenda files.
4871 See [[Matching tags and properties]].
4873 - {{{kbd(C-c a M)}}}, ~org-tags-view~ ::
4875 #+vindex: org-tags-match-list-sublevels
4877 Create a global list of tag matches from all agenda files, but check
4878 only TODO items and force checking of subitems (see variable
4879 ~org-tags-match-list-sublevels~).
4882 The syntax for the search string is described in [[Matching tags and
4885 There is also a special command for creating sparse trees based on a
4888 #+attr_texinfo: :table-type table :indic @asis
4889 - {{{kbd(C-c / p)}}} ::
4892 Create a sparse tree based on the value of a property. This first
4893 prompts for the name of a property, and then for a value. A sparse
4894 tree is created with all entries that define this property with the
4895 given value. If you enclose the value in curly braces, it is
4896 interpreted as a regular expression and matched against the property
4899 ** Property inheritance
4901 :DESCRIPTION: Passing values down a tree
4903 #+cindex: properties, inheritance
4904 #+cindex: inheritance, of properties
4906 #+vindex: org-use-property-inheritance
4908 The outline structure of Org mode documents lends itself to an
4909 inheritance model of properties: if the parent in a tree has a certain
4910 property, the children can inherit this property. Org mode does not
4911 turn this on by default, because it can slow down property searches
4912 significantly and is often not needed. However, if you find
4913 inheritance useful, you can turn it on by setting the variable
4914 ~org-use-property-inheritance~. It may be set to ~t~ to make all
4915 properties inherited from the parent, to a list of properties that
4916 should be inherited, or to a regular expression that matches inherited
4917 properties. If a property has the value {{{samp(nil)}}}, this is
4918 interpreted as an explicit undefine of the property, so that
4919 inheritance search will stop at this value and return ~nil~.
4921 Org mode has a few properties for which inheritance is hard-coded, at
4922 least for the special applications for which they are used:
4925 #+attr_texinfo: :table-type table :indic @asis
4927 #+cindex: property, COLUMNS
4929 The ~:COLUMNS:~ property defines the format of column view (see [[Column
4930 view]]). It is inherited in the sense that the level where a ~:COLUMNS:~
4931 property is defined is used as the starting point for a column view
4932 table, independently of the location in the subtree from where columns
4936 #+cindex: property, CATEGORY
4938 For agenda view, a category set through a ~:CATEGORY:~ property
4939 applies to the entire subtree.
4942 #+cindex: property, ARCHIVE
4944 For archiving, the ~:ARCHIVE:~ property may define the archive
4945 location for the entire subtree (see [[Moving subtrees]]).
4948 #+cindex: property, LOGGING
4950 The LOGGING property may define logging settings for an entry or a
4951 subtree (see [[Tracking TODO state changes]]).
4955 :DESCRIPTION: Tabular viewing and editing
4958 A great way to view and edit properties in an outline tree is /column
4959 view/. In column view, each outline node is turned into a table row.
4960 Columns in this table provide access to properties of the entries. Org
4961 mode implements columns by overlaying a tabular structure over the
4962 headline of each item. While the headlines have been turned into a
4963 table row, you can still change the visibility of the outline tree.
4964 For example, you get a compact table by switching to CONTENTS view
4965 ({{{kbdkey(S-,TAB)}}}} {{{kbdkey(S-,TAB)}}}), or simply {{{kbd(c)}}} while
4966 column view is active), but you can still open, read, and edit the
4967 entry below each headline. Or, you can switch to column view after
4968 executing a sparse tree command and in this way get a table only for
4969 the selected items. Column view also works in agenda buffers (see
4970 [[Agenda views]]) where queries have collected selected items, possibly
4971 from a number of files.
4973 *** Defining columns
4975 :DESCRIPTION: The COLUMNS format property
4977 #+cindex: column view, for properties
4978 #+cindex: properties, column view
4980 Setting up a column view first requires defining the columns. This is
4981 done by defining a column format line.
4983 **** Scope of column definitions
4985 :DESCRIPTION: Where defined, where valid?
4988 To define a column format for an entire file, use a line like:
4992 ,#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4995 To specify a format that only applies to a specific tree, add a
4996 ~:COLUMNS:~ property to the top node of that tree, for example:
4999 ,** Top node for columns view
5001 , :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5005 If a ~:COLUMNS:~ property is present in an entry, it defines columns
5006 for the entry itself, and for the entire subtree below it. Since the
5007 column definition is part of the hierarchical structure of the
5008 document, you can define columns on level 1 that are general enough
5009 for all sublevels, and more specific columns further down, when you
5010 edit a deeper part of the tree.
5012 **** Column attributes
5014 :DESCRIPTION: Appearance and content of a column
5016 A column definition sets the attributes of a column. The general
5017 definition looks like this:
5019 %[{{{var(width)}}}]{{{var(property)}}}[({{{var(title)}}})][{{{{var(summary-type)}}}}]
5021 {{{noindent}}} Except for the percent sign and the property name, all
5022 items are optional. The individual parts have the following meaning:
5024 #+attr_texinfo: :columns 0.2 0.8
5025 | Variable | Meaning |
5026 |-------------------------+--------------------------------------------------------------|
5027 | {{{var(width)}}} | An integer specifying the width of the column in characters. |
5028 | | If omitted, the width will be determined automatically. |
5029 | {{{var(property)}}} | The property that should be edited in this column. |
5030 | | Special properties representing meta data are allowed here |
5031 | | as well (see [[Special properties]]) |
5032 | {{{var(title)}}} | The header text for the column. If omitted, the property |
5034 | {{{var(summary-type)}}} | The summary type. If specified, the column values for |
5035 | | parent nodes are computed from the children. |
5037 {{{noindent}}} Supported summary types are:
5039 #+attr_texinfo: :columns 0.2 0.8
5041 |----------+-----------------------------------------------------------------------|
5042 | ~+~ | Sum numbers in this column. |
5043 | ~+;%.1f~ | Like ~+~, but format result with {{{samp(%.1f)}}}. |
5044 | ~$~ | Currency, short for {{{samp(+;%.2f)}}}. |
5045 | ~:~ | Sum times, HH:MM, plain numbers are hours. |
5046 | ~X~ | Checkbox status, {{{samp([X])}}} if all children are {{{samp([X])}}}. |
5047 | ~X/~ | Checkbox status, {{{samp([n/m])}}}. |
5048 | ~X%~ | Checkbox status, {{{samp([n%])}}}. |
5049 | ~min~ | Smallest number in column. |
5050 | ~max~ | Largest number. |
5051 | ~mean~ | Arithmetic mean of numbers. |
5052 | ~:min~ | Smallest time value in column. |
5053 | ~:max~ | Largest time value. |
5054 | ~:mean~ | Arithmetic mean of time values. |
5055 | ~@min~ | Minimum age (in days/hours/mins/seconds). |
5056 | ~@max~ | Maximum age (in days/hours/mins/seconds). |
5057 | ~@mean~ | Arithmetic mean of ages (in days/hours/mins/seconds). |
5058 | ~est+~ | Add low-high estimates. |
5061 {{{noindent}}} Be aware that you can only have one summary type for
5062 any property you include. Subsequent columns referencing the same
5063 property will all display the same summary information.
5065 The ~est+~ summary type requires further explanation. It is used for
5066 combining estimates, expressed as low-high ranges. For example,
5067 instead of estimating a particular task will take 5 days, you might
5068 estimate it as 5-6 days if you're fairly confident you know how much
5069 work is required, or 1-10 days if you don't really know what needs to
5070 be done. Both ranges average at 5.5 days, but the first represents a
5071 more predictable delivery.
5073 When combining a set of such estimates, simply adding the lows and
5074 highs produces an unrealistically wide result. Instead, ~est+~ adds
5075 the statistical mean and variance of the sub-tasks, generating a final
5076 estimate from the sum. For example, suppose you had ten tasks, each of
5077 which was estimated at 0.5 to 2 days of work. Straight addition
5078 produces an estimate of 5 to 20 days, representing what to expect if
5079 everything goes either extremely well or extremely poorly. In
5080 contrast, ~est+~ estimates the full job more realistically, at 10-15
5083 Here is an example for a complete columns definition, along with allowed
5087 :COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \
5088 %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
5089 :Owner_ALL: Tammy Mark Karl Lisa Don
5090 :Status_ALL: "In progress" "Not started yet" "Finished" ""
5091 :Approved_ALL: "[ ]" "[X]"
5094 {{{noindent}}} The first column, {{{samp(%25ITEM)}}}, means the first
5095 25 characters of the item itself, i.e., of the headline. You probably
5096 always should start the column definition with the {{{samp(ITEM)}}}
5097 specifier. The other specifiers create columns {{{samp(Owner)}}} with
5098 a list of names as allowed values, for {{{samp(Status)}}} with four
5099 different possible values, and for a checkbox field
5100 {{{samp(Approved)}}}. When no width is given after the {{{samp(%)}}}
5101 character, the column will be exactly as wide as it needs to be in
5102 order to fully display all values. The {{{samp(Approved)}}} column
5103 does have a modified title ({{{samp(Approved?)}}}, with a question
5104 mark). Summaries will be created for the {{{samp(Time_Estimate)}}}
5105 column by adding time duration expressions like HH:MM, and for the
5106 {{{samp(Approved)}}} column, by providing an {{{samp([X])}}} status if
5107 all children have been checked. The {{{samp(CLOCKSUM)}}} and
5108 {{{samp(CLOCKSUM_T)}}} columns are special, they lists the sums of
5109 CLOCK intervals in the subtree, either for all clocks or just for
5112 *** Using column view
5114 :DESCRIPTION: How to create and use column view
5117 The following commands turn column view on or off:
5119 #+attr_texinfo: :table-type table :indic @asis
5120 - {{{kbd(C-c C-x C-c)}}}, ~org-columns~ ::
5121 #+kindex: C-c C-x C-c
5122 #+vindex: org-columns-default-format
5124 Turn on column view. If the cursor is before the first headline in the
5125 file, column view is turned on for the entire file, using the
5126 ~#+COLUMNS~ definition. If the cursor is somewhere inside the outline,
5127 this command searches the hierarchy, up from point, for a ~:COLUMNS:~
5128 property that defines a format. When one is found, the column view
5129 table is established for the tree starting at the entry that contains
5130 the ~:COLUMNS:~ property. If no such property is found, the format is
5131 taken from the ~#+COLUMNS~ line or from the variable
5132 ~org-columns-default-format~, and column view is established for the
5133 current entry and its subtree.
5135 - {{{kbd(r)}}}, ~org-columns-redo~ ::
5138 Recreate the column view, to include recent changes made in the
5141 - {{{kbd(g)}}}, ~org-columns-redo~ ::
5144 Same as {{{kbd(r)}}}.
5146 - {{{kbd(q)}}}, ~org-columns-quit~ ::
5151 The following commands let you edit information in column view:
5153 #+attr_texinfo: :table-type table :indic @asis
5154 - {{{key(left)}}} {{{key(right)}}} {{{key(up)}}} {{{key(down)}}} ::
5156 Move through the column view from field to field.
5158 - {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}} ::
5159 #+kindex: S-@key{left}
5160 #+kindex: S-@key{right}
5162 Switch to the next/previous allowed value of the field. For this, you
5163 have to have specified allowed values for a property.
5165 - {{{kbd(1..9\,0)}}} ::
5168 Directly select the Nth allowed value, {{{kbd(0)}}} selects the 10th
5171 - {{{kbd(n)}}} {{{kbd(p)}}}, ~org-columns-next-allowed-value~ ~org-columns-previous-allowed-value~ ::
5174 Same as {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}
5176 - {{{kbd(e)}}}, ~org-columns-edit-value~ ::
5179 Edit the property at point. For the special properties, this will
5180 invoke the same interface that you normally use to change that
5181 property. For example, when editing a TAGS property, the tag
5182 completion or fast selection interface will pop up.
5184 - {{{kbd(C-c C-c)}}}, ~org-columns-set-tags-or-toggle~ ::
5187 When there is a checkbox at point, toggle it.
5189 - {{{kbd(v)}}}, ~org-columns-show-value~ ::
5192 View the full value of this property. This is useful if the width of
5193 the column is smaller than that of the value.
5195 - {{{kbd(a)}}}, ~org-columns-edit-allowed~ ::
5198 Edit the list of allowed values for this property. If the list is found
5199 in the hierarchy, the modified values is stored there. If no list is
5200 found, the new value is stored in the first entry that is part of the
5201 current column view.
5204 The following commands modify column view on-the-fly:
5206 #+attr_texinfo: :table-type table :indic @asis
5207 - {{{kbd(<)}}} {{{kbd(>)}}}, ~org-columns-narrow~ ~org-columns-widen~ ::
5210 Make the column narrower/wider by one character.
5212 - {{{kbdkey(S-M-,right)}}}, ~org-columns-new~ ::
5213 #+kindex: S-M-@key{right}
5215 Insert a new column, to the left of the current column.
5217 - {{{kbdkey(S-M-,left)}}}, ~org-columns-delete~ ::
5218 #+kindex: S-M-@key{left}
5220 Delete the current column.
5222 *** Capturing column view
5224 :DESCRIPTION: A dynamic block for column view
5227 Since column view is just an overlay over a buffer, it cannot be
5228 exported or printed directly. If you want to capture a column view,
5229 use a ~columnview~ dynamic block (see [[Dynamic blocks]]). The frame of
5230 this block looks like this:
5232 #+cindex: #+BEGIN, columnview
5235 ,#+BEGIN: columnview :hlines 1 :id "label"
5240 {{{noindent}}} This dynamic block has the following parameters:
5242 #+attr_texinfo: :table-type table :indic @asis
5245 This is the most important parameter. Column view is a feature that is
5246 often localized to a certain (sub)tree, and the capture block might be
5247 at a different location in the file. To identify the tree whose view
5248 to capture, you can use 4 values:
5250 #+cindex: property, ID
5251 #+attr_texinfo: :columns 0.35 0.65
5253 |---------------------+---------------------------------------------------------------|
5254 | local | Use the tree in which the capture block is located. |
5255 | global | Make a global view, including all headings in the file. |
5256 | =file:PATH-TO-FILE= | Run column view at the top of this file. |
5257 | ID | Call column view in the tree that has an ~:ID:~ |
5258 | | property with the value /label/. You can use |
5259 | | {{{kbd(M-x org-id-copy)}}} to create a globally unique ID for |
5260 | | the current entry and copy it to the kill-ring. |
5264 Use the tree in which the capture block is located.
5268 Make a global view, including all headings in the file.
5270 - =file:PATH-TO-FILE= ::
5272 Run column view at the top of this file.
5276 Call column view in the tree that has an ~:ID:~ property with the
5277 value /label/. You can use {{{kbd(M-x org-id-copy)}}} to
5278 create a globally unique ID for the current entry and copy
5279 it to the kill-ring.
5283 When ~t~, insert an hline after every line. When a number ~N~,
5284 insert an hline before each headline with level ~<=~
5289 When set to ~t~, force column groups to get vertical lines.
5293 When set to a number, don't capture entries below this level.
5295 - ~:skip-empty-rows~ ::
5297 When set to ~t~, skip rows where the only non-empty specifier of the
5298 column view is ~ITEM~.
5302 {{{noindent}}} The following commands insert or update the dynamic
5305 #+attr_texinfo: :table-type table :indic @asis
5306 - {{{kbd(C-c C-x i)}}}, ~org-insert-columns-dblock~ ::
5309 Insert a dynamic block capturing a column view. You will be prompted
5310 for the scope or ID of the view.
5312 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}}, ~org-dblock-update~ ::
5315 Update dynamic block at point. The cursor needs to be in the ~#+BEGIN~
5316 line of the dynamic block.
5318 - {{{kbd(C-u C-c C-x C-u)}}}, ~org-update-all-dblocks~ ::
5319 #+kindex: C-u C-c C-x C-u
5321 Update all dynamic blocks (see [[Dynamic blocks]]). This is useful if you
5322 have several clock table blocks, column-capturing blocks or other
5323 dynamic blocks in a buffer.
5326 You can add formulas to the column view table and you may add plotting
5327 instructions in front of the table---these will survive an update of the
5328 block. If there is a ~#+TBLFM:~ after the table, the table will
5329 actually be recalculated automatically after an update.
5331 An alternative way to capture and process property values into a table
5332 is provided by Eric Schulte's {{{file(org-collector.el)}}} which is a
5333 contributed package.[fn:59] It provides a general API to collect
5334 properties from entries in a certain scope, and arbitrary Lisp
5335 expressions to process these values before inserting them into a table
5340 :DESCRIPTION: Properties for Lisp programmers
5342 #+cindex: properties, API
5343 #+cindex: API, for properties
5345 There is a full API for accessing and changing properties. This API
5346 can be used by Emacs Lisp programs to work with properties and to
5347 implement features based on them. For more information see [[Using the
5352 :DESCRIPTION: Making items useful for planning
5353 :ALT_TITLE: Dates and Times
5358 #+cindex: date stamp
5360 To assist project planning, TODO items can be labeled with a date and/or
5361 a time. The specially formatted string carrying the date and time
5362 information is called a /timestamp/ in Org mode. This may be a
5363 little confusing because timestamp is often used as indicating when
5364 something was created or last changed. However, in Org mode this term
5365 is used in a much wider sense.
5369 :DESCRIPTION: Assigning a time to a tree entry
5370 :TITLE: Timestamps, deadlines, and scheduling
5372 #+cindex: timestamps
5373 #+cindex: ranges, time
5374 #+cindex: date stamps
5376 #+cindex: scheduling
5378 A timestamp is a specification of a date (possibly with a time or a
5379 range of times) in a special format, either ~<2003-09-16 Tue>~ or
5380 ~<2003-09-16 Tue 09:39>~ or ~<2003-09-16 Tue 12:00-12:30>~.[fn:60] A
5381 timestamp can appear anywhere in the headline or body of an Org tree
5382 entry. Its presence causes entries to be shown on specific dates in
5383 the agenda (see [[Weekly/daily agenda]]). We distinguish:
5385 #+attr_texinfo: :table-type table :indic @asis
5386 - Plain timestamp; Event; Appointment ::
5388 #+cindex: appointment
5390 A simple timestamp just assigns a date/time to an item. This is just
5391 like writing down an appointment or event in a paper agenda. In the
5392 timeline and agenda displays, the headline of an entry associated with
5393 a plain timestamp will be shown exactly on that date.
5396 ,* Meet Peter at the movies
5397 <2006-11-01 Wed 19:15>
5398 ,* Discussion on climate change
5399 <2006-11-02 Thu 20:00-22:00>
5402 - Timestamp with repeater interval ::
5403 #+cindex: timestamp, with repeater interval
5405 A timestamp may contain a /repeater interval/, indicating that it
5406 applies not only on the given date, but again and again after a
5407 certain interval of N days (d), weeks (w), months (m), or years (y).
5408 The following will show up in the agenda every Wednesday:
5411 ,* Pick up Sam at school
5412 <2007-05-16 Wed 12:30 +1w>
5415 - Diary-style sexp entries ::
5417 For more complex date specifications, Org mode supports using the
5418 special sexp diary entries implemented in the Emacs calendar/diary
5419 package.[fn:61] For example, with optional time:
5422 ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5423 <%%(org-float t 4 2)>
5426 - Time/Date range ::
5428 #+cindex: date range
5430 Two timestamps connected by {{{samp(--)}}} denote a range. The headline
5431 will be shown on the first and last day of the range, and on any dates
5432 that are displayed and fall in the range. Here is an example:
5435 ,** Meeting in Amsterdam
5436 <2004-08-23 Mon>--<2004-08-26 Thu>
5439 - Inactive timestamp ::
5440 #+cindex: timestamp, inactive
5441 #+cindex: inactive timestamp
5443 Just like a plain timestamp, but with square brackets instead of
5444 angular ones. These timestamps are inactive in the sense that they do
5445 /not/ trigger an entry to show up in the agenda.
5448 ,* Gillian comes late for the fifth time
5452 ** Creating timestamps
5454 :DESCRIPTION: Commands to insert timestamps
5456 For Org mode to recognize timestamps, they need to be in the specific
5457 format. All commands listed below produce timestamps in the correct
5460 #+attr_texinfo: :table-type table :indic @asis
5461 - {{{kbd(C-c .)}}}, ~org-time-stamp~ ::
5464 Prompt for a date and insert a corresponding timestamp. When the
5465 cursor is at an existing timestamp in the buffer, the command is used
5466 to modify this timestamp instead of inserting a new one. When this
5467 command is used twice in succession, a time range is inserted.
5469 - {{{kbd(C-c !)}}}, ~org-time-stamp-inactive~ ::
5472 Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that will not
5473 cause an agenda entry.
5475 - {{{kbd(C-u C-c .)}}} {{{kbd(C-u C-c !)}}} ::
5479 #+vindex: org-time-stamp-rounding-minutes
5481 Like {{{kbd(C-c .)}}} and {{{kbd(C-c !)}}}, but use the alternative
5482 format which contains date and time. The default time can be rounded
5483 to multiples of 5 minutes, see the option
5484 ~org-time-stamp-rounding-minutes~.
5486 - {{{kbd(C-c C-c)}}} ::
5489 Normalize timestamp, insert/fix day name if missing or wrong.
5491 - {{{kbd(C-c <)}}}, ~org-date-from-calendar~ ::
5494 Insert a timestamp corresponding to the cursor date in the Calendar.
5496 - {{{kbd(C-c >)}}}, ~org-goto-calendar~ ::
5499 Access the Emacs calendar for the current date. If there is a
5500 timestamp in the current line, go to the corresponding date instead.
5502 - {{{kbd(C-c C-o)}}}, ~org-open-at-point~ ::
5505 Access the agenda for the date given by the timestamp or -range at
5506 point (see [[Weekly/daily agenda]]).
5508 - {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}, ~org-timestamp-down-day~ ~org-timestamp-up-day~ ::
5509 #+kindex: S-@key{left}
5511 Change date at cursor by one day. These key bindings conflict with
5512 shift-selection and related modes (see [[Conflicts]]).
5514 - {{{kbdkey(S-,up)}}} {{{kbdkey(S-,down)}}}, ~org-timestamp-up~ ~org-timestamp-down-down~ ::
5515 #+kindex: S-@key{up}
5517 Change the item under the cursor in a timestamp. The cursor can be on
5518 a year, month, day, hour or minute. When the timestamp contains a time
5519 range like {{{samp(15:30-16:30)}}}, modifying the first time will also
5520 shift the second, shifting the time block with constant length. To
5521 change the length, modify the second time. Note that if the cursor is
5522 in a headline and not at a timestamp, these same keys modify the
5523 priority of an item. (see [[Priorities]]). The key bindings also conflict
5524 with shift-selection and related modes (see [[Conflicts]]).
5526 - {{{kbd(C-c C-y)}}}, ~org-evaluate-time-range~ ::
5528 #+cindex: evaluate time range
5530 Evaluate a time range by computing the difference between start and
5531 end. With a prefix argument, insert result after the time range (in a
5532 table: into the following column).
5534 *** The date/time prompt
5536 :DESCRIPTION: How Org mode helps you enter dates and times
5538 #+cindex: date, reading in minibuffer
5539 #+cindex: time, reading in minibuffer
5541 #+vindex: org-read-date-prefer-future
5543 When Org mode prompts for a date/time, the default is shown in default
5544 date/time format, and the prompt therefore seems to ask for a specific
5545 format. But it will in fact accept date/time information in a variety
5546 of formats. Generally, the information should start at the beginning
5547 of the string. Org mode will find whatever information is in there and
5548 derive anything you have not specified from the /default date and
5549 time/. The default is usually the current date and time, but when
5550 modifying an existing timestamp, or when entering the second stamp of
5551 a range, it is taken from the stamp in the buffer. When filling in
5552 information, Org mode assumes that most of the time you will want to
5553 enter a date in the future: if you omit the month/year and the given
5554 day/month is /before/ today, it will assume that you mean a future
5555 date.[fn:62] If the date has been automatically shifted into the
5556 future, the time prompt will show this with {{{samp((=>F))}}}.
5558 For example, let's assume that today is *June 13, 2006*. Here is how
5559 various inputs will be interpreted, the items filled in by Org mode
5562 | Input | Interpretation |
5563 |--------------+------------------------------------------------------|
5564 | 3-2-5 | {{{result}}} 2003-02-05 |
5565 | 2/5/3 | {{{result}}} 2003-02-05 |
5566 | 14 | {{{result}}} *2006*-*06*-14 |
5567 | 12 | {{{result}}} *2006*-*07*-12 |
5568 | 2/5 | {{{result}}} *2007*-02-05 |
5569 | Fri | {{{result}}} nearest Friday (default date or later) |
5570 | sep 15 | {{{result}}} *2006*-09-15 |
5571 | feb 15 | {{{result}}} *2007*-02-15 |
5572 | sep 12 9 | {{{result}}} 2009-09-12 |
5573 | 12:45 | {{{result}}} *2006*-*06*-*13* 12:45 |
5574 | 22 sept 0:34 | {{{result}}} *2006*-09-22 0:34 |
5575 | w4 | {{{result}}} ISO week for of the current year *2006* |
5576 | 2012 w4 fri | {{{result}}} Friday of ISO week 4 in 2012 |
5577 | 2012-w04-5 | {{{result}}} Same as above |
5580 Furthermore you can specify a relative date by giving, as the /first/
5581 thing in the input: a plus/minus sign, a number and a letter ([dwmy])
5582 to indicate change in days, weeks, months, or years. With a single
5583 plus or minus, the date is always relative to today. With a double
5584 plus or minus, it is relative to the default date. If instead of a
5585 single letter, you use the abbreviation of day name, the date will be
5586 the Nth such day, e.g.:
5588 | Input | Interpretation |
5589 |-------+------------------------------------------|
5590 | +0 | {{{result}}} today |
5591 | . | {{{result}}} today |
5592 | +4d | {{{result}}} four days from today |
5593 | +4 | {{{result}}} same as +4d |
5594 | +2w | {{{result}}} two weeks from today |
5595 | ++5 | {{{result}}} five days from default date |
5596 | +2tue | {{{result}}} second Tuesday from now |
5599 #+vindex: parse-time-months
5600 #+vindex: parse-time-weekdays
5602 The function understands English month and weekday abbreviations. If
5603 you want to use unabbreviated names and/or other languages, configure
5604 the variables ~parse-time-months~ and ~parse-time-weekdays~.
5606 #+vindex: org-read-date-force-compatible-dates
5608 Not all dates can be represented in a given Emacs implementation. By
5609 default Org mode forces dates into the compatibility range 1970--2037
5610 which works on all Emacs implementations. If you want to use dates
5611 outside of this range, read the docstring of the variable
5612 ~org-read-date-force-compatible-dates~.
5614 You can specify a time range by giving start and end times or by
5615 giving a start time and a duration (in HH:MM format). Use one or two
5616 dash(es) as the separator in the former case and use '+' as the
5617 separator in the latter case, e.g.:
5620 |--------------+----------------------------|
5621 | 11am-1:15pm | {{{result}}} 11:00-13:15 |
5622 | 11am--1:15pm | {{{result}}} same as above |
5623 | 11am+2:15 | {{{result}}} same as above |
5625 #+cindex: calendar, for selecting date
5626 #+vindex: org-popup-calendar-for-date-prompt
5628 Parallel to the minibuffer prompt, a calendar is popped up.[fn:63]
5629 When you exit the date prompt, either by clicking on a date in the
5630 calendar, or by pressing {{{key(RET)}}}, the date selected in the
5631 calendar will be combined with the information entered at the prompt.
5632 You can control the calendar fully from the minibuffer:
5639 #+kindex: S-@key{right}
5640 #+kindex: S-@key{left}
5641 #+kindex: S-@key{down}
5642 #+kindex: S-@key{up}
5643 #+kindex: M-S-@key{right}
5644 #+kindex: M-S-@key{left}
5647 #+attr_texinfo: :columns 0.3 0.7
5648 | Key binding | Meaning |
5649 |---------------------------+----------------------------------------|
5650 | {{{key(RET)}}} | Choose date at cursor in calendar. |
5651 | {{{key(mouse-1)}}} | Select date by clicking on it. |
5652 | {{{kbdkey(S-,right)}}} | One day forward. |
5653 | {{{kbdkey(S-,left)}}} | One day backward. |
5654 | {{{kbdkey(S-,down)}}} | One week forward. |
5655 | {{{kbdkey(S-,up)}}} | One week backward. |
5656 | {{{kbdkey(M-S-,right)}}} | One month forward. |
5657 | {{{kbdkey(M-S-,left)}}} | One month backward. |
5658 | {{{kbd(>)}}} | Scroll calendar forward by one month. |
5659 | {{{kbd(<)}}} | Scroll calendar backward by one month. |
5660 | {{{kbd(M-v)}}} | Scroll calendar forward by 3 months. |
5661 | {{{kbd(C-v)}}} | Scroll calendar backward by 3 months. |
5664 #+vindex: org-read-date-display-live
5666 The actions of the date/time prompt may seem complex, but I assure you they
5667 will grow on you, and you will start getting annoyed by pretty much any other
5668 way of entering a date/time out there. To help you understand what is going
5669 on, the current interpretation of your input will be displayed live in the
5672 *** Custom time format
5674 :DESCRIPTION: Making dates look different
5676 #+cindex: custom date/time format
5677 #+cindex: time format, custom
5678 #+cindex: date format, custom
5680 #+vindex: org-display-custom-times
5681 #+vindex: org-time-stamp-custom-formats
5683 Org mode uses the standard ISO notation for dates and times as it is
5684 defined in ISO 8601. If you cannot get used to this and require
5685 another representation of date and time to keep you happy, you can get
5686 it by customizing the variables ~org-display-custom-times~ and
5687 ~org-time-stamp-custom-formats~.
5689 #+attr_texinfo: :table-type table :indic @asis
5690 - {{{kbd(C-c C-x C-t)}}}, ~org-toggle-time-stamp-overlays~ ::
5691 #+kindex: C-c C-x C-t
5693 Toggle the display of custom formats for dates and times.
5697 Org mode needs the default format for scanning, so the custom date/time
5698 format does not /replace/ the default format---instead it is put
5699 /over/ the default format using text properties. This has the
5700 following consequences:
5703 - You cannot place the cursor onto a timestamp anymore, only before or
5706 - The {{{kbdkey(S-,up)}}} {{{kbdkey(S-,down)}}} keys can no longer be
5707 used to adjust each component of a timestamp. If the cursor is at
5708 the beginning of the stamp, {{{kbdkey(S-,up)}}}
5709 {{{kbdkey(S-,down)}}} will change the stamp by one day, just like
5710 {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}. At the end of the
5711 stamp, the time will be changed by one minute.
5713 - If the timestamp contains a range of clock times or a repeater,
5714 these will not be overlaid, but remain in the buffer as they were.
5716 - When you delete a timestamp character-by-character, it will only
5717 disappear from the buffer after /all/ (invisible) characters
5718 belonging to the ISO timestamp have been removed.
5720 - If the custom timestamp format is longer than the default and you
5721 are using dates in tables, table alignment will be messed up. If
5722 the custom format is shorter, things do work as expected.
5724 ** Deadlines and scheduling
5726 :DESCRIPTION: Planning your work
5729 A timestamp may be preceded by special keywords to facilitate planning:
5731 #+attr_texinfo: :table-type table :indic @asis
5733 #+cindex: DEADLINE keyword
5735 Meaning: the task (most likely a TODO item, though not necessarily) is
5736 supposed to be finished on that date.
5738 #+vindex: org-deadline-warning-days
5740 On the deadline date, the task will be listed in the agenda. In
5741 addition, the agenda for /today/ will carry a warning about the
5742 approaching or missed deadline, starting ~org-deadline-warning-days~
5743 before the due date, and continuing until the entry is marked DONE. An
5747 ,*** TODO write article about the Earth for the Guide
5748 DEADLINE: <2004-02-29 Sun>
5749 The editor in charge is [[bbdb:Ford Prefect]]
5752 You can specify a different lead time for warnings for a specific
5753 deadlines using the following syntax. Here is an example with a
5754 warning period of 5 days ~DEADLINE: <2004-02-29 Sun -5d>~.
5757 #+cindex: SCHEDULED keyword
5759 Meaning: you are planning to start working on that task on the given
5762 #+vindex: org-agenda-skip-scheduled-if-done
5764 The headline will be listed under the given date.[fn:65] In addition,
5765 a reminder that the scheduled date has passed will be present in the
5766 compilation for /today/, until the entry is marked DONE, i.e., the
5767 task will automatically be forwarded until completed.
5770 ,*** TODO Call Trillian for a date on New Years Eve.
5771 SCHEDULED: <2004-12-25 Sat>
5775 *Important:* Scheduling an item in Org mode should /not/ be
5776 understood in the same way that we understand /scheduling a meeting/.
5777 Setting a date for a meeting is just a simple appointment, you should
5778 mark this entry with a simple plain timestamp, to get this item shown
5779 on the date where it applies. This is a frequent misunderstanding by
5780 Org users. In Org mode, /scheduling/ means setting a date when you
5781 want to start working on an action item.
5784 You may use timestamps with repeaters in scheduling and deadline
5785 entries. Org mode will issue early and late warnings based on the
5786 assumption that the timestamp represents the /nearest instance/ of
5787 the repeater. However, the use of diary sexp entries like
5789 ~<%%(org-float t 42)>~
5791 in scheduling and deadline timestamps is limited. Org mode does not
5792 know enough about the internals of each sexp function to issue early and
5793 late warnings. However, it will show the item on each day where the
5796 *** Inserting deadline/schedule
5798 :DESCRIPTION: Planning items
5799 :TITLE: Inserting deadlines or schedules
5802 The following commands allow you to quickly insert a deadline or to schedule
5805 #+attr_texinfo: :table-type table :indic @asis
5806 - {{{kbd(C-c C-d)}}}, ~org-deadline~ ::
5809 Insert {{{samp(DEADLINE)}}} keyword along with a stamp. The insertion
5810 will happen in the line directly following the headline. Any CLOSED
5811 timestamp will be removed. When called with a prefix arg, an existing
5812 deadline will be removed from the entry. Depending on the variable
5813 ~org-log-redeadline~, a note will be taken when changing an existing
5816 - {{{kbd(C-c C-s)}}}, ~org-schedule~ ::
5819 Insert {{{samp(SCHEDULED)}}} keyword along with a stamp. The insertion
5820 will happen in the line directly following the headline. Any
5821 {{{samp(CLOSED)}}} timestamp will be removed. When called with a
5822 prefix argument, remove the scheduling date from the entry. Depending
5823 on the variable ~org-log-reschedule~, a note will be taken when
5824 changing an existing scheduling time.[fn:68]
5826 - {{{kbd(C-c C-x C-k)}}}, ~org-mark-entry-for-agenda-action~ ::
5827 #+kindex: C-c C-x C-k
5831 Mark the current entry for agenda action. After you have marked the
5832 entry like this, you can open the agenda or the calendar to find an
5833 appropriate date. With the cursor on the selected date, press
5834 {{{kbd(k s)}}} or {{{kbd(k d)}}} to schedule the marked item.
5836 - {{{kbd(C-c / d)}}}, ~org-check-deadlines~ ::
5838 #+cindex: sparse tree, for deadlines
5839 #+vindex: org-deadline-warning-days
5841 Create a sparse tree with all deadlines that are either past-due, or
5842 which will become due within ~org-deadline-warning-days~. With
5843 {{{kbd(C-u)}}} prefix, show all deadlines in the file. With a numeric
5844 prefix, check that many days. For example, {{{kbd(C-1 C-c / d)}}}
5845 shows all deadlines due tomorrow.
5847 - {{{kbd(C-c / b)}}}, ~org-check-before-date~ ::
5850 Sparse tree for deadlines and scheduled items before a given date.
5852 - {{{kbd(C-c / a)}}}, ~org-check-after-date~ ::
5855 Sparse tree for deadlines and scheduled items after a given date.
5858 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
5859 by indicating a relative time: e.g. +1d will set the date to the next
5860 day after today, and --1w will set the date to the previous week
5861 before any current timestamp.
5865 :DESCRIPTION: Items that show up again and again
5867 #+cindex: tasks, repeated
5868 #+cindex: repeated tasks
5870 Some tasks need to be repeated again and again. Org mode helps to
5871 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
5872 or plain timestamp. In the following example:
5875 ,** TODO Pay the rent
5876 DEADLINE: <2005-10-01 Sat +1m>
5879 {{{noindent}}} the ~+1m~ is a repeater; the intended interpretation is
5880 that the task has a deadline on <2005-10-01> and repeats itself every
5881 (one) month starting from that time. You can use yearly, monthly,
5882 weekly, daily and hourly repeat cookies by using the ~y/w/m/d/h~
5883 letters. If you need both a repeater and a special warning period in a
5884 deadline entry, the repeater should come first and the warning period
5885 last: ~DEADLINE: <2005-10-01 Sat +1m -3d>~.
5887 #+vindex: org-todo-repeat-to-state
5889 Deadlines and scheduled items produce entries in the agenda when they
5890 are over-due, so it is important to be able to mark such an entry as
5891 completed once you have done so. When you mark a DEADLINE or a
5892 SCHEDULE with the TODO keyword DONE, it will no longer produce entries
5893 in the agenda. The problem with this is, however, that then also the
5894 /next/ instance of the repeated entry will not be active. Org mode
5895 deals with this in the following way: When you try to mark such an
5896 entry DONE (using {{{kbd(C-c C-t)}}}), it will shift the base date of
5897 the repeating timestamp by the repeater interval, and immediately set
5898 the entry state back to TODO.[fn:69] In the example above, setting the
5899 state to DONE would actually switch the date like this:
5902 ,** TODO Pay the rent
5903 DEADLINE: <2005-11-01 Tue +1m>
5906 #+vindex: org-log-repeat
5908 A timestamp will be added under the deadline, to keep a record that
5909 you actually acted on the previous instance of this deadline.[fn:70]
5911 As a consequence of shifting the base date, this entry will no longer be
5912 visible in the agenda when checking past dates, but all future instances
5915 With the {{{samp(+1m)}}} cookie, the date shift will always be exactly one
5916 month. So if you have not paid the rent for three months, marking this
5917 entry DONE will still keep it as an overdue deadline. Depending on the
5918 task, this may not be the best way to handle it. For example, if you
5919 forgot to call your father for 3 weeks, it does not make sense to call
5920 him 3 times in a single day to make up for it. Finally, there are tasks
5921 like changing batteries which should always repeat a certain time
5922 /after/ the last time you did it. For these tasks, Org mode has
5923 special repeaters {{{samp(++)}}} and {{{samp(.+)}}}. For example:
5926 ,** TODO Call Father
5927 DEADLINE: <2008-02-10 Sun ++1w>
5928 Marking this DONE will shift the date by at least one week,
5929 but also by as many weeks as it takes to get this date into
5930 the future. However, it stays on a Sunday, even if you called
5931 and marked it done on Saturday.
5932 ,** TODO Check the batteries in the smoke detectors
5933 DEADLINE: <2005-11-01 Tue .+1m>
5934 Marking this DONE will shift the date to one month after
5938 You may have both scheduling and deadline information for a specific
5939 task---just make sure that the repeater intervals on both are the
5942 An alternative to using a repeater is to create a number of copies of
5943 a task subtree, with dates shifted in each copy. The command
5944 {{{kbd(C-c C-x c)}}} was created for this purpose, it is described in
5945 [[Structure editing]].
5947 ** Clocking work time
5949 :DESCRIPTION: Tracking how long you spend on a task
5951 #+cindex: clocking time
5952 #+cindex: time clocking
5954 Org mode allows you to clock the time you spend on specific tasks in a
5955 project. When you start working on an item, you can start the clock. When
5956 you stop working on that task, or when you mark the task done, the clock is
5957 stopped and the corresponding time interval is recorded. It also computes
5958 the total time spent on each subtree of a project.[fn:71] And it remembers a
5959 history or tasks recently clocked, to that you can jump quickly between a
5960 number of tasks absorbing your time.
5962 To save the clock history across Emacs sessions, use:
5965 #+header: :exports code
5966 #+begin_src emacs-lisp
5967 (setq org-clock-persist 'history)
5968 (org-clock-persistence-insinuate)
5971 When you clock into a new task after resuming Emacs, the incomplete
5972 clock will be found (see [[Resolving idle time]]) and you will be prompted
5973 about what to do with it.[fn:72]
5975 *** Clocking commands
5977 :DESCRIPTION: Starting and stopping a clock
5980 #+attr_texinfo: :table-type table :indic @asis
5981 - {{{kbd(C-c C-x C-i)}}}, ~org-clock-in~ ::
5982 #+kindex: C-c C-x C-i
5983 #+vindex: org-clock-into-drawer
5984 #+vindex: org-clock-continuously
5985 #+cindex: property, LOG_INTO_DRAWER
5987 Start the clock on the current item (clock-in). This inserts the CLOCK
5988 keyword together with a timestamp. If this is not the first clocking
5989 of this item, the multiple CLOCK lines will be wrapped into a
5990 ~:LOGBOOK:~ drawer (see also the variable ~org-clock-into-drawer~).
5991 You can also overrule the setting of this variable for a subtree by
5992 setting a ~CLOCK_INTO_DRAWER~ or ~LOG_INTO_DRAWER~ property. When
5993 called with a {{{kbd(C-u)}}} prefix argument, select the task from a
5994 list of recently clocked tasks. With two {{{kbd(C-u C-u)}}} prefixes,
5995 clock into the task at point and mark it as the default task; the
5996 default task will then always be available with letter {{{kbd(d)}}}
5997 when selecting a clocking task. With three {{{kbd(C-u C-u C-u)}}}
5998 prefixes, force continuous clocking by starting the clock when the
5999 last clock stopped.@*
6001 #+cindex: property: CLOCK_MODELINE_TOTAL
6002 #+cindex: property: LAST_REPEAT
6003 #+vindex: org-clock-modeline-total
6005 While the clock is running, the current clocking time is shown in the
6006 mode line, along with the title of the task. The clock time shown will
6007 be all time ever clocked for this task and its children. If the task
6008 has an effort estimate (see [[Effort estimates]]), the mode line displays
6009 the current clocking time against it.[fn:73] If the task is a
6010 repeating one (see [[Repeated tasks]]), only the time since the last reset
6011 of the task will be shown.[fn:74] More control over what time is shown
6012 can be exercised with the ~CLOCK_MODELINE_TOTAL~ property. It may have
6013 the values ~current~ to show only the current clocking instance,
6014 ~today~ to show all time clocked on this tasks today (see also the
6015 variable ~org-extend-today-until~), ~all~ to include all time, or
6016 ~auto~ which is the default.[fn:75] Clicking with {{{kbd(mouse-1)}}}
6017 onto the mode line entry will pop up a menu with clocking options.
6019 - {{{kbd(C-c C-x C-o)}}}, ~org-clock-out~ ::
6020 #+kindex: C-c C-x C-o
6021 #+vindex: org-log-note-clock-out
6023 Stop the clock (clock-out). This inserts another timestamp at the same
6024 location where the clock was last started. It also directly computes
6025 the resulting time in inserts it after the time range as
6026 {{{samp(=>HH:MM)}}}. See the variable ~org-log-note-clock-out~ for the
6027 possibility to record an additional note together with the clock-out
6030 - {{{kbd(C-c C-x C-x)}}}, ~org-clock-in-last~ ::
6031 #+kindex: C-c C-x C-x
6032 #+vindex: org-clock-continuously
6034 Reclock the last clocked task. With one {{{kbd(C-u)}}} prefix
6035 argument, select the task from the clock history. With two
6036 {{{kbd(C-u)}}} prefixes, force continuous clocking by starting the
6037 clock when the last clock stopped.
6039 - {{{kbd(C-c C-x C-e)}}}, ~org-clock-modify-effort-estimate~ ::
6040 #+kindex: C-c C-x C-e
6042 Update the effort estimate for the current clock task.
6043 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-y)}}}, ~org-evaluate-time-range~ ::
6048 Recompute the time interval after changing one of the timestamps. This
6049 is only necessary if you edit the timestamps directly. If you change
6050 them with {{{kbdkey(S-,cursor)}}} keys, the update is automatic.
6052 - {{{kbdkey(C-S-,up)}}} {{{kbdkey(C-S-,down)}}}, ~org-clock-timestamps-up/down~ ::
6053 #+kindex: C-S-@key{up/down}
6055 On ~CLOCK~ log lines, increase/decrease both timestamps so that the
6056 clock duration keeps the same.
6058 - {{{kbdkey(S-M-,up)}}} {{{kbdkey(S-M-,down)}}}, ~org-timestamp-up/down~ ::
6059 #+kindex: S-M-@key{up/down}
6061 On ~CLOCK~ log lines, increase/decrease the timestamp at point and the
6062 one of the previous (or the next clock) timestamp by the same
6063 duration. For example, if you hit {{{kbdkey(S-M-,up)}}} to increase a
6064 clocked-out timestamp by five minutes, then the clocked-in timestamp
6065 of the next clock will be increased by five minutes.
6067 - {{{kbd(C-c C-t)}}}, ~org-todo~ ::
6070 Changing the TODO state of an item to DONE automatically stops the
6071 clock if it is running in this same item.
6073 - {{{kbd(C-c C-x C-q)}}}, ~org-clock-cancel~ ::
6074 #+kindex: C-c C-x C-q
6076 Cancel the current clock. This is useful if a clock was started by
6077 mistake, or if you ended up working on something else.
6079 - {{{kbd(C-c C-x C-j)}}}, ~org-clock-goto~ ::
6080 #+kindex: C-c C-x C-j
6082 Jump to the headline of the currently clocked in task. With a
6083 {{{kbd(C-u)}}} prefix arg, select the target task from a list of
6084 recently clocked tasks.
6086 - {{{kbd(C-c C-x C-d)}}}, ~org-clock-display~ ::
6087 #+kindex: C-c C-x C-d
6088 #+vindex: org-remove-highlights-with-change
6090 Display time summaries for each subtree in the current buffer. This
6091 puts overlays at the end of each headline, showing the total time
6092 recorded under that heading, including the time of any subheadings.
6093 You can use visibility cycling to study the tree, but the overlays
6094 disappear when you change the buffer (see variable
6095 ~org-remove-highlights-with-change~) or press {{{kbd(C-c C-c)}}}.
6098 The {{{kbd(l)}}} key may be used in the timeline (see [[Timeline for a
6099 single file]]) and in the agenda (see [[Weekly/daily agenda]]) to show which
6100 tasks have been worked on or closed during a day.
6102 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
6103 can have a global keybinding and will not modify the window
6108 :DESCRIPTION: Detailed reports
6110 #+cindex: clocktable, dynamic block
6111 #+cindex: report, of clocked time
6113 Org mode can produce quite complex reports based on the time clocking
6114 information. Such a report is called a /clock table/, because it is
6115 formatted as one or several Org tables.
6117 #+attr_texinfo: :table-type table :indic @asis
6118 - {{{kbd(C-c C-x C-r)}}}, ~org-clock-report~ ::
6119 #+kindex: C-c C-x C-r
6121 Insert a dynamic block (see [[Dynamic blocks]]) containing a clock report
6122 as an Org mode table into the current file. When the cursor is at an
6123 existing clock table, just update it. When called with a prefix
6124 argument, jump to the first clock report in the current document and
6125 update it. The clock table always includes also trees with ~:ARCHIVE:~
6128 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}}, ~org-dblock-update~ ::
6131 Update dynamic block at point. The cursor needs to be in the
6132 ~#+BEGIN~ line of the dynamic block.
6134 - {{{kbd(C-u C-c C-x C-u)}}} ::
6135 #+kindex: C-u C-c C-x C-u
6137 Update all dynamic blocks (see [[Dynamic blocks]]). This is useful if you
6138 have several clock table blocks in a buffer.
6140 - {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}, ~org-clocktable-try-shift~ ::
6142 Shift the current ~:block~ interval and update the table. The cursor
6143 needs to be in the ~#+BEGIN: clocktable~ line for this command. If
6144 ~:block~ is ~today~, it will be shifted to ~today-1~ etc.
6147 Here is an example of the frame for a clock table as it is inserted
6148 into the buffer with the {{{kbd(C-c C-x C-r)}}} command:
6150 #+cindex: #+BEGIN, clocktable
6152 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
6156 #+vindex: org-clocktable-defaults
6157 The {{{samp(BEGIN)}}} line and specify a number of options to define the scope,
6158 structure, and formatting of the report. Defaults for all these options can
6159 be configured in the variable ~org-clocktable-defaults~.
6161 {{{noindent}}} First there are options that determine which clock entries are to
6164 #+attr_texinfo: :table-type table :indic @asis
6167 Maximum level depth to which times are listed in the table. Clocks at
6168 deeper levels will be summed into the upper level.
6172 The scope to consider. This can be any of the following:
6174 - nil :: the current buffer or narrowed region
6175 - file :: the full current buffer
6176 - subtree :: the subtree where the clocktable is located
6177 - tree {{{var(N)}}} :: the surrounding level {{{var(N)}}} tree, for example ~tree3~
6178 - tree :: the surrounding level 1 tree
6179 - agenda :: all agenda files
6180 - ("file"..) :: scan these files
6181 - file-with-archives :: current file and its archives
6182 - agenda-with-archives :: all agenda files, including archives
6186 The time block to consider. This block is specified either absolute,
6187 or relative to the current time and may be any of these formats:
6189 - 2007-12-31 :: New year eve 2007
6190 - 2007-12 :: December 2007
6191 - 2007-W50 :: ISO-week 50 in 2007
6192 - 2007-Q2 :: 2nd quarter in 2007
6193 - 2007 :: the year 2007
6194 - today, yesterday, today-{{{var(N)}}} :: a relative day
6195 - thisweek, lastweek, thisweek-{{{var(N)}}} :: a relative week
6196 - thismonth, lastmonth, thismonth-{{{var(N)}}} :: a relative month
6197 - thisyear, lastyear, thisyear-{{{var(N)}}} :: a relative year
6199 Use {{{kbdkey(S-,left)}}} or {{{kbdkey(S-,right)}}} to shift the
6204 A time string specifying when to start considering times.
6208 A time string specifying when to stop considering times.
6212 Set to ~week~ or ~day~ to split the table into chunks. To use this,
6213 ~:block~ or ~:tstart~, ~:tend~ are needed.
6217 Do not show steps that have zero time.
6221 Do not show table sections from files which did not contribute.
6225 A tags match to select entries that should contribute. See [[Matching
6226 tags and properties]] for the match syntax.
6229 Then there are options which determine the formatting of the table. There
6230 options are interpreted by the function ~org-clocktable-write-default~,
6231 but you can specify your own function using the ~:formatter~ parameter.
6233 #+attr_texinfo: :table-type table :indic @asis
6236 When ~t~, emphasize level one and level two items.
6240 Language to use for descriptive cells like "Task".[fn:77]
6244 Link the item headlines in the table to their origins.
6248 An integer to limit the width of the headline column in the org table.
6249 If you write it like {{{samp(50!)}}}, then the headline will also be
6250 shortened in export.
6254 Indent each headline field according to its level.
6258 Number of columns to be used for times. If this is smaller than
6259 ~:maxlevel~, lower levels will be lumped into one column.
6263 Should a level number column be included?
6267 Abbreviation for ~:level nil :indent t :narrow 40! :tcolumns 1~. All
6268 are overwritten except if there is an explicit ~:narrow~.
6272 A timestamp for the entry, when available. Look for SCHEDULED,
6273 DEADLINE, TIMESTAMP and TIMESTAMP_IA, in this order.
6277 List of properties that should be shown in the table. Each property
6278 will get its own column.
6282 When this flag is ~t~, the values for ~:properties~ will be inherited.
6286 Content of a ~#+TBLFM~ line to be added and evaluated. As a special
6287 case, {{{samp(:formula %)}}} adds a column with % time. If you do not
6288 specify a formula here, any existing formula below the clock table
6289 will survive updates and be evaluated.
6293 A function to format clock data and insert it into the buffer.
6296 To get a clock summary of the current level 1 tree, for the current
6297 day, you could write:
6300 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
6304 {{{noindent}}} To use a specific time range you could write:[fn:78]
6307 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
6308 :tend "<2006-08-10 Thu 12:00>"
6312 A summary of the current subtree with % times would be:
6315 ,#+BEGIN: clocktable :scope subtree :link t :formula %
6319 A horizontally compact representation of everything clocked during
6323 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
6327 *** Resolving idle time
6329 :DESCRIPTION: Resolving time when you've been idle
6330 :TITLE: Resolving idle time and continuous clocking
6333 #+cindex: resolve idle time
6334 #+cindex: idle, resolve, dangling
6336 If you clock in on a work item, and then walk away from your
6337 computer---perhaps to take a phone call---you often need to
6338 ``resolve'' the time you were away by either subtracting it from the
6339 current clock, or applying it to another one.
6341 #+vindex: org-clock-idle-time
6343 By customizing the variable ~org-clock-idle-time~ to some integer,
6344 such as 10 or 15, Emacs can alert you when you get back to your
6345 computer after being idle for that many minutes, and ask what you want
6346 to do with the idle time.[fn:79] There will be a question waiting for you
6347 when you get back, indicating how much idle time has passed
6348 (constantly updated with the current amount), as well as a set of
6349 choices to correct the discrepancy:
6351 #+attr_texinfo: :table-type table :indic @asis
6355 To keep some or all of the minutes and stay clocked in, press
6356 {{{kbd(k)}}}. Org will ask how many of the minutes to keep. Press
6357 {{{key(RET)}}} to keep them all, effectively changing nothing, or
6358 enter a number to keep that many minutes.
6363 If you use the shift key and press {{{kbd(K)}}}, it will keep however
6364 many minutes you request and then immediately clock out of that task.
6365 If you keep all of the minutes, this is the same as just clocking out
6366 of the current task.
6371 To keep none of the minutes, use {{{kbd(s)}}} to subtract all the away
6372 time from the clock, and then check back in from the moment you
6378 To keep none of the minutes and just clock out at the start of the
6379 away time, use the shift key and press {{{kbd(S)}}}. Remember that
6380 using shift will always leave you clocked out, no matter which option
6386 To cancel the clock altogether, use {{{kbd(C)}}}. Note that if instead
6387 of canceling you subtract the away time, and the resulting clock
6388 amount is less than a minute, the clock will still be canceled rather
6389 than clutter up the log with an empty entry.
6392 What if you subtracted those away minutes from the current clock, and
6393 now want to apply them to a new clock? Simply clock in to any task
6394 immediately after the subtraction. Org will notice that you have
6395 subtracted time ``on the books'', so to speak, and will ask if you
6396 want to apply those minutes to the next task you clock in on.
6398 There is one other instance when this clock resolution magic occurs.
6399 Say you were clocked in and hacking away, and suddenly your cat chased
6400 a mouse who scared a hamster that crashed into your UPS's power
6401 button! You suddenly lose all your buffers, but thanks to auto-save
6402 you still have your recent Org mode changes, including your last clock
6405 If you restart Emacs and clock into any task, Org will notice that you
6406 have a dangling clock which was never clocked out from your last
6407 session. Using that clock's starting time as the beginning of the
6408 unaccounted-for period, Org will ask how you want to resolve that
6409 time. The logic and behavior is identical to dealing with away time
6410 due to idleness; it is just happening due to a recovery event rather
6411 than a set amount of idle time.
6413 You can also check all the files visited by your Org agenda for
6414 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks RET)}}}
6415 (or {{{kbd(C-c C-x C-z)}}}).
6417 *** Continuous clocking
6418 #+cindex: continuous clocking
6419 #+vindex: org-clock-continuously
6421 You may want to start clocking from the time when you clocked out the
6422 previous task. To enable this systematically, set
6423 ~org-clock-continuously~ to ~t~. Each time you clock in, Org retrieves
6424 the clock-out time of the last clocked entry for this session, and
6425 start the new clock from there.
6427 If you only want this from time to time, use three universal prefix
6428 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
6429 ~org-clock-in-last~.
6433 :DESCRIPTION: Planning work effort in advance
6435 #+cindex: effort estimates
6436 #+cindex: property, Effort
6437 #+vindex: org-effort-property
6439 If you want to plan your work in a very detailed way, or if you need
6440 to produce offers with quotations of the estimated work effort, you
6441 may want to assign effort estimates to entries. If you are also
6442 clocking your work, you may later want to compare the planned effort
6443 with the actual working time, a great way to improve planning
6444 estimates. Effort estimates are stored in a special property
6445 {{{samp(Effort)}}}.[fn:80] You can set the effort for an entry with
6446 the following commands:
6448 #+attr_texinfo: :table-type table :indic @kbd
6449 - {{{kbd(C-c C-x e)}}}, ~org-set-effort~ ::
6452 Set the effort estimate for the current entry. With a numeric prefix
6453 argument, set it to the Nth allowed value (see below). This command is
6454 also accessible from the agenda with the {{{kbd(e)}}} key.
6456 - {{{kbd(C-c C-x C-e)}}}, ~org-clock-modify-effort-estimate~ ::
6457 #+kindex: C-c C-x C-e
6459 Modify the effort estimate of the item currently being clocked.
6462 Clearly the best way to work with effort estimates is through column
6463 view (see [[Column view]]). You should start by setting up discrete values
6464 for effort estimates, and a ~COLUMNS~ format that displays these
6465 values together with clock sums (if you want to clock your time). For
6466 a specific buffer you can use:
6469 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
6470 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
6473 #+vindex: org-global-properties
6474 #+vindex: org-columns-default-format
6476 {{{noindent}}} or, even better, you can set up these values globally
6477 by customizing the variables ~org-global-properties~ and
6478 ~org-columns-default-format~. In particular if you want to use this
6479 setup also in the agenda, a global setup may be advised.
6481 The way to assign estimates to individual items is then to switch to
6482 column mode, and to use {{{kbdkey(S-,right)}}} and
6483 {{{kbdkey(S-,left)}}} to change the value. The values you enter will
6484 immediately be summed up in the hierarchy. In the column next to it,
6485 any clocked time will be displayed.
6487 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
6489 If you switch to column view in the daily/weekly agenda, the effort column
6490 will summarize the estimated work effort for each day, and you can use this to find space in your schedule. To get
6491 an overview of the entire part of the day that is committed, you can set the
6492 option ~org-agenda-columns-add-appointments-to-effort-sum~.[fn:179] The
6493 appointments on a day that take place over a specified time interval will
6494 then also be added to the load estimate of the day.
6496 Effort estimates can be used in secondary agenda filtering that is
6497 triggered with the {{{kbd(/)}}} key in the agenda (see [[Agenda
6498 commands]]). If you have these estimates defined consistently, two or
6499 three key presses will narrow down the list to stuff that fits into an
6500 available time slot.
6504 :DESCRIPTION: Notes with a running timer
6505 :TITLE: Taking notes with a relative timer
6507 #+cindex: relative timer
6509 When taking notes during, for example, a meeting or a video viewing, it can
6510 be useful to have access to times relative to a starting time. Org provides
6511 such a relative timer and make it easy to create timed notes.
6513 #+attr_texinfo: :table-type table :indic @asis
6514 - {{{kbd(C-c C-x .)}}}, ~org-timer~ ::
6517 Insert a relative time into the buffer. The first time you use this, the
6518 timer will be started. When called with a prefix argument, the timer is
6521 - {{{kbd(C-c C-x -)}}}, ~org-timer-item~ ::
6524 Insert a description list item with the current relative time. With a prefix
6525 argument, first reset the timer to 0.
6527 - {{{kbdkey(M-,RET)}}}, ~org-insert-heading~ ::
6528 #+kindex: M-@key{RET}
6530 Once the timer list is started, you can also use {{{kbdkey(M-,RET)}}}
6531 to insert new timer items.
6533 - {{{kbd(C-c C-x \,)}}} ::
6537 Pause the timer, or continue it if it is already paused
6538 ({{{command(org-timer-pause-or-continue)}}}).
6540 - {{{kbd(C-u C-c C-x \,)}}} ::
6541 #+kindex: C-u C-c C-x ,
6542 #+kindex: C-u C-c C-x ,
6544 Stop the timer. After this, you can only start a new timer, not
6545 continue the old one. This command also removes the timer from the
6548 - {{{kbd(C-c C-x 0)}}}, ~org-timer-start~ ::
6551 Reset the timer without inserting anything into the buffer. By
6552 default, the timer is reset to 0. When called with a {{{kbd(C-u)}}}
6553 prefix, reset the timer to specific starting offset. The user is
6554 prompted for the offset, with a default taken from a timer string at
6555 point, if any, So this can be used to restart taking notes after a
6556 break in the process. When called with a double prefix argument
6557 {{{kbd(C-u C-u)}}}, change all timer strings in the active region by a
6558 certain amount. This can be used to fix timer strings if the timer was
6559 not started at exactly the right moment.
6563 :DESCRIPTION: Starting a countdown timer for a task
6565 #+cindex: Countdown timer
6569 Calling ~org-timer-set-timer~ from an Org mode buffer runs a countdown
6570 timer. Use {{{kbd(;)}}} from agenda buffers, {{{key(C-c C-x ;)}}}
6573 ~org-timer-set-timer~ prompts the user for a duration and displays a
6574 countdown timer in the modeline. ~org-timer-default-timer~ sets the
6575 default countdown value. Giving a prefix numeric argument overrides this
6578 * Capture - Refile - Archive
6580 :DESCRIPTION: The ins and outs for projects
6584 An important part of any organization system is the ability to quickly
6585 capture new ideas and tasks, and to associate reference material with
6586 them. Org does this using a process called /capture/. It also can
6587 store files related to a task (/attachments/) in a special directory.
6588 Once in the system, tasks and projects need to be moved around. Moving
6589 completed project trees to an archive file keeps the system compact
6594 :DESCRIPTION: Capturing new stuff
6598 Org's method for capturing new items is heavily inspired by John
6599 Wiegley excellent remember package. Up to version 6.36 Org used a
6600 special setup for {{{file(remember.el)}}}. The file {{{file(org-remember.el)}}}
6601 is still part of Org mode for backward compatibility with existing
6602 setups. You can find the documentation for org-remember at
6603 [[http://orgmode.org/org-remember.pdf]].
6605 The new capturing setup described here is preferred and should be used by new
6606 users. To convert your ~org-remember-templates~, run the following command:
6607 {{{kbdspckey(M-x org-capture-import-remember-templates,RET)}}}
6609 {{{noindent}}} and then customize the new variable with
6610 {{{kbd(M-x customize-variable org-capture-templates)}}}, check the result, and
6611 save the customization. You can then use both remember and capture
6612 until you are familiar with the new mechanism.
6614 Capture lets you quickly store notes with little interruption of your work
6615 flow. The basic process of capturing is very similar to remember, but Org
6616 does enhance it with templates and more.
6618 *** Setting up capture
6620 :DESCRIPTION: Where notes will be stored
6623 The following customization sets a default target file for notes, and defines
6624 a global key for capturing new material.[fn:81]
6626 #+vindex: org-default-notes-file
6628 #+header: :exports code
6629 #+begin_src emacs-lisp
6630 (setq org-default-notes-file (concat org-directory "/notes.org"))
6631 (define-key global-map "\C-cc" 'org-capture)
6636 :DESCRIPTION: Commands to invoke and terminate capture
6639 #+attr_texinfo: :table-type table :indic @asis
6640 - {{{kbd(C-c c)}}}, ~org-capture~ ::
6644 Call the command ~org-capture~. Note that this keybinding is global
6645 and not active by default - you need to install it. If you have
6646 templates defined (see [[Capture templates]], it will offer these
6647 templates for selection or use a new Org outline node as the default
6648 template. It will insert the template into the target file and switch
6649 to an indirect buffer narrowed to this new node. You may then insert
6650 the information you want.
6652 - {{{kbd(C-c C-c)}}}, ~org-capture-finalize~ ::
6655 Once you have finished entering information into the capture buffer,
6656 {{{kbd(C-c C-c)}}} will return you to the window configuration before
6657 the capture process, so that you can resume your work without further
6658 distraction. When called with a prefix argument, finalize and then
6659 jump to the captured item.
6661 - {{{kbd(C-c C-w)}}}, ~org-capture-refile~ ::
6664 Finalize the capture process by refiling the note to a different place
6665 (see [[Refile and copy]]). Please realize that this is a normal refiling
6666 command that will be executed---so the cursor position at the moment
6667 you run this command is important. If you have inserted a tree with a
6668 parent and children, first move the cursor back to the parent. Any
6669 prefix argument given to this command will be passed on to the
6670 ~org-refile~ command.
6672 - {{{kbd(C-c C-k)}}}, ~org-capture-kill~ ::
6675 Abort the capture process and return to the previous state.
6678 You can also call ~org-capture~ in a special way from the agenda,
6679 using the {{{kbd(k c)}}} key combination. With this access, timestamps
6680 inserted by the selected capture template will default to the cursor
6681 date in the agenda, rather than to the current date.
6683 To find the locations of the last stored capture, use ~org-capture~ with
6686 #+attr_texinfo: :table-type table :indic @asis
6687 - {{{kbd(C-u C-c c)}}} ::
6690 Visit the target location of a capture template. You get to select the
6691 template in the usual way.
6693 - {{{kbd(C-u C-u C-c c)}}} ::
6694 #+kindex: C-u C-u C-c c
6696 Visit the last stored capture item in its buffer.
6699 #+vindex: org-capture-bookmark
6700 #+cindex: org-capture-last-stored
6702 You can also jump to the bookmark ~org-capture-last-stored~, which
6703 will automatically be created unless you set ~org-capture-bookmark~ to
6706 To insert the capture at point in an Org buffer, call ~org-capture~
6707 with a ~C-0~ prefix argument.
6709 *** Capture templates
6711 :DESCRIPTION: Define the outline of different note types
6713 #+cindex: templates, for Capture
6715 You can use templates for different types of capture items, and for
6716 different target locations. The easiest way to create such templates
6717 is through the customize interface.
6719 #+attr_texinfo: :table-type table :indic @asis
6720 - {{{kbd(C-c c C)}}} ::
6723 Customize the variable ~org-capture-templates~.
6726 Before we give the formal description of template definitions, let's
6727 look at an example. Say you would like to use one template to create
6728 general TODO entries, and you want to put these entries under the
6729 heading {{{samp(Tasks)}}} in your file {{{file(~/org/gtd.org)}}}.
6730 Also, a date tree in the file {{{file(journal.org)}}} should capture
6731 journal entries. A possible configuration would look like:
6734 #+header: :exports code
6735 #+begin_src emacs-lisp
6736 (setq org-capture-templates
6737 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
6738 "* TODO %?\n %i\n %a")
6739 ("j" "Journal" entry (file+datetree "~/org/journal.org")
6740 "* %?\nEntered on %U\n %i\n %a")))
6743 {{{noindent}}} If you then press {{{kbd(C-c c t)}}}, Org will prepare
6744 the template for you like this:
6748 [[file:link to where you initiated capture]]
6751 {{{noindent}}} During expansion of the template, ~%a~ has been
6752 replaced by a link to the location from where you called the capture
6753 command. This can be extremely useful for deriving tasks from emails,
6754 for example. You fill in the task definition, press ~C-c C-c~ and Org
6755 returns you to the same place where you started the capture process.
6757 To define special keys to capture to a particular template without
6758 going through the interactive template selection, you can create your
6759 key binding like this:
6762 #+header: :exports code
6763 #+begin_src emacs-lisp
6764 (define-key global-map "\C-cx"
6765 (lambda () (interactive) (org-capture nil "x")))
6768 **** Template elements
6770 :DESCRIPTION: What is needed for a complete template entry
6773 Now lets look at the elements of a template definition. Each entry in
6774 ~org-capture-templates~ is a list with the following items:
6776 #+attr_texinfo: :table-type table :indic @asis
6779 The keys that will select the template, as a string, characters
6780 only, for example "a" for a template to be selected with a
6781 single key, or "BTW" for selection with two keys. When using
6782 several keys, keys using the same prefix key must be sequential
6783 in the list and preceded by a 2-element entry explaining the
6784 prefix key, for example:
6787 #+header: :exports code
6788 #+begin_src emacs-lisp
6789 ("b" "Templates for marking stuff to buy")
6792 {{{noindent}}} If you do not define a template for the {{{kbd(C)}}}
6793 key, this key will be used to open the customize buffer for this
6798 A short string describing the template, which will be shown during
6803 The type of entry, a symbol. Valid values are:
6807 An Org mode node, with a headline. Will be filed as the child of the
6808 target entry or as a top-level entry. The target file should be an Org
6813 A plain list item, placed in the first plain list at the target
6814 location. Again the target file should be an Org file.
6818 A checkbox item. This only differs from the plain list item by the
6823 A new line in the first table at the target location. Where exactly
6824 the line will be inserted depends on the properties ~:prepend~ and
6825 ~:table-line-pos~ (see below).
6829 Text to be inserted as it is.
6832 #+vindex: org-default-notes-file
6834 Specification of where the captured item should be placed. In Org mode
6835 files, targets usually define a node. Entries will become children of this
6836 node. Other types will be added to the table or list in the body of this
6837 node. Most target specifications contain a file name. If that file name is
6838 the empty string, it defaults to ~org-default-notes-file~. A file can
6839 also be given as a variable, function, or Emacs Lisp form.
6843 - ~(file "path/to/file")~ ::
6845 Text will be placed at the beginning or end of that file.
6847 - ~(id "id of existing org entry")~ ::
6849 Filing as child of this entry, or in the body of the entry.
6851 - ~(file+headline "path/to/file" "node headline")~ ::
6853 Fast configuration if the target heading is unique in the file.
6855 - ~(file+olp "path/to/file" "Level 1 heading" "Level 2" ...)~ ::
6857 For non-unique headings, the full path is safer.
6859 - ~(file+regexp "path/to/file" "regexp to find location")~ ::
6861 Use a regular expression to position the cursor.
6863 - ~(file+datetree "path/to/file")~ ::
6865 Will create a heading in a date tree for today's date.
6867 - ~(file+datetree+prompt "path/to/file")~ ::
6869 Will create a heading in a date tree, but will prompt for the date.
6871 - ~(file+function "path/to/file" function-finding-location)~ ::
6873 A function to find the right location in the file.
6877 File to the entry that is currently being clocked.
6879 - ~(function function-finding-location)~ ::
6881 Most general way, write your own function to find both
6886 The template for creating the capture item. If you leave this empty,
6887 an appropriate default template will be used. Otherwise this is a
6888 string with escape codes, which will be replaced depending on time and
6889 context of the capture call. The string with escapes may be loaded
6890 from a template file, using the special syntax
6891 ~(file "path/to/template")~. See below for more details.
6895 The rest of the entry is a property list of additional options.
6896 Recognized properties are:
6900 Normally new captured information will be appended at the target
6901 location (last child, last table line, last list item, ...). Setting
6902 this property will change that.
6904 - ~:immediate-finish~ ::
6906 When set, do not offer to edit the information, just file it away
6907 immediately. This makes sense if the template only needs information
6908 that can be added automatically.
6912 Set this to the number of lines to insert before and after the new
6913 item. The default is 0, and the only other common value is 1.
6917 Start the clock in this item.
6921 Keep the clock running when filing the captured entry.
6923 - ~:clock-resume~ ::
6925 If starting the capture interrupted a clock, restart that clock when
6926 finished with the capture. Note that ~:clock-keep~ has precedence over
6927 ~:clock-resume~. When setting both to ~t~, the current clock will run
6928 and the previous one will not be resumed.
6932 Do not narrow the target buffer, simply show the full buffer. Default
6933 is to narrow it so that you only see the new material.
6935 - ~:table-line-pos~ ::
6937 Specification of the location in the table where the new line should
6938 be inserted. It should be a string like "II-3" meaning that the new
6939 line should become the third line before the second horizontal
6944 If the target file was not yet visited when capture was invoked, kill
6945 the buffer again after capture is completed.
6947 **** Template expansion
6949 :DESCRIPTION: Filling in information about time and context
6952 In the template itself, special {{{kbd(%)}}}-escapes allow dynamic
6953 insertion of content.[fn:82] The templates are expanded in the order given
6956 #+attr_texinfo: :table-type table :indic @asis
6957 - %[{{{var(file)}}}] ::
6959 Insert the contents of the file given by {{{var(file)}}}.
6961 - %({{{var(sexp)}}}) ::
6963 Evaluate Elisp {{{var(sexp)}}} and replace with the result. The
6964 {{{var(sexp)}}} must return a string.
6968 The result of format-time-string on the ... format specification.
6972 Timestamp, date only.
6976 Timestamp, with date and time.
6980 Like ~%t~, ~%T~ above, but inactive timestamps.
6984 Initial content, the region when capture is called while the region is
6985 active. The entire text will be indented like ~%i~ itself.
6989 Annotation, normally the link created with ~org-store-link~.
6993 Like ~%a~, but prompt for the description part.
6997 Like ~%a~, but only insert the literal link.
7001 Current kill ring head.
7005 Content of the X clipboard.
7009 Title of the currently clocked task.
7013 Link to the currently clocked task.
7017 User name (taken from ~user-full-name~).
7021 File visited by current buffer when org-capture was called.
7025 Full path of the file or directory visited by current buffer.
7029 Specific information for certain link types, see below.
7033 Prompt for tags, with completion on tags in target file.
7037 Prompt for tags, with completion all tags in all agenda files.
7041 Like ~%t~, but prompt for date. Similarly ~%^T~, ~%^u~, ~%^U~. You may
7042 define a prompt like ~%^{Birthday}t~.
7046 Interactive selection of which kill or clip to use.
7050 Like ~%^C~, but insert as link.
7054 Prompt the user for a value for property {{{var(prop)}}}.
7058 Prompt the user for a string and replace this sequence with it. You
7059 may specify a default value and a completion table with
7060 ~%^{prompt|default|completion2|completion3...}~. The arrow keys access
7061 a prompt-specific history.
7065 Insert the text entered at the nth %^{PROMPT}, where ~n~ is
7066 a number, starting from 1.
7070 After completing the template, position cursor here.
7073 {{{noindent}}} For specific link types, the following keywords will be
7076 #+vindex: org-from-is-user-regexp
7079 #+attr_texinfo: :table-type table :indic @asis
7080 - bbdb :: ~%:name %:company~
7081 - irc :: ~%:server %:port %:nick~
7082 - vm vm-imap wl mh mew rmail ::
7083 ~%:type %:subject %:message-id~
7084 ~%:from %:fromname %:fromaddress~
7085 ~%:to %:toname %:toaddress~
7086 ~%:date~ (message date header field)
7087 ~%:date-timestamp~ (date as active timestamp)
7088 ~%:date-timestamp-inactive~ (date as inactive timestamp)
7089 ~%:fromto~ (either "to NAME" or "from NAME")[fn:84]
7090 - gnus :: ~%:group~, for messages also all email fields
7092 - info :: ~%:file %:node~
7093 - calendar :: ~%:date~
7095 {{{noindent}}} To place the cursor after template expansion use:
7098 %? After completing the template, position cursor here.
7101 **** Templates in contexts
7103 :DESCRIPTION: Only show a template in a specific context
7106 #+vindex: org-capture-templates-contexts
7108 To control whether a capture template should be accessible from a
7109 specific context, you can customize ~org-capture-templates-contexts~.
7110 Let's say, for example, that you have a capture template "p" for
7111 storing Gnus emails containing patches. Then you would configure this
7115 #+header: :exports code
7116 #+begin_src emacs-lisp
7117 (setq org-capture-templates-contexts
7118 '(("p" (in-mode . "message-mode"))))
7121 You can also tell that the command key "p" should refer to another
7122 template. In that case, add this command key like this:
7125 #+header: :exports code
7126 #+begin_src emacs-lisp
7127 (setq org-capture-templates-contexts
7128 '(("p" "q" (in-mode . "message-mode"))))
7131 See the docstring of the variable ~org-capture-templates-contexts~ for
7136 :DESCRIPTION: Add files to tasks
7138 #+cindex: attachments
7139 #+vindex: org-attach-directory
7141 It is often useful to associate reference material with an outline
7142 node/task. Small chunks of plain text can simply be stored in the
7143 subtree of a project. Hyperlinks (see [[Hyperlinks]]) can establish
7144 associations with files that live elsewhere on your computer or in the
7145 cloud, like emails or source code files belonging to a project.
7146 Another method is /attachments/, which are files located in a
7147 directory belonging to an outline node. Org uses directories named by
7148 the unique ID of each entry. These directories are located in the
7149 {{{file(data)}}} directory which lives in the same directory where
7150 your Org file lives.[fn:85] If you initialize this directory with
7151 ~git init~, Org will automatically commit changes when it sees them.
7152 The attachment system has been contributed to Org by John Wiegley.
7154 In cases where it seems better to do so, you can also attach a
7155 directory of your choice to an entry. You can also make children
7156 inherit the attachment directory from a parent, so that an entire
7157 subtree uses the same attached directory.
7159 {{{noindent}}} The following commands deal with attachments:
7161 #+attr_texinfo: :table-type table :indic @asis
7162 - {{{kbd(C-c C-a)}}}, ~org-attach~ ::
7165 The dispatcher for commands related to the attachment system. After
7166 these keys, a list of commands is displayed and you must press an
7167 additional key to select a command:
7169 - {{{kbd(a)}}}, ~org-attach-attach~ ::
7171 #+vindex: org-attach-method
7173 Select a file and move it into the task's attachment directory. The
7174 file will be copied, moved, or linked, depending on
7175 ~org-attach-method~. Note that hard links are not supported on all
7178 - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
7183 Attach a file using the copy/move/link method. Note that hard links
7184 are not supported on all systems.
7186 - {{{kbd(n)}}}, ~org-attach-new~ ::
7189 Create a new attachment as an Emacs buffer.
7191 - {{{kbd(z)}}}, ~org-attach-sync~ ::
7194 Synchronize the current task with its attachment directory, in case
7195 you added attachments yourself.
7197 - {{{kbd(o)}}}, ~org-attach-open~ ::
7199 #+vindex: org-file-apps
7201 Open current task's attachment. If there is more than one, prompt for
7202 a file name first. Opening will follow the rules set by
7203 ~org-file-apps~. For more details, see the information on following
7204 hyperlinks (see [[Handling links]]).
7206 - {{{kbd(O)}}}, ~org-attach-open-in-emacs~ ::
7209 Also open the attachment, but force opening the file in Emacs.
7211 - {{{kbd(f)}}}, ~org-attach-reveal~ ::
7214 Open the current task's attachment directory.
7216 - {{{kbd(F)}}}, ~org-attach-reveal-in-emacs~ ::
7219 Also open the directory, but force using @command{dired} in Emacs.
7221 - {{{kbd(d)}}}, ~org-attach-delete-one~ ::
7224 Select and delete a single attachment.
7226 - {{{kbd(D)}}}, ~org-attach-delete-all~ ::
7229 Delete all of a task's attachments. A safer way is to open the
7230 directory in {{{command(dired)}}} and delete from there.
7232 - {{{kbd(s)}}}, ~org-attach-set-directory~ ::
7234 #+cindex: property, ATTACH_DIR
7236 Set a specific directory as the entry's attachment directory. This
7237 works by putting the directory path into the ~ATTACH_DIR~ property.
7239 - {{{kbd(i)}}}, ~org-attach-set-inherit~ ::
7241 #+cindex: property, ATTACH_DIR_INHERIT
7243 Set the ~ATTACH_DIR_INHERIT~ property, so that children will use the
7244 same directory for attachments as the parent does.
7248 :DESCRIPTION: Getting input from RSS feeds
7251 #+cindex: Atom feeds
7253 Org can add and change entries based on information found in RSS feeds and
7254 Atom feeds. You could use this to make a task out of each new podcast in a
7255 podcast feed. Or you could use a phone-based note-creating service on the
7256 web to import tasks into Org. To access feeds, configure the variable
7257 ~org-feed-alist~. The docstring of this variable has detailed
7258 information. Here is an example:
7261 #+header: :exports code
7262 #+begin_src emacs-lisp
7263 (setq org-feed-alist
7265 "http://rss.slashdot.org/Slashdot/slashdot"
7266 "~/txt/org/feeds.org" "Slashdot Entries")))
7269 {{{noindent}}} will configure that new items from the feed provided by
7270 ~rss.slashdot.org~ will result in new entries in the file
7271 {{{file(~/org/feeds.org)}}} under the heading ~Slashdot Entries~,
7272 whenever the following command is used:
7274 #+attr_texinfo: :table-type table :indic @asis
7275 - {{{kbd(C-c C-x g)}}}, ~org-feed-update-all~ ::
7278 Collect items from the feeds configured in ~org-feed-alist~ and act
7281 - {{{kbd(C-c C-x G)}}}, ~org-feed-goto-inbox~ ::
7284 Prompt for a feed name and go to the inbox configured for this feed.
7287 Under the same headline, Org will create a drawer
7288 {{{samp(FEEDSTATUS)}}} in which it will store information about the
7289 status of items in the feed, to avoid adding the same item several
7290 times. You should add {{{samp(FEEDSTATUS)}}} to the list of drawers in
7294 ,#+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
7297 For more information, including how to read atom feeds, see
7298 {{{file(org-feed.el)}}} and the docstring of ~org-feed-alist~.
7302 :DESCRIPTION: External (e.g., browser) access to Emacs and Org
7303 :TITLE: Protocols for external access
7306 #+cindex: protocols, for external access
7307 #+cindex: emacsserver
7309 You can set up Org for handling protocol calls from outside
7310 applications that are passed to Emacs through the
7311 {{{file(emacsserver)}}}. For example, you can configure bookmarks in
7312 your web browser to send a link to the current page to Org and create
7313 a note from it using capture (see [[Capture]]). Or you could create a
7314 bookmark that will tell Emacs to open the local source file of a
7315 remote website you are looking at with the browser. See
7316 [[http://orgmode.org/worg/org-contrib/org-protocol.php]] for detailed
7317 documentation and setup instructions.
7321 :DESCRIPTION: Moving/copying a tree from one place to another
7323 #+cindex: refiling notes
7324 #+cindex: copying notes
7326 When reviewing the captured data, you may want to refile or to copy some of
7327 the entries into a different list, for example into a project. Cutting,
7328 finding the right location, and then pasting the note is cumbersome. To
7329 simplify this process, you can use the following special command:
7331 #+attr_texinfo: :table-type table :indic @asis
7332 - {{{kbd(C-c M-w)}}}, ~org-copy~ ::
7336 Copying works like refiling, except that the original note is not deleted.
7338 - {{{kbd(C-c C-w)}}}, ~org-refile~ ::
7340 #+findex: org-refile
7341 #+vindex: org-reverse-note-order
7342 #+vindex: org-refile-targets
7343 #+vindex: org-refile-use-outline-path
7344 #+vindex: org-outline-path-complete-in-steps
7345 #+vindex: org-refile-allow-creating-parent-nodes
7346 #+vindex: org-log-refile
7347 #+vindex: org-refile-use-cache
7349 Refile the entry or region at point. This command offers possible
7350 locations for refiling the entry and lets you select one with
7351 completion. The item (or all items in the region) is filed below the
7352 target heading as a subitem. Depending on ~org-reverse-note-order~, it
7353 will be either the first or last subitem.
7355 By default, all level 1 headlines in the current buffer are considered
7356 to be targets, but you can have more complex definitions across a
7357 number of files. See the variable ~org-refile-targets~ for details. If
7358 you would like to select a location via a file-path-like completion
7359 along the outline path, see the variables
7360 ~org-refile-use-outline-path~ and
7361 ~org-outline-path-complete-in-steps~. If you would like to be able to
7362 create new nodes as new parents for refiling on the fly, check the
7363 variable ~org-refile-allow-creating-parent-nodes~. When the variable
7364 ~org-log-refile~ is set, a timestamp or a note will be recorded when
7365 an entry has been refiled.[fn:86]
7367 - {{{kbd(C-u C-c C-w)}}} ::
7368 #+kindex: C-u C-c C-w
7370 Use the refile interface to jump to a heading.
7372 - {{{kbd(C-u C-u C-c C-w)}}}, ~org-refile-goto-last-stored~ ::
7373 #+kindex: C-u C-u C-c C-w
7375 Jump to the location where ~org-refile~ last moved a tree to.
7377 - {{{kbd(C-2 C-c C-w)}}} ::
7378 #+kindex: C-2 C-c C-w
7380 Refile as the child of the item currently being clocked.
7382 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}}, ~org-refile-cache-clear~ ::
7383 #+kindex: C-u C-u C-u C-c C-w
7384 #+kindex: C-0 C-c C-w
7386 Clear the target cache. Caching of refile targets can be turned on by
7387 setting ~org-refile-use-cache~. To make the command see new possible
7388 targets, you have to clear the cache with this command.
7392 :DESCRIPTION: What to do with finished products
7396 When a project represented by a (sub)tree is finished, you may want to
7397 move the tree out of the way and to stop it from contributing to the
7398 agenda. Archiving is important to keep your working files compact and
7399 global searches like the construction of agenda views fast.
7401 #+attr_texinfo: :table-type table :indic @asis
7402 - {{{kbd(C-c C-x C-a)}}}, ~org-archive-subtree-default~ ::
7403 #+kindex: C-c C-x C-a
7404 #+vindex: org-archive-default-command
7406 Archive the current entry using the command specified in the variable
7407 ~org-archive-default-command~.
7411 :DESCRIPTION: Moving a tree to an archive file
7412 :TITLE: Moving a tree to an archive file
7414 #+cindex: external archiving
7416 The most common archiving action is to move a project tree to another file,
7419 #+attr_texinfo: :table-type table :indic @asis
7420 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}}, ~org-archive-subtree~ ::
7421 #+kindex: C-c C-x C-s
7423 #+vindex: org-archive-location
7425 Archive the subtree starting at the cursor position to the location
7426 given by ~org-archive-location~.
7428 - {{{Kbd(C-u C-c C-x C-s)}}} ::
7429 #+kindex: C-u C-c C-x C-s
7431 Check if any direct children of the current headline could be moved to
7432 the archive. To do this, each subtree is checked for open TODO
7433 entries. If none are found, the command offers to move it to the
7434 archive location. If the cursor is /not/ on a headline when this
7435 command is invoked, the level 1 trees will be checked.
7438 #+cindex: archive locations
7440 The default archive location is a file in the same directory as the
7441 current file, with the name derived by appending {{{file(_archive)}}}
7442 to the current file name. You can also choose what heading to file
7443 archived items under, with the possibility to add them to a datetree
7444 in a file. For information and examples on how to specify the file and
7445 the heading, see the documentation string of the variable
7446 ~org-archive-location~.
7448 There is also an in-buffer option for setting this variable, for
7453 ,#+ARCHIVE: %s_done::
7456 #+cindex: property, ARCHIVE
7458 {{{noindent}}} If you would like to have a special ARCHIVE location
7459 for a single entry or a (sub)tree, give the entry an ~:ARCHIVE:~
7460 property with the location as the value (see [[Properties and columns]]).
7462 #+vindex: org-archive-save-context-info
7464 When a subtree is moved, it receives a number of special properties
7465 that record context information like the file from where the entry
7466 came, its outline path the archiving time etc. Configure the variable
7467 ~org-archive-save-context-info~ to adjust the amount of information
7470 *** Internal archiving
7472 :DESCRIPTION: Switch off a tree but keep it in the file
7475 If you want to just switch off (for agenda views) certain subtrees
7476 without moving them to a different file, you can use the ~ARCHIVE
7479 A headline that is marked with the ARCHIVE tag (see [[Tags]]) stays at
7480 its location in the outline tree, but behaves in the following way:
7482 - It does not open when you attempt to do so with a visibility cycling
7483 command (see [[Visibility cycling]]). You can force cycling archived
7484 subtrees with {{{kbdkey(C-,TAB)}}}, or by setting the option
7485 ~org-cycle-open-archived-trees~. Also normal outline commands like
7486 ~show-all~ will open archived subtrees.
7488 #+vindex: org-cycle-open-archived-trees
7490 - During sparse tree construction (see [[Sparse trees]]), matches in
7491 archived subtrees are not exposed, unless you configure the option
7492 ~org-sparse-tree-open-archived-trees~.
7494 #+vindex: org-sparse-tree-open-archived-trees
7496 - During agenda view construction (see [[Agenda views]]), the content of
7497 archived trees is ignored unless you configure the option
7498 ~org-agenda-skip-archived-trees~, in which case these trees will
7499 always be included. In the agenda you can press {{{kbd(v a)}}} to
7500 get archives temporarily included.
7502 #+vindex: org-agenda-skip-archived-trees
7504 - Archived trees are not exported (see [[Exporting]]), only the headline
7505 is. Configure the details using the variable
7506 ~org-export-with-archived-trees~.
7508 #+vindex: org-export-with-archived-trees
7510 - Archived trees are excluded from column view unless the variable
7511 ~org-columns-skip-archived-trees~ is configured to ~nil~.
7513 #+vindex: org-columns-skip-archived-trees
7516 The following commands help manage the ARCHIVE tag:
7518 #+attr_texinfo: :table-type table :indic @asis
7519 - {{{kbd(C-c C-x a)}}}, ~org-toggle-archive-tag~ ::
7522 Toggle the ARCHIVE tag for the current headline. When the tag is set,
7523 the headline changes to a shadowed face, and the subtree below it is
7526 - {{{kbd(C-u C-c C-x a)}}} ::
7527 #+kindex: C-u C-c C-x a
7529 Check if any direct children of the current headline should be
7530 archived. To do this, each subtree is checked for open TODO entries.
7531 If none are found, the command offers to set the ARCHIVE tag for the
7532 child. If the cursor is /not/ on a headline when this command is
7533 invoked, the level 1 trees will be checked.
7535 - {{{kbdkey(C-,TAB)}}}, ~org-force-cycle-archived~ ::
7537 Cycle a tree even if it is tagged with ARCHIVE.
7539 - {{{kbd(C-c C-x A)}}}, ~org-archive-to-archive-sibling~ ::
7542 Move the current entry to the /Archive Sibling/. This is a sibling of
7543 the entry with the heading {{{samp(Archive)}}} and the tag
7544 {{{samp(ARCHIVE)}}}. The entry becomes a child of that sibling and in
7545 this way retains a lot of its original context, including inherited
7546 tags and approximate position in the outline.
7548 * FIXME Agenda views
7550 :DESCRIPTION: Collecting information into views
7551 :ALT_TITLE: Agenda Views
7554 Due to the way Org works, TODO items, time-stamped items, and tagged
7555 headlines can be scattered throughout a file or even a number of
7556 files. To get an overview of open action items, or of events that are
7557 important for a particular date, this information must be collected,
7558 sorted and displayed in an organized way.
7560 Org can select items based on various criteria and display them
7561 in a separate buffer. Seven different view types are provided:
7563 - an /agenda/ that is like a calendar and shows information for
7566 - a /TODO list/ that covers all unfinished action items,
7568 - a /match view/, showings headlines based on the tags, properties,
7569 and TODO state associated with them,
7571 - a /timeline view/ that shows all events in a single Org file, in
7574 - a /text search view/ that shows all entries from multiple files that
7575 contain specified keywords,
7577 - a /stuck projects view/ showing projects that currently don't move
7580 - /custom views/ that are special searches and combinations of
7584 {{{noindent}}} The extracted information is displayed in a special
7585 /agenda buffer/. This buffer is read-only, but provides commands to
7586 visit the corresponding locations in the original Org files, and even
7587 to edit these files remotely.
7589 #+vindex: org-agenda-window-setup
7590 #+vindex: org-agenda-restore-windows-after-quit
7592 Two variables control how the agenda buffer is displayed and whether
7593 the window configuration is restored when the agenda exits:
7594 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
7598 :DESCRIPTION: Files being searched for agenda information
7600 #+cindex: agenda files
7601 #+cindex: files for agenda
7602 #+vindex: org-agenda-files
7604 The information to be shown is normally collected from all /agenda
7605 files/, the files listed in the variable ~org-agenda-files~.[fn:180] If
7606 a directory is part of this list, all files with the extension
7607 {{{file(.org)}}} in this directory will be part of the list.
7609 Thus, even if you only work with a single Org file, that file should
7610 be put into the list.[fn:88] You can customize ~org-agenda-files~, but
7611 the easiest way to maintain it is through the following commands
7613 #+cindex: files, adding to agenda list
7614 #+attr_texinfo: :table-type table :indic @asis
7615 - {{{kbd(C-c [)}}}, ~org-agenda-file-to-front~ ::
7618 Add current file to the list of agenda files. The file is added to the
7619 front of the list. If it was already in the list, it is moved to the
7620 front. With a prefix argument, file is added/moved to the end.
7622 - {{{kbd(C-c ])}}}, ~org-remove-file~ ::
7625 Remove current file from the list of agenda files.
7627 - {{{kbd(C-')}}} {{{kbd(C-)}}}, ~org-cycle-agenda-files~ ::
7630 #+cindex: cycling, of agenda files
7632 Cycle through agenda file list, visiting one file after the other.
7634 - {{{kbd(M-x org-iswitchb)}}} ::
7635 #+findex: org-iswitchb
7637 Command to use an ~iswitchb~-like interface to switch to and between
7641 {{{noindent}}} The Org menu contains the current list of files and can
7642 be used to visit any of them.
7644 If you would like to focus the agenda temporarily on a file not in
7645 this list, or on just one file in the list, or even on only a subtree
7646 in a file, then this can be done in different ways. For a single
7647 agenda command, you may press {{{kbd(<)}}} once or several times in
7648 the dispatcher (see [[Agenda dispatcher]]). To restrict the agenda scope
7649 for an extended period, use the following commands:
7651 #+attr_texinfo: :table-type table :indic @asis
7652 - {{{kbd(C-c C-x <)}}}, ~org-agenda-set-restriction-lock~ ::
7655 Permanently restrict the agenda to the current subtree. When with a
7656 prefix argument, or with the cursor before the first headline in a
7657 file, the agenda scope is set to the entire file. This restriction
7658 remains in effect until removed with {{{kbd(C-c C-x >)}}}, or by
7659 typing either {{{kbd(<)}}} or {{{kbd(>)}}} in the agenda dispatcher.
7660 If there is a window displaying an agenda view, the new restriction
7661 takes effect immediately.
7663 - {{{kbd(C-c C-x >)}}}, ~org-agenda-remove-restriction-lock~ ::
7666 Remove the permanent restriction created by {{{kbd(C-c C-x <)}}}.
7669 {{{noindent}}} When working with {{{file(speedbar.el)}}}, you can use
7670 the following commands in the Speedbar frame:
7672 #+attr_texinfo: :table-type table :indic @asis
7673 - {{{kbd(<)}}} in the speedbar frame ~org-speedbar-set-agenda-restriction~ ::
7676 Permanently restrict the agenda to the item---either an Org file or a
7677 subtree in such a file---at the cursor in the Speedbar frame. If there
7678 is a window displaying an agenda view, the new restriction takes
7681 - {{{kbd(>)}}} in the speedbar frame ~org-agenda-remove-restriction-lock~ ::
7684 Lift the restriction.
7686 ** Agenda dispatcher
7688 :DESCRIPTION: Keyboard access to agenda views
7689 :TITLE: The agenda dispatcher
7691 #+cindex: agenda dispatcher
7692 #+cindex: dispatching agenda commands
7694 The views are created through a dispatcher, which should be bound to a
7695 global key---for example {{{kbd(C-c a)}}} (see [[Activation]]). In the
7696 following we will assume that {{{kbd(C-c a)}}} is indeed how the
7697 dispatcher is accessed and list keyboard access to commands
7698 accordingly. After pressing {{{kbd(C-c a)}}}, an additional letter is
7699 required to execute a command. The dispatcher offers the following
7702 #+attr_texinfo: :table-type table :indic @asis
7706 Create the calendar-like agenda (see [[Weekly/daily agenda]]).
7708 - {{{kbd(t)}}} or {{{kbd(T)}}} ::
7712 Create a list of all TODO items (see [[Global TODO list]]).
7714 - {{{kbd(m)}}} or {{{kbd(M)}}} ::
7718 Create a list of headlines matching a TAGS expression (see [[Matching tags and properties]]).
7723 Create the timeline view for the current buffer
7724 (see [[Timeline for a single file]]).
7729 Create a list of entries selected by a boolean expression of keywords
7730 and/or regular expressions that must or must not occur in the entry.
7734 #+vindex: org-agenda-text-search-extra-files
7736 Search for a regular expression in all agenda files and additionally
7737 in the files listed in ~org-agenda-text-search-extra-files~. This uses
7738 the Emacs command ~multi-occur~. A prefix argument can be used to
7739 specify the number of context lines for each match, default is
7742 - {{{kbd(#)}}} or {{{kbd(!)}}} ::
7745 Create a list of stuck projects (see [[Stuck projects]]).
7750 Restrict an agenda command to the current buffer.[fn:89] After
7751 pressing {{{kbd(<)}}}, you still need to press the character selecting
7757 If there is an active region, restrict the following agenda command to
7758 the region. Otherwise, restrict it to the current subtree.[fn:90]
7759 After pressing {{{kbd(< <)}}}, you still need to press the character
7760 selecting the command.
7764 #+vindex: org-agenda-sticky
7766 Toggle sticky agenda views. By default, Org maintains only a single
7767 agenda buffer and rebuilds it each time you change the view, to make
7768 sure everything is always up to date. If you switch between views
7769 often and the build time bothers you, you can turn on sticky agenda
7770 buffers (make this the default by customizing the variable
7771 ~org-agenda-sticky~). With sticky agendas, the dispatcher only
7772 switches to the selected view, you need to update it by hand with
7773 {{{kbd(r)}}} or {{{kbd(g)}}}. You can toggle sticky agenda view any
7774 time with ~org-toggle-sticky-agenda~.
7777 You can also define custom commands that will be accessible through
7778 the dispatcher, just like the default commands. This includes the
7779 possibility to create extended agenda buffers that contain several
7780 blocks together, for example the weekly agenda, the global TODO list
7781 and a number of special tags matches. See [[Custom agenda views]].
7783 ** Built-in agenda views
7785 :DESCRIPTION: What is available out of the box?
7786 :TITLE: The built-in agenda views
7788 In this section we describe the built-in views.
7790 *** FIXED Weekly/daily agenda
7792 :DESCRIPTION: The calendar page with current tasks
7795 #+cindex: weekly agenda
7796 #+cindex: daily agenda
7798 The purpose of the weekly/daily /agenda/ is to act like a page of a
7799 paper agenda, showing all the tasks for the current week or day.
7801 #+attr_texinfo: :table-type table :indic @asis
7802 - {{{kbd(C-c a a)}}}, ~org-agenda-list~ ::
7803 #+cindex: org-agenda, command
7805 Compile an agenda for the current week from a list of Org files. The
7806 agenda shows the entries for each day. With a numeric prefix (like
7807 {{{kbd(C-u 2 1 C-c a a)}}}) you may set the number of days to be
7811 #+vindex: org-agenda-span
7812 #+vindex: org-agenda-ndays
7813 The default number of days displayed in the agenda is set by the variable
7814 ~org-agenda-span~ (or the obsolete ~org-agenda-ndays~). This
7815 variable can be set to any number of days you want to see by default in the
7816 agenda, or to a span name, such a ~day~, ~week~, ~month~ or
7819 Remote editing from the agenda buffer means, for example, that you can
7820 change the dates of deadlines and appointments from the agenda buffer.
7821 The commands available in the Agenda buffer are listed in [[Agenda
7824 **** FIXED Calendar/Diary integration
7826 :DESCRIPTION: Integrate the Emacs diary with Org
7828 #+cindex: calendar integration
7829 #+cindex: diary integration
7830 #+cindex: Reingold, Edward M.
7832 Emacs contains the calendar and diary by Edward M. Reingold. The
7833 calendar displays a three-month calendar with holidays from different
7834 countries and cultures. The diary allows you to keep track of
7835 anniversaries, lunar phases, sunrise/set, recurrent appointments
7836 (weekly, monthly) and more. In this way, it is quite complementary to
7837 Org. It can be very useful to combine output from Org with
7840 In order to include entries from the Emacs diary into Org mode's
7841 agenda, you only need to customize the variable
7843 #+begin_src emacs-lisp
7844 (setq org-agenda-include-diary t)
7847 {{{noindent}}} After that, everything will happen automatically. All diary
7848 entries including holidays, anniversaries, etc., will be included in the
7849 agenda buffer created by Org mode. {{{key(SPC)}}}, {{{key(TAB)}}}, and
7850 {{{key(RET)}}} can be used from the agenda buffer to jump to the diary
7851 file in order to edit existing diary entries. The {{{kbd(i)}}} command to
7852 insert new entries for the current date works in the agenda buffer, as
7853 well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and {{{kbd(C)}}} to display
7854 Sunrise/Sunset times, show lunar phases and to convert to other
7855 calendars, respectively. {{{kbd(c)}}} can be used to switch back and forth
7856 between calendar and agenda.
7858 If you are using the diary only for sexp entries and holidays, it is
7859 faster to not use the above setting, but instead to copy or even move
7860 the entries into an Org file. Org mode evaluates diary-style sexp
7861 entries, and does it faster because there is no overhead for first
7862 creating the diary display. Note that the sexp entries must start at
7863 the left margin, no whitespace is allowed before them. For example,
7864 the following segment of an Org file will be processed and entries
7865 will be made in the agenda:[fn:181]
7868 ,* Birthdays and similar stuff
7869 ,#+CATEGORY: Holiday
7870 %%(org-calendar-holiday) ; special function for holiday names
7872 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
7873 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
7876 **** FIXED Anniversaries from BBDB
7878 :DESCRIPTION: Integrate Big Brother Database and Org
7881 #+cindex: BBDB, anniversaries
7882 #+cindex: anniversaries, from BBDB
7884 If you are using the Big Brothers Database to store your contacts, you will
7885 very likely prefer to store anniversaries in BBDB rather than in a
7886 separate Org or diary file. Org supports this and will show BBDB
7887 anniversaries as part of the agenda. All you need to do is to add the
7888 following to one of your agenda files:
7895 ,%%(org-bbdb-anniversaries)
7898 You can then go ahead and define anniversaries for a BBDB record.
7899 Basically, you need to press {{{kbdspckey(C-o anniversary,RET)}}} with
7900 the cursor in a BBDB record and then add the date in the format
7901 ~YYYY-MM-DD~ or ~MM-DD~, followed by a space and the class of the
7902 anniversary ({{{samp(birthday)}}} or {{{samp(wedding)}}}, or a format
7903 string). If you omit the class, it will default to
7904 {{{samp(birthday)}}}. Here are a few examples, the header for the file
7905 {{{file(org-bbdb.el)}}} contains more detailed information.
7911 2008-04-14 %s released version 6.01 of org mode, %d years ago
7914 After a change to BBDB, or for the first agenda display during an
7915 Emacs session, the agenda display will suffer a short delay as Org
7916 updates its hash with anniversaries. However, from then on things will
7917 be very fast---much faster in fact than a long list of
7918 {{{samp(%%(diary-anniversary))}}} entries in an Org or Diary file.
7920 **** FIXED Appointment reminders
7922 :DESCRIPTION: Integrate the Emacs appointment facility and Org
7924 #+cindex: @file{appt.el}
7925 #+cindex: appointment reminders
7926 #+cindex: appointment
7929 Org can interact with Emacs appointments notification facility. To add the
7930 appointments of your agenda files, use the command ~org-agenda-to-appt~.
7931 This command lets you filter through the list of your appointments and add
7932 only those belonging to a specific category or matching a regular expression.
7933 It also reads a ~APPT_WARNTIME~ property which will then override the
7934 value of ~appt-message-warning-time~ for this appointment. See the
7935 docstring for details.
7937 *** FIXED Global TODO list
7939 :DESCRIPTION: All unfinished action items
7941 #+cindex: global TODO list
7942 #+cindex: TODO list, global
7944 The global TODO list contains all unfinished TODO items formatted and
7945 collected into a single place.
7947 #+attr_texinfo: :table-type table :indic @asis
7948 - {{{kbd(C-c a t)}}}, ~org-todo-list~ ::
7950 Show the global TODO list. This collects the TODO items from all
7951 agenda files (see [[Agenda views]]) into a single buffer. By default, this
7952 lists items with a state the is not a DONE state. The buffer is in
7953 ~agenda-mode~, so there are commands to examine and manipulate the
7954 TODO entries directly from that buffer (see [[Agenda commands]]).
7956 - {{{kbd(C-c a T)}}}, ~org-todo-list~ ::
7958 #+cindex: TODO keyword matching
7959 #+vindex: org-todo-keywords
7961 Like the above, but allows selection of a specific TODO keyword. You
7962 can also do this by specifying a prefix argument to {{{kbd(C-c a
7963 t)}}}. You are prompted for a keyword, and you may also specify
7964 several keywords by separating them with {{{samp(|)}}} as the boolean
7965 OR operator. With a numeric prefix, the Nth keyword in
7966 ~org-todo-keywords~ is selected.
7970 The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you can give
7971 a prefix argument to this command to change the selected TODO keyword,
7972 for example {{{kbd(3 r)}}}. If you often need a search for a specific
7973 keyword, define a custom command for it (see [[Agenda dispatcher]]).
7975 Matching specific TODO keywords can also be done as part of a tags
7976 search (see [[Tag searches]]).
7979 Remote editing of TODO items means that you can change the state of a
7980 TODO entry with a single key press. The commands available in the
7981 TODO list are described in [[Agenda commands]].
7983 #+cindex: sublevels, inclusion into TODO list
7985 Normally the global TODO list simply shows all headlines with TODO
7986 keywords. This list can become very long. There are two ways to keep
7990 - Some people view a TODO item that has been /scheduled/ for execution
7991 or have a /deadline/ (see [[Timestamps]]) as no longer /open/. Configure
7992 the variables ~org-agenda-todo-ignore-scheduled~,
7993 ~org-agenda-todo-ignore-deadlines~,
7994 ~org-agenda-todo-ignore-timestamp~ and/or
7995 ~org-agenda-todo-ignore-with-date~ to exclude such items from the
7998 #+vindex: org-agenda-todo-ignore-scheduled
7999 #+vindex: org-agenda-todo-ignore-deadlines
8000 #+vindex: org-agenda-todo-ignore-timestamp
8001 #+vindex: org-agenda-todo-ignore-with-date
8003 - TODO items may have sublevels to break up the task into subtasks. In
8004 such cases it may be enough to list only the highest level TODO
8005 headline and omit the sublevels from the global list. Configure the
8006 variable ~org-agenda-todo-list-sublevels~ to get this behavior.
8008 #+vindex: org-agenda-todo-list-sublevels
8010 *** Matching tags and properties
8012 :DESCRIPTION: Structured information with fine-tuned search
8014 #+cindex: matching, of tags
8015 #+cindex: matching, of properties
8017 #+cindex: match view
8019 If headlines in the agenda files are marked with /tags/ (see [[Tags]]), or
8020 have properties (see [[Properties and columns]]), you can select headlines
8021 based on this metadata and collect them into an agenda buffer. The
8022 match syntax described here also applies when creating sparse trees
8023 with {{{kbd(C-c / m)}}}.
8025 #+attr_texinfo: :table-type table :indic @asis
8026 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
8028 Produce a list of all headlines that match a given set of tags. The
8029 command prompts for a selection criterion, which is a boolean logic
8030 expression with tags, like {{{samp(+work+urgent-withboss)}}} or
8031 {{{samp(work|home)}}} (see [[Tags]]). If you often need a specific search,
8032 define a custom command for it (see [[Agenda dispatcher]]).
8034 - {{{kbd(C-c a M)}}}, ~org-tags-view~ ::
8036 #+vindex: org-tags-match-list-sublevels
8037 #+vindex: org-agenda-tags-todo-honor-ignore-options
8039 Like {{{kbd(C-c a m)}}}, but only select headlines that are also TODO
8040 items in a not-DONE state and force checking subitems (see the variable
8041 ~org-tags-match-list-sublevels~). To exclude scheduled/deadline items,
8042 see the variable ~org-agenda-tags-todo-honor-ignore-options~. Matching
8043 specific TODO keywords together with a tags match is also possible,
8044 see [[Tag searches]].
8047 The commands available in the tags list are described in [[Agenda
8051 #+cindex: Boolean logic, for tag or property searches
8053 A search string can use Boolean operators {{{samp(&)}}} for AND and
8054 {{{samp(|)}}} for OR. {{{samp(&)}}} binds more strongly than
8055 {{{samp(|)}}}. Parentheses are currently not implemented. Each element
8056 in the search is either a tag, a regular expression matching tags, or
8057 an expression like ~PROPERTY OPERATOR VALUE~ with a comparison
8058 operator, accessing a property value. Each element may be preceded by
8059 {{{samp(-)}}}, to select against it, and {{{samp(+)}}} is syntactic
8060 sugar for positive selection. The AND operator {{{samp(&)}}} is
8061 optional when {{{samp(+)}}} or {{{samp(-)}}} is present. Here are some
8062 examples, using only tags.
8064 #+attr_texinfo: :table-type table :indic @samp
8067 Select headlines tagged {{{samp(:work:)}}}, but discard those also
8068 tagged {{{samp(:boss:)}}}.
8072 Selects lines tagged {{{samp(:work:)}}} or {{{samp(:laptop:)}}}.
8074 - work|laptop+night ::
8076 Like before, but require the {{{samp(:laptop:)}}} lines to be tagged
8077 also {{{samp(:night:)}}}.
8080 #+cindex: regular expressions, with tags search
8082 Instead of a tag, you may also specify a regular expression enclosed
8083 in curly braces. For example, {{{samp(work+{^boss.*})}}} matches
8084 headlines that contain the tag {{{samp(:work:)}}} and any tag
8085 /starting/ with {{{samp(boss)}}}.
8087 #+cindex: TODO keyword matching, with tags search
8088 #+cindex: level, require for tags/property match
8089 #+cindex: category, require for tags/property match
8090 #+vindex: org-odd-levels-only
8092 You may also test for properties (see [[Properties and columns]]) at the
8093 same time as matching tags. The properties may be real properties, or
8094 special properties that represent other metadata (see [[Special
8095 properties]]). For example, the "property" ~TODO~ represents the TODO
8096 keyword of the entry. Or, the "property" ~LEVEL~ represents the
8097 level of an entry. So a search {{{samp(+LEVEL=3+boss-TODO="DONE")}}}
8098 lists all level three headlines that have the tag {{{samp(boss)}}} and
8099 are /not/ marked with the TODO keyword DONE. In buffers with
8100 ~org-odd-levels-only~ set, {{{samp(LEVEL)}}} does not count the number
8101 of stars, but {{{samp(LEVEL=2)}}} will correspond to 3 stars etc. The
8102 ITEM special property cannot currently be used in tags/property
8105 Here are more examples:
8107 #+attr_texinfo: :table-type table :indic @samp
8108 - work+TODO="WAITING" ::
8110 Select {{{samp(:work:)}}}-tagged TODO lines with the specific TODO
8111 keyword {{{samp(WAITING)}}}.
8113 - work+TODO="WAITING"|home+TODO="WAITING" ::
8115 Waiting tasks both at work and at home.
8118 When matching properties, a number of different operators can be used to test
8119 the value of a property. Here is a complex example:
8122 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
8123 +With={Sarah|Denny}+SCHEDULED>="<2008-10-11>"
8126 {{{noindent}}} The type of comparison will depend on how the
8127 comparison value is written:
8129 - If the comparison value is a plain number, a numerical comparison is
8130 done, and the allowed operators are ~<~, ~=~, ~>~, ~<=~, ~>=~, and
8133 - If the comparison value is enclosed in double-quotes, a string
8134 comparison is done, and the same operators are allowed.
8136 - If the comparison value is enclosed in double-quotes /and/ angular
8137 brackets (like {{{samp(DEADLINE<="<2008-12-24 18:30>")}}}), both
8138 values are assumed to be date/time specifications in the standard
8139 Org way, and the comparison will be done accordingly. Special values
8140 that will be recognized are ~"<now>"~ for now (including time), and
8141 ~"<today>"~, and ~"<tomorrow>"~ for these days at 0:00 hours, i.e.@:
8142 without a time specification. Also strings like ~"<+5d>"~ or
8143 ~"<-2m>"~ with units ~d~, ~w~, ~m~, and ~y~ for day, week, month,
8144 and year, respectively, can be used.
8146 - If the comparison value is enclosed in curly braces, a regexp match
8147 is performed, with {{{samp(=)}}} meaning that the regexp matches the
8148 property value, and ~<>~ meaning that it does not match.
8151 So the search string in the example finds entries tagged
8152 {{{samp(:work:)}}} but not {{{samp(:boss:)}}}, which also have a
8153 priority value {{{samp(A)}}}, a {{{samp(:Coffee:)}}} property with the
8154 value {{{samp(unlimited)}}}, an {{{samp(Effort)}}} property that is
8155 numerically smaller than 2, a {{{samp(:With:)}}} property that is
8156 matched by the regular expression {{{samp(Sarah|Denny)}}}, and that
8157 are scheduled on or after October 11, 2008.
8159 Accessing TODO, LEVEL, and CATEGORY during a search is fast. Accessing
8160 any other properties will slow down the search. However, once you have
8161 paid the price by accessing one property, testing additional
8162 properties is cheap again.
8164 You can configure Org mode to use property inheritance during a
8165 search, but beware that this can slow down searches considerably. See
8166 [[Property inheritance]], for details.
8168 For backward compatibility, and also for typing speed, there is also a
8169 different way to test TODO states in a search. For this, terminate the
8170 tags/property part of the search string (which may include several
8171 terms connected with {{{samp(|)}}}) with a {{{samp(/)}}} and then
8172 specify a Boolean expression just for TODO keywords. The syntax is
8173 then similar to that for tags, but should be applied with care: for
8174 example, a positive selection on several TODO keywords cannot
8175 meaningfully be combined with boolean AND. However, /negative
8176 selection/ combined with AND can be meaningful. To make sure that only
8177 lines are checked that actually have any TODO keyword (resulting in a
8178 speed-up), use {{{kbd(C-c a M)}}}, or equivalently start the TODO part
8179 after the slash with {{{samp(!)}}}. Using {{{kbd(C-c a M)}}} or
8180 {{{samp(/!)}}} will not match TODO keywords in a DONE state. Examples:
8182 #+attr_texinfo: :table-type table :indic @samp
8185 Same as {{{samp(work+TODO="WAITING")}}}
8187 - work/!-WAITING-NEXT ::
8189 Select {{{samp(:work:)}}}-tagged TODO lines that are neither {{{samp(WAITING)}}}
8190 nor {{{samp(NEXT)}}}
8192 - work/!+WAITING|+NEXT ::
8194 Select {{{samp(:work:)}}}-tagged TODO lines that are either
8195 {{{samp(WAITING)}}} or {{{samp(NEXT)}}}.
8197 *** FIXED Timeline for a single file
8199 :DESCRIPTION: Time-sorted view for a single file
8200 :ALT_TITLE: Timeline
8203 #+cindex: timeline, single file
8204 #+cindex: time-sorted view
8206 The timeline summarizes all time-stamped items from a single Org mode
8207 file in a /time-sorted view/. The main purpose of this command is
8208 to give an overview over events in a project.
8210 #+attr_texinfo: :table-type table :indic @asis
8211 - {{{kbd(C-c a L)}}}, ~org-timeline~ ::
8213 Show a time-sorted view of the Org file, with all time-stamped items.
8214 When called with a {{{kbd(C-u)}}} prefix, all unfinished TODO entries
8215 (scheduled or not) are also listed under the current date.
8218 {{{noindent}}} The commands available in the timeline buffer are
8219 listed in [[Agenda commands]].
8221 *** FIXED Search view
8223 :DESCRIPTION: Find entries by searching for text
8225 #+cindex: search view
8226 #+cindex: text search
8227 #+cindex: searching, for text
8229 This agenda view is a general text search facility for Org mode entries.
8230 It is particularly useful to find notes.
8232 #+attr_texinfo: :table-type table :indic @asis
8233 - {{{kbd(C-c a s)}}}, ~org-search-view~ ::
8235 This is a special search that lets you select entries by matching a
8236 substring or specific words using a boolean logic.
8239 For example, the search string {{{samp(computer equipment)}}} will
8240 find entries that contain {{{samp(computer equipment)}}} as a
8241 substring. If the two words are separated by more space or a line
8242 break, the search will still match. Search view can also search for
8243 specific keywords in the entry, using Boolean logic. The search string
8244 {{{samp(+computer +wifi -ethernet -{8.11[bg]})}}} will search for
8245 note entries that contain the keywords ~computer~ and ~wifi~, but not
8246 the keyword ~ethernet~, and which are also not matched by the regular
8247 expression ~8.11[bg]~, meaning to exclude both 8.11b and 8.11g. The
8248 first {{{samp(+)}}} is necessary to turn on word search, other
8249 {{{samp(+)}}} characters are optional. For more details, see the
8250 docstring of the command ~org-search-view~.
8252 #+vindex: org-agenda-text-search-extra-files
8254 Note that in addition to the agenda files, this command will also
8255 search the files listed in ~org-agenda-text-search-extra-files~.
8257 *** FIXED Stuck projects
8259 :DESCRIPTION: Find projects you need to review
8261 #+pindex: GTD, Getting Things Done
8263 If you are following a system like David Allen's GTD to organize your
8264 work, one of the "duties" you have is a regular review to make sure
8265 that all projects move along. A /stuck/ project is a project that has
8266 no defined next actions, so it will never show up in the TODO lists
8267 Org mode produces. During the review, you need to identify such
8268 projects and define next actions for them.
8270 #+attr_texinfo: :table-type table :indic @asis
8271 - {{{kbd(C-c a #)}}}, ~org-agenda-list-stuck-projects~ ::
8273 List projects that are stuck.
8275 - {{{kbd(C-c a !)}}} ::
8277 #+vindex: org-stuck-projects
8280 Customize the variable ~org-stuck-projects~ to define what a stuck
8281 project is and how to find it.
8284 You almost certainly will have to configure this view before it will
8285 work for you. The built-in default assumes that all your projects are
8286 level-2 headlines, and that a project is not stuck if it has at least
8287 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
8289 Let's assume that you, in your own way of using Org mode, identify
8290 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
8291 indicate a project that should not be considered yet. Let's further
8292 assume that the TODO keyword DONE marks finished projects, and that
8293 NEXT and TODO indicate next actions. The tag @SHOP indicates shopping
8294 and is a next action even without the NEXT tag. Finally, if the
8295 project contains the special word IGNORE anywhere, it should not be
8296 listed either. In this case you would start by identifying eligible
8297 projects with a tags/todo match (see [[Tag searches]]).
8298 {{{samp(+PROJECT/-MAYBE-DONE)}}}, and then check for TODO, NEXT,
8299 @SHOP, and IGNORE in the subtree to identify projects that are not
8300 stuck. The correct customization for this is:
8302 #+begin_src emacs-lisp
8303 (setq org-stuck-projects
8304 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
8308 Note that if a project is identified as non-stuck, the subtree of this entry
8309 will still be searched for stuck projects.
8311 ** Presentation and sorting
8313 :DESCRIPTION: How agenda items are prepared for display
8315 #+cindex: presentation, of agenda items
8316 #+vindex: org-agenda-prefix-format
8317 #+vindex: org-agenda-tags-column
8319 Before displaying items in an agenda view, Org mode visually prepares
8320 the items and sorts them. Each item occupies a single line. The line
8321 starts with a /prefix/ that contains the /category/ (see [[Categories]])
8322 of the item and other important information. You can customize in
8323 which column tags will be displayed through ~org-agenda-tags-column~.
8324 You can also customize the prefix using the option
8325 ~org-agenda-prefix-format~. This prefix is followed by a cleaned-up
8326 version of the outline headline associated with the item.
8330 :DESCRIPTION: Not all tasks are equal
8334 #+cindex: #+CATEGORY
8336 The category is a broad label assigned to each agenda item. By
8337 default, the category is simply derived from the file name, but you
8338 can also specify it with a special line in the buffer, like
8346 #+cindex: property, CATEGORY
8348 If you would like to have a special CATEGORY for a single entry or a
8349 (sub)tree, give the entry a ~:CATEGORY:~ property with the special
8350 category you want to apply as the value.
8352 {{{noindent}}} The display in the agenda buffer looks best if the
8353 category is not longer than 10 characters.
8355 {{{noindent}}} You can set up icons for category by customizing the
8356 ~org-agenda-category-icon-alist~ variable.
8357 #+vindex: org-agenda-category-icon-alist
8359 *** Time-of-day specifications
8361 :DESCRIPTION: How the agenda knows the time
8363 #+cindex: time-of-day specification
8365 Org mode checks each agenda item for a time-of-day specification. The
8366 time can be part of the timestamp that triggered inclusion into the
8367 agenda, for example as in ~<2005-05-10 Tue 19:00>~. Time
8368 ranges can be specified with two timestamps, like:
8370 ~<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>~.
8372 In the headline of the entry itself, a time(range) may also appear as
8373 plain text (like {{{samp(12:45)}}} or a {{{samp(8:30-1pm)}}}). If the
8374 agenda integrates the Emacs diary (see [[Weekly/daily agenda]]), time
8375 specifications in diary entries are recognized as well.
8377 For agenda display, Org mode extracts the time and displays it in a
8378 standard 24 hour format as part of the prefix. The example times in
8379 the previous paragraphs would end up in the agenda like this:
8382 8:30-13:00 Arthur Dent lies in front of the bulldozer
8383 12:45...... Ford Prefect arrives and takes Arthur to the pub
8384 19:00...... The Vogon reads his poem
8385 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
8390 If the agenda is in single-day mode, or for the display of today, the
8391 timed entries are embedded in a time grid, like
8394 8:00...... ------------------
8395 8:30-13:00 Arthur Dent lies in front of the bulldozer
8396 10:00...... ------------------
8397 12:00...... ------------------
8398 12:45...... Ford Prefect arrives and takes Arthur to the pub
8399 14:00...... ------------------
8400 16:00...... ------------------
8401 18:00...... ------------------
8402 19:00...... The Vogon reads his poem
8403 20:00...... ------------------
8404 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
8407 #+vindex: org-agenda-use-time-grid
8408 #+vindex: org-agenda-time-grid
8410 The time grid can be turned on and off with the variable
8411 ~org-agenda-use-time-grid~, and can be configured with
8412 ~org-agenda-time-grid~.
8414 *** Sorting of agenda items
8416 :DESCRIPTION: The order of things
8418 #+cindex: sorting, of agenda items
8419 #+cindex: priorities, of agenda items
8421 Before being inserted into a view, the items are sorted. How this is
8422 done depends on the type of view.
8424 - For the daily/weekly agenda, the items for each day are sorted. The
8425 default order is to first collect all items containing an explicit
8426 time-of-day specification. These entries will be shown at the
8427 beginning of the list, as a /schedule/ for the day. After that,
8428 items remain grouped in categories, in the sequence given by
8429 ~org-agenda-files~. Within each category, items are sorted by
8430 priority (see [[Priorities]]), which is composed of the base priority
8431 (2000 for priority {{{samp(A)}}}, 1000 for {{{samp(B)}}}, and 0 for
8432 {{{samp(C)}}}), plus additional increments for overdue scheduled or deadline items.
8434 #+vindex: org-agenda-files
8436 - For the TODO list, items remain in the order of categories, but
8437 within each category, sorting takes place according to priority (see
8438 [[Priorities]]). The priority used for sorting derives from the
8439 priority cookie, with additions depending on how close an item is to
8440 its due or scheduled date.
8442 - For tags matches, items are not sorted at all, but just appear in
8443 the sequence in which they are found in the agenda files.
8446 #+vindex: org-agenda-sorting-strategy
8448 Sorting can be customized using the variable
8449 ~org-agenda-sorting-strategy~, and may also include criteria based on
8450 the estimated effort of an entry (see [[Effort estimates]]).
8452 ** FIXME Agenda commands
8454 :DESCRIPTION: Remote editing of Org trees
8455 :TITLE: Commands in the agenda buffer
8457 #+cindex: commands, in agenda buffer
8459 Entries in the agenda buffer are linked back to the Org file or diary
8460 file where they originate. You are not allowed to edit the agenda
8461 buffer itself, but commands are provided to show and jump to the
8462 original entry location, and to edit the Org files ``remotely'' from
8463 the agenda buffer. In this way, all information is stored only once,
8464 removing the risk that your agenda and note files may diverge.
8466 Some commands can be executed with mouse clicks on agenda lines. For
8467 the other commands, the cursor needs to be in the desired line.
8470 #+cindex: motion commands in agenda
8472 #+attr_texinfo: :table-type table :indic @asis
8473 - {{{kbd(n)}}}, ~org-agenda-next-line~ ::
8476 Next line (same as {{{key(down)}}} and {{{kbd(C-n)}}}).
8478 - {{{kbd(p)}}}, ~org-agenda-previous-line~ ::
8481 Previous line (same as {{{key(up)}}} and {{{kbd(C-p)}}}).
8483 *** View/Go to Org file
8484 #+cindex: view file commands in agenda
8486 #+attr_texinfo: :table-type table :indic @asis
8487 - {{{key(SPC)}}} or {{{key(mouse-3)}}}, ~org-agenda-show-and-scroll-up~ ::
8491 Display the original location of the item in another window. With
8492 prefix arg, make sure that the entire entry is made visible in the
8493 outline, not only the heading.
8495 - {{{kbd(L)}}}, ~org-agenda-recenter~ ::
8498 Display original location and recenter that window.
8500 - {{{key(TAB)}}} or {{{key(mouse-2)}}}, ~org-agenda-goto~ ::
8504 Go to the original location of the item in another window.
8506 - {{{key(RET)}}}, ~org-agenda-switch-to~ ::
8509 Go to the original location of the item and delete other windows.
8511 - {{{kbd(F)}}}, ~org-agenda-follow-mode~ ::
8513 #+vindex: org-agenda-start-with-follow-mode
8515 Toggle Follow mode. In Follow mode, as you move the cursor through the
8516 agenda buffer, the other window always shows the corresponding
8517 location in the Org file. The initial setting for this mode in new
8518 agenda buffers can be set with the variable
8519 ~org-agenda-start-with-follow-mode~.
8521 - {{{kbd(C-c C-x b)}}}, ~org-agenda-tree-to-indirect-buffer~ ::
8524 Display the entire subtree of the current item in an indirect buffer.
8525 With a numeric prefix argument N, go up to level N and then take that
8526 tree. If N is negative, go up that many levels. With a {{{kbd(C-u)}}}
8527 prefix, do not remove the previously used indirect buffer.
8529 - {{{kbd(C-c C-o)}}}, ~org-agenda-open-link~ ::
8532 Follow a link in the entry. This will offer a selection of any links
8533 in the text belonging to the referenced Org node. If there is only one
8534 link, it will be followed without a selection prompt.
8537 #+cindex: change agenda display
8539 #+attr_texinfo: :table-type table :indic @asis
8542 #+cindex: display changing, in agenda
8544 Interactively select another agenda view and append it to the current
8550 Delete other windows.
8552 - {{{kbd(v d)}}} or short {{{kbd(d)}}}, ~org-agenda-day-view~ ::
8555 #+vindex: org-agenda-span
8557 Switch to day view. When switching to day view, this setting becomes
8558 the default for subsequent agenda refreshes. A numeric prefix argument
8559 may be used to jump directly to a specific day of the year. For
8560 example, {{{kbd(32 d)}}} jumps to February 1st. When setting day view,
8561 a year may be encoded in the prefix argument as well. For example,
8562 {{{kbd(200712 d)}}} will jump to January 12, 2007. If such a year
8563 specification has only one or two digits, it will be mapped to the
8566 - {{{kbd(v w)}}} or short {{{kbd(w)}}}, ~org-agenda-week-view~ ::
8569 #+vindex: org-agenda-span
8571 Switch to week view. When switching week view, this setting becomes
8572 the default for subsequent agenda refreshes. A numeric prefix argument
8573 may be used to jump directly to a specific day of the ISO week. For
8574 example {{{kbd(9 w)}}} to ISO week number 9. When setting week view, a
8575 year may be encoded in the prefix argument as well. For example,
8576 {{{kbd(200712 w)}}} will jump to week 12 in 2007. If such a year
8577 specification has only one or two digits, it will be mapped to the
8580 - {{{kbd(v m)}}}, ~org-agenda-month-view~ ::
8582 #+vindex: org-agenda-span
8584 Switch to month view. Because month views are slow to create, they do
8585 not become the default for subsequent agenda refreshes. A numeric
8586 prefix argument may be used to jump directly to a specific day of the
8587 month. When setting month view, a year may be encoded in the prefix
8588 argument as well. For example, {{{kbd(200712 m)}}} will jump to
8589 December, 2007. If such a year specification has only one or two
8590 digits, it will be mapped to the interval 1938-2037.
8592 - {{{kbd(v y)}}}, ~org-agenda-year-view~ ::
8594 #+vindex: org-agenda-span
8596 Switch to year view. Because year views are slow to create, they do
8597 not become the default for subsequent agenda refreshes. A numeric
8598 prefix argument may be used to jump directly to a specific day of the
8601 - {{{kbdspckey(v,SPC)}}}, ~org-agenda-reset-view~ ::
8602 #+kindex: v @key{SPC}
8603 #+vindex: org-agenda-span
8605 Reset ~org-agenda-span~ to the current span.
8607 - {{{kbd(f)}}}, ~org-agenda-later~ ::
8610 Go forward in time to display the following ~org-agenda-current-span~
8611 days. For example, if the display covers a week, switch to the
8612 following week. With prefix arg, go forward that many times
8613 ~org-agenda-current-span~ days.
8615 - {{{kbd(b)}}}, ~org-agenda-earlier~ ::
8618 Go backward in time to display earlier dates.
8620 - {{{kbd(.)}}}, ~org-agenda-goto-today~ ::
8625 - {{{kbd(j)}}}, ~org-agenda-goto-date~ ::
8628 Prompt for a date and go there.
8630 - {{{kbd(J)}}}, ~org-agenda-clock-goto~ ::
8633 Go to the currently clocked-in task /in the agenda buffer/.
8635 - {{{kbd(D)}}}, ~org-agenda-toggle-diary~ ::
8638 Toggle the inclusion of diary entries. See [[Weekly/daily agenda]].
8640 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}}, ~org-agenda-log-mode~ ::
8644 #+vindex: org-log-done
8645 #+vindex: org-agenda-log-mode-items
8647 Toggle Logbook mode. In Logbook mode, entries that were marked DONE
8648 while logging was on (see the variable ~org-log-done~) are shown in
8649 the agenda, as are entries that have been clocked on that day. You can
8650 configure the entry types that should be included in log mode using
8651 the variable ~org-agenda-log-mode-items~. When called with a
8652 {{{kbd(C-u)}}} prefix, show all possible logbook entries, including
8653 state changes. When called with two prefix args {{{kbd(C-u C-u)}}},
8654 show only logging information, nothing else. {{{kbd(v L)}}} is
8655 equivalent to {{{kbd(C-u v l)}}}.
8657 - {{{kbd(v [)}}} or short {{{kbd([)}}}, ~org-agenda-manipulate-query-add~ ::
8661 Include inactive timestamps into the current view. Only for
8662 weekly/daily agenda and timeline views.
8664 - {{{kbd(v a)}}}, ~org-agenda-archives-mode~ ::
8667 Toggle Archives mode. In Archives mode, trees that are marked
8668 ~ARCHIVED~ are also scanned when producing the agenda. To exit
8669 archives mode, press {{{kbd(v a)}}} again.
8671 - {{{kbd(v A)}}}, ~org-agenda-archives-mode 'files~ ::
8673 Toggle Archives mode. In Archives mode, trees that are marked
8674 ~ARCHIVED~ are also scanned when producing the agenda, including all
8675 archive files. To exit archives mode, press {{{kbd(v a)}}}.
8677 - {{{kbd(v R)}}} or short {{{kbd(R)}}}, ~org-agenda-clockreport-mode~ ::
8680 #+vindex: org-agenda-start-with-clockreport-mode
8681 #+vindex: org-clock-report-include-clocking-task
8683 Toggle Clockreport mode. In Clockreport mode, the daily/weekly agenda
8684 will always show a table with the clocked times for the timespan and
8685 file scope covered by the current agenda view. The initial setting for
8686 this mode in new agenda buffers can be set with the variable
8687 ~org-agenda-start-with-clockreport-mode~. By using a prefix argument
8688 when toggling this mode (i.e., {{{kbd(C-u R)}}}), the clock table will
8689 not show contributions from entries that are hidden by agenda
8690 filtering.[fn:94] See also the variable
8691 ~org-clock-report-include-clocking-task~.
8695 #+vindex: org-agenda-clock-consistency-checks
8697 Show overlapping clock entries, clocking gaps, and other clocking
8698 problems in the current agenda range. You can then visit clocking
8699 lines and fix them manually. See the variable
8700 ~org-agenda-clock-consistency-checks~ for information on how to
8701 customize the definition of what constituted a clocking problem. To
8702 return to normal agenda display, press {{{kbd(l)}}} to exit Logbook
8705 - {{{kbd(v E)}}} or short {{{kbd(E)}}}, ~org-agenda-entry-text-mode~ ::
8708 #+vindex: org-agenda-start-with-entry-text-mode
8709 #+vindex: org-agenda-entry-text-maxlines
8711 Toggle entry text mode. In entry text mode, a number of lines from the
8712 Org outline node referenced by an agenda line will be displayed below
8713 the line. The maximum number of lines is given by the variable
8714 ~org-agenda-entry-text-maxlines~. Calling this command with a numeric
8715 prefix argument will temporarily modify that number to the prefix
8718 - {{{kbd(G)}}}, ~org-agenda-toggle-time-grid~ ::
8720 #+vindex: org-agenda-use-time-grid
8721 #+vindex: org-agenda-time-grid
8723 Toggle the time grid on and off. See also the variables
8724 ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
8726 - {{{kbd(r)}}}, ~org-agenda-redo~ ::
8729 Recreate the agenda buffer, for example to reflect the changes after
8730 modification of the timestamps of items with {{{kbdkey(S-,left)}}} and
8731 {{{kbdkey(S-,right)}}}. When the buffer is the global TODO list, a prefix
8732 argument is interpreted to create a selective list for a specific TODO
8735 - {{{kbd(g)}}}, ~org-agenda-redo~ ::
8738 Same as {{{kbd(r)}}}.
8740 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}}, ~org-save-all-org-buffers~ ::
8744 Save all Org buffers in the current Emacs session, and also the
8747 - {{{kbd(C-c C-x C-c)}}}, ~org-agenda-columns~ ::
8748 #+kindex: C-c C-x C-c
8749 #+vindex: org-columns-default-format
8751 Invoke column view (see [[Column view]]) in the agenda buffer. The column
8752 view format is taken from the entry at point, or (if there is no entry
8753 at point), from the first entry in the agenda view. So whatever the
8754 format for that entry would be in the original buffer (taken from a
8755 property, from a ~#+COLUMNS~ line, or from the default variable
8756 ~org-columns-default-format~), will be used in the agenda.
8758 - {{{kbd(C-c C-x >)}}}, ~org-agenda-remove-restriction-lock~ ::
8761 Remove the restriction lock on the agenda, if it is currently
8762 restricted to a file or subtree (see [[Agenda files]]).
8764 *** FIXME Secondary filtering and query editing
8765 #+cindex: filtering, by tag category and effort, in agenda
8766 #+cindex: tag filtering, in agenda
8767 #+cindex: category filtering, in agenda
8768 #+cindex: effort filtering, in agenda
8769 #+cindex: query editing, in agenda
8771 #+attr_texinfo: :table-type table :indic @asis
8772 - {{{kbd(<)}}}, ~org-agenda-filter-by-category~ ::
8774 #+vindex: org-agenda-category-filter-preset
8776 Filter the current agenda view with respect to the category of the
8777 item at point. Pressing {{{kbd(<)}}} another time will remove this
8778 filter. You can add a filter preset through the option
8779 ~org-agenda-category-filter-preset~ (see below).
8781 - {{{kbd(/)}}}, ~org-agenda-filter-by-tag~ ::
8783 #+vindex: org-agenda-tag-filter-preset
8785 Filter the current agenda view with respect to a tag and/or effort
8786 estimates. The difference between this and a custom agenda command is
8787 that filtering is very fast, so that you can switch quickly between
8788 different filters without having to recreate the
8791 You will be prompted for a tag selection letter; {{{key(SPC)}}} will
8792 mean any tag at all. Pressing {{{key(TAB)}}} at that prompt will offer
8793 use completion to select a tag (including any tags that do not have a
8794 selection character). The command then hides all entries that do not
8795 contain or inherit this tag. When called with prefix arg, remove the
8796 entries that /do/ have the tag. A second {{{kbd(/)}}} at the prompt
8797 will turn off the filter and unhide any hidden entries. If the first
8798 key you press is either {{{kbd(+)}}} or {{{kbd(-)}}}, the previous
8799 filter will be narrowed by requiring or forbidding the selected
8800 additional tag. Instead of pressing {{{kbd(+)}}} or {{{kbd(-)}}} after
8801 {{{kbd(/)}}}, you can also immediately use the ~\~ command.
8803 #+vindex: org-sort-agenda-noeffort-is-high
8805 In order to filter for effort estimates, you should set up allowed
8806 efforts globally, for example:
8808 #+header: :exports code
8809 #+begin_src emacs-lisp
8810 (setq org-global-properties
8811 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
8814 You can then filter for an effort by first typing an operator, one of
8815 {{{kbd(<)}}}, {{{kbd(>)}}}, and {{{kbd(=)}}}, and then the one-digit
8816 index of an effort estimate in your array of allowed values, where
8817 {{{kbd(0)}}} means the 10th value. The filter will then restrict to
8818 entries with effort smaller-or-equal, equal, or larger-or-equal than
8819 the selected value. If the digits 0-9 are not used as fast access keys
8820 to tags, you can also simply press the index digit directly without an
8821 operator. In this case, {{{kbd(<)}}} will be assumed. For application
8822 of the operator, entries without a defined effort will be treated
8823 according to the value of ~org-sort-agenda-noeffort-is-high~. To
8824 filter for tasks without effort definition, press {{{kbd(?)}}} as the
8827 Org also supports automatic, context-aware tag filtering. If the
8828 variable ~org-agenda-auto-exclude-function~ is set to a user-defined
8829 function, that function can decide which tags should be excluded from
8830 the agenda automatically. Once this is set, the {{{kbd(/)}}} command
8831 then accepts {{{kbd(RET)}}} as a sub-option key and runs the auto
8832 exclusion logic. For example, let's say you use a ~Net~ tag to
8833 identify tasks which need network access, an ~Errand~ tag for errands
8834 in town, and a ~Call~ tag for making phone calls. You could
8835 auto-exclude these tags based on the availability of the Internet, and
8836 outside of business hours, with something like this:
8839 #+header: :exports code
8840 #+begin_src emacs-lisp
8841 (defun org-my-auto-exclude-function (tag)
8843 ((string= tag "Net")
8844 (/= 0 (call-process "/sbin/ping" nil nil nil
8845 "-c1" "-q" "-t1" "mail.gnu.org")))
8846 ((or (string= tag "Errand") (string= tag "Call"))
8847 (let ((hour (nth 2 (decode-time))))
8848 (or (< hour 8) (> hour 21)))))
8850 (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
8853 - ~\~ ~org-agenda-filter-by-tag-refine~ ::
8855 #+comment: Should be \
8856 Narrow the current agenda filter by an additional condition. When
8857 called with prefix arg, remove the entries that /do/ have the tag, or
8858 that do match the effort criterion. You can achieve the same effect by
8859 pressing {{{kbd(+)}}} or {{{kbd(-)}}} as the first key after the
8860 {{{kbd(/)}}} command.
8862 - {{{kbd([)}}} {{{kbd(])}}} {{{kbd({)}}} {{{kbd(})}}} in search view ::
8868 Add new search words ({{{kbd([)}}} and {{{kbd(])}}}) or new regular
8869 expressions ({{{kbd({)}}} and {{{kbd(})}}}) to the query string. The
8870 opening bracket/brace will add a positive search term prefixed by
8871 {{{samp(+)}}}, indicating that this search term /must/ occur/match in
8872 the entry. The closing bracket/brace will add a negative search term
8873 which /must not/ occur/match in the entry for it to be selected.
8875 *** FIXME Remote editing
8876 #+cindex: remote editing, from agenda
8878 #+attr_texinfo: :table-type table :indic @asis
8879 - {{{kbd(0--9)}}} ::
8883 - {{{kbd(C-_)}}}, ~org-agenda-undo~ ::
8885 #+cindex: undoing remote-editing events
8886 #+cindex: remote editing, undo
8888 Undo a change due to a remote editing command. The change is undone
8889 both in the agenda buffer and in the remote buffer.
8891 - {{{kbd(t)}}}, ~org-agenda-todo~ ::
8894 Change the TODO state of the item, both in the agenda and in the
8897 - {{{kbdkey(C-S-,right)}}}, ~org-agenda-todo-nextset~ ::
8898 #+kindex: C-S-@key{right}
8900 Switch to the next set of TODO keywords.
8902 - {{{kbdkey(C-S-,left)}}}, ~org-agenda-todo-previousset~ ::
8903 #+kindex: C-S-@key{left}
8905 Switch to the previous set of TODO keywords.
8907 - {{{kbd(C-k)}}}, ~org-agenda-kill~ ::
8909 #+vindex: org-agenda-confirm-kill
8911 Delete the current agenda item along with the entire subtree belonging
8912 to it in the original Org file. If the text to be deleted remotely is
8913 longer than one line, the kill needs to be confirmed by the user. See
8914 variable ~org-agenda-confirm-kill~.
8916 - {{{kbd(C-c C-w)}}}, ~org-agenda-refile~ ::
8919 Refile the entry at point.
8921 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}}, ~org-agenda-archive-default-with-confirmation~ ::
8922 #+kindex: C-c C-x C-a
8924 #+vindex: org-archive-default-command
8926 Archive the subtree corresponding to the entry at point using the
8927 default archiving command set in ~org-archive-default-command~. When
8928 using the ~a~ key, confirmation will be required.
8930 - {{{kbd(C-c C-x a)}}}, ~org-agenda-toggle-archive-tag~ ::
8933 Toggle the ARCHIVE tag for the current headline.
8935 - {{{kbd(C-c C-x A)}}}, ~org-agenda-archive-to-archive-sibling~ ::
8938 Move the subtree corresponding to the current entry to its /archive
8941 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}}, ~org-agenda-archive~ ::
8942 #+kindex: C-c C-x C-s
8945 Archive the subtree corresponding to the current headline. This means
8946 the entry will be moved to the configured archive location, most
8947 likely a different file.
8949 - {{{kbd(T)}}}, ~org-agenda-show-tags~ ::
8951 #+vindex: org-agenda-show-inherited-tags
8953 Show all tags associated with the current item. This is useful if you
8954 have turned off ~org-agenda-show-inherited-tags~, but still want to
8955 see all tags of a headline occasionally.
8957 - {{{kbd(:)}}}, ~org-agenda-set-tags~ ::
8960 Set tags for the current headline. If there is an active region in the
8961 agenda, change a tag for all headings in the region.
8963 - {{{kbd(\\\,)}}} ::
8965 Set the priority for the current item (~org-agenda-priority~). Org
8966 mode prompts for the priority character. If you reply with
8967 {{{key(SPC)}}}, the priority cookie is removed from the entry.
8969 - {{{kbd(P)}}}, ~org-agenda-show-priority~ ::
8972 Display weighted priority of current item.
8974 - {{{kbd(+)}}} {{{kbdkey(S-,up)}}}, ~org-agenda-priority-up~ ::
8977 Increase the priority of the current item. The priority is changed in
8978 the original buffer, but the agenda is not resorted. Use the
8979 {{{kbd(r)}}} key for this.
8981 - {{{kbd(-)}}} {{{kbdkey(S-,down)}}}, ~org-agenda-priority-down~ ::
8984 Decrease the priority of the current item.
8986 - {{{kbd(z)}}} {{{kbd(C-c C-z)}}}, ~org-agenda-add-note~ ::
8988 #+vindex: org-log-into-drawer
8990 Add a note to the entry. This note will be recorded, and then filed to
8991 the same location where state change notes are put. Depending on
8992 ~org-log-into-drawer~, this may be inside a drawer.
8994 - {{{kbd(C-c C-a)}}}, ~org-attach~ ::
8997 Dispatcher for all command related to attachments.
8999 - {{{kbd(C-c C-s)}}}, ~org-agenda-schedule~ ::
9002 Schedule this item. With prefix arg remove the scheduling timestamp
9004 - {{{kbd(C-c C-d)}}}, ~org-agenda-deadline~ ::
9007 Set a deadline for this item. With prefix arg remove the deadline.
9009 - {{{kbdkey(S-,right)}}}, ~org-agenda-do-date-later~ ::
9010 #+kindex: S-@key{right}
9012 Change the timestamp associated with the current line by one day into
9013 the future. If the date is in the past, the first call to this command
9014 will move it to today. With a numeric prefix argument, change it by
9015 that many days. For example, {{{kbdkey(3 6 5 S-,right)}}} will change
9016 it by a year. With a {{{kbd(C-u)}}} prefix, change the time by one
9017 hour. If you immediately repeat the command, it will continue to
9018 change hours even without the prefix arg. With a double
9019 {{{kbd(C-u C-u)}}} prefix, do the same for changing minutes. The stamp is changed
9020 in the original Org file, but the change is not directly reflected in
9021 the agenda buffer. Use {{{kbd(r)}}} or {{{kbd(g)}}} to update the
9024 - {{{kbdkey(S-,left)}}}, ~org-agenda-do-date-earlier~ ::
9025 #+kindex: S-@key{left}
9027 Change the timestamp associated with the current line by one day
9030 - {{{kbd(>)}}}, ~org-agenda-date-prompt~ ::
9033 Change the timestamp associated with the current line. The key
9034 {{{kbd(>)}}} has been chosen, because it is the same as {{{kbd(S-.)}}}
9037 - {{{kbd(I)}}}, ~org-agenda-clock-in~ ::
9040 Start the clock on the current item. If a clock is running already, it
9043 - {{{kbd(O)}}}, ~org-agenda-clock-out~ ::
9046 Stop the previously started clock.
9048 - {{{kbd(X)}}}, ~org-agenda-clock-cancel~ ::
9051 Cancel the currently running clock.
9053 - {{{kbd(J)}}}, ~org-agenda-clock-goto~ ::
9056 Jump to the running clock in another window.
9058 - {{{kbd(k)}}}, ~org-agenda-capture~ ::
9060 #+cindex: capturing, from agenda
9061 #+vindex: org-capture-use-agenda-date
9063 Like ~org-capture~, but use the date at point as the default date for
9064 the capture template. See ~org-capture-use-agenda-date~ to make this
9065 the default behavior of ~org-capture~.
9067 *** Bulk remote editing selected entries
9068 #+cindex: remote editing, bulk, from agenda
9069 #+vindex: org-agenda-bulk-persistent-marks
9070 #+vindex: org-agenda-bulk-custom-functions
9072 #+attr_texinfo: :table-type table :indic @asis
9073 - {{{kbd(m)}}}, ~org-agenda-bulk-mark~ ::
9076 Mark the entry at point for bulk action. With prefix arg, mark that
9077 many successive entries.
9079 - {{{kbd(%)}}}, ~org-agenda-bulk-mark-regexp~ ::
9082 Mark entries matching a regular expression for bulk action.
9084 - {{{kbd(u)}}}, ~org-agenda-bulk-unmark~ ::
9087 Unmark entry for bulk action.
9089 - {{{kbd(U)}}}, ~org-agenda-bulk-remove-all-marks~ ::
9092 Unmark all marked entries for bulk action.
9094 - {{{kbd(B)}}}, ~org-agenda-bulk-action~ ::
9097 Bulk action: act on all marked entries in the agenda. This will prompt
9098 for another key to select the action to be applied. The prefix arg to
9099 {{{kbd(B)}}} will be passed through to the {{{kbd(s)}}} and
9100 {{{kbd(d)}}} commands, to bulk-remove these special timestamps. By
9101 default, marks are removed after the bulk. If you want them to
9102 persist, set ~org-agenda-bulk-persistent-marks~ to ~t~ or hit
9103 {{{kbd(p)}}} at the prompt.
9107 Toggle persistent marks.
9111 Archive all selected entries.
9115 Archive entries by moving them to their respective archive siblings.
9119 Change TODO state. This prompts for a single TODO keyword and changes
9120 the state of all selected entries, bypassing blocking and suppressing
9121 logging notes (but not timestamps).
9125 Add a tag to all selected entries.
9129 Remove a tag from all selected entries.
9133 Schedule all items to a new date. To shift existing schedule dates by
9134 a fixed number of days, use something starting with double plus at the
9135 prompt, for example {{{samp(++8d)}}} or {{{samp(++2w)}}}.
9139 Set deadline to a specific date.
9143 Prompt for a single refile target and move all entries. The entries
9144 will no longer be in the agenda; refresh ({{{kbd(g)}}}) to bring them
9149 Reschedule randomly into the coming N days. N will be prompted for.
9150 With prefix arg ({{{kbd(C-u B S)}}}), scatter only across weekdays.
9154 Apply a function to marked entries.[fn:96] For example, the function
9155 below sets the CATEGORY property of the entries to web.
9158 #+header: :exports code
9159 #+begin_src emacs-lisp
9160 (defun set-category ()
9162 (let* ((marker (or (org-get-at-bol 'org-hd-marker)
9163 (org-agenda-error)))
9164 (buffer (marker-buffer marker)))
9165 (with-current-buffer buffer
9170 (org-back-to-heading t)
9171 (org-set-property "CATEGORY" "web"))))))
9174 *** Calendar commands
9175 #+cindex: calendar commands, from agenda
9177 #+attr_texinfo: :table-type table :indic @asis
9178 - {{{kbd(c)}}}, ~org-agenda-goto-calendar~ ::
9181 Open the Emacs calendar and move to the date at the agenda cursor.
9183 - {{{kbd(c)}}}, ~org-calendar-goto-agenda~ ::
9186 When in the calendar, compute and show the Org mode agenda for the
9189 - {{{kbd(i)}}}, ~org-agenda-diary-entry~ ::
9191 #+vindex: org-agenda-diary-file
9192 #+cindex: diary entries, creating from agenda
9194 Insert a new entry into the diary, using the date at the cursor and
9195 (for block entries) the date at the mark. This will add to the Emacs
9196 diary file, in a way similar to the {{{kbd(i)}}} command in the
9197 calendar.[fn:97] The diary file will pop up in another window, where
9198 you can add the entry.
9200 If you configure ~org-agenda-diary-file~ to point to an Org mode file,
9201 Org will create entries (in Org mode syntax) in that file instead.
9202 Most entries will be stored in a date-based outline tree that will
9203 later make it easy to archive appointments from previous months/years.
9204 The tree will be built under an entry with a ~DATE_TREE~ property, or
9205 else with years as top-level entries. Emacs will prompt you for the
9206 entry text---if you specify it, the entry will be created in
9207 ~org-agenda-diary-file~ without further interaction. If you directly
9208 press {{{key(RET)}}} at the prompt without typing text, the target
9209 file will be shown in another window for you to finish the entry
9210 there. See also the {{{kbd(k r)}}} command.
9212 - {{{kbd(M)}}}, ~org-agenda-phases-of-moon~ ::
9215 Show the phases of the moon for the three months around current date.
9217 - {{{kbd(S)}}}, ~org-agenda-sunrise-sunset~ ::
9220 Show sunrise and sunset times. The geographical location must be set
9221 with calendar variables, see the documentation for the Emacs calendar.
9223 - {{{kbd(C)}}}, ~org-agenda-convert-date~ ::
9226 Convert the date at cursor into many other cultural and historic
9229 - {{{kbd(H)}}}, ~org-agenda-holidays~ ::
9232 Show holidays for three months around the cursor date.
9234 - {{{kbd(M-x org-export-icalendar-combine-agenda-files)}}} ::
9236 Export a single iCalendar file containing entries from all agenda
9237 files. This is a globally available command, and also available in the
9240 *** Exporting to a file
9241 #+attr_texinfo: :table-type table :indic @asis
9242 - {{{kbd(C-x C-w)}}}, ~org-agenda-write~ ::
9244 #+cindex: exporting agenda views
9245 #+cindex: agenda views, exporting
9246 #+vindex: org-agenda-exporter-settings
9248 Write the agenda view to a file. Depending on the extension of the
9249 selected file name, the view will be exported as HTML (extension
9250 {{{file(.html)}}} or {{{file(.htm)}}}), Postscript (extension
9251 {{{file(.ps)}}}), PDF (extension {{{file(.pdf)}}}), and plain text
9252 (any other extension). When called with a {{{kbd(C-u)}}} prefix
9253 argument, immediately open the newly created file. Use the variable
9254 ~org-agenda-exporter-settings~ to set options for {{{file(ps-print)}}}
9255 and for {{{file(htmlize)}}} to be used during export.
9258 #+attr_texinfo: :table-type table :indic @asis
9259 - {{{kbd(q)}}}, ~org-agenda-quit~ ::
9262 Quit agenda, remove the agenda buffer.
9264 - {{{kbd(x)}}}, ~org-agenda-exit~ ::
9266 #+cindex: agenda files, removing buffers
9268 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
9269 for the compilation of the agenda. Buffers created by the user to
9270 visit Org files will not be removed.
9272 ** Custom agenda views
9274 :DESCRIPTION: Defining special searches and views
9276 #+cindex: custom agenda views
9277 #+cindex: agenda views, custom
9279 Custom agenda commands serve two purposes: to store and quickly access
9280 frequently used TODO and tags searches, and to create special composite
9281 agenda buffers. Custom agenda commands will be accessible through the
9282 dispatcher (see [[Agenda dispatcher]]), just like the default commands.
9284 *** Storing searches
9286 :DESCRIPTION: Type once, use often
9289 The first application of custom searches is the definition of keyboard
9290 shortcuts for frequently used searches, either creating an agenda
9291 buffer, or a sparse tree (the latter covering of course only the
9295 #+vindex: org-agenda-custom-commands
9297 Custom commands are configured in the variable
9298 ~org-agenda-custom-commands~. You can customize this variable, for
9299 example by pressing {{{kbd(C-c a C)}}}. You can also directly set it
9300 with Emacs Lisp in {{{file(.emacs)}}}. The following example contains
9301 all valid search types:
9304 #+header: :exports code
9305 #+begin_src emacs-lisp
9306 (setq org-agenda-custom-commands
9307 '(("w" todo "WAITING")
9308 ("W" todo-tree "WAITING")
9309 ("u" tags "+boss-urgent")
9310 ("v" tags-todo "+boss-urgent")
9311 ("U" tags-tree "+boss-urgent")
9312 ("f" occur-tree "\\<FIXME\\>")
9313 ("h" . "HOME+Name tags searches") ; description for "h" prefix
9314 ("hl" tags "+home+Lisa")
9315 ("hp" tags "+home+Peter")
9316 ("hk" tags "+home+Kim")))
9319 {{{noindent}}} The initial string in each entry defines the keys you
9320 have to press after the dispatcher command {{{kbd(C-c a)}}} in order
9321 to access the command. Usually this will be just a single character,
9322 but if you have many similar commands, you can also define two-letter
9323 combinations where the first character is the same in several
9324 combinations and serves as a prefix key.[fn:98] The second parameter
9325 is the search type, followed by the string or regular expression to be
9326 used for the matching. The example above will therefore define:
9328 #+attr_texinfo: :table-type table :indic @kbd
9331 A global search for TODO entries with {{{samp(WAITING)}}} as the TODO
9336 The same search, but only in the current buffer and displaying the
9337 results as a sparse tree.
9341 A global tags search for headlines marked {{{samp(:boss:)}}} but not
9342 {{{samp(:urgent:)}}}.
9346 The same search as {{{kbd(C-c a u)}}}, but limiting the search to
9347 headlines that are also TODO items.
9351 The same search as {{{kbd(C-c a u)}}}, but only in the current buffer and
9352 displaying the result as a sparse tree.
9356 Create a sparse tree (again: current buffer only) with all entries
9357 containing the word {{{samp(FIXME)}}}
9361 A prefix command for a HOME tags search where you have to press an
9362 additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or {{{kbd(k)}}}) to select
9363 a name (Lisa, Peter, or Kim) as additional tag to match.
9368 :DESCRIPTION: All the stuff you need in a single buffer
9370 #+cindex: block agenda
9371 #+cindex: agenda, with block views
9373 Another possibility is the construction of agenda views that comprise
9374 the results of /several/ commands, each of which creates a block in
9375 the agenda buffer. The available commands include ~agenda~ for the
9376 daily or weekly agenda (as created with {{{kbd(C-c a a)}}}), ~alltodo~
9377 for the global TODO list (as constructed with {{{kbd(C-c a t)}}}), and
9378 the matching commands discussed above: ~todo~, ~tags~, and
9379 ~tags-todo~. Here are two examples:
9382 #+header: :exports code
9383 #+begin_src emacs-lisp
9384 (setq org-agenda-custom-commands
9385 '(("h" "Agenda and Home-related tasks"
9389 ("o" "Agenda and Office-related tasks"
9395 {{{noindent}}} This will define {{{kbd(C-c a h)}}} to create a
9396 multi-block view for stuff you need to attend to at home. The
9397 resulting agenda buffer will contain your agenda for the current week,
9398 all TODO items that carry the tag {{{samp(home)}}}, and also all lines
9399 tagged with {{{samp(garden)}}}. Finally the command {{{kbd(C-c a o)}}}
9400 provides a similar view for office tasks.
9402 *** Setting options for custom commands
9404 :DESCRIPTION: Changing the rules
9406 #+cindex: options, for custom agenda views
9407 #+vindex: org-agenda-custom-commands
9409 Org mode contains a number of variables regulating agenda construction
9410 and display. The global variables define the behavior for all agenda
9411 commands, including the custom commands. However, if you want to
9412 change some settings just for a single custom view, you can do so.
9413 Setting options requires inserting a list of variable names and values
9414 at the right spot in ~org-agenda-custom-commands~. For example:
9417 #+header: :exports code
9418 #+begin_src emacs-lisp
9419 (setq org-agenda-custom-commands
9420 '(("w" todo "WAITING"
9421 ((org-agenda-sorting-strategy '(priority-down))
9422 (org-agenda-prefix-format " Mixed: ")))
9423 ("U" tags-tree "+boss-urgent"
9424 ((org-show-following-heading nil)
9425 (org-show-hierarchy-above nil)))
9427 ((org-agenda-files '("~org/notes.org"))
9428 (org-agenda-text-search-extra-files nil)))))
9431 {{{noindent}}} Now the {{{kbd(C-c a w)}}} command will sort the
9432 collected entries only by priority, and the prefix format is modified
9433 to just say {{{samp( Mixed: )}}} instead of giving the category of the
9434 entry. The sparse tags tree of {{{kbd(C-c a U)}}} will now turn out
9435 ultra-compact, because neither the headline hierarchy above the match,
9436 nor the headline following the match will be shown. The command
9437 {{{kbd(C-c a N)}}} will do a text search limited to only a single
9440 #+vindex: org-agenda-custom-commands
9442 For command sets creating a block agenda, ~org-agenda-custom-commands~
9443 has two separate spots for setting options. You can add options that
9444 should be valid for just a single command in the set, and options that
9445 should be valid for all commands in the set. The former are just added
9446 to the command entry; the latter must come after the list of command
9447 entries. Going back to the block agenda example (see [[Block
9448 agenda]]), let's change the sorting strategy for the {{{kbd(C-c a
9449 h)}}} commands to ~priority-down~, but let's sort the results for
9450 GARDEN tags query in the opposite order, ~priority-up~. This would
9454 #+header: :exports code
9455 #+begin_src emacs-lisp
9456 (setq org-agenda-custom-commands
9457 '(("h" "Agenda and Home-related tasks"
9461 ((org-agenda-sorting-strategy '(priority-up)))))
9462 ((org-agenda-sorting-strategy '(priority-down))))
9463 ("o" "Agenda and Office-related tasks"
9469 As you see, the values and parentheses setting is a little complex.
9470 When in doubt, use the customize interface to set this variable---it
9471 fully supports its structure. Just one caveat: when setting options in
9472 this interface, the /values/ are just Lisp expressions. So if the
9473 value is a string, you need to add the double-quotes around the value
9476 #+vindex: org-agenda-custom-commands-contexts
9478 To control whether an agenda command should be accessible from a
9479 specific context, you can customize
9480 ~org-agenda-custom-commands-contexts~. Let's say for example that you
9481 have an agenda command {{{kbd(o)}}} displaying a view that you only
9482 need when reading emails. Then you would configure this option like
9486 #+header: :exports code
9487 #+begin_src emacs-lisp
9488 (setq org-agenda-custom-commands-contexts
9489 '(("o" (in-mode . "message-mode"))))
9492 You can also tell that the command key {{{kbd(o)}}} should refer to another
9493 command key {{{kbd(r)}}}. In that case, add this command key like this:
9496 #+header: :exports code
9497 #+begin_src emacs-lisp
9498 (setq org-agenda-custom-commands-contexts
9499 '(("o" "r" (in-mode . "message-mode"))))
9502 See the docstring of the variable for more information.
9504 ** Exporting agenda views
9506 :DESCRIPTION: Writing a view to a file
9508 #+cindex: agenda views, exporting
9510 If you are away from your computer, it can be very useful to have a
9511 printed version of some agenda views to carry around. Org mode can
9512 export custom agenda views as plain text, HTML, Postscript,
9513 PDF, and iCalendar files.[fn:99] If you want to
9514 do this only occasionally, use the following command:
9516 #+attr_texinfo: :table-type table :indic @asis
9517 - {{{kbd(C-x C-w)}}}, ~org-agenda-write~ ::
9519 #+cindex: exporting agenda views
9520 #+cindex: agenda views, exporting
9521 #+vindex: org-agenda-exporter-settings
9523 Write the agenda view to a file. Depending on the extension of the
9524 selected file name, the view will be exported as HTML (extension
9525 {{{file(.html)}}} or {{{file(.htm)}}}), Postscript (extension
9526 {{{file(.ps)}}}), iCalendar (extension {{{file(.ics)}}}), or plain
9527 text (any other extension). Use the variable
9528 ~org-agenda-exporter-settings~ to set options for {{{file(ps-print)}}}
9529 and for {{{file(htmlize)}}} to be used during export, for example:
9531 #+vindex: org-agenda-add-entry-text-maxlines
9532 #+vindex: htmlize-output-type
9533 #+vindex: ps-number-of-columns
9534 #+vindex: ps-landscape-mode
9537 #+header: :exports code
9538 #+begin_src emacs-lisp
9539 (setq org-agenda-exporter-settings
9540 '((ps-number-of-columns 2)
9541 (ps-landscape-mode t)
9542 (org-agenda-add-entry-text-maxlines 5)
9543 (htmlize-output-type 'css)))
9547 If you need to export certain agenda views frequently, you can
9548 associate any custom agenda command with a list of output file
9549 names.[fn:100] Here is an example that first defines custom commands
9550 for the agenda and the global TODO list, together with a number of
9551 files to which to export them. Then we define two block agenda
9552 commands and specify file names for them as well. File names can be
9553 relative to the current working directory, or absolute.
9556 #+header: :exports code
9557 #+begin_src emacs-lisp
9558 (setq org-agenda-custom-commands
9559 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
9560 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
9561 ("h" "Agenda and Home-related tasks"
9566 ("~/views/home.html"))
9567 ("o" "Agenda and Office-related tasks"
9572 ("~/views/office.ps" "~/calendars/office.ics"))))
9575 The extension of the file name determines the type of export. If it is
9576 {{{file(.html)}}}, Org mode will use the {{{file(htmlize.el)}}}
9577 package to convert the buffer to HTML and save it to this file name.
9578 If the extension is {{{file(.ps)}}}, ~ps-print-buffer-with-faces~ is
9579 used to produce Postscript output. If the extension is
9580 {{{file(.ics)}}}, iCalendar export is run export over all files that
9581 were used to construct the agenda, and limit the export to entries
9582 listed in the agenda. Any other extension produces a plain ASCII file.
9584 The export files are /not/ created when you use one of those
9585 commands interactively because this might use too much overhead.
9586 Instead, there is a special command to produce /all/ specified
9589 #+attr_texinfo: :table-type table :indic @asis
9590 - {{{kbd(C-c a e)}}}, ~org-store-agenda-views~ ::
9592 Export all agenda views that have export file names associated with
9596 You can use the options section of the custom agenda commands to also
9597 set options for the export commands. For example:
9600 #+header: :exports code
9601 #+begin_src emacs-lisp
9602 (setq org-agenda-custom-commands
9604 ((ps-number-of-columns 2)
9605 (ps-landscape-mode t)
9606 (org-agenda-prefix-format " [ ] ")
9607 (org-agenda-with-colors nil)
9608 (org-agenda-remove-tags t))
9612 {{{noindent}}} This command sets two options for the Postscript
9613 exporter, to make it print in two columns in landscape format---the
9614 resulting page can be cut in two and then used in a paper agenda. The
9615 remaining settings modify the agenda prefix to omit category and
9616 scheduling information, and instead include a checkbox to check off
9617 items. We also remove the tags to make the lines compact, and we don't
9618 want to use colors for the black-and-white printer. Settings specified
9619 in ~org-agenda-exporter-settings~ will also apply, but the settings in
9620 ~org-agenda-custom-commands~ take precedence.
9622 {{{noindent}}} From the command line you may also use:
9625 emacs -eval (org-batch-store-agenda-views) -kill
9628 {{{noindent}}} or, if you need to modify some parameters:[fn:101]
9631 emacs -eval '(org-batch-store-agenda-views \
9632 org-agenda-span (quote month) \
9633 org-agenda-start-day "2007-11-01" \
9634 org-agenda-include-diary nil \
9635 org-agenda-files (quote ("~/org/project.org")))' \
9639 {{{noindent}}} which will create the agenda views restricted to the
9640 file {{{file(~/org/project.org)}}}, without diary entries and with a
9643 You can also extract agenda information in a way that allows further
9644 processing by other programs. See [[Extracting agenda information]], for
9647 ** Using column view in the agenda
9649 :DESCRIPTION: Using column view for collected entries
9650 :ALT_TITLE: Agenda column view
9652 #+cindex: column view, in agenda
9653 #+cindex: agenda, column view
9654 <<Agenda column view>>
9656 Column view (see [[Column view]]) is normally used to view and edit
9657 properties embedded in the hierarchical structure of an Org file. It
9658 can be quite useful to use column view also from the agenda, where
9659 entries are collected by certain criteria.
9661 #+attr_texinfo: :table-type table :indic @asis
9662 - {{{kbd(C-c C-x C-c)}}}, ~org-agenda-columns~ ::
9664 Turn on column view in the agenda.
9667 To understand how to use this properly, it is important to realize that the
9668 entries in the agenda are no longer in their proper outline environment.
9669 This causes the following issues:
9671 1. Org needs to make a decision which ~COLUMNS~ format to use. Since
9672 the entries in the agenda are collected from different files, and
9673 different files may have different ~COLUMNS~ formats, this is a
9674 non-trivial problem. Org first checks if the variable
9675 ~org-agenda-overriding-columns-format~ is currently set, and if so,
9676 takes the format from there. Otherwise it takes the format
9677 associated with the first item in the agenda, or, if that item does
9678 not have a specific format (defined in a property, or in its file),
9679 it uses ~org-columns-default-format~.
9681 #+vindex: org-columns-default-format
9682 #+vindex: org-overriding-columns-format
9684 2. If any of the columns has a summary type defined (see [[Column
9685 attributes]]), turning on column view in the agenda will visit all
9686 relevant agenda files and make sure that the computations of this
9687 property are up to date. This is also true for the special
9688 ~CLOCKSUM~ property. Org will then sum the values displayed in the
9689 agenda. In the daily/weekly agenda, the sums will cover a single
9690 day; in all other views they cover the entire block. It is vital to
9691 realize that the agenda may show the same entry /twice/ (for
9692 example as scheduled and as a deadline), and it may show two
9693 entries from the same hierarchy (for example a /parent/ and its
9694 /child/). In these cases, the summation in the agenda will lead to
9695 incorrect results because some values will count double.
9697 #+cindex: property, special, CLOCKSUM
9699 3. When the column view in the agenda shows the ~CLOCKSUM~, that is
9700 always the entire clocked time for this item. So even in the
9701 daily/weekly agenda, the clocksum listed in column view may
9702 originate from times outside the current view. This has the
9703 advantage that you can compare these values with a column listing
9704 the planned total effort for a task---one of the major applications
9705 for column view in the agenda. If you want information about
9706 clocked time in the displayed period use clock table mode (press
9707 {{{kbd(R)}}} in the agenda).
9709 4. When the column view in the agenda shows the ~CLOCKSUM_T~, that is
9710 always today's clocked time for this item. So even in the weekly agenda,
9711 the clocksum listed in column view only originates from today. This lets
9712 you compare the time you spent on a task for today, with the time already
9713 spent (via ~CLOCKSUM~) and with the planned total effort for it.
9715 #+cindex: property, special, CLOCKSUM_T
9717 * FIXME Markup for rich export
9719 :DESCRIPTION: Prepare text for rich export
9723 When exporting Org mode documents, the exporter tries to reflect the
9724 structure of the document as accurately as possible in the backend.
9725 Since export targets like HTML, LaTeX, or DocBook allow much richer
9726 formatting, Org mode has rules on how to prepare text for rich export.
9727 This section summarizes the markup rules used in an Org mode buffer.
9729 ** Structural markup elements
9731 :DESCRIPTION: The basic structure as seen by the exporter
9736 :DESCRIPTION: Where the title is taken from
9738 #+cindex: document title, markup rules
9740 {{{noindent}}} The title of the exported document is taken from the
9745 ,#+TITLE: This is the title of the document
9748 {{{noindent}}} If this line does not exist, the title is derived from
9749 the first non-empty, non-comment line in the buffer. If no such line
9750 exists, or if you have turned off exporting of the text before the
9751 first headline (see below), the title will be the file name without
9754 #+cindex: property, EXPORT_TITLE
9756 If you are exporting only a subtree by marking is as the region, the
9757 heading of the subtree will become the title of the document. If the
9758 subtree has a property ~EXPORT_TITLE~, that will take precedence.
9760 *** Headings and sections
9762 :DESCRIPTION: The document structure as seen by the exporter
9764 #+cindex: headings and sections, markup rules
9766 #+vindex: org-export-headline-levels
9768 The outline structure of the document as described in [[Document
9769 structure]], forms the basis for defining sections of the exported
9770 document. However, since the outline structure is also used for (for
9771 example) lists of tasks, only the first three outline levels will be
9772 used as headings. Deeper levels will become itemized lists. You can
9773 change the location of this switch globally by setting the variable
9774 ~org-export-headline-levels~, or on a per-file basis with the ~H~ option:
9781 *** Table of contents
9783 :DESCRIPTION: The if and where of the table of contents
9785 #+cindex: table of contents, markup rules
9787 #+vindex: org-export-with-toc
9789 The table of contents is normally inserted directly before the first
9790 headline of the file. If you would like to get it to a different
9791 location, insert the string ~[TABLE-OF-CONTENTS]~ on a line by itself
9792 at the desired location. The depth of the table of contents is by
9793 default the same as the number of headline levels, but you can choose
9794 a smaller number, or turn off the table of contents entirely, by
9795 configuring the variable ~org-export-with-toc~, or on a per-file basis
9796 with the ~toc~ option:
9799 ,#+OPTIONS: toc:2 (only to two levels in TOC)
9800 ,#+OPTIONS: toc:nil (no TOC at all)
9805 :DESCRIPTION: Text before the first heading?
9806 :TITLE: Text before the first headline
9808 #+cindex: text before first headline, markup rules
9811 Org mode normally exports the text before the first headline, and even uses
9812 the first line as the document title. The text will be fully marked up. If
9813 you need to include literal HTML, LaTeX, or DocBook code, use the special
9814 constructs described below in the sections for the individual exporters.
9816 #+vindex: org-export-skip-text-before-1st-heading
9818 Some people like to use the space before the first headline for setup
9819 and internal links and therefore would like to control the exported
9820 text before the first headline in a different way. You can do so by
9821 setting the variable ~org-export-skip-text-before-1st-heading~ to ~t~.
9822 On a per-file basis, you can get the same effect with
9823 {{{samp(#+OPTIONS: skip:t)}}}.
9827 If you still want to have some text before the first headline, use the
9832 ,#+TEXT: This text will go before the *first* headline.
9833 ,#+TEXT: [TABLE-OF-CONTENTS]
9834 ,#+TEXT: This goes between the table of contents and the *first* headline
9841 #+cindex: lists, markup rules
9843 Plain lists as described in [[Plain lists]], are translated to the
9844 backend's syntax for such lists. Most backends support unordered,
9845 ordered, and description lists.
9849 :DESCRIPTION: Paragraphs
9851 #+cindex: paragraphs, markup rules
9853 Paragraphs are separated by at least one empty line. If you need to
9854 enforce a line break within a paragraph, use ~\\~ at the end
9857 To keep the line breaks in a region, but otherwise use normal
9858 formatting, you can use ~VERSE~ blocks, which can also be used to
9861 #+cindex: #+BEGIN_VERSE
9864 Great clouds overhead
9865 Tiny black birds rise and fall
9872 When quoting a passage from another document, it is customary to
9873 format this as a paragraph that is indented on both the left and the
9874 right margin. You can include quotations in Org mode documents like
9877 #+cindex: #+BEGIN_QUOTE
9880 Everything should be made as simple as possible,
9881 but not any simpler -- Albert Einstein
9885 If you would like to center some text, do it like this:
9886 #+cindex: #+BEGIN_CENTER
9889 Everything should be made as simple as possible, \\
9896 :DESCRIPTION: Footnotes
9898 #+cindex: footnotes, markup rules
9899 #+cindex: @file{footnote.el}
9901 Footnotes defined in the way described in [[Creating footnotes]], will be exported
9902 by all backends. Org allows multiple references to the same note, and
9903 multiple footnotes side by side.
9905 *** Emphasis and monospace
9907 :DESCRIPTION: Bold, italic, etc.
9910 #+cindex: underlined text, markup rules
9911 #+cindex: bold text, markup rules
9912 #+cindex: italic text, markup rules
9913 #+cindex: verbatim text, markup rules
9914 #+cindex: code text, markup rules
9915 #+cindex: strike-through text, markup rules
9917 You can make words **bold**, //italic//, _underlined_, ~=code=~
9918 and ~~verbatim~~, and, if you must, {{{samp(+strike-through+)}}}. Text
9919 in the code and verbatim string is not processed for Org mode specific
9920 syntax; it is exported verbatim.
9922 *** Horizontal rules
9924 :DESCRIPTION: Make a line
9926 #+cindex: horizontal rules, markup rules
9928 A line consisting of only dashes, and at least 5 of them, will be
9929 exported as a horizontal line (~<hr/>~ in HTML and ~\hrule~
9934 :DESCRIPTION: What will *not* be exported
9936 #+cindex: comment lines
9937 #+cindex: exporting, not
9938 #+cindex: #+BEGIN_COMMENT
9940 Lines starting with zero or more whitespace characters followed by one
9941 {{{samp(#)}}} and a whitespace are treated as comments and will never
9942 be exported. Also entire subtrees starting with the word
9943 {{{samp(COMMENT)}}} will never be exported. Finally, regions
9944 surrounded by {{{samp(#+BEGIN_COMMENT)}}} ...
9945 {{{samp(#+END_COMMENT)}}} will not be exported.
9947 #+attr_texinfo: :table-type table :indic @asis
9948 - {{{kbd(C-c ;)}}} ::
9951 Toggle the COMMENT keyword at the beginning of an entry.
9953 ** Images and tables
9955 :DESCRIPTION: Tables and images can be exported
9958 #+cindex: tables, markup rules
9962 Both the native Org mode tables (see [[Tables]]) and tables formatted with
9963 the {{{file(table.el)}}} package will be exported properly. For Org
9964 mode tables, the lines before the first horizontal separator line will
9965 become table header lines. You can use the following lines somewhere
9966 before the table to assign a caption and a label for cross references,
9967 and in the text you can refer to the object with
9968 ~\ref{tab:basic-data}~:
9971 #+CAPTION: This is the caption for the next table (or link)
9972 #+LABEL: tab:basic-data
9977 Optionally, the caption can take the form:
9979 #+CAPTION: [Caption for list of figures]{Caption for table (or link).}
9982 #+cindex: inlined images, markup rules
9984 Some backends (HTML, LaTeX, and DocBook) allow you to directly
9985 include images into the exported document. Org does this, if a link to
9986 an image files does not have a description part, for example
9987 ~[[./img/a.jpg]]~. If you wish to define a caption for the image and maybe
9988 a label for internal cross references, make sure that the link is on a
9989 line by itself and precede it with ~#+CAPTION~ and ~#+LABEL~ as
9993 #+CAPTION: This is the caption for the next figure link (or table)
9994 #+LABEL: fig:SED-HR4049
9998 You may also define additional attributes for the figure. As this is
9999 backend-specific, see the sections about the individual backends for
10002 See [[Handling links][the discussion of image links]].
10004 ** Literal examples
10006 :DESCRIPTION: Source code examples with special formatting
10008 #+cindex: literal examples, markup rules
10009 #+cindex: code line references, markup rules
10011 You can include literal examples that should not be subjected to
10012 markup. Such examples will be typeset in monospace, so this is well
10013 suited for source code and similar examples.
10014 #+cindex: #+BEGIN_EXAMPLE
10018 Some example from a text file.
10022 Note that such blocks may be /indented/ in order to align nicely with
10023 indented text and in particular with plain list structure (see [[Plain
10024 lists]]). For simplicity when using small examples, you can also start
10025 the example lines with a colon followed by a space. There may also be
10026 additional whitespace before the colon:
10030 : Some example from a text file.
10033 #+cindex: formatting source code, markup rules
10035 If the example is source code from a programming language, or any
10036 other text that can be marked up by font-lock in Emacs, you can ask
10037 for the example to look like the fontified Emacs buffer.[fn:102] This
10038 is done with the {{{samp(src)}}} block, where you also need to specify
10039 the name of the major mode that should be used to fontify the example,
10040 see [[Easy templates]] for shortcuts to easily insert code blocks.[fn:103]
10042 #+cindex: #+BEGIN_SRC
10045 #+BEGIN_SRC emacs-lisp
10046 (defun org-xor (a b)
10052 Both in ~example~ and in ~src~ snippets, you can add a ~-n~ switch to
10053 the end of the ~BEGIN~ line, to get the lines of the example numbered.
10054 If you use a ~+n~ switch, the numbering from the previous numbered
10055 snippet will be continued in the current one. In literal examples, Org
10056 will interpret strings like {{{samp((ref:name))}}} as labels, and use
10057 them as targets for special hyperlinks like ~[[(name)]]~ (i.e., the
10058 reference name enclosed in single parenthesis). In HTML, hovering the
10059 mouse over such a link will remote-highlight the corresponding code
10060 line, which is kind of cool.
10062 You can also add a ~-r~ switch which /removes/ the labels from the
10063 source code.[fn:104] With the ~-n~ switch, links to these references
10064 will be labeled by the line numbers from the code listing, otherwise
10065 links will use the labels with no parentheses. Here is an example:
10068 #+BEGIN_SRC emacs-lisp -n -r
10069 (save-excursion (ref:sc)
10070 (goto-char (point-min)) (ref:jump)
10072 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
10073 jumps to point-min.
10076 #+vindex: org-coderef-label-format
10078 If the syntax for the label format conflicts with the language syntax,
10079 use a ~-l~ switch to change the format, for example
10080 {{{samp(#+BEGIN_SRC pascal -n -r -l "((%s))")}}}. See also the
10081 variable ~org-coderef-label-format~.
10083 HTML export also allows examples to be published as text areas
10084 (see [[Text areas in HTML export]]).
10086 Because the ~#+BEGIN_...~ and ~#+END_...~ patterns need to be added so
10087 often, shortcuts are provided using the Easy Templates facility (see
10088 [[Easy templates]]).
10090 #+attr_texinfo: :table-type table :indic @asis
10091 - {{{kbd(C-c ')}}} ::
10094 Edit the source code example at point in its native mode. This works
10095 by switching to a temporary buffer with the source code. You need to
10096 exit by pressing {{{kbd(C-c ')}}} again.[fn:105] The edited version
10097 will then replace the old version in the Org buffer. Fixed-width
10098 regions (where each line starts with a colon followed by a space) will
10099 be edited using ~artist-mode~ to allow creating ASCII drawings
10100 easily.[fn:106] Using this command in an empty line will create a new
10101 fixed-width region.
10103 - {{{kbd(C-c l)}}} ::
10106 Calling ~org-store-link~ while editing a source code example in a
10107 temporary buffer created with {{{kbd(C-c ')}}} will prompt for a
10108 label. Make sure that it is unique in the current buffer, and insert
10109 it with the proper formatting like {{{samp((ref:label))}}} at the end
10110 of the current line. Then the label is stored as a link
10111 {{{samp((label))}}}, for retrieval with {{{kbd(C-c C-l)}}}.
10115 :DESCRIPTION: Include additional files into a document
10117 #+cindex: include files, markup rules
10119 During export, you can include the content of another file. For
10120 example, to include your {{{file(.emacs)}}} file, you could use:
10122 #+cindex: #+INCLUDE
10125 ,#+INCLUDE: "~/.emacs" src emacs-lisp
10128 {{{noindent}}} The optional second and third parameter are the markup
10129 (e.g., {{{samp(quote)}}}, {{{samp(example)}}}, or {{{samp(src)}}}),
10130 and, if the markup is {{{samp(src)}}}, the language for formatting the
10131 contents. The markup is optional; if it is not given, the text will be
10132 assumed to be in Org mode format and will be processed normally. The
10133 include line will also allow additional keyword parameters ~:prefix1~
10134 and ~:prefix~ to specify prefixes for the first line and for each
10135 following line, ~:minlevel~ in order to get Org mode content demoted
10136 to a specified level, as well as any options accepted by the selected
10137 markup. For example, to include a file as an item, use:
10140 ,#+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
10143 You can also include a portion of a file by specifying a lines range
10144 using the ~:lines~ parameter. The line at the upper end of the range
10145 will not be included. The start and/or the end of the range may be
10146 omitted to use the obvious defaults.
10148 #+attr_texinfo: :table-type table :indic @asis
10149 - #+INCLUDE: "~/.emacs" :lines "5-10" ::
10151 Include lines 5 to 10, 10 excluded.
10153 - #+INCLUDE: "~/.emacs" :lines "-10" ::
10155 Include lines 1 to 10, 10 excluded.
10157 - #+INCLUDE: "~/.emacs" :lines "10-" ::
10159 Include lines from 10 to EOF.
10162 #+attr_texinfo: :table-type table :indic @asis
10166 Visit the include file at point.
10170 :DESCRIPTION: Making an index
10172 #+cindex: index entries, for publishing
10174 You can specify entries that will be used for generating an index
10175 during publishing. This is done by lines starting with ~#+INDEX~. An
10176 entry the contains an exclamation mark will create a sub item. See
10177 [[Generating an index]] for more information.
10180 ,* Curriculum Vitae
10182 #+INDEX: Application!CV
10185 ** Macro replacement
10187 :DESCRIPTION: Use macros to create complex output
10189 #+cindex: macro replacement, during export
10192 You can define text snippets with a macro:
10195 ,#+MACRO: name replacement text $1, $2 are arguments
10198 {{{noindent}}} which can be referenced anywhere in the document (even in
10199 code examples) with ~{{{name(arg1,arg2)}}}~. In addition to
10200 defined macros, ~{{{title}}}~, ~{{{author}}}~, etc.,
10201 will reference information set by the ~#+TITLE:~, ~#+AUTHOR:~, and
10202 similar lines. Also, ~{{{date(FORMAT)}}}~ and
10203 ~{{{modification-time(FORMAT)}}}~ refer to current date time
10204 and to the modification time of the file being exported, respectively.
10205 ~FORMAT~ should be a format string understood by
10206 ~format-time-string~.
10208 Macro expansion takes place during export, and some people use it to
10209 construct complex HTML code.
10211 ** FIXME Embedded LaTeX
10213 :DESCRIPTION: LaTeX can be freely used inside Org documents
10214 :ALT_TITLE: Embedded Latex
10216 #+cindex: @TeX{} interpretation
10217 #+cindex: @LaTeX{} interpretation
10219 Plain ASCII is normally sufficient for almost all note taking.
10220 Exceptions include scientific notes, which often require mathematical
10221 symbols and the occasional formula. LaTeX is widely used to typeset
10222 scientific documents.[fn:107] Org mode supports embedding LaTeX
10223 code into its files, because many academics are used to writing and
10224 reading LaTeX source code, and because it can be readily processed
10225 to produce pretty output for a number of export backends.
10227 *** Special symbols
10229 :DESCRIPTION: Greek letters and other symbols
10231 #+cindex: math symbols
10232 #+cindex: special symbols
10233 #+cindex: @TeX{} macros
10234 #+cindex: @LaTeX{} fragments, markup rules
10235 #+cindex: HTML entities
10236 #+cindex: @LaTeX{} entities
10238 You can use LaTeX macros to insert special symbols like
10239 ~\alpha~ to indicate the Greek letter, or ~\to~ to
10240 indicate an arrow. Completion for these macros is available, just type
10241 ~\~ and maybe a few letters, and press {{{kbdkey(M-,TAB)}}}
10242 to see possible completions. Unlike LaTeX code, Org mode allows
10243 these macros to be present without surrounding math delimiters, for
10247 Angles are written as Greek letters \alpha, \beta and \gamma.
10250 #+vindex: org-entities
10252 During export, these symbols will be transformed into the native
10253 format of the exporter backend. Strings like ~\alpha~ will be exported
10254 as ~α~ in the HTML output, and as ~$\alpha$~ in the LaTeX
10255 output. Similarly, ~\nbsp~ will become ~ ~ in HTML and ~~~ in
10256 LaTeX. If you need such a symbol inside a word, terminate it like
10257 this: ~\Aacute{}stor~.
10259 A large number of entities is provided, with names taken from both
10260 HTML and LaTeX; see the variable ~org-entities~ for the complete
10261 list. ~\-~ is treated as a shy hyphen, and {{{samp(--)}}},
10262 {{{samp(---)}}}, and {{{samp(...)}}} are all converted into special
10263 commands creating hyphens of different lengths or a compact set of
10266 If you would like to see entities displayed as UTF8 characters, use the
10267 following command:[fn:108]
10269 #+attr_texinfo: :table-type table :indic @asis
10270 - {{{kbd(C-c C-x XXX)}}} ::
10271 #+kindex: C-c C-x XXX
10273 Toggle display of entities as UTF-8 characters. This does not change
10274 the buffer content which remains plain ASCII, but it overlays the
10275 UTF-8 character for display purposes only.
10277 *** FIXME Subscripts and superscripts
10279 :DESCRIPTION: Simple syntax for raising/lowering text
10281 #+cindex: subscript
10282 #+cindex: superscript
10284 Just like in LaTeX, {{{samp(^)}}} and {{{samp(_)}}} are used to
10285 indicate super- and subscripts. Again, these can be used without
10286 embedding them in math-mode delimiters. To increase the readability of
10287 ASCII text, it is not necessary (but OK) to surround multi-character
10288 sub- and superscripts with curly braces. For example
10291 The mass of the sun is M_sun = 1.989 x 10^30 kg. The radius of
10292 the sun is R_{sun} = 6.96 x 10^8 m.
10295 #+vindex: org-export-with-sub-superscripts
10297 To avoid interpretation as raised or lowered text, you can quote
10298 {{{kbd(^)}}} and {{{kbd(_)}}} with a backslash: ~\^~ and ~\_~. If you
10299 write a text where the underscore is often used in a different
10300 context, Org's convention to always interpret these as subscripts can
10301 get in your way. Configure the variable
10302 ~org-export-with-sub-superscripts~ to globally change this convention,
10303 or use, on a per-file basis:
10309 {{{noindent}}} With this setting, ~a_b~ will not be interpreted as a
10310 subscript, but ~a_{b}~ will.
10312 #+attr_texinfo: :table-type table :indic @asis
10313 - {{{kbd(C-c C-x XXX)}}} ::
10314 #+kindex: C-c C-x XXX
10316 In addition to showing entities as UTF-8 characters, this command will
10317 also format sub- and superscripts in a WYSIWYM way.
10319 *** LaTeX fragments
10321 :DESCRIPTION: Complex formulas made easy
10323 #+cindex: @LaTeX{} fragments
10324 #+vindex: org-format-latex-header
10326 Going beyond symbols and sub- and superscripts, a full formula
10327 language is needed. Org mode can contain LaTeX math fragments, and
10328 it supports ways to process these for several export backends. When
10329 exporting to LaTeX, the code is obviously left as it is. When
10330 exporting to HTML, Org invokes the [[http://www.mathjax.org][MathJax library]] (see [[Math
10331 formatting in HTML export]]) to process and display the math.[fn:109]
10332 Finally, it can also process the mathematical expressions into images
10333 that can be displayed in a browser or in DocBook documents.[fn:110]
10335 LaTeX fragments don't need any special marking at all. The following
10336 snippets will be identified as LaTeX source code:
10338 - Environments of any kind.[fn:111] The only requirement is that the
10339 ~\begin~ statement appears on a new line, preceded by only whitespace.
10341 - Text within the usual LaTeX math delimiters. To avoid conflicts
10342 with currency specifications, single ~$~ characters are
10343 only recognized as math delimiters if the enclosed text contains at
10344 most two line breaks, is directly attached to the ~$~
10345 characters with no whitespace in between, and if the closing
10346 ~$~ is followed by whitespace, punctuation or a dash. For
10347 the other delimiters, there is no such restriction, so when in
10348 doubt, use ~\(...\)~ as inline math delimiters.
10351 {{{noindent}}} For example:
10354 \begin{equation} % arbitrary environments,
10355 x=\sqrt{b} % even tables, figures
10356 \end{equation} % etc
10358 If $a^2=b$ and \( b=2 \), then the solution must be
10359 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
10363 #+vindex: org-format-latex-options
10365 If you need any of the delimiter ASCII sequences for other purposes,
10366 you can configure the option ~org-format-latex-options~ to deselect
10367 the ones you do not wish to have interpreted by the LaTeX
10370 #+vindex: org-export-with-LaTeX-fragments
10372 LaTeX processing can be configured with the variable
10373 ~org-export-with-LaTeX-fragments~. The default setting is ~t~ which
10374 means {{{file(MathJax)}}} for HTML, and no processing for DocBook,
10375 ASCII and LaTeX backends. You can also set this variable on a
10376 per-file basis using one of these lines:
10378 #+attr_texinfo: :table-type table :indic @asis
10379 - #+OPTIONS: LaTeX:t ::
10381 Do the right thing automatically (MathJax).
10383 - #+OPTIONS: LaTeX:dvipng ::
10385 Force using dvipng images.
10387 - #+OPTIONS: LaTeX:nil ::
10389 Do not process LaTeX fragments at all
10391 - #+OPTIONS: LaTeX:verbatim ::
10393 Verbatim export, for jsMath or so.
10395 *** Previewing LaTeX fragments
10397 :DESCRIPTION: What will this snippet look like?
10399 #+cindex: @LaTeX{} fragments, preview
10401 If you have {{{file(dvipng)}}} installed, LaTeX fragments can be
10402 processed to produce preview images of the typeset expressions:
10404 #+attr_texinfo: :table-type table :indic @asis
10405 - {{{kbd(C-c C-x C-l)}}} ::
10406 #+kindex: C-c C-x C-l
10408 Produce a preview image of the LaTeX fragment at point and overlay
10409 it over the source code. If there is no fragment at point, process all
10410 fragments in the current entry (between two headlines). When called
10411 with a prefix argument, process the entire subtree. When called with
10412 two prefix arguments, or when the cursor is before the first headline,
10413 process the entire buffer.
10415 - {{{kbd(C-c C-c)}}} ::
10418 Remove the overlay preview images.
10421 #+vindex: org-format-latex-options
10423 You can customize the variable ~org-format-latex-options~ to influence
10424 some aspects of the preview. In particular, the ~:scale~ (and for HTML
10425 export, ~:html-scale~) property can be used to adjust the size of the
10430 :DESCRIPTION: Speed up entering of formulas
10431 :TITLE: Using CDLaTeX to enter math
10433 #+cindex: CD@LaTeX{}
10435 CDLaTeX mode is a minor mode that is normally used in combination
10436 with a major LaTeX mode like AUCTeX in order to speed-up
10437 insertion of environments and math templates. Inside Org mode, you can
10438 make use of some of the features of CDLaTeX mode. You need to
10439 install {{{file(cdlatex.el)}}} and {{{file(texmathp.el)}}} (the latter
10440 comes also with AUCTeX) from
10441 [[http://www.astro.uva.nl/~dominik/Tools/cdlatex]]. Don't use CDLaTeX
10442 mode itself under Org mode, but use the light version
10443 ~org-cdlatex-mode~ that comes as part of Org mode. Turn it on for the
10444 current buffer with ~M-x org-cdlatex-mode~, or for all Org files with
10448 #+header: :exports code
10449 #+begin_src emacs-lisp
10450 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
10453 When this mode is enabled, the following features are present (for more
10454 details see the documentation of CDLaTeX mode):
10456 #+attr_texinfo: :table-type table :indic @asis
10457 - {{{kbd(C-c {)}}} ::
10460 Insert an environment template.
10462 - {{{key(TAB)}}} ::
10463 #+kindex: @key{TAB}
10465 Expand a template if the cursor is inside a LaTeX fragment.[fn:112]
10466 For example, {{{key(TAB)}}} will expand ~fr~ to ~\frac{}{}~ and
10467 position the cursor correctly inside the first brace. Another
10468 {{{key(TAB)}}} will get you into the second brace. Even outside
10469 fragments, {{{key(TAB)}}} will expand environment abbreviations at the
10470 beginning of a line. For example, if you write {{{samp(equ)}}} at the
10471 beginning of a line and press {{{key(TAB)}}}, this abbreviation will
10472 be expanded to an ~equation~ environment. To get a list of all
10473 abbreviations, type {{{kbd(M-x cdlatex-command-help)}}}.
10475 - {{{kbd(_)}}} {{{kbd(^)}}} ::
10478 #+vindex: cdlatex-simplify-sub-super-scripts
10480 Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment will
10481 insert these characters together with a pair of braces. If you use
10482 {{{key(TAB)}}} to move out of the braces, and if the braces surround
10483 only a single character or macro, they are removed again (depending on
10484 the variable ~cdlatex-simplify-sub-super-scripts~).
10489 Pressing the backquote followed by a character inserts math macros,
10490 also outside LaTeX fragments. If you wait more than 1.5 seconds
10491 after the backquote, a help window will pop up.
10496 Pressing the single-quote followed by another character modifies the
10497 symbol before point with an accent or a font. If you wait more than
10498 1.5 seconds after the single-quote, a help window will pop up.
10499 Character modification will work only inside LaTeX fragments;
10500 outside the quote is normal.
10504 :DESCRIPTION: Sharing and publishing notes
10506 #+cindex: exporting
10508 Org mode documents can be exported into a variety of other formats.
10509 For printing and sharing of notes, ASCII export produces a readable
10510 and simple version of an Org file. HTML export allows you to publish a
10511 notes file on the web, while the XOXO format provides a solid base for
10512 exchange with a broad range of other applications. LaTeX export
10513 lets you use Org mode and its structured editing functions to easily
10514 create LaTeX files. DocBook export makes it possible to convert Org
10515 files to many other formats using DocBook tools. OpenDocument Text
10516 (ODT) export allows seamless collaboration across organizational
10517 boundaries. For project management you can create gantt and resource
10518 charts by using TaskJuggler export. To incorporate entries with
10519 associated times like deadlines or appointments into a desktop
10520 calendar program like iCal, Org mode can also produce extracts in the
10521 iCalendar format. Currently, Org mode only supports export, not import
10522 of these different formats.
10524 Org supports export of selected regions when ~transient-mark-mode~ is
10525 enabled (default in Emacs 23).
10527 ** Selective export
10529 :DESCRIPTION: Using tags to select and exclude trees
10531 #+cindex: export, selective by tags or TODO keyword
10532 #+vindex: org-export-select-tags
10533 #+vindex: org-export-exclude-tags
10534 #+cindex: org-export-with-tasks
10536 You may use tags to select the parts of a document that should be exported,
10537 or to exclude parts from export. This behavior is governed by two variables:
10538 ~org-export-select-tags~ and ~org-export-exclude-tags~,
10539 respectively defaulting to ~:export:~ and ~:noexport:~.
10541 1. Org first checks if any of the /select/ tags is present in the
10542 buffer. If yes, all trees that do not carry one of these tags will
10543 be excluded. If a selected tree is a subtree, the heading hierarchy
10544 above it will also be selected for export, but not the text below
10547 2. If none of the select tags is found, the whole buffer will be
10548 selected for export.
10550 3. Finally, all subtrees that are marked by any of the /exclude/ tags
10551 will be removed from the export buffer.
10554 The variable ~org-export-with-tasks~ can be configured to select which
10555 kind of tasks should be included for export. See the docstring of the
10556 variable for more information.
10558 ** FIXME Export options
10560 :DESCRIPTION: Per-file export settings
10562 #+cindex: options, for export
10563 #+cindex: completion, of option keywords
10565 The exporter recognizes special lines in the buffer which provide
10566 additional information. These lines may be put anywhere in the file.
10567 The whole set of lines can be inserted into the buffer with
10568 {{{kbd(C-c C-e t)}}}. For individual lines, a good way to make sure the keyword
10569 is correct is to type {{{samp(#+)}}} and then use {{{kbdkey(M-,TAB)}}}
10570 completion (see [[Completion]]). For a summary of other in-buffer settings
10571 not specifically related to export, see [[In-buffer settings]]. In
10572 particular, note that you can place commonly-used (export) options in
10573 a separate file which can be included using ~#+SETUPFILE~.
10575 #+attr_texinfo: :table-type table :indic @asis
10576 - {{{kbd(C-c C-e t)}}}, ~org-insert-export-options-template~ ::
10577 #+kindex: C-c C-e t
10579 Insert template with export options, see example below.
10586 #+cindex: #+DESCRIPTION
10587 #+cindex: #+KEYWORDS
10588 #+cindex: #+LANGUAGE
10590 #+cindex: #+OPTIONS
10592 #+cindex: #+LINK_UP
10593 #+cindex: #+LINK_HOME
10594 #+cindex: #+EXPORT_SELECT_TAGS
10595 #+cindex: #+EXPORT_EXCLUDE_TAGS
10597 #+cindex: #+LaTeX_HEADER
10598 #+vindex: user-full-name
10599 #+vindex: user-mail-address
10600 #+vindex: org-export-default-language
10601 #+vindex: org-export-date-timestamp-format
10603 #+attr_texinfo: :table-type table :indic @asis
10606 The title to be shown (default is the buffer name).
10610 The author (default taken from ~user-full-name~).
10614 A date, an Org timestamp, or a format string for
10615 ~format-time-string~.[fn:113]
10619 His/her email address (default from ~user-mail-address~).
10621 - #+DESCRIPTION: ::
10623 The page description, e.g., for the XHTML meta tag.
10627 The page keywords, e.g., for the XHTML meta tag.
10631 Language for HTML, e.g., en (~org-export-default-language~).
10635 Some descriptive text to be inserted at the beginning.
10639 Several lines may be given.
10643 H:2 num:t toc:t \n:nil @:t ::t |:t ^:t f:t TeX:t ...
10647 Lisp-var lisp-val, e.g., org-export-latex-low-levels itemize. You need
10648 to confirm using these, or configure ~org-export-allow-BIND~.
10652 The ``up'' link of an exported page.
10656 The ``home'' link of an exported page.
10658 - #+LaTeX_HEADER: ::
10660 Extra line(s) for the LaTeX header, like ~\usepackage{xyz}~.
10662 - #+EXPORT_SELECT_TAGS: ::
10664 Tags that select a tree for export.
10666 - #+EXPORT_EXCLUDE_TAGS: ::
10668 Tags that exclude a tree from export.
10672 The XSLT stylesheet used by DocBook exporter to generate FO file.
10676 {{{noindent}}} The ~#+OPTIONS~ line is a compact form to specify
10677 export settings.[fn:114] Here you can:
10679 #+cindex: headline levels
10680 #+cindex: section-numbers
10681 #+cindex: table of contents
10682 #+cindex: line-break preservation
10683 #+cindex: quoted HTML tags
10684 #+cindex: fixed-width sections
10686 #+cindex: @TeX{}-like syntax for sub- and superscripts
10687 #+cindex: footnotes
10688 #+cindex: special strings
10689 #+cindex: emphasized text
10690 #+cindex: @TeX{} macros
10691 #+cindex: @LaTeX{} fragments
10692 #+cindex: author info, in export
10693 #+cindex: time info, in export
10694 #+vindex: org-export-plist-vars
10695 #+vindex: org-export-author-info
10696 #+vindex: org-export-creator-info
10697 #+vindex: org-export-email-info
10698 #+vindex: org-export-time-stamp-file
10700 #+attr_texinfo: :table-type table :indic @code
10703 Set the number of headline levels for export.
10707 Turn on/off section-numbers.
10711 Turn on/off table of contents, or set level limit (integer).
10715 Turn on/off line-break-preservation (DOES NOT WORK).
10719 Turn on/off quoted HTML tags.
10723 Turn on/off fixed-width sections.
10727 Turn on/off tables,
10731 Turn on/off TeX-like syntax for sub- and superscripts. If you write
10732 "^:{}", ~a_{b}~ will be interpreted, but the simple ~a_b~ will be left
10737 Turn on/off conversion of special strings.
10741 Turn on/off footnotes like this: ~[1]~.
10745 Turn on/off inclusion of TODO keywords into exported text.
10749 Turn on/off inclusion of tasks (TODO items), can be nil to remove all
10750 tasks, ~todo~ to remove DONE tasks, or list of keywords to keep.
10754 Turn on/off priority cookies.
10758 Turn on/off inclusion of tags, may also be ~not-in-toc~.
10762 Turn on/off inclusion of any time/date stamps like DEADLINES.
10766 Turn on/off emphasized text (bold, italic, underlined).
10770 Turn on/off simple TeX macros in plain text.
10774 Configure export of LaTeX fragments. Default ~auto~.
10778 Turn on/off skipping the text before the first heading.
10782 Turn on/off inclusion of author name/email into exported file.
10786 Turn on/off inclusion of author email into exported file.
10790 Turn on/off inclusion of creator info into exported file.
10794 Turn on/off inclusion creation time into exported file.
10798 Turn on/off inclusion of drawers, or list drawers to include.
10801 {{{noindent}}} These options take effect in both the HTML and LaTeX
10802 export, except for ~TeX~ and ~LaTeX~ options, which are respectively
10803 ~t~ and ~nil~ for the LaTeX export.
10805 The default values for these and many other options are given by a set
10806 of variables. For a list of such variables, the corresponding OPTIONS
10807 keys and also the publishing keys (see [[Project alist]]), see the
10808 constant ~org-export-plist-vars~.
10810 When exporting only a single subtree by selecting it with
10811 {{{kbd(C-c @)}}} before calling an export command, the subtree can
10812 overrule some of the file's export settings with properties
10813 ~EXPORT_FILE_NAME~, ~EXPORT_TITLE~, ~EXPORT_TEXT~, ~EXPORT_AUTHOR~,
10814 ~EXPORT_DATE~, and ~EXPORT_OPTIONS~.
10816 ** The export dispatcher
10818 :DESCRIPTION: How to access exporter commands
10820 #+cindex: dispatcher, for export commands
10822 All export commands can be reached using the export dispatcher, which
10823 is a prefix key that prompts for an additional key specifying the
10824 command. Normally the entire file is exported, but if there is an
10825 active region that contains one outline tree, the first heading is
10826 used as document title and the subtrees are exported.
10828 #+attr_texinfo: :table-type table :indic @asis
10829 - {{{kbd(C-c C-e)}}}, ~org-export~ ::
10831 #+vindex: org-export-run-in-background
10833 Dispatcher for export and publishing commands. Displays a help-window
10834 listing the additional key(s) needed to launch an export or publishing
10835 command. The prefix arg is passed through to the exporter. A double
10836 prefix {{{kbd(C-u C-u)}}} causes most commands to be executed in the
10837 background, in a separate Emacs process.[fn:115]
10839 - {{{kbd(C-c C-e v)}}}, ~org-export-visible~ ::
10840 #+kindex: C-c C-e v
10842 Like {{{kbd(C-c C-e)}}}, but only export the text that is currently visible
10843 (i.e., not hidden by outline visibility).
10845 - {{{kbd(C-u C-u C-c C-e)}}}, ~org-export~ ::
10846 #+kindex: C-u C-u C-c C-e
10847 #+vindex: org-export-run-in-background
10849 Call the exporter, but reverse the setting of
10850 ~org-export-run-in-background~, i.e., request background processing if
10851 not set, or force processing in the current Emacs process if set.
10853 ** ASCII/Latin-1/UTF-8 export
10855 :DESCRIPTION: Exporting to flat files with encoding
10857 #+cindex: ASCII export
10858 #+cindex: Latin-1 export
10859 #+cindex: UTF-8 export
10861 ASCII export produces a simple and very readable version of an Org
10862 mode file, containing only plain ASCII. Latin-1 and UTF-8 export
10863 augment the file with special characters and symbols available in
10866 #+cindex: region, active
10867 #+cindex: active region
10868 #+cindex: transient-mark-mode
10870 #+attr_texinfo: :table-type table :indic @asis
10871 - {{{kbd(C-c C-e a)}}}, ~org-export-as-ascii~ ::
10872 #+kindex: C-c C-e a
10873 #+cindex: property, EXPORT_FILE_NAME
10875 Export as an ASCII file. For an Org file, {{{file(myfile.org)}}}, the
10876 ASCII file will be {{{file(myfile.txt)}}}. The file will be
10877 overwritten without warning. If there is an active region, only the
10878 region will be exported.[fn:116] If the selected region is a single
10879 tree, the tree head will become the document title.[fn:117] If the
10880 tree head entry has or inherits an ~EXPORT_FILE_NAME~ property, that
10881 name will be used for the export.
10883 - {{{kbd(C-c C-e A)}}}, ~org-export-as-ascii-to-buffer~ ::
10884 #+kindex: C-c C-e A
10886 Export to a temporary buffer. Do not create a file.
10888 - {{{kbd(C-c C-e n)}}}, ~org-export-as-latin1~ ::
10889 #+kindex: C-c C-e n
10891 Like {{{kbd(C-c C-e a)}}}, but use Latin-1 encoding.
10893 - {{{kbd(C-c C-e N)}}}, ~org-export-as-latin1-to-buffer~ ::
10894 #+kindex: C-c C-e N
10896 Like {{{kbd(C-c C-e A)}}}, but use Latin-1 encoding.
10898 - {{{kbd(C-c C-e u)}}}, ~org-export-as-utf8~ ::
10899 #+kindex: C-c C-e u
10901 Like {{{kbd(C-c C-e a)}}}, but use UTF-8 encoding.
10903 - {{{kbd(C-c C-e U)}}}, ~org-export-as-utf8-to-buffer~ ::
10904 #+kindex: C-c C-e U
10906 Like {{{kbd(C-c C-e A)}}}, but use UTF-8 encoding.
10909 - {{{kbd(C-c C-e v a/n/u)}}} ::
10910 #+kindex: C-c C-e v a
10911 #+kindex: C-c C-e v n
10912 #+kindex: C-c C-e v u
10914 Export only the visible part of the document.
10917 #+cindex: headline levels, for exporting
10919 In the exported version, the first 3 outline levels will become
10920 headlines, defining a general document structure. Additional levels
10921 will be exported as itemized lists. If you want that transition to
10922 occur at a different level, specify it with a prefix argument, e.g.:
10928 {{{noindent}}} This setting creates only top level headlines and
10929 exports the rest as items. When headlines are converted to items, the
10930 indentation of the text following the headline is changed to fit
10931 nicely under the item. This is done with the assumption that the first
10932 body line indicates the base indentation of the body text. Any
10933 indentation larger than this is adjusted to preserve the layout
10934 relative to the first line. Should there be lines with less
10935 indentation than the first one, these are left alone.
10937 #+vindex: org-export-ascii-links-to-notes
10939 Links will be exported in a footnote-like style, with the descriptive
10940 part in the text and the link in a note before the next heading. See
10941 the variable ~org-export-ascii-links-to-notes~ for details and other
10946 :DESCRIPTION: Exporting to HTML
10948 #+cindex: HTML export
10949 #+cindex: Gruber, John
10951 Org mode contains a HTML (XHTML 1.0 strict) exporter with extensive
10952 HTML formatting, in ways similar to John Gruber's /markdown/ language,
10953 but with additional support for tables.
10955 *** HTML export commands
10957 :DESCRIPTION: How to invoke HTML export
10959 #+cindex: region, active
10960 #+cindex: active region
10961 #+cindex: transient-mark-mode
10963 #+attr_texinfo: :table-type table :indic @asis
10964 - {{{kbd(C-c C-e h)}}}, ~org-export-as-html~ ::
10965 #+kindex: C-c C-e h
10966 #+cindex: property, EXPORT_FILE_NAME
10968 Export as an HTML file. For an Org file {{{file(myfile.org)}}}, the
10969 HTML file will be {{{file(myfile.html)}}}. The file will be
10970 overwritten without warning. If there is an active region, only the
10971 active region will be exported.[fn:118] If the selected region is a
10972 single tree, the tree head will become the document title.[fn:119] If
10973 the tree head entry has, or inherits, an ~EXPORT_FILE_NAME~ property,
10974 that name will be used for the export.
10976 - {{{kbd(C-c C-e b)}}}, ~org-export-as-html-and-open~ ::
10977 #+kindex: C-c C-e b
10979 Export as a HTML file and immediately open it with a browser.
10981 - {{{kbd(C-c C-e H)}}}, ~org-export-as-html-to-buffer~ ::
10982 #+kindex: C-c C-e H
10984 Export to a temporary buffer. Do not create a file.
10986 - {{{kbd(C-c C-e R)}}}, ~org-export-region-as-html~ ::
10987 #+kindex: C-c C-e R
10989 Export the active region to a temporary buffer. With a prefix
10990 argument, do not produce the file header and footer, but just the
10991 plain HTML section for the region. This is good for cut-and-paste
10994 - {{{kbd(C-c C-e v h/b/H/R)}}} ::
10995 #+kindex: C-c C-e v h
10996 #+kindex: C-c C-e v b
10997 #+kindex: C-c C-e v H
10998 #+kindex: C-c C-e v R
11000 Export only the visible part of the document.
11002 - {{{kbd(M-x org-export-region-as-html)}}} ::
11004 Convert the region to HTML under the assumption that it was in Org
11005 mode syntax before. This is a global command that can be invoked in
11008 - {{{kbd(M-x org-replace-region-by-HTML)}}} ::
11010 Replace the active region (assumed to be in Org mode syntax) by HTML
11014 #+cindex: headline levels, for exporting
11016 In the exported version, the first three outline levels will become
11017 headlines, defining a general document structure. Additional levels
11018 will be exported as itemized lists. If you want that transition to
11019 occur at a different level, specify it with a numeric prefix argument,
11026 {{{noindent}}} This setting creates two levels of headings and exports
11027 the rest as list items.
11029 *** HTML preamble and postamble
11031 :DESCRIPTION: How to insert a preamble and postamble
11033 #+vindex: org-export-html-preamble
11034 #+vindex: org-export-html-postamble
11035 #+vindex: org-export-html-preamble-format
11036 #+vindex: org-export-html-postamble-format
11037 #+vindex: org-export-html-validation-link
11038 #+vindex: org-export-author-info
11039 #+vindex: org-export-email-info
11040 #+vindex: org-export-creator-info
11041 #+vindex: org-export-time-stamp-file
11043 The HTML exporter lets you define a preamble and a postamble.
11045 The default value for ~org-export-html-preamble~ is ~t~, which means
11046 that the preamble is inserted depending on the relevant format string
11047 in ~org-export-html-preamble-format~.
11049 Setting ~org-export-html-preamble~ to a string will override the default
11050 format string. Setting it to a function, will insert the output of the
11051 function, which must be a string; such a function takes no argument but you
11052 can check against the value of ~opt-plist~, which contains the list of
11053 publishing properties for the current file. Setting to ~nil~ will not
11054 insert any preamble.
11056 The default value for ~org-export-html-postamble~ is
11057 {{{samp('auto)}}}, which means that the HTML exporter will look for
11058 the value of ~org-export-author-info~, ~org-export-email-info~,
11059 ~org-export-creator-info~ and ~org-export-time-stamp-file~,
11060 ~org-export-html-validation-link~ and build the postamble from these
11061 values. Setting ~org-export-html-postamble~ to ~t~ will insert the
11062 postamble from the relevant format string found in
11063 ~org-export-html-postamble-format~. Setting it to ~nil~ will not
11064 insert any postamble.
11066 *** Quoting HTML tags
11068 :DESCRIPTION: Using direct HTML in Org mode
11071 Plain ~<~ and {{{samp(>)}}} are always transformed to
11072 {{{samp(<)}}} and {{{samp(>)}}} in HTML export. If you want to
11073 include simple HTML tags which should be interpreted as such, mark
11074 them with {{{samp(@)}}} as in {{{samp(@<b>bold text@</b>)}}}. Note
11075 that this really works only for simple tags. For more extensive HTML
11076 that should be copied verbatim to the exported file use either ~#+HTML~:
11079 #+cindex: #+BEGIN_HTML
11081 ,#+HTML: Literal HTML code for export
11084 {{{noindent}}} or an HTML block:
11085 #+cindex: #+BEGIN_HTML
11089 All lines between these markers are exported literally
11093 *** Links in HTML export
11095 :DESCRIPTION: How links will be interpreted and formatted
11097 #+cindex: links, in HTML export
11098 #+cindex: internal links, in HTML export
11099 #+cindex: external links, in HTML export
11101 Internal links (see [[Internal links]]) will continue to work in HTML.
11102 This includes automatic links created by radio targets (see [[Radio
11103 targets]]). Links to external files will still work if the target file
11104 is on the same /relative/ path as the published Org file. Links to
11105 other {{{file(.org)}}} files will be translated into HTML links under
11106 the assumption that a HTML version also exists of the linked file, at
11107 the same relative path. ~id:~ links can then be used to jump
11108 to specific entries across files. For information related to linking
11109 files while publishing them to a publishing directory see [[Publishing
11112 If you want to specify attributes for links, you can do so using a
11113 special ~#+ATTR_HTML~ line to define attributes that will be added to
11114 the ~<a>~ or ~<img>~ tags. Here is an example that sets ~title~ and
11115 ~style~ attributes for a link:
11117 #+cindex: #+ATTR_HTML
11119 ,#+ATTR_HTML: title="The Org mode homepage" style="color:red;"
11120 ,[[http://orgmode.org]]
11123 *** Tables in HTML export
11125 :DESCRIPTION: How to modify the formatting of tables
11127 #+cindex: tables, in HTML
11128 #+vindex: org-export-html-table-tag
11130 Org mode tables are exported to HTML using the table tag defined in
11131 ~org-export-html-table-tag~. The default setting makes tables without
11132 cell borders and frame. If you would like to change this for
11133 individual tables, place something like the following before the
11136 #+cindex: #+CAPTION
11137 #+cindex: #+ATTR_HTML
11139 ,#+CAPTION: This is a table with lines around and between cells
11140 ,#+ATTR_HTML: border="2" rules="all" frame="border"
11143 *** Images in HTML export
11145 :DESCRIPTION: How to insert figures into HTML output
11147 #+cindex: images, inline in HTML
11148 #+cindex: inlining images in HTML
11149 #+vindex: org-export-html-inline-images
11151 HTML export can inline images given as links in the Org file, and it
11152 can make an image the clickable part of a link. By default, images are
11153 inlined if a link does not have a description.[fn:120] So
11154 ~[[file:myimg.jpg]]~ will be inlined, while ~[[file:myimg.jpg][the
11155 image]]~ will just produce a link {{{samp(the image)}}} that points to
11156 the image. If the description part itself is a ~file:~ link or
11157 a ~http:~ URL pointing to an image, this image will be inlined and
11158 activated so that clicking on the image will activate the link. For
11159 example, to include a thumbnail that will link to a high resolution
11160 version of the image, you could use:
11163 [[file:highres.jpg][file:thumb.jpg]]
11166 If you need to add attributes to an inlined image, use a ~#+ATTR_HTML~.
11167 In the example below we specify the ~alt~ and ~title~ attributes to
11168 support text viewers and accessibility, and align it to the right.
11170 #+cindex: #+CAPTION
11171 #+cindex: #+ATTR_HTML
11173 ,#+CAPTION: A black cat stalking a spider
11174 ,#+ATTR_HTML: alt="cat/spider image" title="Action!" align="right"
11178 {{{noindent}}} You could use ~http~ addresses just as well.
11180 *** Math formatting in HTML export
11182 :DESCRIPTION: Beautiful math also on the web
11187 LaTeX math snippets (see [[LaTeX fragments]]) can be displayed in two
11188 different ways on HTML pages. The default is to use the [[http://www.mathjax.org][MathJax system]]
11189 which should work out of the box with Org mode installation because
11190 ~http://orgmode.org~ serves {{{file(MathJax)}}} for Org mode users for
11191 small applications and for testing purposes.[fn:121] To configure
11192 {{{file(MathJax)}}}, use the variable
11193 ~org-export-html-mathjax-options~ or insert something like the
11194 following into the buffer:
11197 ,#+MATHJAX: align:"left" mathml:t path:"/MathJax/MathJax.js"
11200 {{{noindent}}} See the docstring of the variable
11201 ~org-export-html-mathjax-options~ for the meaning of the parameters in
11204 If you prefer, you can also request that LaTeX fragments are
11205 processed into small images that will be inserted into the browser
11206 page. Before the availability of MathJax, this was the default method
11207 for Org files. This method requires that the {{{file(dvipng)}}}
11208 program is available on your system. You can still get this processing
11209 with the following option:
11212 ,#+OPTIONS: LaTeX:dvipng
11215 *** Text areas in HTML export
11217 :DESCRIPTION: An alternate way to show an example
11219 #+cindex: text areas, in HTML
11221 An alternative way to publish literal code examples in HTML is to use
11222 text areas, where the example can even be edited before pasting it
11223 into an application. It is triggered by a ~-t~ switch at an ~example~
11224 or ~src~ block. Using this switch disables any options for syntax and
11225 label highlighting, and line numbering, which may be present. You may
11226 also use ~-h~ and ~-w~ switches to specify the height and width of the
11227 text area, which default to the number of lines in the example, and
11228 80, respectively. For example
11231 ,#+BEGIN_EXAMPLE -t -w 40
11232 (defun org-xor (a b)
11240 :DESCRIPTION: Changing the appearance of the output
11242 #+cindex: CSS, for HTML export
11243 #+cindex: HTML export, CSS
11244 #+vindex: org-export-html-todo-kwd-class-prefix
11245 #+vindex: org-export-html-tag-class-prefix
11247 You can also give style information for the exported file. The HTML
11248 exporter assigns the following special CSS classes to appropriate
11249 parts of the document---your style specifications may change these, in
11250 addition to any of the standard classes like for headlines, tables,
11253 #+attr_texinfo: :table-type table :indic @code
11254 - p.author :: author information, including email
11255 - p.date :: publishing date
11256 - p.creator :: creator info, about org mode version
11257 - .title :: document title
11258 - .todo :: TODO keywords, all not-done states
11259 - .done :: the DONE keywords, all states that count as done
11260 - .WAITING :: each TODO keyword also uses a class named after itself
11261 - .timestamp :: timestamp
11262 - .timestamp-kwd :: keyword associated with a timestamp, like SCHEDULED
11263 - .timestamp-wrapper :: span around keyword plus timestamp
11264 - .tag :: tag in a headline
11265 - ._HOME :: each tag uses itself as a class, "@" replaced by "_"
11266 - .target :: target for links
11267 - .linenr :: the line number in a code example
11268 - .code-highlighted :: for highlighting referenced code lines
11269 - div.outline-N :: div for outline level N (headline plus text))
11270 - div.outline-text-N :: extra div for text at outline level N
11271 - .section-number-N :: section number in headlines, different for each level
11272 - div.figure :: how to format an inlined image
11273 - pre.src :: formatted source code
11274 - pre.example :: normal example
11275 - p.verse :: verse paragraph
11276 - div.footnotes :: footnote section headline
11277 - p.footnote :: footnote definition paragraph, containing a footnote
11278 - .footref :: a footnote reference number (always a <sup>)
11279 - .footnum :: footnote number in footnote definition (always <sup>)
11282 #+vindex: org-export-html-style-default
11283 #+vindex: org-export-html-style-include-default
11284 #+vindex: org-export-html-style
11285 #+vindex: org-export-html-extra
11286 #+vindex: org-export-html-style-default
11288 Each exported file contains a compact default style that defines these
11289 classes in a basic way.[fn:123] You may overwrite these
11290 settings, or add to them by using the variables ~org-export-html-style~
11291 (for Org-wide settings) and ~org-export-html-style-extra~ (for more
11292 fine-grained settings, like file-local settings). To set the latter variable
11293 individually for each file, you can use a ~#+STYLE:~ line:
11297 ,#+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
11300 {{{noindent}}} For longer style definitions, you can use several such
11301 lines. You could also directly write a ~<style>~ ~</style>~ section in
11302 this way, without referring to an external file.
11304 In order to add styles to a subtree, use the ~:HTML_CONTAINER_CLASS:~
11305 property to assign a class to the tree. In order to specify CSS styles
11306 for a particular headline, you can use the id specified in a
11307 ~:CUSTOM_ID:~ property.
11309 # FIXME: More about header and footer styles
11310 # FIXME: Talk about links and targets.
11312 *** JavaScript support
11314 :DESCRIPTION: Info and folding in a web browser
11316 #+cindex: Rose, Sebastian
11318 Sebastian Rose has written a JavaScript program especially designed to
11319 enhance the web viewing experience of HTML files created with Org. This
11320 program allows you to view large files in two different ways. The first one
11321 is an /Info/-like mode where each section is displayed separately and
11322 navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}} keys (and some other keys
11323 as well, press {{{kbd(?)}}} for an overview of the available keys). The second
11324 view type is a /folding/ view much like Org provides inside Emacs. The
11325 script is available at [[http://orgmode.org/org-info.js]] and you can find
11326 the documentation for it at [[http://orgmode.org/worg/code/org-info-js/]].
11327 We host the script at our site, but if you use it a lot, you might
11328 not want to be dependent on ~orgmode.org~ and prefer to install a local
11329 copy on your own web server.
11331 To use the script, you need to make sure that the
11332 {{{file(org-jsinfo.el)}}} module gets loaded. It should be loaded by
11333 default, but you can try {{{ksksksk(M-x customize-variable,RET,org-modules,RET)}}}
11334 to convince yourself that this is indeed the case. All it then takes to make use of the program
11335 is adding a single line to the Org file:
11337 #+cindex: #+INFOJS_OPT
11339 ,#+INFOJS_OPT: view:info toc:nil
11342 {{{noindent}}} If this line is found, the HTML header will
11343 automatically contain the code needed to invoke the script. Using the
11344 line above, you can set the following viewing options:
11346 #+attr_texinfo: :table-type table :indic @code
11349 The path to the script. The default is to grab the script from
11350 [[http://orgmode.org/org-info.js]], but you might want to have
11351 a local copy and use a path like {{{samp(../scripts/org-info.js)}}}.
11355 Initial view when the website is first shown. Possible values are:
11357 - info :: Info-like interface with one section per page.
11358 - overview :: Folding interface, initially showing only top-level.
11359 - content :: Folding interface, starting with all headlines visible.
11360 - showall :: Folding interface, all headlines and text visible.
11364 Maximum headline level that will still become an independent section
11365 for info and folding modes. The default is taken from
11366 ~org-export-headline-levels~ (= the ~H~ switch in ~#+OPTIONS~). If
11367 this is smaller than in ~org-export-headline-levels~, each
11368 info/folding section can still contain child headlines.
11372 Should the table of contents /initially/ be visible? Even when ~nil~,
11373 you can always get to the "toc" with {{{kbd(i)}}}.
11377 The depth of the table of contents. The defaults are taken from the
11378 variables ~org-export-headline-levels~ and ~org-export-with-toc~.
11382 Does the CSS of the page specify a fixed position for the "toc"? If
11383 yes, the toc will never be displayed as a section.
11387 Should there be short contents (children) in each section? Make this
11388 ~above~ if the section should be above initial text.
11392 Headings are highlighted when the mouse is over them. Should be
11393 {{{samp(underline)}}} (default) or a background color like
11394 {{{samp(#cccccc)}}}.
11398 Should view-toggle buttons be everywhere? When ~nil~ (the default),
11399 only one such button will be present.
11402 #+vindex: org-infojs-options
11403 #+vindex: org-export-html-use-infojs
11405 {{{noindent}}} You can choose default values for these options by
11406 customizing the variable ~org-infojs-options~. If you always want to
11407 apply the script to your pages, configure the variable
11408 ~org-export-html-use-infojs~.
11410 ** LaTeX and PDF export
11412 :DESCRIPTION: Exporting to LaTeX and processing to PDF
11414 #+cindex: @LaTeX{} export
11415 #+cindex: PDF export
11416 #+cindex: Guerry, Bastien
11418 Org mode contains a LaTeX exporter written by Bastien Guerry. With
11419 further processing, this backend is also used to produce PDF
11420 output.[fn:124] Since the LaTeX output uses {{{file(hyperref)}}} to
11421 implement links and cross references, the PDF output file will be
11422 fully linked. Beware of the fact that your ~org~ file has to be
11423 properly structured in order to be correctly exported: respect the
11424 hierarchy of sections.
11426 *** LaTeX/PDF export commands
11428 :DESCRIPTION: Invoking export to LaTeX/PDF
11430 #+cindex: region, active
11431 #+cindex: active region
11432 #+cindex: transient-mark-mode
11434 #+attr_texinfo: :table-type table :indic @asis
11435 - {{{kbd(C-c C-e l)}}}, ~org-export-as-latex~ ::
11436 #+kindex: C-c C-e l
11437 #+cindex: property EXPORT_FILE_NAME
11439 Export as a LaTeX file. For an Org file {{{file(myfile.org)}}}, the
11440 LaTeX file will be {{{file(myfile.tex)}}}. The file will be
11441 overwritten without warning. If there is an active region, only the
11442 active region will be exported.[fn:125] If the selected region is a
11443 single tree, the tree head will become the document title.[fn:126] If
11444 the tree head entry has or inherits an ~EXPORT_FILE_NAME~ property,
11445 that name will be used for the export.
11447 - {{{kbd(C-c C-e L)}}}, ~org-export-as-latex-to-buffer~ ::
11448 #+kindex: C-c C-e L
11450 Export to a temporary buffer. Do not create a file.
11452 - {{{kbd(C-c C-e v l/L)}}} ::
11454 Export only the visible part of the document.
11456 - {{{kbd(M-x org-export-region-as-latex)}}} ::
11458 Convert the region to LaTeX under the assumption that it was in Org
11459 mode syntax before. This is a global command that can be invoked in
11462 - {{{kbd(M-x org-replace-region-by-latex)}}} ::
11464 Replace the active region (assumed to be in Org mode syntax) by
11467 - {{{kbd(C-c C-e p)}}}, ~org-export-as-pdf~ ::
11468 #+kindex: C-c C-e p
11470 Export as LaTeX and then process to PDF.
11472 - {{{kbd(C-c C-e d)}}}, ~org-export-as-pdf-and-open~ ::
11473 #+kindex: C-c C-e d
11475 Export as LaTeX and then process to PDF, then open the resulting
11479 #+cindex: headline levels, for exporting
11480 #+vindex: org-latex-low-levels
11482 In the exported version, the first 3 outline levels will become
11483 headlines, defining a general document structure. Additional levels
11484 will be exported as description lists. The exporter can ignore them or
11485 convert them to a custom string depending on ~org-latex-low-levels~.
11487 If you want that transition to occur at a different level, specify it
11488 with a numeric prefix argument, e.g.:
11494 {{{noindent}}} The example setting creates two levels of headings and
11495 exports the rest as list items.
11497 *** Header and sectioning
11499 :DESCRIPTION: Setting up the export file structure
11500 :TITLE: Header and sectioning structure
11502 #+cindex: @LaTeX{} class
11503 #+cindex: @LaTeX{} sectioning structure
11504 #+cindex: @LaTeX{} header
11505 #+cindex: header, for @LaTeX{} files
11506 #+cindex: sectioning structure, for @LaTeX{} export
11508 By default, the LaTeX output uses the class ~article~.
11510 #+vindex: org-export-latex-default-class
11511 #+vindex: org-export-latex-classes
11512 #+vindex: org-export-latex-default-packages-alist
11513 #+vindex: org-export-latex-packages-alist
11514 #+cindex: #+LaTeX_HEADER
11515 #+cindex: #+LaTeX_CLASS
11516 #+cindex: #+LaTeX_CLASS_OPTIONS
11517 #+cindex: property, LaTeX_CLASS
11518 #+cindex: property, LaTeX_CLASS_OPTIONS
11520 You can change this globally by setting a different value for
11521 ~org-export-latex-default-class~ or locally by adding an option like
11522 ~#+LaTeX_CLASS: myclass~ in your file, or with a ~:LaTeX_CLASS:~
11523 property that applies when exporting a region containing only this
11524 (sub)tree. The class must be listed in ~org-export-latex-classes~.
11525 This variable defines a header template for each class, and allows you
11526 to define the sectioning structure for each class.[fn:127] You can
11527 also define your own classes there. ~#+LaTeX_CLASS_OPTIONS~ or a
11528 ~:LaTeX_CLASS_OPTIONS:~ property can specify the options for the
11529 ~\documentclass~ macro. The options to documentclass have to be
11530 provided, as expected by LaTeX, within square brackets. You can
11531 also use ~#+LaTeX_HEADER: \usepackage{xyz}~ to add lines to the
11532 header. See the docstring of ~org-export-latex-classes~ for more
11533 information. An example is shown below.
11536 ,#+LaTeX_CLASS: article
11537 ,#+LaTeX_CLASS_OPTIONS: [a4paper]
11538 ,#+LaTeX_HEADER: \usepackage{xyz}
11544 *** Quoting LaTeX code
11546 :DESCRIPTION: Incorporating literal LaTeX code
11549 Embedded LaTeX as described in [[Embedded LaTeX]], will be correctly
11550 inserted into the LaTeX file. This includes simple macros like
11551 ~\ref{LABEL}~ to create a cross reference to a figure. Furthermore,
11552 you can add special code that should only be present in LaTeX export
11553 with the following constructs:
11556 #+cindex: #+BEGIN_LaTeX
11558 ,#+LaTeX: Literal LaTeX code for export
11563 #+cindex: #+BEGIN_LaTeX
11567 All lines between these markers are exported literally
11571 *** Tables in LaTeX export
11573 :DESCRIPTION: Options for exporting tables to LaTeX
11575 #+cindex: tables, in @LaTeX{} export
11577 For LaTeX export of a table, you can specify a label, a caption and
11578 placement options (see [[Images and tables]]). You can also use the
11579 ~ATTR_LaTeX~ line to request a ~longtable~ environment for the
11580 table, so that it may span several pages, or to change the default table
11581 environment from ~table~ to ~table*~ or to change the default inner
11582 tabular environment to ~tabularx~ or ~tabulary~. Finally, you can
11583 set the alignment string, and (with ~tabularx~ or ~tabulary~) the
11586 #+cindex: #+CAPTION
11588 #+cindex: #+ATTR_LaTeX
11590 ,#+CAPTION: A long table
11592 ,#+ATTR_LaTeX: longtable align=l|lp@{3cm@}r|l
11597 or to specify a multicolumn table with ~tabulary~:
11599 #+cindex: #+CAPTION
11601 #+cindex: #+ATTR_LaTeX
11603 ,#+CAPTION: A wide table with tabulary
11605 ,#+ATTR_LaTeX: table* tabulary width=\textwidth
11610 *** Images in LaTeX export
11612 :DESCRIPTION: How to insert figures into LaTeX output
11614 #+cindex: images, inline in LaTeX
11615 #+cindex: inlining images in LaTeX
11617 Images that are linked to without a description part in the link, like
11618 ~[[file:img.jpg]]~ or ~[[./img.jpg]]~ will be inserted into the PDF
11619 output file resulting from LaTeX processing. Org will use an
11620 ~\includegraphics~ macro to insert the image. If you have specified
11621 a caption and/or a label as described in [[Images and tables]], the
11622 figure will be wrapped into a ~figure~ environment and thus become
11623 a floating element. You can use an ~#+ATTR_LaTeX:~ line to specify
11624 various other options. You can ask org to export an image as a float
11625 without specifying a label or a caption by using the keyword ~float~
11626 in this line. Various optional arguments to the ~\includegraphics~
11627 macro can also be specified in this fashion. To modify the placement
11628 option of the floating environment, add something like
11629 {{{samp(placement=[h!])}}} to the attributes. It is to be noted this
11630 option can be used with tables as well.[fn:128]
11632 If you would like to let text flow around the image, add the word
11633 {{{samp(wrap)}}} to the ~#+ATTR_LaTeX:~ line, which will make the
11634 figure occupy the left half of the page. To fine-tune, the ~placement~
11635 field will be the set of additional arguments needed by the
11636 ~wrapfigure~ environment. Note that if you change the size of the
11637 image, you need to use compatible settings for ~\includegraphics~ and
11640 #+cindex: #+CAPTION
11642 #+cindex: #+ATTR_LaTeX
11644 ,#+CAPTION: The black-body emission of the disk around HR 4049
11645 ,#+LABEL: fig:SED-HR4049
11646 ,#+ATTR_LaTeX: width=5cm,angle=90
11647 [[./img/sed-hr4049.pdf]]
11649 ,#+ATTR_LaTeX: width=0.38\textwidth wrap placement=@{r@}@{0.4\textwidth@}
11653 If you wish to include an image which spans multiple columns in a page, you
11654 can use the keyword ~multicolumn~ in the ~#+ATTR_LaTeX~ line. This
11655 will export the image wrapped in a ~figure*~ environment.
11657 If you need references to a label created in this way, write
11658 ~\ref{fig:SED-HR4049}~ just like in LaTeX.
11660 *** Beamer class export
11662 :DESCRIPTION: Turning the file into a presentation
11665 The LaTeX class {{{file(beamer)}}} allows production of high
11666 quality presentations using LaTeX and pdf processing. Org mode has
11667 special support for turning an Org mode file or tree into a
11668 {{{file(beamer)}}} presentation.
11670 When the LaTeX class for the current buffer (as set with ~#+LaTeX_CLASS:
11671 beamer~) or subtree (set with a ~LaTeX_CLASS~ property) is
11672 ~beamer~, a special export mode will turn the file or tree into a beamer
11673 presentation. Any tree with not-too-deep level nesting should in principle be
11674 exportable as a beamer presentation. By default, the top-level entries (or
11675 the first level below the selected subtree heading) will be turned into
11676 frames, and the outline structure below this level will become itemize lists.
11677 You can also configure the variable ~org-beamer-frame-level~ to a
11678 different level---then the hierarchy above frames will produce the sectioning
11679 structure of the presentation.
11681 A template for useful in-buffer settings or properties can be inserted
11682 into the buffer with
11683 {{{kbd(M-x org-insert-beamer-options-template)}}}. Among other things, this will
11684 install a column view format which is very handy for editing special
11685 properties used by beamer.
11687 You can influence the structure of the presentation using the following
11690 #+attr_texinfo: :table-type table :indic @asis
11693 The environment that should be used to format this entry. Valid
11694 environments are defined in the constant
11695 ~org-beamer-environments-default~, and you can define more in
11696 ~org-beamer-environments-extra~. If this property is set, the entry
11697 will also get a ~:B_environment:~ tag to make this visible. This tag
11698 has no semantic meaning, it is only a visual aid.
11700 - ~BEAMER_envargs~ ::
11702 The beamer-special arguments that should be used for the environment,
11703 like ~[t]~ or ~[<+->]~ of ~<2-3>~. If the ~BEAMER_col~ property is
11704 also set, something like ~C[t]~ can be added here as well to set an
11705 options argument for the implied ~columns~ environment. ~c[t]~ or
11706 ~c<2->~ will set an options for the implied ~column~ environment.
11710 The width of a column that should start with this entry. If this
11711 property is set, the entry will also get a ~:BMCOL:~ property to make
11712 this visible. Also this tag is only a visual aid. When this is a plain
11713 number, it will be interpreted as a fraction of ~\textwidth~.
11714 Otherwise it will be assumed that you have specified the units, like
11715 {{{samp(3cm)}}}. The first such property in a frame will start a
11716 ~columns~ environment to surround the columns. This environment is
11717 closed when an entry has a ~BEAMER_col~ property with value 0 or 1, or
11718 automatically at the end of the frame.
11720 - ~BEAMER_extra~ ::
11722 Additional commands that should be inserted after the environment has
11723 been opened. For example, when creating a frame, this can be used to
11724 specify transitions.
11727 Frames will automatically receive a ~fragile~ option if they contain
11728 source code that uses the verbatim environment. Special {{{file(beamer)}}}
11729 specific code can be inserted using ~#+BEAMER:~ and
11730 ~#+BEGIN_BEAMER~ ... ~#+END_BEAMER~ constructs, similar to other export
11731 backends, but with the difference that ~#+LaTeX:~ stuff will be included
11732 in the presentation as well.
11734 Outline nodes with ~BEAMER_env~ property value {{{samp(note)}}} or
11735 {{{samp(noteNH)}}} will be formatted as beamer notes, i,e, they will be wrapped
11736 into ~\note{...}~. The former will include the heading as part of the
11737 note text, the latter will ignore the heading of that node. To simplify note
11738 generation, it is actually enough to mark the note with a /tag/ (either
11739 ~:B_note:~ or ~:B_noteNH:~) instead of creating the
11740 ~BEAMER_env~ property.
11742 You can turn on a special minor mode ~org-beamer-mode~ for editing
11743 support with the following line:
11749 #+attr_texinfo: :table-type table :indic @asis
11750 - {{{kbd(C-c C-b)}}}, ~org-beamer-select-environment~ ::
11753 In ~org-beamer-mode~, this key offers fast selection of a beamer
11754 environment or the ~BEAMER_col~ property.
11757 Column view provides a great way to set the environment of a node and
11758 other important parameters. Make sure you are using a COLUMN format
11759 that is geared toward this special purpose. The command
11760 {{{kbd(M-x org-insert-beamer-options-template)}}} defines such a format.
11762 Here is a simple example Org document that is intended for beamer export.
11765 ,#+LaTeX_CLASS: beamer
11766 ,#+TITLE: Example Presentation
11767 ,#+AUTHOR: Carsten Dominik
11768 ,#+LaTeX_CLASS_OPTIONS: [presentation]
11769 ,#+BEAMER_FRAME_LEVEL: 2
11770 ,#+BEAMER_HEADER_EXTRA: \usetheme@{Madrid@}\usecolortheme@{default@}
11771 ,#+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex)
11773 ,* This is the first structural section
11775 ,** Frame 1 \\ with a subtitle
11776 ,*** Thanks to Eric Fraga :BMCOL:B_block:
11779 :BEAMER_envargs: C[t]
11782 for the first viable beamer setup in Org
11783 ,*** Thanks to everyone else :BMCOL:B_block:
11787 :BEAMER_envargs: <2->
11789 for contributing to the discussion
11790 ,**** This will be formatted as a beamer note :B_note:
11791 ,** Frame 2 \\ where we will not use columns
11792 ,*** Request :B_block:
11793 Please test this stuff!
11799 For more information, see the documentation on Worg.
11803 :DESCRIPTION: Exporting to DocBook
11805 #+cindex: DocBook export
11806 #+cindex: PDF export
11807 #+cindex: Cui, Baoqiu
11809 Org contains a DocBook exporter written by Baoqiu Cui. Once an Org file is
11810 exported to DocBook format, it can be further processed to produce other
11811 formats, including PDF, HTML, man pages, etc., using many available DocBook
11812 tools and stylesheets.
11814 Currently DocBook exporter only supports DocBook V5.0.
11816 *** DocBook export commands
11818 :DESCRIPTION: How to invoke DocBook export
11820 #+cindex: region, active
11821 #+cindex: active region
11822 #+cindex: transient-mark-mode
11824 #+attr_texinfo: :table-type table :indic @asis
11825 - {{{kbd(C-c C-e D)}}}, ~org-export-as-docbook~ ::
11826 #+kindex: C-c C-e D
11827 #+cindex: property EXPORT_FILE_NAME
11829 Export as a DocBook file. For an Org file, {{{file(myfile.org)}}}, the
11830 DocBook XML file will be {{{file(myfile.xml)}}}. The file will be
11831 overwritten without warning. If there is an active region, only the
11832 region will be exported.[fn:129] If the selected region is a single
11833 tree, the tree head will become the document title.[fn:130] If the
11834 tree head entry has, or inherits, an ~EXPORT_FILE_NAME~ property, that
11835 name will be used for the export.
11837 - {{{kbd(C-c C-e V)}}}, ~org-export-as-docbook-pdf-and-open~ ::
11838 #+kindex: C-c C-e V
11840 Export as a DocBook file, process to PDF, then open the resulting PDF
11843 #+vindex: org-export-docbook-xslt-proc-command
11844 #+vindex: org-export-docbook-xsl-fo-proc-command
11846 Note that, in order to produce PDF output based on an exported DocBook
11847 file, you need to have XSLT processor and XSL-FO processor software
11848 installed on your system. Check variables
11849 ~org-export-docbook-xslt-proc-command~ and
11850 ~org-export-docbook-xsl-fo-proc-command~.
11852 #+vindex: org-export-docbook-xslt-stylesheet
11854 The stylesheet argument ~%s~ in variable
11855 ~org-export-docbook-xslt-proc-command~ is replaced by the value of
11856 variable ~org-export-docbook-xslt-stylesheet~, which needs to be set by
11857 the user. You can also overrule this global setting on a per-file basis by
11858 adding an in-buffer setting ~#+XSLT:~ to the Org file.
11860 - {{{kbd(C-c C-e v D)}}} ::
11861 #+kindex: C-c C-e v D
11863 Export only the visible part of the document.
11865 *** Quoting DocBook code
11867 :DESCRIPTION: Incorporating DocBook code in Org files
11869 You can quote DocBook code in Org files and copy it verbatim into exported
11870 DocBook file with the following constructs:
11872 #+cindex: #+DOCBOOK
11873 #+cindex: #+BEGIN_DOCBOOK
11875 ,#+DOCBOOK: Literal DocBook code for export
11879 #+cindex: #+BEGIN_DOCBOOK
11883 All lines between these markers are exported by DocBook exporter
11888 For example, you can use the following lines to include a DocBook warning
11889 admonition. As to what this warning says, you should pay attention to the
11890 document context when quoting DocBook code in Org files. You may make
11891 exported DocBook XML files invalid by not quoting DocBook code correctly.
11896 <para>You should know what you are doing when quoting DocBook XML code
11897 in your Org file. Invalid DocBook XML may be generated by
11898 DocBook exporter if you are not careful!</para>
11903 *** Recursive sections
11905 :DESCRIPTION: Recursive sections in DocBook
11907 #+cindex: DocBook recursive sections
11909 DocBook exporter exports Org files as articles using the ~article~
11910 element in DocBook. Recursive sections, i.e., ~section~ elements, are
11911 used in exported articles. Top level headlines in Org files are
11912 exported as top level sections, and lower level headlines are exported
11913 as nested sections. The entire structure of Org files will be exported
11914 completely, no matter how many nested levels of headlines there are.
11916 Using recursive sections makes it easy to port and reuse exported
11917 DocBook code in other DocBook document types like ~book~ or ~set~.
11919 *** Tables in DocBook export
11921 :DESCRIPTION: Tables are exported as HTML tables
11923 #+cindex: tables, in DocBook export
11925 Tables in Org files are exported as HTML tables, which have been
11926 supported since DocBook V4.3.
11928 If a table does not have a caption, an informal table is generated
11929 using the ~informaltable~ element; otherwise, a formal table will be
11930 generated using the ~table~ element.
11932 *** Images in DocBook export
11934 :DESCRIPTION: How to insert figures into DocBook output
11936 #+cindex: images, inline in DocBook
11937 #+cindex: inlining images in DocBook
11939 Images that are linked to without a description part in the link, like
11940 ~[[file:img.jpg]]~ or ~[[./img.jpg]]~, will be exported to
11941 DocBook using ~mediaobject~ elements. Each ~mediaobject~ element
11942 contains an ~imageobject~ that wraps an ~imagedata~ element. If you
11943 have specified a caption for an image as described in [[Images and
11944 tables]], a ~caption~ element will be added in ~mediaobject~. If a label
11945 is also specified, it will be exported as an ~xml:id~ attribute of the
11946 ~mediaobject~ element.
11948 #+vindex: org-export-docbook-default-image-attributes
11950 Image attributes supported by the ~imagedata~ element, like ~align~ or
11951 ~width~, can be specified in two ways: you can either customize
11952 variable ~org-export-docbook-default-image-attributes~ or use the
11953 ~#+ATTR_DOCBOOK:~ line. Attributes specified in variable
11954 ~org-export-docbook-default-image-attributes~ are applied to all
11955 inline images in the Org file to be exported (unless they are
11956 overridden by image attributes specified in ~#+ATTR_DOCBOOK:~ lines).
11958 The ~#+ATTR_DOCBOOK:~ line can be used to specify additional image
11959 attributes or override default image attributes for individual images.
11960 If the same attribute appears in both the ~#+ATTR_DOCBOOK:~ line and
11961 variable ~org-export-docbook-default-image-attributes~, the former
11962 takes precedence. Here is an example about how image attributes can be
11965 #+cindex: #+CAPTION
11967 #+cindex: #+ATTR_DOCBOOK
11969 ,#+CAPTION: The logo of Org mode
11970 ,#+LABEL: unicorn-svg
11971 ,#+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"
11972 [[./img/org-mode-unicorn.svg]]
11975 #+vindex: org-export-docbook-inline-image-extensions
11977 By default, DocBook exporter recognizes the following image file
11978 types: {{{file(jpeg)}}}, {{{file(jpg)}}}, {{{file(png)}}},
11979 {{{file(gif)}}}, and {{{file(svg)}}}. You can customize variable
11980 ~org-export-docbook-inline-image-extensions~ to add more types to this
11981 list as long as DocBook supports them.
11983 *** Special characters
11985 :DESCRIPTION: How to handle special characters
11986 :TITLE: Special characters in DocBook export
11988 #+vindex: org-export-docbook-doctype
11989 #+vindex: org-entities
11991 Special characters that are written in TeX-like syntax, such as
11992 ~\alpha~, ~\Gamma~, and ~\Zeta~, are supported by DocBook exporter.
11993 These characters are rewritten to XML entities, like ~α~,
11994 ~Γ~, and ~Ζ~, based on the list saved in variable
11995 ~org-entities~. As long as the generated DocBook file includes the
11996 corresponding entities, these special characters are recognized.
11998 You can customize variable ~org-export-docbook-doctype~ to include the
11999 entities you need. For example, you can set variable
12000 ~org-export-docbook-doctype~ to the following value to recognize all
12001 special characters included in XHTML entities:
12004 "<!DOCTYPE article [
12005 <!ENTITY % xhtml1-symbol PUBLIC
12006 \"-//W3C//ENTITIES Symbol for HTML//EN//XML\"
12007 \"http://www.w3.org/2003/entities/2007/xhtml1-symbol.ent\"
12014 ** OpenDocument Text export
12016 :DESCRIPTION: Exporting to OpenDocument Text
12018 #+cindex: K, Jambunathan
12020 #+cindex: OpenDocument
12021 #+cindex: export, OpenDocument
12022 #+cindex: LibreOffice
12023 #+cindex: org-odt.el
12024 #+cindex: org-modules
12026 Org Mode supports export to OpenDocument Text (ODT) format using the
12027 {{{file(org-odt.el)}}} module.[fn:131] Documents created by this
12028 exporter use the {{{cite(OpenDocument-v1.2 specification)}}} and
12029 are compatible with LibreOffice 3.4.[fn:132]
12031 *** Pre-requisites for ODT export
12033 :DESCRIPTION: What packages ODT exporter relies on
12037 The ODT exporter relies on the {{{file(zip)}}} program to create the
12038 final output. Check the availability of this program before proceeding
12041 *** ODT export commands
12043 :DESCRIPTION: How to invoke ODT export
12044 :ALT_TITLE: Exporting to ODT
12046 <<x-export-to-odt>>
12048 #+cindex: region, active
12049 #+cindex: active region
12050 #+cindex: transient-mark-mode
12052 #+attr_texinfo: :table-type table :indic @asis
12053 - {{{kbd(C-c C-e o)}}}, ~org-export-as-odt~ ::
12054 #+kindex: C-c C-e o
12055 #+cindex: property EXPORT_FILE_NAME
12057 Export as OpenDocument Text file.
12059 #+vindex: org-export-odt-preferred-output-format
12061 If ~org-export-odt-preferred-output-format~ is specified,
12062 automatically convert the exported file to that format. See
12063 [[Automatically exporting to other formats]].
12065 For an Org file {{{file(myfile.org)}}}, the ODT file will be
12066 {{{file(myfile.odt)}}}. The file will be overwritten without warning.
12067 If there is an active region, only the region will be
12068 exported.[fn:133] If the selected region is a single tree, the tree
12069 head will become the document title.[fn:134] If the tree head entry
12070 has, or inherits, an ~EXPORT_FILE_NAME~ property, that name will be
12071 used for the export.
12073 - {{{kbd(C-c C-e O)}}}, ~org-export-as-odt-and-open~ ::
12074 #+kindex: C-c C-e O
12076 Export as an OpenDocument Text file and open the resulting file.
12078 #+vindex: org-export-odt-preferred-output-format
12080 If ~org-export-odt-preferred-output-format~ is specified, open the
12081 converted file instead. See [[x-export-to-other-formats][Automatically exporting to other formats]].
12083 *** Extending ODT export
12085 :DESCRIPTION: How to produce ~doc~, ~pdf~ files
12088 The ODT exporter can interface with a variety of document converters
12089 and supports popular converters out of the box. As a result, you can
12090 use it to export to formats like {{{samp(doc)}}} or convert a document
12091 from one format (say {{{samp(csv)}}}) to another format (say
12092 {{{samp(ods)}}} or {{{samp(xls)}}}).
12094 #+cindex: @file{unoconv}
12095 #+cindex: LibreOffice
12097 If you have a working installation of LibreOffice, a document
12098 converter is pre-configured for you and you can use it right away. If
12099 you would like to use {{{file(unoconv)}}} as your preferred converter,
12100 customize the variable ~org-export-odt-convert-process~ to point to
12101 ~unoconv~. You can also use your own favorite converter or tweak the
12102 default settings of the {{{file(LibreOffice)}}} and
12103 {{{samp(unoconv)}}} converters. See [[Configuring a document converter]].
12105 **** Automatically exporting to other formats
12107 :DESCRIPTION: Automatic conversion to doc, docx, etc.
12109 <<x-export-to-other-formats>>
12111 #+vindex: org-export-odt-preferred-output-format
12113 Very often, you will find yourself exporting to ODT format, only to
12114 immediately save the exported document to other formats like
12115 {{{samp(doc)}}}, {{{samp(docx)}}}, {{{samp(rtf)}}}, {{{samp(pdf)}}}
12116 etc. In such cases, you can specify your preferred output format by
12117 customizing the variable ~org-export-odt-preferred-output-format~.
12118 This way, the export commands (see [[x-export-to-odt][Exporting to ODT]])
12119 can be extended to export to a format that is of immediate interest to
12122 **** Converting between document formats
12124 :DESCRIPTION: Interacting with configured converters
12126 # <<x-convert-to-other-formats>>
12128 There are many document converters in the wild that support
12129 conversion to and from various file formats, including, but not
12130 limited to the ODT format. LibreOffice converter, mentioned above, is
12131 one such converter. Once a converter is configured, you can interact
12132 with it using the following command.
12134 #+attr_texinfo: :table-type table :indic @asis
12135 - {{{kbd(M-x org-export-odt-convert)}}} ::
12136 #+vindex: org-export-odt-convert
12138 Convert an existing document from one format to another. With a prefix
12139 argument, also open the newly produced file.
12141 *** Applying custom styles
12143 :DESCRIPTION: How to apply custom styles to the output
12145 #+cindex: styles, custom
12146 #+cindex: template, custom
12148 The ODT exporter ships with a set of OpenDocument styles
12149 (see [[Working with OpenDocument style files]]) that ensure a well-formatted output.
12150 These factory styles, however, may not cater to your specific tastes.
12151 To customize the output, you can either modify the above styles files
12152 directly, or generate the required styles using an application like
12153 LibreOffice. The latter method is suitable for expert and non-expert
12154 users alike, and is described here.
12156 Custom styles can be applied in three easy steps:
12158 1. Create a sample {{{file(example.org)}}} file with the below
12159 settings and export it to ODT format.
12162 ,#+OPTIONS: H:10 num:t
12165 2. Open the above {{{file(example.odt)}}} using LibreOffice. Use the
12166 {{{file(Stylist)}}} to locate the target styles---these typically
12167 have the {{{samp(Org)}}} prefix---and modify those to your taste.
12168 Save the modified file either as an OpenDocument Text
12169 ({{{file(.odt)}}}) or OpenDocument Template ({{{file(.ott)}}})
12172 3. Customize the variable ~org-export-odt-styles-file~ and point it to
12173 the newly created file. For additional configuration options see
12174 [[x-overriding-factory-styles][Overriding factory styles]].
12176 #+cindex: #+ODT_STYLES_FILE
12177 #+vindex: org-export-odt-styles-file
12179 If you would like to choose a style on a per-file basis, you can use
12180 the ~#+ODT_STYLES_FILE~ option. A typical setting will look like
12181 one of these two examples:
12184 ,#+ODT_STYLES_FILE: "/path/to/example.ott"
12190 ,#+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
12193 Although you can use third-party styles and templates for customizing
12194 your output, this will produce the desired output only if the template
12195 provides all style names that the {{{samp(ODT)}}} exporter relies
12196 upon. Unless this condition is met, the output is going to be less
12197 than satisfactory. It is highly recommended that you only work with
12198 templates that are directly derived from the factory settings.
12200 *** Links in ODT export
12202 :DESCRIPTION: How links will be interpreted and formatted
12204 #+cindex: tables, in DocBook export
12206 ODT exporter creates native cross-references for internal links. It
12207 creates Internet-style links for all other links.
12209 A link with no description and destined to a regular (un-itemized)
12210 outline heading is replaced with a cross-reference and section number
12213 A ~\ref{label}~-style reference to an image, table etc. is replaced
12214 with a cross-reference and sequence number of the labeled entity. See
12215 [[Labels and captions in ODT export]].
12217 *** Tables in ODT export
12219 :DESCRIPTION: How tables are exported
12222 #+cindex: tables, in DocBook export
12224 Export of native Org mode tables (see [[Tables]]) and simple
12225 {{{file(table.el)}}} tables is supported. However, export of complex
12226 {{{file(table.el)}}} tables---tables that have column or row
12227 spans---is not supported. Such tables are stripped from the exported
12230 By default, a table is exported with top and bottom frames and with
12231 rules separating row and column groups (see [[Column groups]]).
12232 Furthermore, all tables are typeset to occupy the same width. If the
12233 table specifies alignment and relative width for its columns (see
12234 [[Column width and alignment]]) then these are honored on export.[fn:135]
12236 #+cindex: #+ATTR_ODT
12238 You can control the width of the table by specifying ~:rel-width~
12239 property using an ~#+ATTR_ODT~ line.
12241 For example, consider the following table which makes use of all the
12242 rules mentioned above.
12245 #+ATTR_ODT: :rel-width 50
12246 | Area/Month | Jan | Feb | Mar | Sum |
12247 |---------------+-------+-------+-------+-------|
12249 | <l13> | <r5> | <r5> | <r5> | <r6> |
12250 | North America | 1 | 21 | 926 | 948 |
12251 | Middle East | 6 | 75 | 844 | 925 |
12252 | Asia Pacific | 9 | 27 | 790 | 826 |
12253 |---------------+-------+-------+-------+-------|
12254 | Sum | 16 | 123 | 2560 | 2699 |
12257 On export, the table will occupy 50% of text area. The columns will be
12258 sized (roughly) in the ratio of 13:5:5:5:6. The first column will be
12259 left-aligned and rest of the columns will be right-aligned. There will
12260 be vertical rules after separating the header and last columns from
12261 other columns. There will be horizontal rules separating the header
12262 and last rows from other rows.
12264 If you are not satisfied with the above formatting options, you can
12265 create custom table styles and associate them with a table using the
12266 ~#+ATTR_ODT~ line. See [[Customizing tables in ODT export]].
12268 *** Images in ODT export
12270 :DESCRIPTION: How to insert images
12272 #+cindex: images, embedding in ODT
12273 #+cindex: embedding images in ODT
12275 You can embed images within the exported document by providing a link to the
12276 desired image file with no link description. For example, to embed
12277 {{{samp(img.png)}}} do either of the following:
12287 You can create clickable images by providing a link whose description
12288 is a link to an image file. For example, to embed an image
12289 {{{file(org-mode-unicorn.png)}}}, which when clicked jumps to
12290 [[http://Orgmode.org]] website, do the following:
12293 [[http://orgmode.org][./org-mode-unicorn.png]]
12296 #+cindex: #+ATTR_ODT
12298 You can control the size and scale of the embedded images using the
12299 ~#+ATTR_ODT~ attribute.
12301 #+cindex: identify, ImageMagick
12302 #+vindex: org-export-odt-pixels-per-inch
12304 The exporter specifies the desired size of the image in the final
12305 document in units of centimeters. In order to scale the embedded
12306 images, the exporter queries for pixel dimensions of the images using
12307 either ImageMagick's {{{file(identify)}}} program, or Emacs'
12308 `create-image' and `image-size' APIs.[fn:136] The pixel dimensions are
12309 subsequently converted to centimeters using
12310 ~org-export-odt-pixels-per-inch~. The default value of this variable
12311 is set to ~display-pixels-per-inch~. You can tweak this variable to
12312 achieve the best results.
12314 The examples below illustrate the various possibilities.
12316 #+attr_texinfo: :table-type table :indic @asis
12317 - Explicitly size the image ::
12319 To embed {{{file(img.png)}}} as a 10 cm x 10 cm image, do the
12323 #+ATTR_ODT: :width 10 :height 10
12327 - Scale the image ::
12329 To embed {{{file(img.png)}}} at half its size, do the following:
12332 #+ATTR_ODT: :scale 0.5
12336 - Scale the image to a specific width ::
12338 To embed {{{file(img.png)}}} with a width of 10 cm while retaining the
12339 original height:width ratio, do the following:
12342 #+ATTR_ODT: :width 10
12346 - Scale the image to a specific height ::
12348 To embed {{{file(img.png)}}} with a height of 10 cm while retaining
12349 the original height:width ratio, do the following:
12352 #+ATTR_ODT: :height 10
12356 #+cindex: #+ATTR_ODT
12358 You can control the manner in which an image is anchored by setting
12359 the ~:anchor~ property of it's ~#+ATTR_ODT~ line. You can specify one
12360 of the the following three values for the ~:anchor~ property -
12361 {{{samp("as-char")}}}, {{{samp("paragraph")}}} and {{{samp("page")}}}.
12363 To create an image that is anchored to a page, do the following:
12366 #+ATTR_ODT: :anchor "page"
12370 *** Math formatting in ODT export
12372 :DESCRIPTION: How LaTeX fragments are formatted
12375 The ODT exporter has special support for handling math.
12377 **** Working with LaTeX math snippets
12379 :DESCRIPTION: How to embed LaTeX math fragments
12382 LaTeX math snippets (see [[LaTeX fragments]]) can be embedded in the ODT
12383 document in one of the following ways:
12386 #+attr_texinfo: :table-type table :indic @asis
12389 This option is activated on a per-file basis with the following option:
12392 ,#+OPTIONS: LaTeX:t
12395 With this option, LaTeX fragments are first converted into MathML
12396 fragments using an external LaTeX-to-MathML converter program. The
12397 resulting MathML fragments are then embedded as an OpenDocument Formula in
12398 the exported document.
12400 #+vindex: org-latex-to-mathml-convert-command
12401 #+vindex: org-latex-to-mathml-jar-file
12403 You can specify the LaTeX-to-MathML converter by customizing the variables
12404 ~org-latex-to-mathml-convert-command~ and
12405 ~org-latex-to-mathml-jar-file~.
12407 If you prefer to use {{{file(MathToWeb)}}} as your converter, you can
12408 configure the above variables as shown below.[fn:137]
12411 #+header: :exports code
12412 #+begin_src emacs-lisp
12413 (setq org-latex-to-mathml-convert-command
12414 "java -jar %j -unicode -force -df %o %I"
12415 org-latex-to-mathml-jar-file
12416 "/path/to/mathtoweb.jar")
12419 You can use the following commands to quickly verify the reliability of
12420 the LaTeX-to-MathML converter.
12422 - {{{kbd(M-x org-export-as-odf)}}} ::
12424 Convert a LaTeX math snippet to an OpenDocument formula
12425 ({{{file(.odf)}}}) file.
12427 - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
12429 Convert a LaTeX math snippet to an OpenDocument formula
12430 ({{{file(.odf)}}}) file and open the formula file with the
12431 system-registered application.
12436 This option is activated on a per-file basis with
12439 ,#+OPTIONS: LaTeX:dvipng
12442 With this option, LaTeX fragments are processed into PNG images and
12443 the resulting images are embedded in the exported document. This
12444 method requires that the {{{file(dvipng)}}} program be available on
12447 **** Working with MathML or OpenDocument formula files
12449 :DESCRIPTION: How to embed equations in native format
12452 For various reasons, you may find embedding LaTeX math snippets in
12453 an ODT document less than reliable. In that case, you can embed a math
12454 equation by linking to its MathML ({{{file(.mml)}}}) source or its
12455 OpenDocument formula ({{{file(.odf)}}}) file as shown below:
12467 *** Labels and captions in ODT export
12469 :DESCRIPTION: How captions are rendered
12472 You can label and caption various category of objects---an inline
12473 image, a table, a LaTeX fragment or a Math formula---using
12474 ~#+LABEL~ and ~#+CAPTION~ lines. See [[Images and tables]]. ODT exporter
12475 enumerates each labeled or captioned object of a given category
12476 separately. As a result, each such object is assigned a sequence
12477 number based on order of its appearance in the Org file.
12479 In the exported document, a user-provided caption is augmented with
12480 the category and sequence number. Consider the following inline image
12484 ,#+CAPTION: Bell curve
12485 ,#+LABEL: fig:SED-HR4049
12489 It could be rendered as shown below in the exported document.
12492 Figure 2: Bell curve
12495 #+vindex: org-export-odt-category-strings
12497 You can modify the category component of the caption by customizing
12498 the variable ~org-export-odt-category-strings~. For example, to tag
12499 all embedded images with the string {{{samp(Illustration)}}} (instead
12500 of the default {{{samp(Figure)}}}) use the following setting.
12503 #+header: :exports code
12504 #+begin_src emacs-lisp
12505 (setq org-export-odt-category-strings
12506 '(("en" "Table" "Illustration" "Equation" "Equation")))
12509 With this, previous image will be captioned as below in the exported
12513 Illustration 2: Bell curve
12516 *** Literal examples in ODT export
12518 :DESCRIPTION: How source and example blocks are formatted
12521 Export of literal examples (see [[Literal examples]]) with full
12522 fontification is supported. Internally, the exporter relies on
12523 {{{file(htmlfontify.el)}}} to generate all style definitions needed
12524 for a fancy listing.[fn:138] The auto-generated styles have
12525 {{{samp(OrgSrc)}}} as prefix and inherit their color from the faces
12526 used by Emacs ~font-lock~ library for the source language.
12528 #+vindex: org-export-odt-fontify-srcblocks
12530 If you prefer to use your own custom styles for fontification, you can
12531 do so by customizing the variable
12532 ~org-export-odt-create-custom-styles-for-srcblocks~.
12534 #+vindex: org-export-odt-create-custom-styles-for-srcblocks
12536 You can turn off fontification of literal examples by customizing the
12537 variable ~org-export-odt-fontify-srcblocks~.
12539 *** Advanced topics in ODT export
12541 :DESCRIPTION: Read this if you are a power user
12544 If you rely heavily on ODT export, you may want to exploit the full
12545 set of features that the exporter offers. This section describes
12546 features that would be of interest to power users.
12548 **** Configuring a document converter
12550 :DESCRIPTION: How to register a document converter
12553 #+cindex: doc, docx, rtf
12554 #+cindex: converter
12556 The ODT exporter can work with popular converters with little or no
12557 extra configuration from your side. See [[Extending ODT export]]. If you
12558 are using a converter that is not supported by default or if you would
12559 like to tweak the default converter settings, proceed as below.
12561 #+attr_texinfo: :table-type table :indic @asis
12562 - Register the converter ::
12564 #+vindex: org-export-odt-convert-processes
12566 Name your converter and add it to the list of known converters by
12567 customizing the variable ~org-export-odt-convert-processes~. Also
12568 specify how the converter can be invoked via command-line to effect
12571 - Configure its capabilities ::
12573 #+vindex: org-export-odt-convert-capabilities
12574 # <<x-odt-converter-capabilities>>
12576 Specify the set of formats the converter can handle by customizing the
12577 variable ~org-export-odt-convert-capabilities~. Use the default value
12578 for this variable as a guide for configuring your converter. As suggested by
12579 the default setting, you can specify the full set of formats supported by the
12580 converter and not limit yourself to specifying formats that are related to
12581 just the OpenDocument Text format.
12583 - Choose the converter ::
12585 #+vindex: org-export-odt-convert-process
12587 Select the newly added converter as the preferred one by customizing the
12588 variable ~org-export-odt-convert-process~.
12590 **** Working with OpenDocument style files
12592 :DESCRIPTION: Explore the internals
12594 #+cindex: styles, custom
12595 #+cindex: template, custom
12597 This section explores the internals of the ODT exporter and the means
12598 by which it produces styled documents. Read this section if you are
12599 interested in exploring the automatic and custom OpenDocument styles
12600 used by the exporter.
12602 # <<x-factory-styles>>
12604 The ODT exporter relies on two files for generating its output.
12605 These files are bundled with the distribution under the directory pointed to
12606 by the variable ~org-odt-styles-dir~. The two files are:
12608 #+attr_texinfo: :table-type table :indic @asis
12609 - {{{file(OrgOdtStyles.xml)}}} ::
12610 <<x-orgodtstyles-xml>>
12612 This file contributes to the {{{file(styles.xml)}}} file of the final
12613 {{{samp(ODT)}}} document. This file is modified to control outline
12614 numbering based on user settings, and To add styles generated by
12615 {{{file(htmlfontify.el)}}} for fontification of code blocks.
12617 - {{{file(OrgOdtContentTemplate.xml)}}} ::
12618 <<x-orgodtcontenttemplate-xml>>
12620 This file contributes to the {{{file(content.xml)}}} file of the final
12621 {{{samp(ODT)}}} document. The contents of the Org outline are inserted
12622 between the ~<office:text>~ and ~</office:text>~
12623 elements of this file.
12625 In addition to serving as a template file for the final
12626 {{{file(content.xml)}}}, the file also contains automatic styles for
12627 formatting of tables which are referenced by the exporter, and
12628 ~<text:sequence-decl>~ ... ~</text:sequence-decl>~
12629 elements that control how various entities---tables, images,
12630 equations, etc.---are numbered.
12633 <<x-overriding-factory-styles>>
12635 The following two variables control the location from which the ODT
12636 exporter picks up the custom styles and content template files. You
12637 can customize these variables to override the factory styles used by
12640 #+attr_texinfo: :table-type table :indic @asis
12641 - ~org-export-odt-styles-file~ ::
12642 <<x-org-export-odt-styles-file>>
12644 Use this variable to specify the {{{file(styles.xml)}}} that will be
12645 used in the final output. You can specify one of the following values:
12647 - A {{{file(styles.xml)}}} file ::
12649 Use this file instead of the default {{{file(styles.xml)}}}
12651 - A {{{file(.odt)}}} or {{{file(.ott)}}} file ::
12653 Use the {{{file(styles.xml)}}} contained in the specified OpenDocument
12654 Text or Template file.
12656 - A {{{file(.odt)}}} or {{{file(.ott)}}} file and a subset of files contained within them ::
12658 Use the {{{file(styles.xml)}}} contained in the specified OpenDocument
12659 Text or Template file. Additionally extract the specified member files
12660 and embed those within the final {{{samp(ODT)}}} document.
12662 Use this option if the {{{file(styles.xml)}}} file references
12663 additional files like header and footer images.
12667 Use the default {{{file(styles.xml)}}}
12669 - ~org-export-odt-content-template-file~ ::
12670 <<x-org-export-odt-content-template-file>>
12672 Use this variable to specify the blank {{{file(content.xml)}}} that
12673 will be used in the final output.
12675 **** Creating one-off styles
12677 :DESCRIPTION: How to produce custom highlighting, etc.
12680 There are times when you would want one-off formatting in the exported
12681 document. You can achieve this by embedding raw OpenDocument XML in
12682 the Org file. The use of this feature is better illustrated with
12683 couple of examples.
12685 #+attr_texinfo: :table-type table :indic @asis
12686 - Embedding ODT tags as part of regular text ::
12688 You can include simple OpenDocument tags by prefixing them with
12689 {{{samp(@)}}}. For example, to highlight a region of text do the
12693 @<text:span text:style-name="Highlight">This is a
12694 highlighted text@</text:span>. But this is a
12698 *Hint:* To see the above example in action, edit your
12699 {{{file(styles.xml)}}} (see [[x-orgodtstyles-xml][Factory styles]]) and
12700 add a custom {{{samp(Highlight)}}} style as shown below.
12703 <style:style style:name="Highlight" style:family="text">
12704 <style:text-properties fo:background-color="#ff0000"/>
12708 - Embedding a one-line OpenDocument XML ::
12710 You can add a simple OpenDocument one-liner using the ~#+ODT:~
12711 directive. For example, to force a page break do the following:
12714 #+ODT: <text:p text:style-name="PageBreak"/>
12717 *Hint:* To see the above example in action, edit your
12718 {{{file(styles.xml)}}} (see [[x-orgodtstyles-xml][Factory styles]]) and
12719 add a custom {{{samp(PageBreak)}}} style as shown below.
12722 <style:style style:name="PageBreak" style:family="paragraph"
12723 style:parent-style-name="Text_20_body">
12724 <style:paragraph-properties fo:break-before="page"/>
12728 - Embedding a block of OpenDocument XML ::
12730 You can add a large block of OpenDocument XML using the
12731 ~#+BEGIN_ODT~ ... ~#+END_ODT~ construct.
12733 For example, to create a one-off paragraph that uses bold text, do the
12738 <text:p text:style-name="Text_20_body_20_bold">
12739 This paragraph is specially formatted and uses bold text.
12744 **** Customizing tables in ODT export
12746 :DESCRIPTION: How to define and use table templates
12748 #+cindex: tables, in ODT export
12749 #+cindex: #+ATTR_ODT
12751 You can override the default formatting of the table by specifying a
12752 custom table style with the ~#+ATTR_ODT~ line. For a discussion on
12753 default formatting of tables see [[Tables in ODT export]].
12755 This feature closely mimics the way table templates are defined in the
12756 OpenDocument-v1.2 specification.[fn:139]
12758 To have a quick preview of this feature, install the following setting and
12759 export the example table.
12762 #+header: :exports code
12763 #+begin_src emacs-lisp
12764 (setq org-export-odt-table-styles
12765 (append org-export-odt-table-styles
12766 '(("TableWithHeaderRowAndColumn" "Custom"
12767 ((use-first-row-styles . t)
12768 (use-first-column-styles . t)))
12769 ("TableWithFirstRowandLastRow" "Custom"
12770 ((use-first-row-styles . t)
12771 (use-last-row-styles . t))))))
12775 ,#+ATTR_ODT: :style "TableWithHeaderRowAndColumn"
12776 | Name | Phone | Age |
12777 | Peter | 1234 | 17 |
12778 | Anna | 4321 | 25 |
12781 In the above example, you used a template named {{{samp(Custom)}}} and
12782 installed two table styles with the names
12783 {{{samp(TableWithHeaderRowAndColumn)}}} and
12784 {{{samp(TableWithFirstRowandLastRow)}}}. (*Important:* The
12785 OpenDocument styles needed for producing the above template have been
12786 pre-defined for you. These styles are available under the section
12787 marked {{{samp(Custom Table Template)}}} in
12788 {{{file(OrgOdtContentTemplate.xml)}}} (see
12789 [[x-orgodtcontenttemplate-xml][Factory styles]]). If you need additional
12790 templates you have to define these styles yourself.
12793 To use this feature proceed as follows:
12795 #+attr_texinfo: :table-type table :indic @asis
12796 - Create a table template[fn:140] ::
12798 A table template is nothing but a set of {{{samp(table-cell)}}} and
12799 {{{samp(paragraph)}}} styles for each of the following table cell
12812 The names for the above styles must be chosen based on the name of the
12813 table template using a well-defined convention.
12815 The naming convention is better illustrated with an example. For a
12816 table template with the name {{{samp(Custom)}}}, the needed style
12817 names are listed in the following table.
12819 | Table cell type | ~table-cell~ style | ~paragraph~ style |
12820 |-----------------+----------------------------------------+---------------------------------------------|
12821 | Body | {{{samp(CustomTableCell)}}} | {{{samp(CustomTableParagraph)}}} |
12822 | First column | {{{samp(CustomFirstColumnTableCell)}}} | {{{samp(CustomFirstColumnTableParagraph)}}} |
12823 | Last column | {{{samp(CustomLastColumnTableCell)}}} | {{{samp(CustomLastColumnTableParagraph)}}} |
12824 | First row | {{{samp(CustomFirstRowTableCell)}}} | {{{samp(CustomFirstRowTableParagraph)}}} |
12825 | Last row | {{{samp(CustomLastRowTableCell)}}} | {{{samp(CustomLastRowTableParagraph)}}} |
12826 | Even row | {{{samp(CustomEvenRowTableCell)}}} | {{{samp(CustomEvenRowTableParagraph)}}} |
12827 | Odd row | {{{samp(CustomOddRowTableCell)}}} | {{{samp(CustomOddRowTableParagraph)}}} |
12828 | Even column | {{{samp(CustomEvenColumnTableCell)}}} | {{{samp(CustomEvenColumnTableParagraph)}}} |
12829 | Odd column | {{{samp(CustomOddColumnTableCell)}}} | {{{samp(CustomOddColumnTableParagraph)}}} |
12832 To create a table template with the name {{{samp(Custom)}}}, define
12833 the above styles in the ~<office:automatic-styles>~ ...
12834 ~</office:automatic-styles>~ element of the content template file (see
12835 [[x-orgodtcontenttemplate-xml][Factory styles]]).
12837 - Define a table style[fn:141] ::
12839 #+vindex: org-export-odt-table-styles
12841 To define a table style, create an entry for the style in the variable
12842 ~org-export-odt-table-styles~ and specify the following:
12844 - the name of the table template created in step (1)
12845 - the set of cell styles in that template that are to be activated
12848 For example, the entry below defines two different table styles
12849 {{{samp(TableWithHeaderRowAndColumn)}}} and
12850 {{{samp(TableWithFirstRowandLastRow)}}} based on the same template
12851 {{{samp(Custom)}}}. The styles achieve their intended effect by
12852 selectively activating the individual cell styles in that template.
12855 #+header: :exports code
12856 #+begin_src emacs-lisp
12857 (setq org-export-odt-table-styles
12858 (append org-export-odt-table-styles
12859 '(("TableWithHeaderRowAndColumn" "Custom"
12860 ((use-first-row-styles . t)
12861 (use-first-column-styles . t)))
12862 ("TableWithFirstRowandLastRow" "Custom"
12863 ((use-first-row-styles . t)
12864 (use-last-row-styles . t))))))
12867 - Associate a table with the table style ::
12869 To do this, specify the table style created in step (2) as part of
12870 the ~ATTR_ODT~ line as shown below.
12873 ,#+ATTR_ODT: :style "TableWithHeaderRowAndColumn"
12874 | Name | Phone | Age |
12875 | Peter | 1234 | 17 |
12876 | Anna | 4321 | 25 |
12879 **** Validating OpenDocument XML
12881 :DESCRIPTION: How to debug corrupt OpenDocument files
12884 Occasionally, you will discover that the document created by the ODT
12885 exporter cannot be opened by your favorite application. One of the
12886 common reasons for this is that the {{{file(.odt)}}} file is corrupt.
12887 In such cases, you may want to validate the document against the
12888 OpenDocument RELAX NG Compact Syntax (RNC) schema.
12890 For de-compressing the {{{file(.odt)}}} file[fn:142]:
12891 [[info:emacs#File Archives]]. For general help with validation (and
12892 schema-sensitive editing) of XML files: [[info:nxml-mode#Introduction]].
12893 #+vindex: org-export-odt-schema-dir
12895 If you have ready access to OpenDocument {{{file(.rnc)}}} files and
12896 the needed schema-locating rules in a single folder, you can customize
12897 the variable ~org-export-odt-schema-dir~ to point to that directory.
12898 The ODT exporter will take care of updating the
12899 ~rng-schema-locating-files~ for you.
12901 ** TaskJuggler export
12903 :DESCRIPTION: Exporting to TaskJuggler
12905 #+cindex: TaskJuggler export
12906 #+cindex: Project management
12908 [[http://www.taskjuggler.org/][TaskJuggler]] is a project management tool. It provides an optimizing
12909 scheduler that computes your project time lines and resource
12910 assignments based on the project outline and the constraints that you
12913 The TaskJuggler exporter is a bit different from other exporters, such
12914 as the ~HTML~ and LaTeX exporters for example, in that it does not
12915 export all the nodes of a document or strictly follow the order of the
12916 nodes in the document.
12918 Instead the TaskJuggler exporter looks for a tree that defines the
12919 tasks and optionally trees that define the resources and reports for
12920 this project. It then creates a TaskJuggler file based on these trees
12921 and the attributes defined in all the nodes.
12923 *** TaskJuggler export commands
12925 :DESCRIPTION: Key bindings for TaskJuggler export
12928 #+attr_texinfo: :table-type table :indic @asis
12929 - {{{kbd(C-c C-e j)}}}, ~org-export-as-taskjuggler~ ::
12930 #+kindex: C-c C-e j
12932 Export as a TaskJuggler file.
12934 - {{{kbd(C-c C-e J)}}}, ~org-export-as-taskjuggler-and-open~ ::
12935 #+kindex: C-c C-e J
12937 Export as a TaskJuggler file and then open the file with TaskJugglerUI
12938 (only for TaskJugglerUI 2.x).
12942 :DESCRIPTION: Marking tasks for TaskJuggler export
12944 #+vindex: org-export-taskjuggler-project-tag
12946 Create your tasks as you usually do with Org mode. Assign efforts to
12947 each task using properties (it is easiest to do this in the column
12948 view). You should end up with something similar to the example by
12950 [[http://www.contextualdevelopment.com/static/artifacts/articles/2008/project-planning/project-planning.org]].
12951 Now mark the top node of your tasks with a tag named
12952 ~:taskjuggler_project:~ (or whatever you customized
12953 ~org-export-taskjuggler-project-tag~ to). You are now ready to export
12954 the project plan with {{{kbd(C-c C-e J)}}} which will export the
12955 project plan and open a gantt chart in TaskJugglerUI.
12959 :DESCRIPTION: Define TaskJuggler resources
12961 #+vindex: org-export-taskjuggler-resource-tag
12963 Next you can define resources and assign those to work on specific
12964 tasks. You can group your resources hierarchically. Tag the top node
12965 of the resources with ~:taskjuggler_resource:~ (or whatever you
12966 customized ~org-export-taskjuggler-resource-tag~ to). You can
12967 optionally assign an identifier (named {{{samp(resource_id)}}}) to the
12968 resources (using the standard Org properties commands, see [[Property
12969 syntax]]) or you can let the exporter generate identifiers automatically
12970 (the exporter picks the first word of the headline as the identifier
12971 as long as it is unique---see the documentation of
12972 ~org-taskjuggler-get-unique-id~). Using that identifier you can then
12973 allocate resources to tasks. This is again done with the
12974 {{{samp(allocate)}}} property on the tasks. Do this in column view or
12975 when on the task type
12976 {{{ksksksk(C-c C-x p allocate,RET,<resource_id>,RET)}}}.
12978 Once the allocations are done you can again export to TaskJuggler and
12979 check in the Resource Allocation Graph which person is working on what
12982 *** Export of properties
12984 :DESCRIPTION: Which properties will be exported?
12987 The exporter also takes TODO state information into consideration,
12988 i.e., if a task is marked as done it will have the corresponding
12989 attribute in TaskJuggler ({{{samp(complete 100)}}}). Scheduling
12990 information is also taken into account to set start/end dates for
12993 The exporter will also export any property on a task resource or
12994 resource node which is known to TaskJuggler, such as
12995 {{{samp(limits)}}}, {{{samp(vacation)}}}, {{{samp(shift)}}},
12996 {{{samp(booking)}}}, {{{samp(efficiency)}}}, {{{samp(journalentry)}}},
12997 {{{samp(rate)}}} for resources or {{{samp(account)}}},
12998 {{{samp(start)}}}, {{{samp(note)}}}, {{{samp(duration)}}},
12999 {{{samp(end)}}}, {{{samp(journalentry)}}}, {{{samp(milestone)}}},
13000 {{{samp(reference)}}}, {{{samp(responsible)}}},
13001 {{{samp(scheduling)}}}, etc for tasks.
13005 :DESCRIPTION: How the exporter handles dependencies
13008 The exporter will handle dependencies that are defined in the tasks
13009 either with the {{{samp(ORDERED)}}} attribute (see [[TODO dependencies]]),
13010 with the {{{samp(BLOCKER)}}} attribute (see {{{file(org-depend.el)}}})
13011 or alternatively with a {{{samp(depends)}}} attribute. Both the
13012 {{{samp(BLOCKER)}}} and the {{{samp(depends)}}} attribute can be
13013 either {{{samp(previous-sibling)}}} or a reference to an identifier
13014 (named {{{samp(task_id)}}}) which is defined for another task in the
13015 project. {{{samp(BLOCKER)}}} and the {{{samp(depends)}}} attribute can
13016 define multiple dependencies separated by either space or comma. You
13017 can also specify optional attributes on the dependency by simply
13018 appending it. The following examples should illustrate this:
13023 , :task_id: preparation
13026 ,* Training material
13028 , :task_id: training_material
13031 ,** Markup Guidelines
13035 ,** Workflow Guidelines
13042 , :BLOCKER: training_material { gapduration 1d } preparation
13048 :DESCRIPTION: Gantt charts, etc.
13050 #+vindex: org-export-taskjuggler-default-reports
13052 TaskJuggler can produce many kinds of reports (e.g., gantt chart,
13053 resource allocation, etc). The user defines what kind of reports
13054 should be generated for a project in the TaskJuggler file. By default,
13055 the exporter will automatically insert some pre-set reports in the
13056 file. These defaults are defined in
13057 ~org-export-taskjuggler-default-reports~. They can be modified using
13058 customize along with a number of other options. For a more complete
13060 {{{ksksksk(M-x customize-group,RET,org-export-taskjuggler,RET)}}}.
13062 Alternately, the user can tag a tree with
13063 ~org-export-taskjuggler-report-tag~, and define reports in sub-nodes,
13064 similarly to what is done with tasks or resources. The properties used
13065 for report generation are defined in
13066 ~org-export-taskjuggler-valid-report-attributes~. In addition, a
13067 special property named {{{samp(report-kind)}}} is used to define the
13068 kind of report one wants to generate (by default, a
13069 {{{samp(taskreport)}}}).
13071 For more information and examples see the Org-taskjuggler tutorial at
13072 [[http://orgmode.org/worg/org-tutorials/org-taskjuggler.html]].
13076 :DESCRIPTION: Exporting to Freemind mind maps
13078 #+cindex: Freemind export
13081 The Freemind exporter was written by Lennart Borgman.
13083 #+attr_texinfo: :table-type table :indic @asis
13084 - {{{kbd(C-c C-e m)}}}, ~org-export-as-freemind~ ::
13085 #+kindex: C-c C-e m
13087 Export as a Freemind mind map. For an Org file {{{file(myfile.org)}}},
13088 the Freemind file will be {{{file(myfile.mm)}}}.
13092 :DESCRIPTION: Exporting to XOXO
13094 #+cindex: XOXO export
13096 Org mode contains an exporter that produces XOXO-style output.
13097 Currently, this exporter only handles the general outline structure
13098 and does not interpret any additional Org mode features.
13100 #+attr_texinfo: :table-type table :indic @asis
13101 - {{{kbd(C-c C-e x)}}}, ~org-export-as-xoxo~ ::
13102 #+kindex: C-c C-e x
13104 Export as an XOXO file. For an Org file {{{file(myfile.org)}}}, the
13105 XOXO file will be {{{file(myfile.html)}}}.
13107 - {{{kbd(C-c C-e v x)}}} ::
13108 #+kindex: C-c C-e v x
13110 Export only the visible part of the document.
13112 ** iCalendar export
13114 :DESCRIPTION: Exporting to iCalendar format
13116 #+cindex: iCalendar export
13118 #+vindex: org-icalendar-include-todo
13119 #+vindex: org-icalendar-use-deadline
13120 #+vindex: org-icalendar-use-scheduled
13121 #+vindex: org-icalendar-categories
13122 #+vindex: org-icalendar-alarm-time
13124 Some people use Org mode for keeping track of projects, but still
13125 prefer a standard calendar application for anniversaries and
13126 appointments. In this case it can be useful to show deadlines and
13127 other time-stamped items in Org files in the calendar application. Org
13128 mode can export calendar information in the standard iCalendar format.
13129 If you also want to have TODO entries included in the export,
13130 configure the variable ~org-icalendar-include-todo~. Plain timestamps
13131 are exported as VEVENT, and TODO items as VTODO. It will also create
13132 events from deadlines that are in non-TODO items. Deadlines and
13133 scheduling dates in TODO items will be used to set the start and due
13134 dates for the TODO entry.[fn:143] As categories, it will use the tags
13135 locally defined in the heading, and the file/tree category.[fn:144]
13136 See the variable ~org-icalendar-alarm-time~ for a way to assign alarms
13137 to entries with a time.
13139 #+vindex: org-icalendar-store-UID
13140 #+cindex: property, ID
13142 The iCalendar standard requires each entry to have a globally unique
13143 identifier (UID). Org creates these identifiers during export. If you
13144 set the variable ~org-icalendar-store-UID~, the UID will be stored in
13145 the ~:ID:~ property of the entry and re-used next time you report this
13146 entry. Since a single entry can give rise to multiple iCalendar
13147 entries (as a timestamp, a deadline, a scheduled item, and as a TODO
13148 item), Org adds prefixes to the UID, depending on what triggered the
13149 inclusion of the entry. In this way the UID remains unique, but a
13150 synchronization program can still figure out from which entry all the
13151 different instances originate.
13153 #+attr_texinfo: :table-type table :indic @asis
13154 - {{{kbd(C-c C-e i)}}}, ~org-export-icalendar-this-file~ ::
13155 #+kindex: C-c C-e i
13157 Create iCalendar entries for the current file and store them in the
13158 same directory, using a file extension {{{file(.ics)}}}.
13160 - {{{kbd(C-c C-e I)}}}, ~ org-export-icalendar-all-agenda-files~ ::
13161 #+kindex: C-c C-e I
13162 #+vindex: org-agenda-files
13164 Like {{{kbd(C-c C-e i)}}}, but do this for all files in
13165 ~org-agenda-files~. For each of these files, a separate iCalendar file
13168 - {{{kbd(C-c C-e c)}}}, ~org-export-icalendar-combine-agenda-files~ ::
13169 #+kindex: C-c C-e c
13170 #+vindex: org-combined-agenda-icalendar-file
13172 Create a single large iCalendar file from all files in
13173 ~org-agenda-files~ and write it to the file given by
13174 ~org-combined-agenda-icalendar-file~.
13177 #+vindex: org-use-property-inheritance
13178 #+vindex: org-icalendar-include-body
13179 #+cindex: property, SUMMARY
13180 #+cindex: property, DESCRIPTION
13181 #+cindex: property, LOCATION
13183 The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
13184 the selected entries have them.[fn:145] If not, the summary will be
13185 derived from the headline, and the description from the body (limited
13186 to ~org-icalendar-include-body~ characters).
13188 How this calendar is best read and updated, depends on the application
13189 you are using. The FAQ covers this issue.
13193 :DESCRIPTION: Create a web site of linked Org files
13195 #+cindex: publishing
13196 #+cindex: O'Toole, David
13198 Org includes a publishing management system that allows you to
13199 configure automatic HTML conversion of /projects/ composed of
13200 interlinked org files. You can also configure Org to automatically
13201 upload your exported HTML pages and related attachments, such as
13202 images and source code files, to a web server.
13204 You can also use Org to convert files into PDF, or even combine HTML
13205 and PDF conversion so that files are available in both formats on the
13208 Publishing has been contributed to Org by David O'Toole.
13212 :DESCRIPTION: Defining projects
13214 Publishing needs significant configuration to specify files,
13215 destination and many other properties of a project.
13219 :DESCRIPTION: The central configuration variable
13220 :TITLE: The variable ~org-publish-project-alist~
13222 #+cindex: org-publish-project-alist
13223 #+cindex: projects, for publishing
13224 #+vindex: org-publish-project-alist
13226 Publishing is configured almost entirely through setting the value of
13227 one variable, called ~org-publish-project-alist~. Each element of the
13228 list configures one project, and may be in one of the two following
13232 #+header: :exports code
13233 #+begin_src emacs-lisp
13234 ("project-name" :property value :property value ...)
13237 i.e., a well-formed property list with alternating keys and values,
13241 #+header: :exports code
13242 #+begin_src emacs-lisp
13243 ("project-name" :components ("project-name" "project-name" ...))
13246 In both cases, projects are configured by specifying property values.
13247 A project defines the set of files that will be published, as well as
13248 the publishing configuration to use when publishing those files. When
13249 a project takes the second form listed above, the individual members
13250 of the ~:components~ property are taken to be sub-projects, which
13251 group together files requiring different publishing options. When you
13252 publish such a "meta-project," all the components will also be
13253 published, in the sequence given.
13255 *** Sources and destinations
13257 :DESCRIPTION: From here to there
13258 :TITLE: Sources and destinations for files
13260 #+cindex: directories, for publishing
13262 Most properties are optional, but some should always be set. In
13263 particular, Org needs to know where to look for source files, and
13264 where to put published files.
13266 #+attr_texinfo: :table-type table :indic @asis
13267 - ~:base-directory~ ::
13269 Directory containing publishing source files
13271 - ~:publishing-directory~ ::
13273 Directory where output files will be published. You can directly
13274 publish to a webserver using a file name syntax appropriate for the
13275 Emacs {{{file(tramp)}}} package. Or you can publish to a local
13276 directory and use external tools to upload your website
13277 (see [[Uploading files]]).
13279 - ~:preparation-function~ ::
13281 Function or list of functions to be called before starting the
13282 publishing process, for example, to run ~make~ for updating files to
13283 be published. The project property list is scoped into this call as
13284 the variable ~project-plist~.
13286 - ~:completion-function~ ::
13288 Function or list of functions called after finishing the publishing
13289 process, for example, to change permissions of the resulting files.
13290 The project property list is scoped into this call as the variable
13293 *** Selecting files
13295 :DESCRIPTION: What files are part of the project?
13297 #+cindex: files, selecting for publishing
13299 By default, all files with extension {{{file(.org)}}} in the base directory
13300 are considered part of the project. This can be modified by setting the
13301 following properties:
13303 #+attr_texinfo: :table-type table :indic @asis
13304 - ~:base-extension~ ::
13306 Extension (without the dot!) of source files. This actually is a
13307 regular expression. Set this to the symbol ~any~ if you want to get
13308 all files in ~:base-directory~, even without extension.
13312 Regular expression to match file names that should not be published,
13313 even though they have been selected on the basis of their extension.
13317 List of files to be included regardless of ~:base-extension~ and
13322 Non-nil means, check base-directory recursively for files to publish.
13324 *** Publishing action
13326 :DESCRIPTION: Setting the function doing the publishing
13328 #+cindex: action, for publishing
13330 Publishing means that a file is copied to the destination directory and
13331 possibly transformed in the process. The default transformation is to export
13332 Org files as HTML files, and this is done by the function
13333 ~org-publish-org-to-html~ which calls the HTML exporter (see [[HTML
13334 export]]). But you also can publish your content as PDF files using
13335 ~org-publish-org-to-pdf~, or as ~ascii~, ~latin1~ or
13336 ~utf8~ encoded files using the corresponding functions. If you want to
13337 publish the Org file itself, but with /archived/, /commented/, and
13338 /tag-excluded/ trees removed, use ~org-publish-org-to-org~ and set the
13339 parameters ~:plain-source~ and/or ~:htmlized-source~. This will
13340 produce {{{file(file.org)}}} and {{{file(file.org.html)}}} in the publishing
13341 directory.[fn:146] Other files like images only need to be copied to the
13342 publishing destination; for this you may use ~org-publish-attachment~.
13343 For non-Org files, you always need to specify the publishing function:
13345 #+attr_texinfo: :table-type table :indic @asis
13346 - ~:publishing-function~ ::
13348 Function executing the publication of a file. This may also be a list
13349 of functions, which will all be called in turn.
13351 - ~:plain-source~ ::
13353 Non-nil means, publish plain source.
13355 - ~:htmlized-source~ ::
13357 Non-nil means, publish htmlized source.
13360 The function must accept three arguments: a property list containing
13361 at least a ~:publishing-directory~ property, the name of the file to
13362 be published, and the path to the publishing directory of the output
13363 file. It should take the specified file, make the necessary
13364 transformation (if any) and place the result into the destination
13367 *** Publishing options
13369 :DESCRIPTION: Tweaking HTML/LaTeX export
13371 #+cindex: options, for publishing
13373 The property list can be used to set many export options for the HTML
13374 and LaTeX exporters. In most cases, these properties correspond to user
13375 variables in Org. The table below lists these properties along
13376 with the variable they belong to. See the documentation string for the
13377 respective variable for details.
13379 #+vindex: org-export-html-link-up
13380 #+vindex: org-export-html-link-home
13381 #+vindex: org-export-default-language
13382 #+vindex: org-display-custom-times
13383 #+vindex: org-export-headline-levels
13384 #+vindex: org-export-with-section-numbers
13385 #+vindex: org-export-section-number-format
13386 #+vindex: org-export-with-toc
13387 #+vindex: org-export-preserve-breaks
13388 #+vindex: org-export-with-archived-trees
13389 #+vindex: org-export-with-emphasize
13390 #+vindex: org-export-with-sub-superscripts
13391 #+vindex: org-export-with-special-strings
13392 #+vindex: org-export-with-footnotes
13393 #+vindex: org-export-with-drawers
13394 #+vindex: org-export-with-tags
13395 #+vindex: org-export-with-todo-keywords
13396 #+vindex: org-export-with-tasks
13397 #+vindex: org-export-with-done-tasks
13398 #+vindex: org-export-with-priority
13399 #+vindex: org-export-with-TeX-macros
13400 #+vindex: org-export-with-LaTeX-fragments
13401 #+vindex: org-export-skip-text-before-1st-heading
13402 #+vindex: org-export-with-fixed-width
13403 #+vindex: org-export-with-timestamps
13404 #+vindex: org-export-author-info
13405 #+vindex: org-export-email-info
13406 #+vindex: org-export-creator-info
13407 #+vindex: org-export-time-stamp-file
13408 #+vindex: org-export-with-tables
13409 #+vindex: org-export-highlight-first-table-line
13410 #+vindex: org-export-html-style-include-default
13411 #+vindex: org-export-html-style-include-scripts
13412 #+vindex: org-export-html-style
13413 #+vindex: org-export-html-style-extra
13414 #+vindex: org-export-html-link-org-files-as-html
13415 #+vindex: org-export-html-inline-images
13416 #+vindex: org-export-html-extension
13417 #+vindex: org-export-html-table-tag
13418 #+vindex: org-export-html-expand
13419 #+vindex: org-export-html-with-timestamp
13420 #+vindex: org-export-publishing-directory
13421 #+vindex: org-export-html-preamble
13422 #+vindex: org-export-html-postamble
13423 #+vindex: user-full-name
13424 #+vindex: user-mail-address
13425 #+vindex: org-export-select-tags
13426 #+vindex: org-export-exclude-tags
13428 #+attr_texinfo: :table-type table :indic @asis
13429 - ~:link-up~ :: ~org-export-html-link-up~
13430 - ~:link-home~ :: ~org-export-html-link-home~
13431 - ~:language~ :: ~org-export-default-language~
13432 - ~:customtime~ :: ~org-display-custom-times~
13433 - ~:headline-levels~ :: ~org-export-headline-levels~
13434 - ~:section-numbers~ :: ~org-export-with-section-numbers~
13435 - ~:section-number-format~ :: ~org-export-section-number-format~
13436 - ~:table-of-contents~ :: ~org-export-with-toc~
13437 - ~:preserve-breaks~ :: ~org-export-preserve-breaks~
13438 - ~:archived-trees~ :: ~org-export-with-archived-trees~
13439 - ~:emphasize~ :: ~org-export-with-emphasize~
13440 - ~:sub-superscript~ :: ~org-export-with-sub-superscripts~
13441 - ~:special-strings~ :: ~org-export-with-special-strings~
13442 - ~:footnotes~ :: ~org-export-with-footnotes~
13443 - ~:drawers~ :: ~org-export-with-drawers~
13444 - ~:tags~ :: ~org-export-with-tags~
13445 - ~:todo-keywords~ :: ~org-export-with-todo-keywords~
13446 - ~:tasks~ :: ~org-export-with-tasks~
13447 - ~:priority~ :: ~org-export-with-priority~
13448 - ~:TeX-macros~ :: ~org-export-with-TeX-macros~
13449 - ~:LaTeX-fragments~ :: ~org-export-with-LaTeX-fragments~
13450 - ~:latex-listings~ :: ~org-export-latex-listings~
13451 - ~:skip-before-1st-heading~ :: ~org-export-skip-text-before-1st-heading~
13452 - ~:fixed-width~ :: ~org-export-with-fixed-width~
13453 - ~:timestamps~ :: ~org-export-with-timestamps~
13454 - ~:author~ :: ~user-full-name~
13455 - ~:email~ :: ~user-mail-address~ : ~addr;addr;..~
13456 - ~:author-info~ :: ~org-export-author-info~
13457 - ~:email-info~ :: ~org-export-email-info~
13458 - ~:creator-info~ :: ~org-export-creator-info~
13459 - ~:tables~ :: ~org-export-with-tables~
13460 - ~:table-auto-headline~ :: ~org-export-highlight-first-table-line~
13461 - ~:style-include-default~ :: ~org-export-html-style-include-default~
13462 - ~:style-include-scripts~ :: ~org-export-html-style-include-scripts~
13463 - ~:style~ :: ~org-export-html-style~
13464 - ~:style-extra~ :: ~org-export-html-style-extra~
13465 - ~:convert-org-links~ :: ~org-export-html-link-org-files-as-html~
13466 - ~:inline-images~ :: ~org-export-html-inline-images~
13467 - ~:html-extension~ :: ~org-export-html-extension~
13468 - ~:html-preamble~ :: ~org-export-html-preamble~
13469 - ~:html-postamble~ :: ~org-export-html-postamble~
13470 - ~:xml-declaration~ :: ~org-export-html-xml-declaration~
13471 - ~:html-table-tag~ :: ~org-export-html-table-tag~
13472 - ~:expand-quoted-html~ :: ~org-export-html-expand~
13473 - ~:timestamp~ :: ~org-export-html-with-timestamp~
13474 - ~:publishing-directory~ :: ~org-export-publishing-directory~
13475 - ~:select-tags~ :: ~org-export-select-tags~
13476 - ~:exclude-tags~ :: ~org-export-exclude-tags~
13477 - ~:latex-image-options~ :: ~org-export-latex-image-default-option~
13480 Most of the ~org-export-with-*~ variables have the same effect in both
13481 HTML and LaTeX exporters, except for ~:TeX-macros~ and
13482 ~:LaTeX-fragments~ options, respectively ~nil~ and ~t~ in the LaTeX
13483 export. See ~org-export-plist-vars~ to check this list of options.
13485 #+vindex: org-publish-project-alist
13487 When a property is given a value in ~org-publish-project-alist~, its
13488 setting overrides the value of the corresponding user variable (if
13489 any) during publishing. Options set within a file (see [[Export
13490 options]]), however, override everything.
13492 *** Publishing links
13494 :DESCRIPTION: Which links keep working after publishing?
13496 #+cindex: links, publishing
13498 To create a link from one Org file to another, you would use something
13499 like ~[[file:foo.org][The foo]]~ or simply ~[[file:foo.org]]~ (see
13500 [[Hyperlinks]]). When published, this link becomes a link to
13501 {{{file(foo.html)}}}. In this way, you can interlink the pages of your
13502 "org web" project and the links will work as expected when you publish
13503 them to HTML. If you also publish the Org source file and want to link
13504 to that, use an ~http:~ link instead of a ~file:~ link, because
13505 ~file:~ links are converted to link to the corresponding
13506 {{{file(html)}}} file.
13508 You may also link to related files, such as images. Provided you are
13509 careful with relative file names, and provided you have also
13510 configured Org to upload the related files, these links will work too.
13511 See [[Complex example]], for an example of this usage.
13513 Sometimes an Org file to be published may contain links that are only
13514 valid in your production environment, but not in the publishing
13515 location. In this case, use the following property to define a
13516 function for checking link validity:
13518 #+attr_texinfo: :table-type table :indic @asis
13519 - ~:link-validation-function~ ::
13520 Function to validate links
13523 {{{noindent}}} This function must accept two arguments, the file name
13524 and a directory relative to which the file name is interpreted in the
13525 production environment. If this function returns ~nil~, then the HTML
13526 generator will only insert a description into the HTML file, but no
13527 link. One option for this function is ~org-publish-validate-link~
13528 which checks if the given file is part of any project in
13529 ~org-publish-project-alist~.
13533 :DESCRIPTION: Generating a list of all pages
13534 :TITLE: Generating a sitemap
13536 #+cindex: sitemap, of published pages
13538 The following properties may be used to control publishing of
13539 a map of files for a given project.
13541 #+attr_texinfo: :table-type table :indic @asis
13542 - ~:auto-sitemap~ ::
13544 When non-nil, publish a sitemap during ~org-publish-current-project~
13545 or ~org-publish-all~.
13547 - ~:sitemap-filename~ ::
13549 Filename for output of sitemap. Defaults to {{{file(sitemap.org)}}} (which
13550 becomes {{{file(sitemap.html)}}}).
13552 - ~:sitemap-title~ ::
13554 Title of sitemap page. Defaults to name of file.
13556 - ~:sitemap-function~ ::
13558 Plug-in function to use for generation of the sitemap. Defaults to
13559 ~org-publish-org-sitemap~, which generates a plain list of links to
13560 all files in the project.
13562 - ~:sitemap-sort-folders~ ::
13564 Where folders should appear in the sitemap. Set this to ~first~
13565 (default) or ~last~ to display folders first or last, respectively.
13566 Any other value will mix files and folders.
13568 - ~:sitemap-sort-files~ ::
13570 How the files are sorted in the site map. Set this to ~alphabetically~
13571 (default), ~chronologically~ or ~anti-chronologically~.
13572 ~chronologically~ sorts the files with older date first while
13573 ~anti-chronologically~ sorts the files with newer date first.
13574 ~alphabetically~ sorts the files alphabetically. The date of a file is
13575 retrieved with ~org-publish-find-date~.
13577 - ~:sitemap-ignore-case~ ::
13579 Should sorting be case-sensitive? Default ~nil~.
13581 - ~:sitemap-file-entry-format~ ::
13583 With this option one can tell how a sitemap's entry is formatted in
13584 the sitemap. This is a format string with some escape sequences: ~%t~
13585 stands for the title of the file, ~%a~ stands for the author of the
13586 file and ~%d~ stands for the date of the file. The date is retrieved
13587 with the ~org-publish-find-date~ function and formatted with
13588 ~org-publish-sitemap-date-format~. Default ~%t~.
13590 - ~:sitemap-date-format~ ::
13592 Format string for the ~format-time-string~ function that tells how a
13593 sitemap entry's date is to be formatted. This property bypasses
13594 ~org-publish-sitemap-date-format~ which defaults to ~%Y-%m-%d~.
13596 - ~:sitemap-sans-extension~ ::
13598 When non-nil, remove filenames' extensions from the generated sitemap.
13599 Useful to have cool URIs (see [[http://www.w3.org/Provider/Style/URI]]).
13602 *** Generating an index
13604 :DESCRIPTION: An index that reaches across pages
13606 #+cindex: index, in a publishing project
13608 Org mode can generate an index across the files of a publishing project.
13610 #+attr_texinfo: :table-type table :indic @asis
13613 When non-nil, generate in index in the file {{{file(theindex.org)}}}
13614 and publish it as {{{file(theindex.html)}}}.
13617 The file will be created when first publishing a project with the
13618 ~:makeindex~ set. The file only contains a statement
13619 {{{samp(#+INCLUDE: "theindex.inc")}}}. You can then build around this
13620 include statement by adding a title, style information, etc.
13624 :DESCRIPTION: How to get files up on the server
13629 For those people already utilizing third party sync tools such as
13630 {{{command(rsync)}}} or {{{command(unison)}}}, it might be preferable
13631 not to use the built in remote publishing facilities of Org mode
13632 which rely heavily on Tramp. Tramp, while very useful and powerful,
13633 tends not to be so efficient for multiple file transfer and has been
13634 known to cause problems under heavy usage.
13636 Specialized synchronization utilities offer several advantages. In
13637 addition to timestamp comparison, they also do content and
13638 permissions/attribute checks. For this reason you might prefer to
13639 publish your web to a local directory (possibly even in place with
13640 your Org files) and then use {{{file(unison)}}} or {{{file(rsync)}}}
13641 to do the synchronization with the remote host.
13643 Since Unison (for example) can be configured as to which files to
13644 transfer to a certain remote destination, it can greatly simplify the
13645 project publishing definition. Simply keep all files in the correct
13646 location, process your Org files with ~org-publish~ and let the
13647 synchronization tool do the rest. You do not need, in this scenario,
13648 to include attachments such as {{{file(jpg)}}}, {{{file(css)}}} or
13649 {{{file(gif)}}} files in the project definition since the 3rd party
13652 Publishing to a local directory is also much faster than to a remote
13653 one, so that you can afford more easily to republish entire projects.
13654 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
13655 main benefit of re-including any changed external files such as source
13656 example files you might include with ~#+INCLUDE:~. The timestamp
13657 mechanism in Org is not smart enough to detect if included files have
13660 ** Sample configuration
13662 :DESCRIPTION: Example projects
13664 Below we provide two example configurations. The first one is a simple
13665 project publishing only a set of Org files. The second example is
13666 more complex, with a multi-component project.
13670 :DESCRIPTION: One-component publishing
13671 :TITLE: Example: simple publishing configuration
13673 This example publishes a set of Org files to the {{{file(public_html)}}}
13674 directory on the local machine.
13677 #+header: :exports code
13678 #+begin_src emacs-lisp
13679 (setq org-publish-project-alist
13681 :base-directory "~/org/"
13682 :publishing-directory "~/public_html"
13683 :section-numbers nil
13684 :table-of-contents nil
13685 :style "<link rel=\"stylesheet\"
13686 href=\"../other/mystyle.css\"
13687 type=\"text/css\"/>")))
13690 *** Complex example
13692 :DESCRIPTION: A multi-component publishing example
13693 :TITLE: Example: complex publishing configuration
13695 This more complicated example publishes an entire website, including
13696 Org files converted to HTML, image files, Emacs Lisp source code, and
13697 style sheets. The publishing directory is remote and private files are
13700 To ensure that links are preserved, care should be taken to replicate
13701 your directory structure on the web server, and to use relative file
13702 paths. For example, if your Org files are kept in {{{file(~/org)}}}
13703 and your publishable images in {{{file(~/images)}}}, you would link to
13707 file:../images/myimage.png
13710 On the web server, the relative path to the image should be the
13711 same. You can accomplish this by setting up an "images" folder in the
13712 right place on the web server, and publishing images to it.
13715 #+header: :exports code
13716 #+begin_src emacs-lisp
13717 (setq org-publish-project-alist
13719 :base-directory "~/org/"
13720 :base-extension "org"
13721 :publishing-directory "/ssh:user@@host:~/html/notebook/"
13722 :publishing-function org-publish-org-to-html
13723 :exclude "PrivatePage.org" ;; regexp
13725 :section-numbers nil
13726 :table-of-contents nil
13727 :style "<link rel=\"stylesheet\"
13728 href=\"../other/mystyle.css\" type=\"text/css\"/>"
13732 :base-directory "~/images/"
13733 :base-extension "jpg\\|gif\\|png"
13734 :publishing-directory "/ssh:user@@host:~/html/images/"
13735 :publishing-function org-publish-attachment)
13738 :base-directory "~/other/"
13739 :base-extension "css\\|el"
13740 :publishing-directory "/ssh:user@@host:~/html/other/"
13741 :publishing-function org-publish-attachment)
13742 ("website" :components ("orgfiles" "images" "other"))))
13745 ** Triggering publication
13747 :DESCRIPTION: Publication commands
13749 Once properly configured, Org can publish with the following commands:
13751 #+attr_texinfo: :table-type table :indic @asis
13752 - {{{kbd(C-c C-e X)}}}, ~org-publish~ ::
13753 #+kindex: C-c C-e X
13755 Prompt for a specific project and publish all files that belong to it.
13757 - {{{kbd(C-c C-e P)}}}, ~org-publish-current-project~ ::
13758 #+kindex: C-c C-e P
13760 Publish the project containing the current file.
13762 - {{{kbd(C-c C-e F)}}}, ~org-publish-current-file~ ::
13763 #+kindex: C-c C-e F
13765 Publish only the current file.
13767 - {{{kbd(C-c C-e E)}}}, ~org-publish-all~ ::
13768 #+kindex: C-c C-e E
13770 Publish every project.
13773 #+vindex: org-publish-use-timestamps-flag
13775 Org uses timestamps to track when a file has changed. The above
13776 functions normally only publish changed files. You can override this
13777 and force publishing of all files by giving a prefix argument to any
13778 of the commands above, or by customizing the variable
13779 ~org-publish-use-timestamps-flag~. This may be necessary in particular
13780 if files include other files via ~#+SETUPFILE:~ or ~#+INCLUDE:~.
13782 * Working with source code
13784 :DESCRIPTION: Export, evaluate, and tangle code blocks
13785 :ALT_TITLE: Working With Source Code
13787 #+cindex: Schulte, Eric
13788 #+cindex: Davison, Dan
13789 #+cindex: source code, working with
13791 Source code can be included in Org mode documents using a
13792 {{{samp(src)}}} block, e.g.:
13795 #+BEGIN_SRC emacs-lisp
13796 (defun org-xor (a b)
13802 Org mode provides a number of features for working with live source
13803 code, including editing of code blocks in their native major-mode,
13804 evaluation of code blocks, converting code blocks into source files
13805 (known as "tangling" in literate programming), and exporting code
13806 blocks and their results in several formats. This functionality was
13807 contributed by Eric Schulte and Dan Davison, and was originally named
13810 The following sections describe Org mode's code block handling facilities.
13812 ** Structure of code blocks
13814 :DESCRIPTION: Code block syntax described
13816 #+cindex: code block, structure
13817 #+cindex: source code, block structure
13819 #+cindex: #+BEGIN_SRC
13821 Live code blocks can be specified with a {{{samp(src)}}} block or
13822 inline.[fn:147] The structure of a {{{samp(src)}}} block is shown in
13823 the following example:
13827 ,#+BEGIN_SRC <language> <switches> <header arguments>
13832 The ~#+NAME:~ line is optional, and can be used to name the code
13833 block. Live code blocks require that a language be specified on the
13834 ~#+BEGIN_SRC~ line. Switches and header arguments are optional.
13835 #+cindex: source code, inline
13837 Live code blocks can also be specified inline using the following
13841 src_<language>{<body>}
13847 src_<language>[<header arguments>]{<body>}
13850 #+attr_texinfo: :table-type table :indic @asis
13851 - ~<#+NAME: name>~ ::
13854 This line associates a name with the code block. This is similar to
13855 the ~#+TBLNAME: NAME~ lines that can be used to name tables in Org
13856 mode files. Referencing the name of a code block makes it possible to
13857 evaluate the block from other places in the file, from other files, or
13858 from Org mode table formulas (see [[The spreadsheet]]). Names are assumed
13859 to be unique and the behavior of Org mode when two or more blocks
13860 share the same name is undefined.
13863 #+cindex: source code, language
13865 The language of the code in the block (see [[Languages]]).
13868 #+cindex: source code, switches
13870 Optional switches control code block export (see the discussion of
13871 switches in [[Literal examples]]).
13873 - ~<header arguments>~ ::
13874 #+cindex: source code, header arguments
13876 Optional header arguments control many aspects of evaluation, export
13877 and tangling of code blocks (see [[Header arguments]]). Header arguments
13878 can also be set on a per-buffer or per-subtree basis using properties.
13882 Source code in the specified language.
13884 ** Editing source code
13886 :DESCRIPTION: Language major-mode editing
13888 #+cindex: code block, editing
13889 #+cindex: source code, editing
13892 Use {{{kbd(C-c ')}}} to edit the current code block. This brings up a
13893 language major-mode edit buffer containing the body of the code block.
13894 Saving this buffer will write the new contents back to the Org buffer.
13895 Use {{{kbd(C-c ')}}} again to exit.
13897 The ~org-src-mode~ minor mode will be active in the edit buffer. The
13898 following variables can be used to configure the behavior of the edit
13899 buffer. See also the customization group ~org-edit-structure~ for
13900 further configuration options.
13902 #+attr_texinfo: :table-type table :indic @asis
13903 - ~org-src-lang-modes~ ::
13905 If an Emacs major-mode named ~<lang>-mode~ exists, where
13906 ~<lang>~ is the language named in the header line of the code block,
13907 then the edit buffer will be placed in that major-mode. This variable
13908 can be used to map arbitrary language names to existing major modes.
13910 - ~org-src-window-setup~ ::
13912 Controls the way Emacs windows are rearranged when the edit buffer is
13915 - ~org-src-preserve-indentation~ ::
13917 This variable is especially useful for tangling languages such as
13918 Python, in which whitespace indentation in the output is meaningful.
13920 - ~org-src-ask-before-returning-to-edit-buffer~ ::
13922 By default, Org will ask before returning to an open edit buffer. Set this
13923 variable to nil to switch without asking.
13926 To turn on native code fontification in the Org mode buffer, configure
13927 the variable ~org-src-fontify-natively~.
13929 ** Exporting code blocks
13931 :DESCRIPTION: Export contents and/or results
13933 #+cindex: code block, exporting
13934 #+cindex: source code, exporting
13936 It is possible to export the /code/ of code blocks, the /results/ of
13937 code block evaluation, /both/ the code and the results of code block
13938 evaluation, or /none/. For most languages, the default exports code.
13939 However, for some languages (e.g., ~ditaa~) the default exports the
13940 results of code block evaluation. For information on exporting code
13941 block bodies, see [[Literal examples]].
13943 The ~:exports~ header argument can be used to specify export
13944 behavior with the following arguments:
13946 #+attr_texinfo: :table-type table :indic @asis
13947 - ~:exports code~ ::
13949 The default in most languages. The body of the code block is exported, as
13950 described in [[Literal examples]].
13952 - ~:exports results~ ::
13954 The code block will be evaluated and the results will be placed in the
13955 Org mode buffer for export, either updating previous results of the
13956 code block located anywhere in the buffer or, if no previous results
13957 exist, placing the results immediately after the code block. The body
13958 of the code block will not be exported.
13960 - ~:exports both~ ::
13962 Both the code block and its results will be exported.
13964 - ~:exports none~ ::
13966 Neither the code block nor its results will be exported.
13969 It is possible to inhibit the evaluation of code blocks during export.
13970 Setting the ~org-export-babel-evaluate~ variable to ~nil~ will ensure
13971 that no code blocks are evaluated as part of the export process. This
13972 can be useful in situations where potentially untrusted Org mode files
13973 are exported in an automated fashion, for example when Org mode is
13974 used as the markup language for a wiki.
13976 ** Extracting source code
13978 :DESCRIPTION: Create pure source code files
13981 #+cindex: source code, extracting
13982 #+cindex: code block, extracting source code
13984 Creating pure source code files by extracting code from source blocks
13985 is referred to as "tangling"---a term adopted from the literate
13986 programming community. During tangling of code blocks their bodies are
13987 expanded using ~org-babel-expand-src-block~ which can expand both
13988 variable and ``noweb'' style references (see [[Noweb reference syntax]]).
13990 *** Header arguments for tangling
13991 #+attr_texinfo: :table-type table :indic @asis
13994 The default. The code block is not included in the tangled output.
13998 Include the code block in the tangled output. The output file name is
13999 the name of the org file with the extension {{{samp(.org)}}} replaced
14000 by the extension for the block language.
14002 - ~:tangle filename~ ::
14004 Include the code block in the tangled output to file {{{samp(filename)}}}.
14006 *** Functions for tangling
14007 #+attr_texinfo: :table-type table :indic @asis
14008 - ~org-babel-tangle~ ::
14009 #+kindex: C-c C-v t
14011 Tangle the current file. Bound to {{{kbd(C-c C-v t)}}}.
14013 With a prefix argument only tangle the current code block.
14015 - ~org-babel-tangle-file~ ::
14016 #+kindex: C-c C-v f
14018 Choose a file to tangle. Bound to {{{kbd(C-c C-v f)}}}.
14020 *** Hooks for tangling
14021 #+attr_texinfo: :table-type table :indic @asis
14022 - ~org-babel-post-tangle-hook~ ::
14024 This hook is run from within code files tangled by ~org-babel-tangle~.
14025 Example applications could include post-processing, compilation, or
14026 evaluation of tangled code files.
14028 ** Evaluating code blocks
14030 :DESCRIPTION: Place results in the Org buffer
14032 #+cindex: code block, evaluating
14033 #+cindex: source code, evaluating
14034 #+cindex: #+RESULTS
14036 Code blocks can be evaluated and the results of evaluation optionally
14037 placed in the Org mode buffer.[fn:148] The results of evaluation are
14038 placed following a line that begins by default with ~#+RESULTS~ and
14039 optionally a cache identifier and/or the name of the evaluated code
14040 block. The default value of ~#+RESULTS~ can be changed with the
14041 customizable variable ~org-babel-results-keyword~.
14043 By default, the evaluation facility is only enabled for Lisp code
14044 blocks specified as ~emacs-lisp~. However, source code blocks in many
14045 languages can be evaluated within Org mode (see [[Languages]] for a list
14046 of supported languages and [[Structure of code blocks]] for information on
14047 the syntax used to define a code block).
14050 #+kindex: C-c C-v e
14052 There are a number of ways to evaluate code blocks. The simplest is to
14053 press {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-v e)}}} with the point on a
14054 code block.[fn:149] This will call the ~org-babel-execute-src-block~
14055 function to evaluate the block and insert its results into the Org
14060 It is also possible to evaluate named code blocks from anywhere in an
14061 Org mode buffer or an Org mode table. Live code blocks located in the
14062 current Org mode buffer or in the ``Library of Babel'' (see [[Library of
14063 Babel]]) can be executed. Named code blocks can be executed with a
14064 separate ~#+CALL:~ line or inline within a block of text.
14066 The syntax of the ~#+CALL:~ line is:
14069 ,#+CALL: <name>(<arguments>)
14070 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
14073 The syntax for inline evaluation of named code blocks is:
14076 ... call_<name>(<arguments>) ...
14077 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
14080 #+attr_texinfo: :table-type table :indic @asis
14083 The name of the code block to be evaluated (see [[Structure of code
14088 Arguments specified in this section will be passed to the code block.
14089 These arguments use standard function call syntax, rather than header
14090 argument syntax. For example, a ~#+CALL:~ line that passes the number
14091 four to a code block named ~double~, which declares the header
14092 argument ~:var n=2~, would be written as ~#+CALL: double(n=4)~.
14094 - ~<inside header arguments>~ ::
14096 Inside header arguments are passed through and applied to the named
14097 code block. These arguments use header argument syntax rather than
14098 standard function call syntax. Inside header arguments affect how the
14099 code block is evaluated. For example, ~[:results output]~ will collect
14100 the results of everything printed to ~STDOUT~ during execution of the
14103 - ~<end header arguments>~ ::
14105 End header arguments are applied to the calling instance and do not
14106 affect evaluation of the named code block. They affect how the results
14107 are incorporated into the Org mode buffer and how the call line is
14108 exported. For example, ~:results html~ will insert the results of the
14109 call line evaluation in the Org buffer, wrapped in a ~BEGIN_HTML:~
14113 For more examples of passing header arguments to ~#+CALL:~ lines see
14114 [[Header arguments in function calls]].
14116 ** Library of Babel
14118 :DESCRIPTION: Use and contribute to a source code library
14120 #+cindex: babel, library of
14121 #+cindex: source code, library
14122 #+cindex: code block, library
14124 The ``Library of Babel'' consists of code blocks that can be called
14125 from any Org mode file. Code blocks defined in the ``Library of
14126 Babel'' can be called remotely as if they were in the current Org mode
14127 buffer (see [[Evaluating code blocks]] for information on the syntax of
14128 remote code block evaluation).
14131 The central repository of code blocks in the ``Library of Babel'' is
14132 housed in an Org mode file located in the {{{samp(contrib)}}}
14133 directory of Org mode.
14135 Users can add code blocks they believe to be generally useful to their
14136 ``Library of Babel.'' The code blocks can be stored in any Org mode
14137 file and then loaded into the library with ~org-babel-lob-ingest~.
14139 #+kindex: C-c C-v i
14141 Code blocks located in any Org mode file can be loaded into the
14142 ``Library of Babel'' with the ~org-babel-lob-ingest~ function, bound
14143 to {{{kbd(C-c C-v i)}}}.
14147 :DESCRIPTION: Supported code block languages
14149 #+cindex: babel, languages
14150 #+cindex: source code, languages
14151 #+cindex: code block, languages
14153 Code blocks in the following languages are supported.
14155 #+attr_texinfo: :columns 0.24 0.24 0.04 0.24 0.24
14156 | Language | Identifier | | Language | Identifier |
14157 |------------+--------------+---+----------------+--------------|
14158 | Asymptote | asymptote | | Awk | awk |
14159 | Emacs Calc | calc | | C | C |
14160 | C++ | C++ | | Clojure | clojure |
14161 | CSS | css | | ditaa | ditaa |
14162 | Graphviz | dot | | Emacs Lisp | emacs-lisp |
14163 | gnuplot | gnuplot | | Haskell | haskell |
14164 | Java | java | | | |
14165 | Javascript | js | | LaTeX | latex |
14166 | Ledger | ledger | | Lisp | lisp |
14167 | Lilypond | lilypond | | MATLAB | matlab |
14168 | Mscgen | mscgen | | Objective Caml | ocaml |
14169 | Octave | octave | | Org mode | org |
14170 | Oz | oz | | Perl | perl |
14171 | Plantuml | plantuml | | Python | python |
14172 | R | R | | Ruby | ruby |
14173 | Sass | sass | | Scheme | scheme |
14174 | GNU Screen | screen | | shell | sh |
14175 | SQL | sql | | SQLite | sqlite |
14178 Language-specific documentation is available for some languages. If
14179 available, it can be found at
14180 [[http://orgmode.org/worg/org-contrib/babel/languages.html]].
14182 The variable ~org-babel-load-languages~ controls which languages are
14183 enabled for evaluation (by default only ~emacs-lisp~ is enabled). This
14184 variable can be set using the customization interface or by adding
14185 code like the following example, disables ~emacs-lisp~ evaluation and
14186 enables evaluation of ~R~ code blocks, to your emacs configuration:
14189 #+header: :exports code
14190 #+begin_src emacs-lisp
14191 (org-babel-do-load-languages
14192 'org-babel-load-languages
14193 '((emacs-lisp . nil)
14197 It is also possible to enable support for a language by loading the
14198 related elisp file with ~require~.
14200 {{{noindent}}} The following example adds support for evaluating
14201 ~clojure~ code blocks:
14204 #+header: :exports code
14205 #+begin_src emacs-lisp
14206 (require 'ob-clojure)
14209 ** Header arguments
14211 :DESCRIPTION: Configure code block functionality
14213 #+cindex: code block, header arguments
14214 #+cindex: source code, block header arguments
14216 Code block functionality can be configured with header arguments. This
14217 section provides an overview of the use of header arguments, and then
14218 describes each header argument in detail.
14220 *** Using header arguments
14222 :DESCRIPTION: Different ways to set header arguments
14225 The values of header arguments can be set in six different ways, each
14226 more specific (and having higher priority) than the last.
14228 **** System-wide header arguments
14230 :DESCRIPTION: Set global default values
14232 #+vindex: org-babel-default-header-args
14234 System-wide values of header arguments can be specified by customizing
14235 the ~org-babel-default-header-args~ variable:
14239 :results => "replace"
14246 # org-babel-default-header-args is a variable defined in `org-babel.el'.
14248 # ((:session . "none")
14249 # (:results . "replace")
14250 # (:exports . "code")
14256 # Default arguments to use when evaluating a code block.
14259 For example, the following code could be used to set the default
14260 value of ~:noweb~ header arguments to ~yes~. This would have the
14261 effect of expanding ~:noweb~ references by default when evaluating
14262 source code blocks.
14265 #+header: :exports code
14266 #+begin_src emacs-lisp
14267 (setq org-babel-default-header-args
14268 (cons '(:noweb . "yes")
14269 (assq-delete-all :noweb org-babel-default-header-args)))
14272 **** Language-specific header arguments
14274 :DESCRIPTION: Set default values by language
14277 Each language can define its own set of default header arguments. See
14278 the language-specific documentation available online at
14279 [[http://orgmode.org/worg/org-contrib/babel]].
14281 **** Buffer-wide header arguments
14283 :DESCRIPTION: Set default values for a specific buffer
14286 Buffer-wide header arguments may be specified as properties through
14287 the use of ~#+PROPERTY:~ lines placed anywhere in an Org mode file
14288 (see [[Property syntax]]).
14290 For example the following would set ~session~ to ~*R*~, and ~results~
14291 to ~silent~ for every code block in the buffer, ensuring that all
14292 execution took place in the same session, and no results would be
14293 inserted into the buffer.
14296 ,#+PROPERTY: session *R*
14297 ,#+PROPERTY: results silent
14300 **** Header arguments in Org mode properties
14302 :DESCRIPTION: Set default values for a buffer or heading
14305 Header arguments are also read from Org mode properties (see [[Property
14306 syntax]]), which can be set on a buffer-wide or per-heading basis. An
14307 example of setting a header argument for all code blocks in a buffer
14311 ,#+PROPERTY: tangle yes
14314 #+vindex: org-use-property-inheritance
14316 When properties are used to set default header arguments, they are
14317 looked up with inheritance, regardless of the value of
14318 ~org-use-property-inheritance~. In the following example the value of
14319 the ~:cache~ header argument will default to ~yes~ in all code blocks
14320 in the subtree rooted at the following heading:
14329 #+kindex: C-c C-x p
14330 #+vindex: org-babel-default-header-args
14332 Properties defined in this way override the properties set in
14333 ~org-babel-default-header-args~. It is convenient to use the
14334 ~org-set-property~ function bound to {{{kbd(C-c C-x p)}}} to set
14335 properties in Org mode documents.
14337 **** Code block specific header arguments
14339 :DESCRIPTION: The most common way to set values
14342 The most common way to assign values to header arguments is at the
14343 code block level. This can be done by listing a sequence of header
14344 arguments and their values as part of the ~#+BEGIN_SRC~ line.
14345 Properties set in this way override both the values of
14346 ~org-babel-default-header-args~ and header arguments specified as
14347 properties. In the following example, the ~:results~ header argument
14348 is set to ~silent~, meaning the results of execution will not be
14349 inserted in the buffer, and the ~:exports~ header argument is set to
14350 ~code~, meaning only the body of the code block will be preserved on
14351 export to HTML or LaTeX.
14355 #+BEGIN_SRC haskell :results silent :exports code :var n=0
14357 fac n = n * fac (n-1)
14361 Similarly, it is possible to set header arguments for inline code blocks:
14364 src_haskell[:exports both]@{fac 5@}
14367 Code block header arguments can span multiple lines using ~#+HEADER:~
14368 or ~#+HEADERS:~ lines preceding a code block or nested between the
14369 ~#+NAME:~ line and the ~#+BEGIN_SRC~ line of a named code block.
14371 #+cindex: #+HEADER:
14372 #+cindex: #+HEADERS:
14374 This is an example of multi-line header arguments on an un-named code
14378 ,#+HEADERS: :var data1=1
14379 ,#+BEGIN_SRC emacs-lisp :var data2=2
14380 (message "data1:%S, data2:%S" data1 data2)
14387 This is an example of multi-line header arguments on a named code block:
14390 ,#+NAME: named-block
14391 ,#+HEADER: :var data=2
14392 ,#+BEGIN_SRC emacs-lisp
14393 (message "data:%S" data)
14396 ,#+RESULTS: named-block
14400 **** Header arguments in function calls
14402 :DESCRIPTION: The most specific level
14405 At the most specific level, header arguments for ``Library of Babel''
14406 or ~#+CALL:~ lines can be set as shown in the two examples below. For
14407 more information on the structure of ~#+CALL:~ lines see [[Evaluating
14410 The following example will apply the ~:exports results~ header
14411 argument to the evaluation of the ~#+CALL:~ line:
14414 ,#+CALL: factorial(n=5) :exports results
14417 The following example will apply the ~:session special~ header
14418 argument to the evaluation of the ~factorial~ code block:
14421 ,#+CALL: factorial[:session special](n=5)
14424 *** Specific header arguments
14426 :DESCRIPTION: List of header arguments
14428 Header arguments consist of an initial colon followed by the name of
14429 the argument in lowercase letters. Additional header arguments are
14430 defined on a language-specific basis, see [[Languages]].
14432 The following header arguments are defined:
14436 :DESCRIPTION: Pass arguments to code blocks
14438 The ~:var~ header argument is used to pass arguments to code blocks.
14439 The specifics of how arguments are included in a code block vary by
14440 language; these are addressed in the language-specific documentation.
14441 However, the syntax used to specify arguments is the same across all
14442 languages. In every case, variables require a default value when they
14445 The values passed to arguments can either be literal values,
14446 references, or Emacs Lisp code (see [[Emacs Lisp evaluation of
14447 variables]]). References include anything in the Org mode file that
14448 takes a ~#+NAME:~, ~#+TBLNAME:~, or ~#+RESULTS:~ line. This includes
14449 tables, lists, ~#+BEGIN_EXAMPLE~ blocks, other code blocks, and the
14450 results of other code blocks.
14452 Argument values can be indexed in a manner similar to arrays (see
14453 [[Indexable variable values]]).
14455 The following syntax is used to pass arguments to code blocks using the
14456 ~:var~ header argument:
14462 The argument, ~assign~, can either be a literal value, such as a
14463 string {{{samp("string")}}} or a number {{{samp(9)}}}, or a reference
14464 to a table, a list, a literal example, another code block (with or
14465 without arguments), or the results of evaluating another code block.
14467 Here are examples of passing values by reference:
14469 #+attr_texinfo: :table-type table :indic @asis
14470 - a table named with either ~#+NAME:~ or ~#+TBLNAME:~ ::
14473 #+TBLNAME: example-table
14479 #+NAME: table-length
14480 #+BEGIN_SRC emacs-lisp :var table=example-table
14484 #+RESULTS: table-length
14488 - a simple list named with ~#+NAME:~ ::
14491 #+NAME: example-list
14497 #+BEGIN_SRC emacs-lisp :var x=example-list
14505 Note that nesting is not carried through to the source code block.
14507 - a named code block without arguments, optionally followed by parentheses ::
14510 #+BEGIN_SRC emacs-lisp :var length=table-length()
14518 - a named code block with arguments ::
14522 #+BEGIN_SRC emacs-lisp :var input=8
14530 #+BEGIN_SRC emacs-lisp :var input=double(input=1)
14538 - a literal example block ::
14541 ,#+NAME: literal-example
14547 ,#+NAME: read-literal-example
14548 ,#+BEGIN_SRC emacs-lisp :var x=literal-example
14549 (concatenate 'string x " for you.")
14552 ,#+RESULTS: read-literal-example
14553 : A literal example
14554 : on two lines for you.
14557 # ***** Alternate argument syntax
14558 <<Alternate argument syntax>>
14560 It is also possible to specify arguments in a potentially more natural
14561 way using the ~#+NAME:~ line of a code block. As in the following
14562 example, arguments can be packed inside of parentheses, separated by
14563 commas, following the source name.
14566 ,#+NAME: double(input=0, x=2)
14567 ,#+BEGIN_SRC emacs-lisp
14572 # ***** Indexable variable values
14573 <<Indexable variable values>>
14575 It is possible to reference portions of variable values by
14576 /indexing/ into the variables. Indexes are 0 based with negative
14577 values counting back from the end. If an index is separated by commas
14578 then each subsequent section will index into the next deepest nesting
14579 or dimension of the value. Note that this indexing occurs /before/
14580 other table related header arguments like ~:hlines~, ~:colnames~, and
14581 ~:rownames~ are applied. The following example assigns the last cell
14582 of the first row the table ~example-table~ to the variable ~data~:
14585 ,#+NAME: example-table
14591 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
14599 Ranges of variable values can be referenced using two integers
14600 separated by a ~:~, in which case the entire inclusive range is
14601 referenced. The following example assigns the middle three rows of
14602 ~example-table~ to ~data~.
14605 #+NAME: example-table
14612 #+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
14622 Additionally, an empty index, or the single character ~*~, are both
14623 interpreted to mean the entire range and as such are equivalent to
14624 ~0:-1~, as shown in the following example in which the entire first
14625 column is referenced:
14628 #+NAME: example-table
14634 #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
14642 It is possible to index into the results of code blocks as well as
14643 tables. Any number of dimensions can be indexed. Dimensions are
14644 separated from one another by commas, as shown in the following
14649 #+BEGIN_SRC emacs-lisp
14650 '(((1 2 3) (4 5 6) (7 8 9))
14651 ((10 11 12) (13 14 15) (16 17 18))
14652 ((19 20 21) (22 23 24) (25 26 27)))
14655 #+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
14663 # ***** Emacs Lisp evaluation of variables
14664 <<Emacs Lisp evaluation of variables>>
14666 Emacs lisp code can be used to initialize variable values. When a
14667 variable value starts with ~(~, ~[~, ~'~ or ~`~ it will be evaluated
14668 as Emacs Lisp and the result of the evaluation will be assigned as the
14669 variable value. The following example demonstrates use of this
14670 evaluation to reliably pass the file-name of the Org mode buffer to a
14671 code block:[fn:150]
14674 #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
14679 Note that values read from tables and lists will not be evaluated as
14680 Emacs Lisp, as shown in the following example, which contains a Lisp
14681 list as the sole table element:
14687 #+HEADERS: :var data=table[0,0]
14698 :DESCRIPTION: Specify the type of results and how they will be collected and handled
14700 There are three classes of ~:results~ header argument. Only one option
14701 per class may be supplied per code block.
14703 #+attr_texinfo: :table-type table :indic @asis
14706 These header arguments specify how the results should be collected
14707 from the code block.
14711 These header arguments specify what type of result the code block will
14712 return---which has implications for how they will be inserted into the
14717 These header arguments specify how the results of evaluating the code
14718 block should be handled.
14723 The following ~:results~ options are mutually exclusive, and specify
14724 how the results should be collected from the code block.
14726 #+attr_texinfo: :table-type table :indic @asis
14729 This is the default. The result is the value of the last statement in
14730 the code block. This header argument places the evaluation in
14731 functional mode. Note that in some languages, e.g., Python, use of
14732 this result type requires that a ~return~ statement be included in the
14733 body of the source code block.
14737 The result is the collection of everything printed to STDOUT during
14738 the execution of the code block. This header argument places the
14739 evaluation in scripting mode.
14744 The following ~:results~ options are mutually exclusive and specify
14745 what type of results the code block will return. By default, results
14746 are inserted as either a table or scalar depending on their value.
14748 #+attr_texinfo: :table-type table :indic @asis
14749 - ~table~, ~vector~ ::
14751 The results should be interpreted as an Org mode table. If a single
14752 value is returned, it will be converted into a table with one row and
14753 one column. E.g., ~:results value table~.
14755 - ~scalar~, ~verbatim~ ::
14757 The results should be interpreted literally---they will not be
14758 converted into a table. The results will be inserted into the Org mode
14759 buffer as quoted text. E.g., ~:results value verbatim~.
14763 The results should be interpreted as an Org mode list. If a single
14764 scalar value is returned it will be converted into a list with only
14769 The results will be interpreted as the path to a file, and will be
14770 inserted into the Org mode buffer as a file link. E.g., ~:results
14775 The results are interpreted as raw Org mode code and are inserted
14776 directly into the buffer. If the results look like a table they will
14777 be aligned as such by Org mode. E.g., ~:results value raw~.
14781 The results are will be enclosed in a ~BEGIN_SRC org~ block. They are
14782 not comma-escaped by default but they will be if you hit
14783 {{{kbd(TAB)}}} in the block and/or if you export the file. E.g.,
14784 ~:results value org~.
14788 Results are assumed to be HTML and will be enclosed in a ~BEGIN_HTML~
14789 block. E.g., ~:results value html~.
14793 Results assumed to be LaTeX and are enclosed in a ~BEGIN_LaTeX~
14794 block. E.g., ~:results value latex~.
14798 Result are assumed to be parsable code and are enclosed in a code
14799 block. E.g., ~:results value code~.
14803 The result is converted to pretty-printed code and is enclosed in a
14804 code block. This option currently supports Emacs Lisp, Python, and
14805 Ruby. E.g., ~:results value pp~.
14809 The result is wrapped in a RESULTS drawer. This can be useful for
14810 inserting ~raw~ or ~org~ syntax results in such a way that their
14811 extent is known and they can be automatically removed or replaced.
14815 The following ~:results~ options indicate what happens with the
14816 results once they are collected.
14818 #+attr_texinfo: :table-type table :indic @asis
14821 The default value. Any existing results will be removed, and the new
14822 results will be inserted into the Org mode buffer in their place.
14823 E.g., ~:results output replace~.
14827 If there are pre-existing results of the code block then the new
14828 results will be appended to the existing results. Otherwise the new
14829 results will be inserted as with ~replace~.
14833 If there are pre-existing results of the code block then the new
14834 results will be prepended to the existing results. Otherwise the new
14835 results will be inserted as with ~replace~.
14839 The results will be echoed in the minibuffer but will not be inserted
14840 into the Org mode buffer. E.g., ~:results output silent~.
14844 :DESCRIPTION: Specify a path for file output
14847 The header argument ~:file~ is used to specify an external file in
14848 which to save code block results. After code block evaluation an Org
14849 mode style ~[[file:]]~ link (see [[Link format]]) to the file will be inserted
14850 into the Org mode buffer. Some languages including R, gnuplot, dot,
14851 and ditaa provide special handling of the ~:file~ header argument,
14852 automatically wrapping the code block body in the boilerplate code
14853 required to save output to the specified file. This is often useful
14854 for saving graphical output of a code block to the specified file.
14856 The argument to ~:file~ should be either a string specifying the path
14857 to a file, or a list of two strings in which case the first element of
14858 the list should be the path to a file and the second a description for
14863 :DESCRIPTION: Specify a description for file results
14866 The value of the ~:file-desc~ header argument is used to provide a
14867 description for file code block results which are inserted as Org mode
14868 links (see [[Link format]]). If the ~:file-desc~ header argument is given
14869 with no value the link path will be placed in both the ``link'' and
14870 the ``description'' portion of the Org mode link.
14874 :DESCRIPTION: Specify the default (possibly remote) directory for code block execution
14875 :TITLE: ~:dir~ and remote execution
14878 While the ~:file~ header argument can be used to specify the path to
14879 the output file, ~:dir~ specifies the default directory during code
14880 block execution. If it is absent, then the directory associated with
14881 the current buffer is used. In other words, supplying ~:dir path~
14882 temporarily has the same effect as changing the current directory with
14883 {{{kbd(M-x cd path)}}}, and then not supplying ~:dir~. Under the
14884 surface, ~:dir~ simply sets the value of the Emacs variable
14885 ~default-directory~.
14887 When using ~:dir~, you should supply a relative path for file output
14888 (e.g., ~:file myfile.jpg~ or ~:file results/myfile.jpg~) in which
14889 case that path will be interpreted relative to the default directory.
14891 In other words, if you want your plot to go into a folder called
14892 {{{file(Work)}}} in your home directory, you could use a code block
14893 like the following example:
14896 #+BEGIN_SRC R :file myplot.png :dir ~/Work
14897 matplot(matrix(rnorm(100), 10), type="l")
14901 # ***** Remote execution
14902 <<Remote execution>>
14904 A directory on a remote machine can be specified using tramp file
14905 syntax, in which case the code will be evaluated on the remote
14906 machine. An example is:
14909 #+BEGIN_SRC R :file plot.png :dir /dand@yakuba.princeton.edu:
14910 plot(1:10, main=system("hostname", intern=TRUE))
14914 Text results will be returned to the local Org mode buffer as usual,
14915 and file output will be created on the remote machine with relative
14916 paths interpreted relative to the remote directory. An Org mode link
14917 to the remote file will be created.
14919 So, in the above example a plot will be created on the remote machine,
14920 and a link of the following form will be inserted in the org buffer:
14923 [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
14926 Most of this functionality follows immediately from the fact that
14927 ~:dir~ sets the value of the Emacs variable ~default-directory~,
14928 thanks to tramp. Those using XEmacs, or GNU Emacs prior to version 23
14929 may need to install tramp separately in order for these features to
14932 # ***** Further points
14934 Please be aware of these further points:
14936 - If ~:dir~ is used in conjunction with ~:session~, although it will
14937 determine the starting directory for a new session as expected, no
14938 attempt is currently made to alter the directory associated with an
14941 - ~:dir~ should typically not be used to create files during export
14942 with ~:exports results~ or ~:exports both~. The reason is that, in
14943 order to retain portability of exported material between machines,
14944 during export links inserted into the buffer will /not/ be expanded
14945 against ~default directory~. Therefore, if ~default-directory~ is
14946 altered using ~:dir~, it is probable that the file will be created
14947 in a location to which the link does not point.
14951 :DESCRIPTION: Export code and/or results
14953 The ~:exports~ header argument specifies what should be included in HTML
14954 or LaTeX exports of the Org mode file.
14956 #+attr_texinfo: :table-type table :indic @asis
14959 The default. The body of code is included into the exported file.
14960 E.g., ~:exports code~.
14964 The result of evaluating the code is included in the exported file.
14965 E.g., ~:exports results~.
14969 Both the code and results are included in the exported file. E.g.,
14974 Nothing is included in the exported file. E.g., ~:exports none~.
14978 :DESCRIPTION: Toggle tangling and specify file name
14981 The ~:tangle~ header argument specifies whether or not the code
14982 block should be included in tangled extraction of source code files.
14984 #+attr_texinfo: :table-type table :indic @asis
14987 The code block is exported to a source code file named after the full
14988 path (including the directory) and file name (w/o extension) of the
14989 Org mode file. E.g., ~:tangle yes~.
14993 The default. The code block is not exported to a source code file.
14994 E.g., ~:tangle no~.
14998 Any other string passed to the ~:tangle~ header argument is
14999 interpreted as a path (directory and file name relative to the
15000 directory of the Org mode file) to which the block will be exported,
15001 e.g., ~:tangle path~.
15005 :DESCRIPTION: Toggle creation of parent directories of target files during tangling
15008 The ~:mkdirp~ header argument can be used to create parent directories
15009 of tangled files when missing. This can be set to ~yes~ to enable
15010 directory creation or to ~no~ to inhibit directory creation.
15014 :DESCRIPTION: Toggle insertion of comments in tangled code files
15017 By default code blocks are tangled to source-code files without any
15018 insertion of comments beyond those which may already exist in the body
15019 of the code block. The ~:comments~ header argument can be set as
15020 follows to control the insertion of extra comments into the tangled
15023 #+attr_texinfo: :table-type table :indic @asis
15026 The default. No extra comments are inserted during tangling.
15030 The code block is wrapped in comments which contain pointers back to
15031 the original Org file from which the code was tangled.
15035 A synonym for ``link'' to maintain backwards compatibility.
15039 Include text from the Org mode file as a comment.
15041 The text is picked from the leading context of the tangled code and is
15042 limited by the nearest headline or source block as the case may be.
15046 Turns on both the ``link'' and ``org'' comment options.
15050 Turns on the ``link'' comment option, and additionally wraps expanded
15051 noweb references in the code block body in link comments.
15055 :DESCRIPTION: Control insertion of padding lines in tangle code files
15058 Control in insertion of padding lines around code block bodies in tangled
15059 code files. The default value is ~yes~ which results in insertion of
15060 newlines before and after each tangled code block. The following arguments
15063 #+attr_texinfo: :table-type table :indic @asis
15066 Insert newlines before and after each code block body in tangled code
15071 Do not insert any newline padding in tangled output.
15075 :DESCRIPTION: Turn off variable assignment and noweb expansion during tangling
15078 By default, code blocks are expanded with ~org-babel-expand-src-block~
15079 during tangling. This has the effect of assigning values to variables
15080 specified with ~:var~ (see [[var]]), and of replacing ``noweb'' references
15081 (see [[Noweb reference syntax]]) with their targets. The ~:no-expand~
15082 header argument can be used to turn off this behavior.
15086 :DESCRIPTION: Preserve state of code evaluation
15089 The ~:session~ header argument starts a session for an interpreted
15090 language where state is preserved.
15092 By default, a session is not started.
15094 A string passed to the ~:session~ header argument will give the
15095 session a name. This makes it possible to run concurrent sessions for
15096 each interpreted language.
15100 :DESCRIPTION: Toggle expansion of noweb references
15103 The ~:noweb~ header argument controls expansion of ``noweb'' syntax
15104 references (see [[Noweb reference syntax]]) when the code block is
15105 evaluated, tangled, or exported. The ~:noweb~ header argument can have
15106 one of the five values: ~no~, ~yes~, ~tangle~, ~no-export~, or
15109 #+attr_texinfo: :table-type table :indic @asis
15112 The default. ``Noweb'' syntax references in the body of the code block
15113 will not be expanded before the code block is evaluated, tangled or
15118 ``Noweb'' syntax references in the body of the code block will be
15119 expanded before the code block is evaluated, tangled or exported.
15123 ``Noweb'' syntax references in the body of the code block will be
15124 expanded before the code block is tangled. However, ``noweb'' syntax
15125 references will not be expanded when the code block is evaluated or
15130 ``Noweb'' syntax references in the body of the code block will be
15131 expanded before the block is evaluated or tangled. However, ``noweb''
15132 syntax references will not be expanded when the code block is
15135 - ~strip-export~ ::
15137 ``Noweb'' syntax references in the body of the code block will be
15138 expanded before the block is evaluated or tangled. However, ``noweb''
15139 syntax references will not be removed when the code block is exported.
15143 ``Noweb'' syntax references in the body of the code block will only be
15144 expanded before the block is evaluated.
15146 # ***** Noweb prefix lines
15147 <<Noweb prefix lines>>
15149 Noweb insertions are placed behind the line prefix of the
15150 ~<<reference>>~. Because the ~<<example>>~ noweb reference appears
15151 behind the SQL comment syntax in the following example, each line of
15152 the expanded noweb reference will be commented.
15165 -- multi-line body of example
15168 Note that noweb replacement text that does not contain any newlines
15169 will not be inserted behind the line prefix, so it is always possible
15170 to use inline noweb references.
15174 :DESCRIPTION: Specify block's noweb reference resolution target
15177 When expanding ``noweb'' style references the bodies of all code block
15178 with /either/ a block name matching the reference name /or/ a
15179 ~:noweb-ref~ header argument matching the reference name will be
15180 concatenated together to form the replacement text.
15182 By setting this header argument at the sub-tree or file level, simple code
15183 block concatenation may be achieved. For example, when tangling the
15184 following Org mode file, the bodies of code blocks will be concatenated into
15185 the resulting pure code file.[fn:151]
15188 #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
15191 ,* the mount point of the fullest disk
15193 :noweb-ref: fullest-disk
15196 ,** query all mounted disks
15201 ,** strip the header row
15206 ,** sort by the percent full
15208 |awk '@{print $5 " " $6@}'|sort -n |tail -1 \
15211 ,** extract the mount point
15213 |awk '@{print $2@}'
15217 The ~:noweb-sep~ (see [[noweb-sep]]) header argument holds the string used
15218 to separate accumulate noweb references like those above. By default a
15223 :DESCRIPTION: String used to separate noweb references
15226 The ~:noweb-sep~ header argument holds the string used to separate
15227 accumulated noweb references (see [[noweb-ref]]). By default a newline is
15232 :DESCRIPTION: Avoid re-evaluating unchanged code blocks
15235 The ~:cache~ header argument controls the use of in-buffer caching of
15236 the results of evaluating code blocks. It can be used to avoid
15237 re-evaluating unchanged code blocks. Note that the ~:cache~ header
15238 argument will not attempt to cache results when the ~:session~ header
15239 argument is used, because the results of the code block execution may
15240 be stored in the session outside of the Org mode buffer. The ~:cache~
15241 header argument can have one of two values: ~yes~ or ~no~.
15243 #+attr_texinfo: :table-type table :indic @asis
15246 The default. No caching takes place, and the code block will be
15247 evaluated every time it is called.
15251 Every time the code block is run a SHA1 hash of the code and arguments
15252 passed to the block will be generated. This hash is packed into the
15253 ~#+RESULTS:~ line and will be checked on subsequent executions of the
15254 code block. If the code block has not changed since the last time it
15255 was evaluated, it will not be re-evaluated.
15258 Code block caches notice if the value of a variable argument
15259 to the code block has changed. If this is the case, the cache is
15260 invalidated and the code block is re-run. In the following example,
15261 ~caller~ will not be re-run unless the results of ~random~ have
15262 changed since it was last run.
15266 #+BEGIN_SRC R :cache yes
15270 #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
15274 #+BEGIN_SRC emacs-lisp :var x=random :cache yes
15278 #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
15284 :DESCRIPTION: Delimiter for writing tabular results outside Org
15288 The ~:sep~ header argument can be used to control the delimiter used
15289 when writing tabular results out to files external to Org mode. This
15290 is used either when opening tabular results of a code block by calling
15291 the ~org-open-at-point~ function bound to {{{kbd(C-c C-o)}}} on the
15292 code block, or when writing code block results to an external file
15293 (see [[file]]) header argument.
15295 By default, when ~:sep~ is not specified output tables are tab
15300 :DESCRIPTION: Handle horizontal lines in tables
15303 Tables are frequently represented with one or more horizontal lines,
15304 or hlines. The ~:hlines~ argument to a code block accepts the values
15305 ~yes~ or ~no~, with a default value of ~no~.
15307 #+attr_texinfo: :table-type table :indic @asis
15310 Strips horizontal lines from the input table. In most languages this
15311 is the desired effect because an ~hline~ symbol is interpreted as an
15312 unbound variable and raises an error. Setting ~:hlines no~ or relying
15313 on the default value yields the following results.
15316 #+TBLNAME: many-cols
15324 #+BEGIN_SRC python :var tab=many-cols
15328 #+RESULTS: echo-table
15336 Leaves hlines in the table. Setting ~:hlines yes~ has this effect.
15339 #+TBLNAME: many-cols
15347 #+BEGIN_SRC python :var tab=many-cols :hlines yes
15351 #+RESULTS: echo-table
15361 :DESCRIPTION: Handle column names in tables
15364 The ~:colnames~ header argument accepts the values ~yes~, ~no~, or
15365 ~nil~ for unassigned. The default value is ~nil~. Note that the
15366 behavior of the ~:colnames~ header argument may differ across
15367 languages. For example Emacs Lisp code blocks ignore the ~:colnames~
15368 header argument entirely given the ease with which tables with column
15369 names may be handled directly in Emacs Lisp.
15371 #+attr_texinfo: :table-type table :indic @asis
15374 If an input table looks like it has column names (because its second
15375 row is an hline), then the column names will be removed from the table
15376 before processing, then reapplied to the results.
15379 #+TBLNAME: less-cols
15385 #+NAME: echo-table-again
15386 #+BEGIN_SRC python :var tab=less-cols
15387 return [[val + '*' for val in row] for row in tab]
15390 #+RESULTS: echo-table-again
15397 Please note that column names are not removed before the table is
15398 indexed using variable indexing. See [[Indexable variable values]].
15402 No column name pre-processing takes place
15406 Column names are removed and reapplied as with ~nil~ even if the table
15407 does not ``look like'' it has column names (i.e., the second row is
15412 :DESCRIPTION: Handle row names in tables
15415 The ~:rownames~ header argument can take on the values ~yes~
15416 or ~no~, with a default value of ~no~.
15418 #+attr_texinfo: :table-type table :indic @asis
15421 No row name pre-processing will take place.
15425 The first column of the table is removed from the table before
15426 processing, and is then reapplied to the results.
15429 #+TBLNAME: with-rownames
15430 | one | 1 | 2 | 3 | 4 | 5 |
15431 | two | 6 | 7 | 8 | 9 | 10 |
15433 #+NAME: echo-table-once-again
15434 #+BEGIN_SRC python :var tab=with-rownames :rownames yes
15435 return [[val + 10 for val in row] for row in tab]
15438 #+RESULTS: echo-table-once-again
15439 | one | 11 | 12 | 13 | 14 | 15 |
15440 | two | 16 | 17 | 18 | 19 | 20 |
15443 Please note that row names are not removed before the table is indexed
15444 using variable indexing. See [[Indexable variable values]].
15448 :DESCRIPTION: Make tangles files executable
15451 Setting the ~:shebang~ header argument to a string value (e.g.,
15452 {{{samp(:shebang "#!/bin/bash")}}}) causes the string to be inserted as the
15453 first line of any tangled file holding the code block, and the file
15454 permissions of the tangled file are set to make it executable.
15458 :DESCRIPTION: Limit evaluation of specific code blocks
15461 The ~:eval~ header argument can be used to limit the evaluation of
15462 specific code blocks. The ~:eval~ header argument can be useful for
15463 protecting against the evaluation of dangerous code blocks or to
15464 ensure that evaluation will require a query regardless of the value of
15465 the ~org-confirm-babel-evaluate~ variable. The possible values of
15466 ~:eval~ and their effects are shown below.
15468 #+attr_texinfo: :table-type table :indic @asis
15469 - ~never~ or ~no~ ::
15471 The code block will not be evaluated under any circumstances.
15475 Evaluation of the code block will require an affirmative answer to a
15478 - ~never-export~ or ~no-export~ ::
15480 The code block will not be evaluated during export but may still be
15481 called interactively.
15483 - ~query-export~ ::
15485 Evaluation of the code block during export will require an affirmative
15489 If this header argument is not set then evaluation is determined by the value
15490 of the ~org-confirm-babel-evaluate~ variable (see [[Code evaluation
15495 :DESCRIPTION: Mark source block evaluation results
15498 The ~:wrap~ header argument is used to mark the results of source
15499 block evaluation. The header argument can be passed a string that will
15500 be appended to ~#+BEGIN_~ and ~#+END_~, which will then be used to
15501 wrap the results. If no string is specified then the results will be
15502 wrapped in a ~#+BEGIN/END_RESULTS~ block.
15504 ** Results of evaluation
15506 :DESCRIPTION: How evaluation results are handled
15508 #+cindex: code block, results of evaluation
15509 #+cindex: source code, results of evaluation
15511 The way in which results are handled depends on whether a session is
15512 invoked, as well as on whether ~:results value~ or ~:results output~
15513 is used. The following table shows the table possibilities. For a full
15514 listing of the possible results header arguments, see [[results]].
15516 | | *Non-session* | *Session* |
15517 |-------------------+--------------------------+-------------------------------------|
15518 | ~:results value~ | value of last expression | value of last expression |
15519 | ~:results output~ | contents of STDOUT | concatenation of interpreter output |
15522 Please note that with ~:results value~, the result in both ~:session~
15523 and non-session is returned to Org mode as a table (a one- or
15524 two-dimensional vector of strings or numbers) when appropriate.
15528 #+attr_texinfo: :table-type table :indic @asis
15529 - ~:results value~ ::
15531 This is the default. Internally, the value is obtained by wrapping the
15532 code in a function definition in the external language, and evaluating
15533 that function. Therefore, code should be written as if it were the
15534 body of such a function. In particular, note that Python does not
15535 automatically return a value from a function unless a ~return~
15536 statement is present, and so a {{{samp(return)}}} statement will
15537 usually be required in Python.
15539 This is the only one of the four evaluation contexts in which the code
15540 is automatically wrapped in a function definition.
15542 - ~:results output~ ::
15544 The code is passed to the interpreter as an external process, and the
15545 contents of the standard output stream are returned as text.[fn:152]
15549 #+attr_texinfo: :table-type table :indic @asis
15550 - ~:results value~ ::
15552 The code is passed to an interpreter running as an interactive Emacs
15553 inferior process. Only languages which provide tools for interactive
15554 evaluation of code have session support, so some language (e.g., C and
15555 ditaa) do not support the ~:session~ header argument, and in other
15556 languages (e.g., Python and Haskell) which have limitations on the
15557 code which may be entered into interactive sessions, those limitations
15558 apply to the code in code blocks using the ~:session~ header argument
15561 Unless the ~:results output~ option is supplied (see below) the result
15562 returned is the result of the last evaluation performed by the
15563 interpreter.[fn:153]
15565 - ~:results output~ ::
15567 The code is passed to the interpreter running as an interactive Emacs
15568 inferior process. The result returned is the concatenation of the
15569 sequence of (text) output from the interactive interpreter. Notice
15570 that this is not necessarily the same as what would be sent to
15571 ~STDOUT~ if the same code were passed to a non-interactive interpreter
15572 running as an external process. Compare the following two
15576 #+BEGIN_SRC python :results output
15587 In non-session mode, the `2' is not printed and does not appear.
15590 #+BEGIN_SRC python :results output :session
15602 But in ~:session~ mode, the interactive interpreter receives input `2'
15603 and prints out its value, `2'. (Indeed, the other print statements are
15606 ** Noweb reference syntax
15608 :DESCRIPTION: Literate programming in Org mode
15610 #+cindex: code block, noweb reference
15611 #+cindex: syntax, noweb
15612 #+cindex: source code, noweb reference
15614 The ``noweb'' (see [[http://www.cs.tufts.edu/~nr/noweb/]]) Literate
15615 Programming system allows named blocks of code to be referenced using
15616 the familiar Noweb syntax:
15619 <<code-block-name>>
15622 When a code block is tangled or evaluated, whether or not ``noweb''
15623 references are expanded depends upon the value of the ~:noweb~ header
15624 argument. If ~:noweb yes~, then a Noweb reference is expanded before
15625 evaluation. If ~:noweb no~, the default, then the reference is not
15626 expanded before evaluation. See the [[noweb-ref]] header argument for a
15627 more flexible way to resolve noweb references.
15629 It is possible to include the /results/ of a code block rather than
15630 the body. This is done by appending parenthesis to the code block
15631 name, which may optionally contain arguments to the code block as
15635 <<code-block-name(optional arguments)>>
15638 Note that the default value, ~:noweb no~, was chosen to ensure that
15639 correct code is not broken in a language, such as Ruby, where
15640 ~<<arg>>~ is a syntactically valid construct. If ~<<arg>>~ is not
15641 syntactically valid in languages that you use, then please consider
15642 setting the default value.
15644 If noweb tangling is slow in large Org mode files, consider
15645 setting the ~*org-babel-use-quick-and-dirty-noweb-expansion*~ variable
15646 to true. This will result in faster noweb reference resolution at the
15647 expense of not correctly resolving inherited values of the
15648 ~:noweb-ref~ header argument.
15650 ** Key bindings and useful functions
15652 :DESCRIPTION: Work quickly with code blocks
15654 #+cindex: code block, key bindings
15656 Many common Org mode key sequences are re-bound depending on
15659 Within a code block, the following key bindings
15666 #+attr_texinfo: :columns 0.2 0.55
15667 | Key binding | Function |
15668 |-----------------------+-----------------------------------|
15669 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~ |
15670 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ |
15671 | {{{kbdkey(C-,up)}}} | ~org-babel-load-in-session~ |
15672 | {{{kbdkey(M-,down)}}} | ~org-babel-pop-to-session~ |
15675 In an Org mode buffer, the following key bindings are active:
15677 #+kindex: C-c C-v p
15678 #+kindex: C-c C-v C-p
15679 #+kindex: C-c C-v n
15680 #+kindex: C-c C-v C-n
15681 #+kindex: C-c C-v e
15682 #+kindex: C-c C-v C-e
15683 #+kindex: C-c C-v o
15684 #+kindex: C-c C-v C-o
15685 #+kindex: C-c C-v v
15686 #+kindex: C-c C-v C-v
15687 #+kindex: C-c C-v u
15688 #+kindex: C-c C-v C-u
15689 #+kindex: C-c C-v g
15690 #+kindex: C-c C-v C-g
15691 #+kindex: C-c C-v r
15692 #+kindex: C-c C-v C-r
15693 #+kindex: C-c C-v b
15694 #+kindex: C-c C-v C-b
15695 #+kindex: C-c C-v s
15696 #+kindex: C-c C-v C-s
15697 #+kindex: C-c C-v d
15698 #+kindex: C-c C-v C-d
15699 #+kindex: C-c C-v t
15700 #+kindex: C-c C-v C-t
15701 #+kindex: C-c C-v f
15702 #+kindex: C-c C-v C-f
15703 #+kindex: C-c C-v c
15704 #+kindex: C-c C-v C-c
15705 #+kindex: C-c C-v j
15706 #+kindex: C-c C-v C-j
15707 #+kindex: C-c C-v l
15708 #+kindex: C-c C-v C-l
15709 #+kindex: C-c C-v i
15710 #+kindex: C-c C-v C-i
15711 #+kindex: C-c C-v I
15712 #+kindex: C-c C-v C-I
15713 #+kindex: C-c C-v z
15714 #+kindex: C-c C-v C-z
15715 #+kindex: C-c C-v a
15716 #+kindex: C-c C-v C-a
15717 #+kindex: C-c C-v h
15718 #+kindex: C-c C-v C-h
15719 #+kindex: C-c C-v x
15720 #+kindex: C-c C-v C-x
15722 #+attr_texinfo: :columns 0.4 0.6
15723 | Key binding | Function |
15724 |------------------------------------------------+--------------------------------------------|
15725 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~ |
15726 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~ |
15727 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~ |
15728 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~ |
15729 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~ |
15730 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~ |
15731 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~ |
15732 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~ |
15733 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~ |
15734 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~ |
15735 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~ |
15736 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~ |
15737 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~ |
15738 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~ |
15739 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~ |
15740 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~ |
15741 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~ |
15742 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~ |
15743 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~ |
15744 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~ |
15745 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~ |
15746 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
15749 # When possible these keybindings were extended to work when the control key is
15750 # kept pressed, resulting in the following additional keybindings.
15752 # @multitable @columnfractions 0.25 0.75
15753 # - {{{kbd(C-c C-v C-a)}}} @tab ~org-babel-sha1-hash~
15754 # - {{{kbd(C-c C-v C-b)}}} @tab ~org-babel-execute-buffer~
15755 # - {{{kbd(C-c C-v C-f)}}} @tab ~org-babel-tangle-file~
15756 # - {{{kbd(C-c C-v C-l)}}} @tab ~org-babel-lob-ingest~
15757 # - {{{kbd(C-c C-v C-p)}}} @tab ~org-babel-expand-src-block~
15758 # - {{{kbd(C-c C-v C-s)}}} @tab ~org-babel-execute-subtree~
15759 # - {{{kbd(C-c C-v C-t)}}} @tab ~org-babel-tangle~
15760 # - {{{kbd(C-c C-v C-z)}}} @tab ~org-babel-switch-to-session~
15765 :DESCRIPTION: Call functions from the command line
15767 #+cindex: code block, batch execution
15768 #+cindex: source code, batch execution
15770 It is possible to call functions from the command line. This shell
15771 script calls ~org-babel-tangle~ on every one of its arguments.
15773 Be sure to adjust the paths to fit your system.
15777 # -*- mode: shell-script -*-
15779 # tangle files with org-mode
15784 # wrap each argument in the code required to call tangle on it
15786 FILES="$FILES \"$i\""
15791 (add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\"))
15792 (add-to-list 'load-path (expand-file-name \"~/src/org/contrib/lisp/\" t))
15793 (require 'org)(require 'org-exp)(require 'ob)(require 'ob-tangle)
15794 (mapc (lambda (file)
15795 (find-file (expand-file-name file \"$DIR\"))
15797 (kill-buffer)) '($FILES)))" 2>&1 |grep tangled
15800 * FIXME Miscellaneous
15802 :DESCRIPTION: All the rest which did not fit elsewhere
15805 ** FIXME Completion
15807 :DESCRIPTION: M-TAB knows what you need
15809 #+cindex: completion, of @TeX{} symbols
15810 #+cindex: completion, of TODO keywords
15811 #+cindex: completion, of dictionary words
15812 #+cindex: completion, of option keywords
15813 #+cindex: completion, of tags
15814 #+cindex: completion, of property keys
15815 #+cindex: completion, of link abbreviations
15816 #+cindex: @TeX{} symbol completion
15817 #+cindex: TODO keywords completion
15818 #+cindex: dictionary word completion
15819 #+cindex: option keyword completion
15820 #+cindex: tag completion
15821 #+cindex: link abbreviations, completion of
15823 Emacs would not be Emacs without completion, and Org mode uses it
15824 whenever it makes sense. If you prefer an iswitchb- or ido-like
15825 interface for some of the completion prompts, you can specify your
15826 preference by setting at most one of the variables
15827 ~org-completion-use-iswitchb~ or ~org-completion-use-ido~.
15829 Org supports in-buffer completion. This type of completion does not
15830 make use of the minibuffer. You simply type a few letters into the
15831 buffer and use the {{{key(TAB)}}} key to complete text right there.
15833 #+attr_texinfo: :table-type table :indic @asis
15834 - {{{kbdkey(M-,TAB)}}} ::
15835 #+kindex: M-@key{TAB}
15837 Complete word at point.
15839 - At the beginning of a headline ::
15841 Complete TODO keywords.
15843 - After {{{kbd(XXX)}}} ::
15845 Complete TeX symbols supported by the exporter.
15847 - After {{{samp(*)}}} ::
15849 Complete headlines in the current buffer so that they can be used in
15853 [[*find this headline]]
15856 - After {{{samp(:)}}} in a headline ::
15858 Complete tags. The list of tags is taken from the variable
15859 ~org-tag-alist~ (possibly set through the {{{samp(#+TAGS)}}} in-buffer
15860 option, see [[Setting tags]]), or it is created dynamically from all tags
15861 used in the current buffer.
15863 - After {{{samp(:)}}} and not in a headline ::
15865 Complete property keys. The list of keys is constructed dynamically
15866 from all keys used in the current buffer.
15868 - After {{{samp([)}}} ::
15870 Complete link abbreviations (see [[Link abbreviations]]).
15872 - After {{{samp(#+)}}} ::
15874 Complete the special keywords like {{{samp(TYP_TODO)}}} or
15875 {{{samp(OPTIONS)}}} which set file-specific options for Org mode. When
15876 the option keyword is already complete, pressing {{{kbdkey(M-,TAB)}}}
15877 again will insert example settings for this keyword.
15879 - In the line after {{{samp(#+STARTUP: )}}} ::
15881 Complete startup keywords, i.e., valid keys for this line.
15885 Complete dictionary words using Ispell.
15889 :DESCRIPTION: Quick insertion of structural elements
15891 #+cindex: template insertion
15892 #+cindex: insertion, of templates
15894 Org mode supports insertion of empty structural elements (like
15895 ~#+BEGIN_SRC~ and ~#+END_SRC~ pairs) with just a few key strokes. This
15896 is achieved through a native template expansion mechanism. Note that
15897 Emacs has several other template mechanisms which could be used in a
15898 similar way, for example {{{file(yasnippet)}}}.
15900 To insert a structural element, type a {{{kbd(<)}}}, followed by a
15901 template selector and {{{kbdkey(,TAB)}}}. Completion takes effect only
15902 when the above keystrokes are typed on a line by itself.
15904 The following template selectors are currently supported:
15919 #+attr_texinfo: :columns 0.2 0.7
15920 | Selector | Template |
15921 |--------------+---------------------------------------|
15922 | {{{kbd(a)}}} | ~#+BEGIN_ASCII~ ...~ #+END_ASCII~ |
15923 | {{{kbd(A)}}} | ~#+ASCII:~ |
15924 | {{{kbd(c)}}} | ~#+BEGIN_CENTER~ ... ~#+END_CENTER~ |
15925 | {{{kbd(e)}}} | ~#+BEGIN_EXAMPLE~ ... ~#+END_EXAMPLE~ |
15926 | {{{kbd(h)}}} | ~#+BEGIN_HTML~ ... ~#+END_HTML~ |
15927 | {{{kbd(H)}}} | ~#+HTML:~ |
15928 | {{{kbd(i)}}} | ~#+INDEX:~ |
15929 | {{{kbd(I)}}} | ~#+INCLUDE:~ |
15930 | {{{kbd(l)}}} | ~#+BEGIN_LaTeX~ ... ~#+END_LaTeX~ |
15931 | {{{kbd(L)}}} | ~#+LaTeX:~ |
15932 | {{{kbd(q)}}} | ~#+BEGIN_QUOTE~ ... ~#+END_QUOTE~ |
15933 | {{{kbd(s)}}} | ~#+BEGIN_SRC~ ... ~#+END_SRC~ |
15934 | {{{kbd(v)}}} | ~#+BEGIN_VERSE~ ... ~#+END_VERSE~ |
15936 For example, on an empty line, typing "<e" and then pressing TAB, will expand
15937 into a complete EXAMPLE template.
15939 You can install additional templates by customizing the variable
15940 ~org-structure-template-alist~. See the docstring of the variable for
15941 additional details.
15945 :DESCRIPTION: Electric commands at the beginning of a headline
15947 #+cindex: speed keys
15948 #+vindex: org-use-speed-commands
15949 #+vindex: org-speed-commands-user
15951 Single keys can be made to execute commands when the cursor is at the
15952 beginning of a headline, i.e., before the first star. Configure the
15953 variable ~org-use-speed-commands~ to activate this feature. There is a
15954 pre-defined list of commands, and you can add more such commands using
15955 the variable ~org-speed-commands-user~. Speed keys do not only speed
15956 up navigation and other commands, but they also provide an alternative
15957 way to execute commands bound to keys that are not or not easily
15958 available on a TTY, or on a small mobile device with a limited
15961 To see which commands are available, activate the feature and press
15962 {{{kbd(?)}}} with the cursor at the beginning of a headline.
15964 ** Code evaluation security
15966 :DESCRIPTION: Org mode files evaluate in-line code
15967 :TITLE: Code evaluation and security issues
15970 Org provides tools to work with the code snippets, including
15973 Running code on your machine always comes with a security risk. Badly
15974 written or malicious code can be executed on purpose or by accident.
15975 Org has default settings that will only evaluate source code if you
15976 give explicit permission to do so, and as a casual user of these
15977 features you should leave these precautions intact.
15979 For people who regularly work with source code, the confirmation
15980 prompts can become annoying, and you might want to turn them off. This
15981 can be done, but you must be aware of the risks that are involved.
15983 Code evaluation can happen under the following circumstances:
15985 #+attr_texinfo: :table-type table :indic @asis
15986 - Source code blocks ::
15988 Source code blocks can be evaluated during export, or when pressing
15989 {{{kbd(C-c C-c)}}} in the block. The most important thing to realize
15990 here is that Org mode files which contain code snippets are, in a
15991 certain sense, like executable files. So you should accept them and
15992 load them into Emacs only from trusted sources---just like you would
15993 do with a program you install on your computer.
15995 Make sure you know what you are doing before customizing the variables
15996 that take off the default security brakes.
15998 - ~org-confirm-babel-evaluate~ ::
16000 When ~t~ (the default), the user is asked before every code block
16001 evaluation. When ~nil~, the user is not asked. When set to a function,
16002 it is called with two arguments (language and body of the code block)
16003 and should return ~t~ to ask and ~nil~ not to ask.
16005 For example, here is how to execute "ditaa" code (which is considered
16006 safe) without asking:
16009 #+header: :exports code
16010 #+begin_src emacs-lisp
16011 (defun my-org-confirm-babel-evaluate (lang body)
16012 (not (string= lang "ditaa"))) ; don't ask for ditaa
16013 (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
16016 - Following ~shell~ and ~elisp~ links ::
16018 Org has two link types that can directly evaluate code (see [[External
16019 links]]). These links can be problematic because the code to be
16020 evaluated is not visible.
16022 - ~org-confirm-shell-link-function~ ::
16024 Function to queries user about shell link execution.
16026 - ~org-confirm-elisp-link-function~ ::
16028 Function to query user for Emacs Lisp link execution.
16030 - Formulas in tables ::
16032 Formulas in tables (see [[The spreadsheet]]) are code that is evaluated
16033 either by the /calc/ interpreter, or by the /Emacs Lisp/ interpreter.
16037 :DESCRIPTION: Adapting Org to your taste
16039 #+cindex: customization
16040 #+cindex: options, for customization
16041 #+cindex: variables, for customization
16043 There are more than 500 variables that can be used to customize Org.
16044 For the sake of compactness of the manual, I am not describing the
16045 variables here. A structured overview of customization variables is
16046 available with {{{kbd(M-x org-customize)}}}. Or select ~Browse Org
16047 Group~ from the ~Org->Customization~ menu. Many settings can also be
16048 activated on a per-file basis, by putting special lines into the
16049 buffer (see [[In-buffer settings]]).
16051 ** In-buffer settings
16053 :DESCRIPTION: Overview of the #+KEYWORDS
16054 :TITLE: Summary of in-buffer settings
16056 #+cindex: in-buffer settings
16057 #+cindex: special keywords
16059 Org mode uses special lines in the buffer to define settings on a
16060 per-file basis. These lines start with a {{{samp(#+)}}} followed by a
16061 keyword, a colon, and then individual words defining a setting.
16062 Several setting words can be in the same line, but you can also have
16063 multiple lines for the keyword. While these settings are described
16064 throughout the manual, here is a summary. After changing any of those
16065 lines in the buffer, press {{{kbd(C-c C-c)}}} with the cursor still in
16066 the line to activate the changes immediately. Otherwise they become
16067 effective only when the file is visited again in a new Emacs session.
16069 #+vindex: org-archive-location
16070 #+attr_texinfo: :table-type table :indic @asis
16071 - {{{kbd(#+ARCHIVE: %s_done)}}} ::
16073 This line sets the archive location for the agenda file. It applies to
16074 all subsequent lines, until the next {{{samp(#+ARCHIVE)}}} line or the
16075 end of the file. The first such line also applies to any entries
16076 before it. The corresponding variable is ~org-archive-location~.
16078 - {{{kbd(#+CATEGORY:)}}} ::
16080 This line sets the category for the agenda file. The category applies
16081 to all subsequent lines, until the next {{{samp(#+CATEGORY)}}} line or
16082 the end of the file. The first such line also applies to any entries
16085 - {{{kbd(#+COLUMNS: %25ITEM ...)}}} ::
16086 #+cindex: property, COLUMNS
16088 Set the default format for columns view. This format applies when
16089 columns view is invoked in locations where no ~COLUMNS~ property
16092 - {{{kbd(#+CONSTANTS: name1=value1 ...)}}} ::
16093 #+vindex: org-table-formula-constants
16094 #+vindex: org-table-formula
16096 Set file-local values for constants to be used in table formulas. This
16097 line sets the local variable ~org-table-formula-constants-local~. The
16098 global version of this variable is ~org-table-formula-constants~.
16100 - {{{kbd(#+FILETAGS: :tag1:tag2:tag3:)}}} ::
16102 Set tags that can be inherited by any entry in the file, including the
16105 - {{{kbd(#+DRAWERS: NAME1 ...)}}} ::
16106 #+vindex: org-drawers
16108 Set the file-local set of additional drawers. The corresponding global
16109 variable is ~org-drawers~.
16111 - {{{kbd(#+LINK: linkword replace)}}} ::
16112 #+vindex: org-link-abbrev-alist
16114 These lines (several are allowed) specify link abbreviations. See
16115 [[Link abbreviations]]. The corresponding variable is ~org-link-abbrev-alist~.
16117 - {{{kbd(#+PRIORITIES: highest lowest default)}}} ::
16118 #+vindex: org-highest-priority
16119 #+vindex: org-lowest-priority
16120 #+vindex: org-default-priority
16122 This line sets the limits and the default for the priorities. All
16123 three must be either letters A-Z or numbers 0-9. The highest priority
16124 must have a lower ASCII number than the lowest priority.
16126 - {{{kbd(#+PROPERTY: Property_Name Value)}}} ::
16128 This line sets a default inheritance value for entries in the current
16129 buffer, most useful for specifying the allowed values of a property.
16131 - {{{kbd(#+SETUPFILE: file)}}} ::
16132 #+cindex: #+SETUPFILE
16134 This line defines a file that holds more in-buffer setup. Normally
16135 this is entirely ignored. Only when the buffer is parsed for
16136 option-setting lines (i.e., when starting Org mode for a file, when
16137 pressing {{{kbd(C-c C-c)}}} in a settings line, or when exporting),
16138 then the contents of this file are parsed as if they had been included
16139 in the buffer. In particular, the file can be any other Org mode file
16140 with internal setup. You can visit the file the cursor is in the line
16141 with {{{kbd(C-c ')}}}.
16143 - {{{kbd(#+STARTUP:)}}} ::
16144 #+cindex: #+STARTUP:
16146 This line sets options to be used at startup of Org mode, when an
16147 Org file is being visited.
16149 The first set of options deals with the initial visibility of the
16150 outline tree. The corresponding variable for global default settings
16151 is ~org-startup-folded~, with a default value ~t~, which means
16154 #+vindex: org-startup-folded
16155 #+cindex: @code{overview}, STARTUP keyword
16156 #+cindex: @code{content}, STARTUP keyword
16157 #+cindex: @code{showall}, STARTUP keyword
16158 #+cindex: @code{showeverything}, STARTUP keyword
16160 #+attr_texinfo: :table-type table :indic @asis
16161 - ~overview~ :: top-level headlines only
16162 - ~content~ :: all headlines
16163 - ~showall~ :: no folding of any entries
16164 - ~showeverything~ :: show even drawer contents
16166 #+vindex: org-startup-indented
16167 #+cindex: @code{indent}, STARTUP keyword
16168 #+cindex: @code{noindent}, STARTUP keyword
16170 Dynamic virtual indentation is controlled by the variable
16171 ~org-startup-indented~.[fn:182]
16173 #+attr_texinfo: :table-type table :indic @asis
16174 - ~indent~ :: start with ~org-indent-mode~ turned on
16175 - ~noindent~ :: start with ~org-indent-mode~ turned off
16177 #+vindex: org-startup-align-all-tables
16179 Then there are options for aligning tables upon visiting a file. This
16180 is useful in files containing narrowed table columns. The corresponding
16181 variable is ~org-startup-align-all-tables~, with a default value
16184 #+cindex: @code{align}, STARTUP keyword
16185 #+cindex: @code{noalign}, STARTUP keyword
16187 #+attr_texinfo: :table-type table :indic @asis
16188 - ~align~ :: align all tables
16189 - ~noalign~ :: don't align tables on startup
16191 #+vindex: org-startup-with-inline-images
16193 When visiting a file, inline images can be automatically displayed.
16194 The corresponding variable is ~org-startup-with-inline-images~, with a
16195 default value ~nil~ to avoid delays when visiting a file.
16197 #+cindex: @code{inlineimages}, STARTUP keyword
16198 #+cindex: @code{noinlineimages}, STARTUP keyword
16200 #+attr_texinfo: :table-type table :indic @asis
16201 - ~inlineimages~ show inline images
16202 - ~noinlineimages~ don't show inline images on startup
16204 #+vindex: org-log-done
16205 #+vindex: org-log-note-clock-out
16206 #+vindex: org-log-repeat
16208 Logging the closing and reopening of TODO items and clock intervals
16209 can be configured using these options (see variables ~org-log-done~,
16210 ~org-log-note-clock-out~, and ~org-log-repeat~).
16212 #+cindex: @code{logdone}, STARTUP keyword
16213 #+cindex: @code{lognotedone}, STARTUP keyword
16214 #+cindex: @code{nologdone}, STARTUP keyword
16215 #+cindex: @code{lognoteclock-out}, STARTUP keyword
16216 #+cindex: @code{nolognoteclock-out}, STARTUP keyword
16217 #+cindex: @code{logrepeat}, STARTUP keyword
16218 #+cindex: @code{lognoterepeat}, STARTUP keyword
16219 #+cindex: @code{nologrepeat}, STARTUP keyword
16220 #+cindex: @code{logreschedule}, STARTUP keyword
16221 #+cindex: @code{lognotereschedule}, STARTUP keyword
16222 #+cindex: @code{nologreschedule}, STARTUP keyword
16223 #+cindex: @code{logredeadline}, STARTUP keyword
16224 #+cindex: @code{lognoteredeadline}, STARTUP keyword
16225 #+cindex: @code{nologredeadline}, STARTUP keyword
16226 #+cindex: @code{logrefile}, STARTUP keyword
16227 #+cindex: @code{lognoterefile}, STARTUP keyword
16228 #+cindex: @code{nologrefile}, STARTUP keyword
16230 #+attr_texinfo: :table-type table :indic @asis
16231 - ~logdone~ :: record a timestamp when an item is marked DONE
16232 - ~lognotedone~ :: record timestamp and a note when DONE
16233 - ~nologdone~ :: don't record when items are marked DONE
16234 - ~logrepeat~ :: record a time when reinstating a repeating item
16235 - ~lognoterepeat~ :: record a note when reinstating a repeating item
16236 - ~nologrepeat~ :: do not record when reinstating repeating item
16237 - ~lognoteclock-out~ :: record a note when clocking out
16238 - ~nolognoteclock-out~ :: don't record a note when clocking out
16239 - ~logreschedule~ :: record a timestamp when scheduling time changes
16240 - ~lognotereschedule~ :: record a note when scheduling time changes
16241 - ~nologreschedule~ :: do not record when a scheduling date changes
16242 - ~logredeadline~ :: record a timestamp when deadline changes
16243 - ~lognoteredeadline~ :: record a note when deadline changes
16244 - ~nologredeadline~ :: do not record when a deadline date changes
16245 - ~logrefile~ :: record a timestamp when refiling
16246 - ~lognoterefile~ :: record a note when refiling
16247 - ~nologrefile~ :: do not record when refiling
16249 #+vindex: org-hide-leading-stars
16250 #+vindex: org-odd-levels-only
16252 Here are the options for hiding leading stars in outline headings, and
16253 for indenting outlines. The corresponding variables are
16254 ~org-hide-leading-stars~ and ~org-odd-levels-only~, both with a
16255 default setting ~nil~ (meaning ~showstars~ and ~oddeven~).
16257 #+cindex: @code{hidestars}, STARTUP keyword
16258 #+cindex: @code{showstars}, STARTUP keyword
16259 #+cindex: @code{odd}, STARTUP keyword
16260 #+cindex: @code{even}, STARTUP keyword
16262 #+attr_texinfo: :table-type table :indic @asis
16263 - ~hidestars~ :: make all but one of the stars starting a headline invisible.
16264 - ~showstars~ :: show all stars starting a headline
16265 - ~indent~ :: virtual indentation according to outline level
16266 - ~noindent~ :: no virtual indentation according to outline level
16267 - ~odd~ :: allow only odd outline levels (1, 3, ...)
16268 - ~oddeven~ :: allow all outline levels
16270 #+vindex: org-put-time-stamp-overlays
16271 #+vindex: org-time-stamp-overlay-formats
16273 To turn on custom format overlays over timestamps (variables
16274 ~org-put-time-stamp-overlays~ and ~org-time-stamp-overlay-formats~),
16277 #+cindex: @code{customtime}, STARTUP keyword
16279 #+attr_texinfo: :table-type table :indic @asis
16280 - ~customtime~ :: overlay custom time format
16282 #+vindex: constants-unit-system
16284 The following options influence the table spreadsheet (variable
16285 ~constants-unit-system~).
16287 #+cindex: @code{constcgs}, STARTUP keyword
16288 #+cindex: @code{constSI}, STARTUP keyword
16290 #+attr_texinfo: :table-type table :indic @asis
16291 - ~constcgs~ :: {{{file(constants.el)}}} should use the c-g-s unit system
16292 - ~constSI~ :: {{{file(constants.el)}}} should use the SI unit system
16294 #+vindex: org-footnote-define-inline
16295 #+vindex: org-footnote-auto-label
16296 #+vindex: org-footnote-auto-adjust
16298 To influence footnote settings, use the following keywords. The
16299 corresponding variables are ~org-footnote-define-inline~,
16300 ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
16302 #+cindex: @code{fninline}, STARTUP keyword
16303 #+cindex: @code{nofninline}, STARTUP keyword
16304 #+cindex: @code{fnlocal}, STARTUP keyword
16305 #+cindex: @code{fnprompt}, STARTUP keyword
16306 #+cindex: @code{fnauto}, STARTUP keyword
16307 #+cindex: @code{fnconfirm}, STARTUP keyword
16308 #+cindex: @code{fnplain}, STARTUP keyword
16309 #+cindex: @code{fnadjust}, STARTUP keyword
16310 #+cindex: @code{nofnadjust}, STARTUP keyword
16312 #+attr_texinfo: :table-type table :indic @asis
16313 - ~fninline~ :: define footnotes inline
16314 - ~fnnoinline~ :: define footnotes in separate section
16315 - ~fnlocal~ :: define footnotes near first reference, but not inline
16316 - ~fnprompt~ :: prompt for footnote labels
16317 - ~fnauto~ :: create ~[fn:1]~-like labels automatically (default)
16318 - ~fnconfirm~ :: offer automatic label for editing or confirmation
16319 - ~fnplain~ :: create ~[1]~-like labels automatically
16320 - ~fnadjust~ :: automatically renumber and sort footnotes
16321 - ~nofnadjust~ :: do not renumber and sort automatically
16323 #+cindex: org-hide-block-startup
16325 To hide blocks on startup, use these keywords. The corresponding
16326 variable is ~org-hide-block-startup~.
16328 #+cindex: @code{hideblocks}, STARTUP keyword
16329 #+cindex: @code{nohideblocks}, STARTUP keyword
16331 #+attr_texinfo: :table-type table :indic @asis
16332 - ~hideblocks~ :: Hide all begin/end blocks on startup
16333 - ~nohideblocks~ :: Do not hide blocks on startup
16335 #+cindex: org-pretty-entities
16337 The display of entities as UTF-8 characters is governed by the
16338 variable ~org-pretty-entities~ and the keywords
16340 #+cindex: @code{entitiespretty}, STARTUP keyword
16341 #+cindex: @code{entitiesplain}, STARTUP keyword
16343 #+attr_texinfo: :table-type table :indic @asis
16344 - ~entitiespretty~ :: Show entities as UTF-8 characters where possible
16345 - ~entitiesplain~ :: Leave entities plain
16347 - {{{kbd(#+TAGS: TAG1(c1) TAG2(c2))}}} ::
16348 #+vindex: org-tag-alist
16350 These lines (several such lines are allowed) specify the valid tags in
16351 this file, and (potentially) the corresponding /fast tag selection/
16352 keys. The corresponding variable is ~org-tag-alist~.
16354 - {{{kbd(#+TBLFM:)}}} ::
16356 This line contains the formulas for the table directly above the line.
16358 - {{{kbd(#+TITLE:)}}}, {{{kbd(#+AUTHOR:)}}}, {{{kbd(#+EMAIL:)}}}, {{{kbd(#+LANGUAGE:)}}}, {{{kbd(#+TEXT:)}}}, {{{kbd(#+DATE:)}}}, {{{kbd(#+OPTIONS:)}}}, {{{kbd(#+BIND:)}}}, {{{kbd(#+XSLT:)}}}, {{{kbd(#+DESCRIPTION:)}}}, {{{kbd(#+KEYWORDS:)}}}, {{{kbd(#+LaTeX_HEADER:)}}}, {{{kbd(#+STYLE:)}}}, {{{kbd(#+LINK_UP:)}}}, {{{kbd(#+LINK_HOME:)}}}, {{{kbd(#+EXPORT_SELECT_TAGS:)}}}, {{{kbd(#+EXPORT_EXCLUDE_TAGS:)}}} ::
16360 These lines provide settings for exporting files. For more details see
16361 [[Export options]].
16363 - {{{kbd(#+TODO:)}}}, {{{kbd(#+SEQ_TODO:)}}}, {{{kbd(#+TYP_TODO:)}}} ::
16364 #+vindex: org-todo-keywords
16366 These lines set the TODO keywords and their interpretation in the
16367 current file. The corresponding variable is ~org-todo-keywords~.
16369 ** The very busy C-c C-c key
16371 :DESCRIPTION: When in doubt, press C-c C-c
16372 :TITLE: The very busy C-c C-c key
16375 #+cindex: C-c C-c, overview
16377 The key {{{kbd(C-c C-c)}}} has many purposes in Org, which are all
16378 mentioned scattered throughout this manual. One specific function of
16379 this key is to add /tags/ to a headline (see [[Tags]]). In many
16380 other circumstances it means something like "Hey Org, look
16381 here and update according to what you see here." Here is a summary of
16382 what this means in different contexts.
16384 - If there are highlights in the buffer from the creation of a sparse
16385 tree, or from clock display, remove these highlights.
16386 - If the cursor is in one of the special ~#+KEYWORD~ lines, this
16387 triggers scanning the buffer for these lines and updating the
16389 - If the cursor is inside a table, realign the table. This command
16390 works even if the automatic table editor has been turned off.
16391 - If the cursor is on a ~#+TBLFM~ line, re-apply the formulas to the
16393 - If the current buffer is a capture buffer, close the note and file
16394 it. With a prefix argument, file it, without further interaction, to
16395 the default location.
16396 - If the cursor is on a ~<<<target>>>~, update radio targets and
16397 corresponding links in this buffer.
16398 - If the cursor is in a property line or at the start or end of a
16399 property drawer, offer property commands.
16400 - If the cursor is at a footnote reference, go to the corresponding
16401 definition, and vice versa.
16402 - If the cursor is on a statistics cookie, update it.
16403 - If the cursor is in a plain list item with a checkbox, toggle the
16404 status of the checkbox.
16405 - If the cursor is on a numbered item in a plain list, renumber the
16407 - If the cursor is on the ~#+BEGIN~ line of a dynamic block, the block
16409 - If the cursor is at a timestamp, fix the day name in the timestamp.
16413 :DESCRIPTION: Getting rid of leading stars in the outline
16414 :TITLE: A cleaner outline view
16416 #+cindex: hiding leading stars
16417 #+cindex: dynamic indentation
16418 #+cindex: odd-levels-only outlines
16419 #+cindex: clean outline view
16421 Some people find it noisy and distracting that the Org headlines start
16422 with a potentially large number of stars, and that text below the
16423 headlines is not indented. While this is no problem when writing a
16424 /book-like/ document where the outline headings are really section
16425 headings, in a more /list-oriented/ outline, indented structure is a
16429 ,* Top level headline | * Top level headline
16430 ,** Second level | * Second level
16431 ,*** 3rd level | * 3rd level
16432 some text | some text
16433 ,*** 3rd level | * 3rd level
16434 more text | more text
16435 ,* Another top level headline | * Another top level headline
16438 {{{noindent}}} If you are using at least Emacs 23.2 and version 6.29
16439 of Org, this kind of view can be achieved dynamically at display time
16440 using ~org-indent-mode~.[fn:183] In this minor mode, all lines are
16441 prefixed for display with the necessary amount of space.[fn:154] Also
16442 headlines are prefixed with additional stars, so that the amount of
16443 indentation shifts by two spaces per level.[fn:155] All headline stars
16444 but the last one are made invisible using the ~org-hide~ face---see
16445 below under {{{samp(2.)}}} for more information on how this
16446 works.[fn:156] You can turn on ~org-indent-mode~ for all files by
16447 customizing the variable ~org-startup-indented~, or you can turn it on
16448 for individual files using
16454 If you want a similar effect in an earlier version of Emacs and/or
16455 Org, or if you want the indentation to be hard space characters so
16456 that the plain text file looks as similar as possible to the Emacs
16457 display, Org supports you in the following way:
16459 #+attr_texinfo: :table-type table :indic @asis
16460 - Indentation of text below headlines ::
16462 You may indent text below each headline to make the left boundary line up
16463 with the headline, like
16467 more text, now indented
16470 #+vindex: org-adapt-indentation
16472 Org supports this with paragraph filling, line wrapping, and structure
16474 preserving or adapting the indentation as appropriate.[fn:157]
16476 - Hiding leading stars ::
16477 #+vindex: org-hide-leading-stars
16479 You can modify the display in such a way that all leading stars become
16480 invisible. To do this in a global way, configure the variable
16481 ~org-hide-leading-stars~ or change this on a per-file basis with
16484 ,#+STARTUP: hidestars
16485 ,#+STARTUP: showstars
16488 With hidden stars, the tree becomes:
16491 ,* Top level headline
16497 #+vindex: org-hide @r{(face)}
16499 {{{noindent}}} The leading stars are not truly replaced by whitespace,
16500 they are only fontified with the face ~org-hide~ that uses the
16501 background color as font color. If you are not using either white or
16502 black background, you may have to customize this face to get the
16503 wanted effect. Another possibility is to set this font such that the
16504 extra stars are /almost/ invisible, for example using the color
16505 ~grey90~ on a white background.
16507 #+vindex: org-odd-levels-only
16509 Things become cleaner still if you skip all the even levels and use
16510 only odd levels 1, 3, 5, ..., effectively adding two stars to go from
16511 one outline level to the next.[fn:158] In this way we get the outline
16512 view shown at the beginning of this section. In order to make the
16513 structure editing and export commands handle this convention
16514 correctly, configure the variable ~org-odd-levels-only~, or set this
16515 on a per-file basis with one of the following lines:
16519 ,#+STARTUP: oddeven
16522 You can convert an Org file from single-star-per-level to the
16523 double-star-per-level convention with {{{kbdkey(M-x
16524 org-convert-to-odd-levels , RET)}}} in that file. The reverse
16525 operation is {{{kbd(M-x org-convert-to-oddeven-levels)}}}.
16529 :DESCRIPTION: Using Org on a tty
16530 :TITLE: Using Org on a tty
16533 Because Org contains a large number of commands, by default many of
16534 Org's core commands are bound to keys that are generally not
16535 accessible on a tty, such as the cursor keys ({{{key(left)}}},
16536 {{{key(right)}}}, {{{key(up)}}}, {{{key(down)}}}), {{{key(TAB)}}} and
16537 {{{key(RET)}}}, in particular when used together with modifiers like
16538 {{{key(Meta)}}} and/or {{{key(Shift)}}}. To access these commands on a
16539 tty when special keys are unavailable, the following alternative
16540 bindings can be used. The tty bindings below will likely be more
16541 cumbersome; you may find for some of the bindings below that a
16542 customized workaround suits you better. For example, changing a
16543 timestamp is really only fun with {{{kbdkey(S-,cursor)}}} keys,
16544 whereas on a tty you would rather use {{{kbd(C-c .)}}} to re-insert
16547 #+attr_texinfo: :columns 0.2 0.3 0.1 0.4
16548 | Default | Alternative 1 | Speed key | Alternative 2 |
16549 |--------------------------+------------------------------+--------------+---------------------------|
16550 | {{{kbdkey(S-,TAB)}}} | {{{kbdspckey(C-u,TAB)}}} | {{{kbd(C)}}} | |
16551 | {{{kbdkey(M-,left)}}} | {{{kbd(C-c C-x l)}}} | {{{kbd(l)}}} | {{{kbdkeys(,Esc,left)}}} |
16552 | {{{kbdkey(M-S-,left)}}} | {{{kbd(C-c C-x L)}}} | {{{kbd(L)}}} | |
16553 | {{{kbdkey(M-,right)}}} | {{{kbd(C-c C-x r)}}} | {{{kbd(r)}}} | {{{kbdkeys(,Esc,right)}}} |
16554 | {{{kbdkey(M-S-,right)}}} | {{{kbd(C-c C-x R)}}} | {{{kbd(R)}}} | |
16555 | {{{kbdkey(M-,up)}}} | {{{kbd(C-c C-x u)}}} | {{{kbd( )}}} | {{{kbdkeys(,Esc,up)}}} |
16556 | {{{kbdkey(M-S-,up)}}} | {{{kbd(C-c C-x U)}}} | {{{kbd(U)}}} | |
16557 | {{{kbdkey(M-,down)}}} | {{{kbd(C-c C-x d)}}} | {{{kbd( )}}} | {{{kbdkeys(,Esc,down)}}} |
16558 | {{{kbdkey(M-S-,down)}}} | {{{kbd(C-c C-x D)}}} | {{{kbd(D)}}} | |
16559 | {{{kbdkey(S-,RET)}}} | {{{kbd(C-c C-x c)}}} | {{{kbd( )}}} | |
16560 | {{{kbdkey(M-,RET)}}} | {{{kbd(C-c C-x m)}}} | {{{kbd( )}}} | {{{kbdkeys(,Esc,RET)}}} |
16561 | {{{kbdkey(M-S-,RET)}}} | {{{kbd(C-c C-x M)}}} | {{{kbd( )}}} | |
16562 | {{{kbdkey(S-,left)}}} | {{{kbdspckey(C-c,left)}}} | {{{kbd( )}}} | |
16563 | {{{kbdkey(S-,right)}}} | {{{kbdspckey(C-c,right)}}} | {{{kbd( )}}} | |
16564 | {{{kbdkey(S-,up)}}} | {{{kbdspckey(C-c,up)}}} | {{{kbd( )}}} | |
16565 | {{{kbdkey(S-,down)}}} | {{{kbdspckey(C-c,down)}}} | {{{kbd( )}}} | |
16566 | {{{kbdkey(C-S-,left)}}} | {{{kbdspckey(C-c C-x,left)}}} | {{{kbd( )}}} | |
16567 | {{{kbdkey(C-S-,right)}}} | {{{kbdspckey(C-c C-x,right)}}} | {{{kbd( )}}} | |
16571 :DESCRIPTION: Other Emacs packages
16572 :TITLE: Interaction with other packages
16574 #+cindex: packages, interaction with other
16575 Org lives in the world of GNU Emacs and interacts in various ways
16576 with other code out there.
16578 *** FIXME Cooperation
16580 :DESCRIPTION: Packages Org cooperates with
16581 :TITLE: Packages that Org cooperates with
16584 #+attr_texinfo: :table-type table :indic @asis
16585 - {{{file(calc.el)}}} by Dave Gillespie ::
16586 #+cindex: @file{calc.el}
16587 #+cindex: Gillespie, Dave
16589 Org uses the Calc package for implementing spreadsheet functionality
16590 in its tables (see [[The spreadsheet]]). Org checks for the availability
16591 of Calc by looking for the function ~calc-eval~ which will have been
16592 autoloaded during setup if Calc has been installed properly. As of
16593 Emacs 22, Calc is part of the Emacs distribution. Another possibility
16594 for interaction between the two packages is using Calc for embedded
16595 calculations. See [[info:calc:Embedded Mode][GNU Emacs Calc Manual]].
16597 - {{{file(constants.el)}}} by Carsten Dominik ::
16598 #+cindex: @file{constants.el}
16599 #+cindex: Dominik, Carsten
16600 #+vindex: org-table-formula-constants
16602 In a table formula (see [[The spreadsheet]]), it is possible to use names
16603 for natural constants or units. Instead of defining your own constants
16604 in the variable ~org-table-formula-constants~, install the
16605 {{{file(constants)}}} package which defines a large number of
16606 constants and units, and lets you use unit prefixes like {{{samp(M)}}}
16607 for {{{samp(Mega)}}}, etc. You will need version 2.0 of this package,
16608 available at [[http://www.astro.uva.nl/~dominik/Tools]]. Org checks for
16609 the function ~constants-get~, which has to be autoloaded in your
16610 setup. See the installation instructions in the file
16611 {{{file(constants.el)}}}.
16613 - {{{file(cdlatex.el)}}} by Carsten Dominik ::
16614 #+cindex: @file{cdlatex.el}
16615 #+cindex: Dominik, Carsten
16617 Org mode can make use of the CDLaTeX package to efficiently enter
16618 LaTeX fragments into Org files. See [[CDLaTeX mode]].
16620 - {{{file(imenu.el)}}} by Ake Stenhoff and Lars Lindberg ::
16621 #+cindex: @file{imenu.el}
16622 #+cindex: Stenhoff, Ake
16623 #+cindex: Lindberg, Lars
16625 Imenu allows menu access to an index of items in a file. Org mode
16626 supports Imenu---all you need to do to get the index is the following:
16628 #+begin_src emacs-lisp
16629 (add-hook 'org-mode-hook
16630 (lambda () (imenu-add-to-menubar "Imenu")))
16633 #+vindex: org-imenu-depth
16635 By default the index is two levels deep---you can modify the depth
16636 using the option ~org-imenu-depth~.
16638 - {{{file(remember.el)}}} by John Wiegley ::
16639 #+cindex: @file{remember.el}
16640 #+cindex: Wiegley, John
16642 Org used to use this package for capture, but no longer does.
16644 - {{{file(speedbar.el)}}} by Eric M. Ludlam ::
16645 #+cindex: @file{speedbar.el}
16646 #+cindex: Ludlam, Eric M.
16648 Speedbar is a package that creates a special frame displaying files and
16649 index items in files. Org mode supports Speedbar and allows you to
16650 drill into Org files directly from the Speedbar. It also allows you to
16651 restrict the scope of agenda commands to a file or a subtree by using
16652 the command {{{kbd(<)}}} in the Speedbar frame.
16654 - {{{file(table.el)}}} by Takaaki Ota ::
16656 #+cindex: table editor, @file{table.el}
16657 #+cindex: @file{table.el}
16658 #+cindex: Ota, Takaaki
16660 Complex ASCII tables with automatic line wrapping, column- and row-spanning,
16661 and alignment can be created using the Emacs table package by Takaaki Ota
16662 ([[http://sourceforge.net/projects/table]], and also part of Emacs 22).
16663 Org mode will recognize these tables and export them properly. Because of
16664 interference with other Org mode functionality, you unfortunately cannot edit
16665 these tables directly in the buffer. Instead, you need to use the command
16666 {{{kbd(C-c ')}}} to edit them, similar to source code snippets.
16668 - {{{kbd(C-c ')}}}, ~org-edit-special~ ::
16671 Edit a {{{file(table.el)}}} table. Works when the cursor is in a
16674 - {{{kbd(C-c XXX)}}}, ~org-table-create-with-table.el~ ::
16677 Insert a {{{file(table.el)}}} table. If there is already a table at
16678 point, this command converts it between the {{{file(table.el)}}}
16679 format and the Org mode format. See the documentation string of the
16680 command ~org-convert-table~ for the restrictions under which this is
16683 {{{file(table.el)}}} is part of Emacs since Emacs 22.
16685 - {{{file(footnote.el)}}} by Steven L. Baur ::
16686 #+cindex: @file{footnote.el}
16687 #+cindex: Baur, Steven L.
16689 Org mode recognizes numerical footnotes as provided by this package.
16690 However, Org mode also has its own footnote support (see [[Creating footnotes]]),
16691 which makes using {{{file(footnote.el)}}} unnecessary.
16695 :DESCRIPTION: Packages that lead to conflicts
16698 #+cindex: @code{shift-selection-mode}
16699 #+vindex: org-support-shift-select
16701 In Emacs 23, ~shift-selection-mode~ is on by default, meaning that
16702 cursor motions combined with the shift key should start or enlarge
16703 regions. This conflicts with the use of {{{kbdkey(S-,cursor)}}}
16704 commands in Org to change timestamps, TODO keywords, priorities, and
16705 item bullet types if the cursor is at such a location. By default,
16706 {{{kbdkey(S-,cursor)}}} commands outside special contexts don't do
16707 anything, but you can customize the variable
16708 ~org-support-shift-select~. Org mode then tries to accommodate shift
16709 selection by using it outside of the special contexts where
16710 special commands apply, and by extending an existing active
16711 region even if the cursor moves across a special context.
16713 #+attr_texinfo: :table-type table :indic @asis
16714 - {{{file(CUA.el)}}} by Kim. F. Storm ::
16715 #+cindex: @file{CUA.el}
16716 #+cindex: Storm, Kim. F.
16717 #+vindex: org-replace-disputed-keys
16719 Key bindings in Org conflict with the {{{kbdkey(S-,<cursor>)}}} keys
16720 used by CUA mode (as well as ~pc-select-mode~ and ~s-region-mode~) to
16721 select and extend the region. In fact, Emacs 23 has this built-in in
16722 the form of ~shift-selection-mode~, see previous paragraph. If you are
16723 using Emacs 23, you probably don't want to use another package for
16724 this purpose. However, if you prefer to leave these keys to a
16725 different package while working in Org mode, configure the variable
16726 ~org-replace-disputed-keys~. When set, Org will move the following key
16727 bindings in Org files, and in the agenda buffer (but not during date
16730 | S-UP {{{result}}} M-p | S-DOWN {{{result}}} M-n |
16731 | S-LEFT {{{result}}} M-- | S-RIGHT {{{result}}} M-+ |
16732 | C-S-LEFT {{{result}}} M-S-- | C-S-RIGHT {{{result}}} M-S-+ |
16734 #+vindex: org-disputed-keys
16736 Yes, these are unfortunately more difficult to remember. If you want
16737 to have other replacement keys, look at the variable
16738 ~org-disputed-keys~.
16740 - {{{file(filladapt.el)}}} by Kyle Jones ::
16741 #+cindex: @file{filladapt.el}
16742 #+cindex: Jones, Kyle
16744 Org mode tries to do the right thing when filling paragraphs, list
16745 items and other elements. Many users reported they had problems using
16746 both {{{file(filladapt.el)}}} and Org mode, so a safe thing to do is
16747 to disable it like this:
16749 #+begin_src emacs-lisp
16750 (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
16753 - {{{file(yasnippet.el)}}} ::
16754 #+cindex: @file{yasnippet.el}
16756 The way Org mode binds the {{{key(TAB)}}} key (binding to ~[tab]~
16757 instead of ~"\t"~) overrules YASnippet's access to this key. The
16758 following code fixed this problem:
16760 #+begin_src emacs-lisp
16761 (add-hook 'org-mode-hook
16763 (setq-local yas/trigger-key [tab])
16764 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
16767 The latest version of yasnippet doesn't play well with Org mode. If the
16768 above code does not fix the conflict, start by defining the following
16771 #+begin_src emacs-lisp
16772 (defun yas/org-very-safe-expand ()
16773 (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
16776 Then, tell Org mode what to do with the new function:
16778 #+begin_src emacs-lisp
16779 (add-hook 'org-mode-hook
16781 (make-variable-buffer-local 'yas/trigger-key)
16782 (setq yas/trigger-key [tab])
16783 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
16784 (define-key yas/keymap [tab] 'yas/next-field)))
16787 - {{{file(windmove.el)}}} by Hovav Shacham ::
16788 #+cindex: @file{windmove.el}
16789 #+cindex: Shacham, Hovav
16791 This package also uses the {{{kbd(S-<cursor>)}}} keys, so everything
16792 written in the paragraph above about CUA mode also applies here. If
16793 you want make the windmove function active in locations where Org mode
16794 does not have special functionality on {{{kbdkey(S-,cursor)}}}, add
16795 this to your configuration:
16797 #+begin_src emacs-lisp
16798 ;; Make windmove work in org-mode:
16799 (add-hook 'org-shiftup-final-hook 'windmove-up)
16800 (add-hook 'org-shiftleft-final-hook 'windmove-left)
16801 (add-hook 'org-shiftdown-final-hook 'windmove-down)
16802 (add-hook 'org-shiftright-final-hook 'windmove-right)
16805 - {{{file(viper.el)}}} by Michael Kifer ::
16806 #+cindex: @file{viper.el}
16807 #+cindex: Kifer, Michael
16810 Viper uses {{{kbd(C-c /)}}} and therefore makes this key not access the
16811 corresponding Org mode command ~org-sparse-tree~. You need to find
16812 another key for this command, or override the key in
16813 ~viper-vi-global-user-map~ with
16815 #+begin_src emacs-lisp
16816 (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
16821 :DESCRIPTION: Encrypting Org files
16823 #+cindex: @file{+org-crypt.el}
16824 #+cindex: @code{org-decrypt-entry}
16826 Org-crypt will encrypt the text of an entry, but not the headline, or
16827 properties. Org-crypt uses the Emacs EasyPG library to encrypt and
16830 Any text below a headline that has a {{{samp(:crypt:)}}} tag will
16831 automatically be encrypted when the file is saved. If you want to use
16832 a different tag just customize the ~org-crypt-tag-matcher~ setting.
16834 To use org-crypt it is suggested that you have the following in your
16835 {{{file(.emacs)}}}:
16838 #+header: :exports code
16839 #+begin_src emacs-lisp
16840 (require 'org-crypt)
16841 (org-crypt-use-before-save-magic)
16842 (setq org-tags-exclude-from-inheritance (quote ("crypt")))
16844 (setq org-crypt-key nil)
16845 ;; GPG key to use for encryption
16846 ;; Either the Key ID or set to nil to use symmetric encryption.
16848 (setq auto-save-default nil)
16849 ;; Auto-saving does not cooperate with org-crypt.el: so you need
16850 ;; to turn it off if you plan to use org-crypt.el quite often.
16851 ;; Otherwise, you'll get an (annoying) message each time you
16854 ;; To turn it off only locally, you can insert this:
16856 ;; # -*- buffer-auto-save-file-name: nil; -*-
16859 Excluding the crypt tag from inheritance prevents already encrypted text
16860 being encrypted again.
16864 :DESCRIPTION: How to hack your way around
16865 :APPENDIX: Appendix
16869 This appendix describes some ways a user can extend the functionality
16874 :DESCRIPTION: How to reach into Org's internals
16878 Org has a large number of hook variables that can be used to add
16879 functionality. This appendix about hacking is going to illustrate the
16880 use of some of them. A complete list of all hooks with documentation is
16881 maintained by the Worg project and can be found at
16882 [[http://orgmode.org/worg/org-configs/org-hooks.php]].
16886 :DESCRIPTION: Available extensions
16888 #+cindex: add-on packages
16890 A large number of add-on packages have been written by various
16891 authors. These packages are not part of Emacs, but they are
16892 distributed as contributed packages with the separate release
16893 available at the Org mode home page at [[http://orgmode.org]]. The
16894 list of contributed packages, along with documentation about each
16895 package, is maintained by the Worg project at
16896 [[http://orgmode.org/worg/org-contrib/]].
16898 ** Adding hyperlink types
16900 :DESCRIPTION: New custom link types
16902 #+cindex: hyperlinks, adding new types
16904 Org has a large number of hyperlink types built-in (see [[Hyperlinks]]).
16905 If you would like to add new link types, Org provides an interface for
16906 doing so. Let's look at an example file, {{{file(org-man.el)}}}, that
16907 will add support for creating links like:
16910 [[man:printf][The printf manual]]
16913 to show Unix manual pages inside Emacs:
16916 #+header: :exports code
16917 #+begin_src emacs-lisp
16918 ;;; org-man.el - Support for links to manpages in Org
16922 (org-add-link-type "man" 'org-man-open)
16923 (add-hook 'org-store-link-functions 'org-man-store-link)
16925 (defcustom org-man-command 'man
16926 "The Emacs command to be used to display a man page."
16928 :type '(choice (const man) (const woman)))
16930 (defun org-man-open (path)
16931 "Visit the manpage on PATH.
16932 PATH should be a topic that can be thrown at the man command."
16933 (funcall org-man-command path))
16935 (defun org-man-store-link ()
16936 "Store a link to a manpage."
16937 (when (memq major-mode '(Man-mode woman-mode))
16938 ;; This is a man page, we do make this link
16939 (let* ((page (org-man-get-page-name))
16940 (link (concat "man:" page))
16941 (description (format "Manpage for %s" page)))
16942 (org-store-link-props
16945 :description description))))
16947 (defun org-man-get-page-name ()
16948 "Extract the page name from the buffer name."
16949 ;; This works for both `Man-mode' and `woman-mode'.
16950 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
16951 (match-string 1 (buffer-name))
16952 (error "Cannot create link to this man page")))
16956 ;;; org-man.el ends here
16959 {{{noindent}}} You would activate this new link type in
16960 {{{file(.emacs)}}} with:
16963 #+header: :exports code
16964 #+begin_src emacs-lisp
16968 {{{noindent}}} Let's go through the file and see what it does.
16969 #+vindex: org-store-link-functions
16971 1. It does ~(require 'org)~ to make sure that {{{file(org.el)}}} has
16974 2. The next line calls ~org-add-link-type~ to define a new link type
16975 with prefix {{{samp(man)}}}. The call also contains the name of a
16976 function that will be called to follow such a link.
16978 3. The next line adds a function to ~org-store-link-functions~, in
16979 order to allow the command {{{kbd(C-c l)}}} to record a useful link
16980 in a buffer displaying a man page.
16983 The rest of the file defines the necessary variables and functions.
16984 First there is a customization variable that determines which Emacs
16985 command should be used to display man pages. There are two options,
16986 ~man~ and ~woman~. Then the function to follow a link is defined. It
16987 gets the link path as an argument---in this case the link path is just
16988 a topic for the manual command. The function calls the value of
16989 ~org-man-command~ to display the man page.
16991 Finally the function ~org-man-store-link~ is defined. When you try to
16992 store a link with {{{kbd(C-c l)}}}, this function will be called to
16993 try to make a link. The function must first decide if it is supposed
16994 to create the link for this buffer type; we do this by checking the
16995 value of the variable ~major-mode~. If not, the function must exit and
16996 return the value ~nil~. If yes, the link is created by getting the
16997 manual topic from the buffer name and prefixing it with the string
16998 {{{samp(man:)}}}. Then it must call the command ~org-store-link-props~
16999 and set the ~:type~ and ~:link~ properties. Optionally you can also
17000 set the ~:description~ property to provide a default for the link
17001 description when the link is later inserted into an Org buffer with
17002 {{{kbd(C-c C-l)}}}.
17004 When it makes sense for your new link type, you may also define a
17005 function that implements special (e.g., completion) support for
17006 inserting such a link with {{{kbd(C-c C-l)}}}. Such a function should
17007 not accept any arguments, and return the full link with prefix.
17009 ** Context-sensitive commands
17011 :DESCRIPTION: How to add functionality to such commands
17013 #+cindex: context-sensitive commands, hooks
17014 #+cindex: add-ons, context-sensitive commands
17015 #+vindex: org-ctrl-c-ctrl-c-hook
17017 Org has several commands that act differently depending on context.
17018 The most important example is the {{{kbd(C-c C-c)}}} (see [[The very
17019 busy C-c C-c key]]). Also the {{{kbd(M-cursor)}}} and
17020 {{{kbd(M-S-cursor)}}} keys have this property.
17022 Add-ons can tap into this functionality by providing a function that
17023 detects special context for that add-on and executes functionality
17024 appropriate for the context. Here is an example from Dan Davison's
17025 {{{file(org-R.el)}}} which allows you to evaluate commands based on
17026 the {{{file(R)}}} programming language.[fn:159] For this package,
17027 special contexts are lines that start with ~#+R:~ or ~#+RR:~.
17030 #+header: :exports code
17031 #+begin_src emacs-lisp
17032 (defun org-R-apply-maybe ()
17033 "Detect if this is context for org-R and execute R commands."
17034 (if (save-excursion
17035 (beginning-of-line 1)
17036 (looking-at "#\\+RR?:"))
17037 (progn (call-interactively 'org-R-apply)
17038 t) ;; to signal that we took action
17039 nil)) ;; to signal that we did not
17041 (add-hook 'org-ctrl-c-ctrl-c-hook 'org-R-apply-maybe)
17044 The function first checks if the cursor is in such a line. If that is
17045 the case, ~org-R-apply~ is called and the function returns ~t~ to
17046 signal that action was taken, and {{{kbd(C-c C-c)}}} will stop looking
17047 for other contexts. If the function finds it should do nothing
17048 locally, it returns ~nil~ so that other, similar functions can have a
17051 ** Tables in arbitrary syntax
17053 :DESCRIPTION: Orgtbl for LaTeX and other programs
17055 #+cindex: tables, in other modes
17056 #+cindex: lists, in other modes
17057 #+cindex: Orgtbl mode
17059 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
17060 frequent feature request has been to make it work with native tables
17061 in specific languages, for example LaTeX. However, this is
17062 extremely hard to do in a general way, would lead to a customization
17063 nightmare, and would take away much of the simplicity of the Orgtbl
17066 This appendix describes a different approach. We keep the Orgtbl mode
17067 table in its native format (the source table), and use a custom
17068 function to /translate/ the table to the correct syntax, and to
17069 /install/ it in the right location (the target table). This puts
17070 the burden of writing conversion functions on the user, but it allows
17071 for a very flexible system.
17073 Bastien added the ability to do the same with lists, in Orgstruct
17074 mode. You can use Org's facilities to edit and structure lists by
17075 turning ~orgstruct-mode~ on, then locally exporting such lists in
17076 another format (HTML, LaTeX or Texinfo.)
17080 :DESCRIPTION: Sending and receiving radio tables
17082 #+cindex: radio tables
17084 To define the location of the target table, you first need to create
17085 two lines that are comments in the current mode, but contain magic
17086 words for Orgtbl mode to find. Orgtbl mode will insert the translated
17087 table between these lines, replacing whatever was there before. For
17091 /* BEGIN RECEIVE ORGTBL table_name */
17092 /* END RECEIVE ORGTBL table_name */
17095 {{{noindent}}} Just above the source table, we put a special line that
17096 tells Orgtbl mode how to translate this table and where to install it.
17101 ,#+ORGTBL: SEND table_name translation_function arguments ...
17104 {{{noindent}}} Here, ~table_name~ is the reference name for the table
17105 that is also used in the receiver lines. ~translation_function~ is the
17106 Lisp function that does the translation. Furthermore, the line can
17107 contain a list of arguments (alternating key and value) at the end.
17108 The arguments will be passed as a property list to the translation
17109 function for interpretation. A few standard parameters are already
17110 recognized and acted upon before the translation function is called:
17112 #+attr_texinfo: :table-type table :indic @asis
17115 Skip the first N lines of the table. Hlines do count as separate lines
17116 for this parameter!
17118 - ~:skipcols (n1 n2 ...)~ ::
17120 List of columns that should be skipped. If the table has a column with
17121 calculation marks, that column is automatically discarded as well.
17122 Please note that the translator function sees the table /after/ the
17123 removal of these columns, the function never knows that there have
17124 been additional columns.
17126 - ~:no-escape t~ ::
17128 When non-nil, do not escape special characters ~&%#_^~ when exporting
17129 the table. The default value is nil.
17132 {{{noindent}}} The one problem remaining is how to keep the source
17133 table in the buffer without disturbing the normal workings of the
17134 file, for example during compilation of a C file or processing of a
17135 LaTeX file. There are a number of different solutions:
17137 - The table could be placed in a block comment if that is supported by
17138 the language. For example, in C mode you could wrap the table
17139 between {{{samp(/*)}}} and {{{samp(*/)}}} lines.
17141 - Sometimes it is possible to put the table after some kind of END
17142 statement, for example ~\bye~ in TeX and ~\end{document}~ in
17145 - You can just comment the table line-by-line whenever you want to
17146 process the file, and uncomment it whenever you need to edit the
17147 table. This only sounds tedious---the command {{{kbd(M-x
17148 orgtbl-toggle-comment)}}} makes this comment-toggling very easy, in
17149 particular if you bind it to a key.
17151 *** A LaTeX example
17153 :DESCRIPTION: Step by step, almost a tutorial
17154 :TITLE: A LaTeX example of radio tables
17156 #+cindex: @LaTeX{}, and Orgtbl mode
17158 The best way to wrap the source table in LaTeX is to use the
17159 ~comment~ environment provided by {{{file(comment.sty)}}}. It has to
17160 be activated by placing ~\usepackage{comment}~ into the document
17161 header. Orgtbl mode can insert a radio table skeleton with the command
17162 {{{kbd(M-x orgtbl-insert-radio-table)}}}.[fn:160] You will be prompted
17163 for a table name, let's say we use {{{samp(salesfigures)}}}. You will
17164 then get the following template:
17166 #+cindex: #+ORGTBL, SEND
17168 % BEGIN RECEIVE ORGTBL salesfigures
17169 % END RECEIVE ORGTBL salesfigures
17171 #+ORGTBL: SEND salesfigures orgtbl-to-latex
17176 #+vindex: @LaTeX{}-verbatim-environments
17178 {{{noindent}}} The ~#+ORGTBL: SEND~ line tells Orgtbl mode to use the
17179 function ~orgtbl-to-latex~ to convert the table into LaTeX and to
17180 put it into the receiver location with name ~salesfigures~. You may
17181 now fill in the table---feel free to use the spreadsheet features:[fn:161]
17184 % BEGIN RECEIVE ORGTBL salesfigures
17185 % END RECEIVE ORGTBL salesfigures
17187 #+ORGTBL: SEND salesfigures orgtbl-to-latex
17188 | Month | Days | Nr sold | per day |
17189 |-------+------+---------+---------|
17190 | Jan | 23 | 55 | 2.4 |
17191 | Feb | 21 | 16 | 0.8 |
17192 | March | 22 | 278 | 12.6 |
17193 #+TBLFM: $4=$3/$2;%.1f
17194 % $ (optional extra dollar to keep font-lock happy, see footnote)
17198 {{{noindent}}} When you are done, press {{{kbd(C-c C-c)}}} in the
17199 table to get the converted table inserted between the two marker
17202 Now let's assume you want to make the table header by hand, because
17203 you want to control how columns are aligned, etc. In this case we make
17204 sure that the table translator skips the first 2 lines of the source
17205 table, and tell the command to work as a splice, i.e., to not
17206 produce header and footer commands of the target table:
17209 \begin{tabular}{lrrr}
17210 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
17211 % BEGIN RECEIVE ORGTBL salesfigures
17212 % END RECEIVE ORGTBL salesfigures
17216 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
17217 | Month | Days | Nr sold | per day |
17218 |-------+------+---------+---------|
17219 | Jan | 23 | 55 | 2.4 |
17220 | Feb | 21 | 16 | 0.8 |
17221 | March | 22 | 278 | 12.6 |
17222 #+TBLFM: $4=$3/$2;%.1f
17226 The LaTeX translator function ~orgtbl-to-latex~ is already part of
17227 Orgtbl mode. It uses a ~tabular~ environment to typeset the table and
17228 marks horizontal lines with ~\hline~. Furthermore, it interprets the
17229 following parameters (see also see [[Translator functions]]):
17231 #+attr_texinfo: :table-type table :indic @asis
17232 - ~:splice nil/t~ ::
17234 When set to ~t~, return only table body lines, don't wrap them into a
17235 tabular environment. Default is ~nil~.
17239 A format to be used to wrap each field, it should contain ~%s~ for the
17240 original field value. For example, to wrap each field value in
17241 dollars, you could use ~:fmt "$%s$"~. This may also be a property list
17242 with column numbers and formats, for example ~:fmt (2 "$%s$" 4
17243 "%s\\%%")~. A function of one argument can be used in place of the
17244 strings; the function must return a formatted string.
17248 Use this format to print numbers with exponentials. The format should
17249 have ~%s~ twice for inserting mantissa and exponent, for example:
17261 This may also be a property list with column numbers and formats, for
17265 :efmt (2 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")
17268 After ~efmt~ has been applied to a value, ~fmt~ will also be applied.
17269 Similar to ~fmt~, functions of two arguments can be supplied instead
17272 *** Translator functions
17274 :DESCRIPTION: Copy and modify
17276 #+cindex: HTML, and Orgtbl mode
17277 #+cindex: translator function
17279 Orgtbl mode has several translator functions built-in: ~orgtbl-to-csv~
17280 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values)
17281 ~orgtbl-to-latex~, ~orgtbl-to-html~, and ~orgtbl-to-texinfo~. Except
17282 for ~orgtbl-to-html~, these all use a generic translator,
17283 ~orgtbl-to-generic~.[fn:162] For example, ~orgtbl-to-latex~ itself is
17284 a very short function that computes the column definitions for the
17285 ~tabular~ environment, defines a few field and line separators and
17286 then hands processing over to the generic translator. Here is the
17290 #+header: :exports code
17291 #+begin_src emacs-lisp
17292 (defun orgtbl-to-latex (table params)
17293 "Convert the Orgtbl mode TABLE to LaTeX."
17294 (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
17295 org-table-last-alignment ""))
17298 :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
17299 :tend "\\end@{tabular@}"
17300 :lstart "" :lend " \\\\" :sep " & "
17301 :efmt "%s\\,(%s)" :hline "\\hline")))
17302 (orgtbl-to-generic table (org-combine-plists params2 params))))
17305 As you can see, the properties passed into the function (variable
17306 ~PARAMS~) are combined with the ones newly defined in the function
17307 (variable ~PARAMS2~). The ones passed into the function (i.e., the
17308 ones set by the {{{samp(ORGTBL SEND)}}} line) take precedence. So if
17309 you would like to use the LaTeX translator, but wanted the line
17310 endings to be ~\\[2mm]~ instead of the default ~\\~, you could just
17311 overrule the default with:
17314 ,#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
17317 For a new language, you can either write your own converter function
17318 in analogy with the LaTeX translator, or you can use the generic
17319 function directly. For example, if you have a language where a table
17320 is started with {{{samp(!BTBL!)}}}, ended with {{{samp(!ETBL!)}}}, and
17321 where table lines are started with {{{samp(!BL!)}}}, ended with
17322 {{{samp(!EL!)}}}, and where the field separator is a TAB, you could
17323 call the generic translator like this (on a single line!):
17326 ,#+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
17327 :lstart "!BL! " :lend " !EL!" :sep "\t"
17330 {{{noindent}}} Please check the documentation string of the function
17331 ~orgtbl-to-generic~ for a full list of parameters understood by that
17332 function, and remember that you can pass each of them into
17333 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
17334 the generic function.
17336 Of course you can also write a completely new function doing
17337 complicated things the generic translator cannot do. A translator
17338 function takes two arguments. The first argument is the table, a list
17339 of lines, each line either the symbol ~hline~ or a list of fields. The
17340 second argument is the property list containing all parameters
17341 specified in the {{{samp(#+ORGTBL: SEND)}}} line. The function must
17342 return a single string containing the formatted table. If you write a
17343 generally useful translator, please post it to the [[mailto:emacs-orgmode@gnu.org][mailing list]] so
17344 that others can benefit from your work.
17348 :DESCRIPTION: Doing the same for lists
17350 #+cindex: radio lists
17351 #+cindex: org-list-insert-radio-list
17353 Sending and receiving radio lists works exactly the same way as
17354 sending and receiving radio tables (see [[Radio tables]]). As for radio
17355 tables, you can insert radio list templates in HTML, LaTeX and
17356 Texinfo modes by calling ~org-list-insert-radio-list~.
17358 Here are the differences with radio tables:
17360 - Orgstruct mode must be active.
17362 - Use the ~ORGLST~ keyword instead of ~ORGTBL~.
17364 - The available translation functions for radio lists don't take
17367 - {{{kbd(C-c C-c)}}} will work when pressed on the first item of the
17371 Here is a LaTeX example. Let's say that you have this in your
17376 % BEGIN RECEIVE ORGLST to-buy
17377 % END RECEIVE ORGLST to-buy
17379 #+ORGLST: SEND to-buy org-list-to-latex
17388 Pressing `C-c C-c' on ~a new house~ will insert the converted
17389 LaTeX list between the two marker lines.
17393 :DESCRIPTION: Automatically filled blocks
17395 #+cindex: dynamic blocks
17397 Org documents can contain /dynamic blocks/. These are specially marked
17398 regions that are updated by some user-written function. A good example
17399 for such a block is the clock table inserted by the command
17400 {{{kbd(C-c C-x C-r)}}} (see [[Clocking work time]]).
17402 Dynamic blocks are enclosed by a BEGIN-END structure that assigns a
17403 name to the block and can also specify parameters for the function
17404 producing the content of the block.
17406 #+cindex: #+BEGIN:dynamic block
17408 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
17413 Dynamic blocks are updated with the following commands:
17415 #+attr_texinfo: :table-type table :indic @asis
17416 - {{{kbd(C-c C-x C-u)}}}, ~org-dblock-update~ ::
17417 #+kindex: C-c C-x C-u
17419 Update dynamic block at point.
17421 - {{{kbd(C-u C-c C-x C-u)}}} ::
17422 #+kindex: C-u C-c C-x C-u
17424 Update all dynamic blocks in the current file.
17427 Updating a dynamic block means to remove all the text between ~BEGIN~
17428 and ~END~, parse the ~BEGIN~ line for parameters and then call the
17429 specific writer function for this block to insert the new content. If
17430 you want to use the original content in the writer function, you can
17431 use the extra parameter ~:content~.
17433 For a block with name ~myblock~, the writer function is
17434 ~org-dblock-write:myblock~ with as only parameter a property list
17435 with the parameters given in the begin line. Here is a trivial example
17436 of a block that keeps track of when the block update function was last
17440 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
17445 {{{noindent}}} The corresponding block writer function could look like
17449 #+header: :exports code
17450 #+begin_src emacs-lisp
17451 (defun org-dblock-write:block-update-time (params)
17452 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
17453 (insert "Last block update at: "
17454 (format-time-string fmt (current-time)))))
17457 If you want to make sure that all dynamic blocks are always
17458 up-to-date, you could add the function ~org-update-all-dblocks~ to a
17459 hook, for example ~before-save-hook~. ~org-update-all-dblocks~ is
17460 written in a way such that it does nothing in buffers that are not in
17463 You can narrow the current buffer to the current dynamic block (like
17464 any other block) with ~org-narrow-to-block~.
17466 ** Special agenda views
17468 :DESCRIPTION: Customized views
17470 #+cindex: agenda views, user-defined
17471 #+vindex: org-agenda-skip-function
17472 #+vindex: org-agenda-skip-function-global
17474 Org provides a special hook that can be used to narrow down the
17475 selection made by these agenda views: ~agenda~, ~todo~, ~alltodo~,
17476 ~tags~, ~tags-todo~, ~tags-tree~. You may specify a function that is
17477 used at each match to verify if the match should indeed be part of the
17478 agenda view, and if not, how much should be skipped. You can specify a
17479 global condition that will be applied to all agenda views, this
17480 condition would be stored in the variable
17481 ~org-agenda-skip-function-global~. More commonly, such a definition is
17482 applied only to specific custom searches, using
17483 ~org-agenda-skip-function~.
17485 Let's say you want to produce a list of projects that contain a
17486 ~WAITING~ tag anywhere in the project tree. Let's further assume that
17487 you have marked all tree headings that define a project with the TODO
17488 keyword PROJECT. In this case you would run a TODO search for the
17489 keyword PROJECT, but skip the match unless there is a ~WAITING~ tag
17490 anywhere in the subtree belonging to the project line.
17492 To achieve this, you must write a function that searches the subtree for
17493 the tag. If the tag is found, the function must return ~nil~ to
17494 indicate that this match should not be skipped. If there is no such
17495 tag, return the location of the end of the subtree, to indicate that
17496 search should continue from there.
17499 #+header: :exports code
17500 #+begin_src emacs-lisp
17501 (defun my-skip-unless-waiting ()
17502 "Skip trees that are not waiting"
17503 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
17504 (if (re-search-forward ":waiting:" subtree-end t)
17505 nil ; tag found, do not skip
17506 subtree-end))) ; tag not found, continue after end of subtree
17509 Now you may use this function in an agenda custom command, for example
17513 #+header: :exports code
17514 #+begin_src emacs-lisp
17515 (org-add-agenda-custom-command
17516 '("b" todo "PROJECT"
17517 ((org-agenda-skip-function 'my-skip-unless-waiting)
17518 (org-agenda-overriding-header "Projects waiting for something: "))))
17521 #+vindex: org-agenda-overriding-header
17523 Note that this also binds ~org-agenda-overriding-header~ to get a
17524 meaningful header in the agenda view.
17526 #+vindex: org-odd-levels-only
17527 #+vindex: org-agenda-skip-function
17529 A general way to create custom searches is to base them on a search
17530 for entries with a certain level limit. If you want to study all
17531 entries with your custom search function, simply do a search for
17532 {{{samp(LEVEL>0)}}}, and then use ~org-agenda-skip-function~ to select
17533 the entries you really want to have.[fn:163]
17535 You may also put a Lisp form into ~org-agenda-skip-function~. In
17536 particular, you may use the functions ~org-agenda-skip-entry-if~
17537 and ~org-agenda-skip-subtree-if~ in this form, for example:
17539 #+attr_texinfo: :table-type table :indic @asis
17540 - {{{samp((org-agenda-skip-entry-if 'scheduled))}}} ::
17542 Skip current entry if it has been scheduled.
17544 - {{{samp((org-agenda-skip-entry-if 'notscheduled))}}} ::
17546 Skip current entry if it has not been scheduled.
17548 - {{{samp((org-agenda-skip-entry-if 'deadline))}}} ::
17550 Skip current entry if it has a deadline.
17552 - {{{samp((org-agenda-skip-entry-if 'scheduled 'deadline))}}} ::
17554 Skip current entry if it has a deadline, or if it is scheduled.
17556 - {{{samp((org-agenda-skip-entry-if 'todo '("TODO" "WAITING")))}}} ::
17558 Skip current entry if the TODO keyword is TODO or WAITING.
17560 - {{{samp((org-agenda-skip-entry-if 'todo 'done))}}} ::
17562 Skip current entry if the TODO keyword marks a DONE state.
17564 - {{{samp((org-agenda-skip-entry-if 'timestamp))}}} ::
17566 Skip current entry if it has any timestamp, may also be deadline or scheduled.
17567 <<x-agenda-skip-entry-regexp>>
17569 - {{{samp((org-agenda-skip-entry-if 'regexp "regular expression"))}}} ::
17571 Skip current entry if the regular expression matches in the entry.
17573 - {{{samp((org-agenda-skip-entry-if 'notregexp "regular expression"))}}} ::
17575 Skip current entry unless the regular expression matches.
17577 - {{{samp((org-agenda-skip-subtree-if 'regexp "regular expression"))}}} ::
17579 Same as above, but check and skip the entire subtree.
17582 Therefore we could also have written the search for WAITING projects
17583 like this, even without defining a special function:
17586 #+header: :exports code
17587 #+begin_src emacs-lisp
17588 (org-add-agenda-custom-command
17589 '("b" todo "PROJECT"
17590 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
17591 'regexp ":waiting:"))
17592 (org-agenda-overriding-header "Projects waiting for something: "))))
17595 ** Extracting agenda information
17597 :DESCRIPTION: Post-processing agenda information
17599 #+cindex: agenda, pipe
17600 #+cindex: Scripts, for agenda processing
17601 #+vindex: org-agenda-custom-commands
17603 Org provides commands to access agenda information for the command
17604 line in Emacs batch mode. This extracted information can be sent
17605 directly to a printer, or it can be read by a program that does
17606 further processing of the data. The first of these commands is the
17607 function ~org-batch-agenda~, that produces an agenda view and sends it
17608 as ASCII text to STDOUT. The command takes a single string as
17609 parameter. If the string has length 1, it is used as a key to one of
17610 the commands you have configured in ~org-agenda-custom-commands~,
17611 basically any key you can use after {{{kbd(C-c a)}}}. For example, to
17612 directly print the current TODO list, you could use:
17615 #+header: :exports code
17617 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
17620 If the parameter is a string with 2 or more characters, it is used as
17621 a tags/TODO match string. For example, to print your local shopping
17622 list (all items with the tag {{{samp(shop)}}}, but excluding the tag
17623 {{{samp(NewYork)}}}), you could use:
17626 #+header: :exports code
17628 emacs -batch -l ~/.emacs \
17629 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
17632 {{{noindent}}} You may also modify parameters on the fly like this:
17635 #+header: :exports code
17637 emacs -batch -l ~/.emacs \
17638 -eval '(org-batch-agenda "a" \
17639 org-agenda-span (quote month) \
17640 org-agenda-include-diary nil \
17641 org-agenda-files (quote ("~/org/project.org")))' \
17645 {{{noindent}}} which will produce a 30-day agenda, fully restricted to
17646 the Org file {{{file(~/org/projects.org)}}}, not even including the
17649 If you want to process the agenda data in more sophisticated ways, you
17650 can use the command ~org-batch-agenda-csv~ to get a comma-separated
17651 list of values for each agenda item. Each line in the output will
17652 contain a number of fields separated by commas. The fields in a line
17655 #+attr_texinfo: :table-type table :indic @code
17656 - category :: The category of the item
17657 - head :: The headline, without TODO keyword, TAGS and PRIORITY
17658 - type :: The type of the agenda entry, can be:
17659 - todo :: selected in TODO match
17660 - tagsmatch :: selected in tags match
17661 - diary :: imported from diary
17662 - deadline :: a deadline
17663 - scheduled :: scheduled
17664 - timestamp :: appointment, selected by timestamp
17665 - closed :: entry was closed on date
17666 - upcoming-deadline :: warning about nearing deadline
17667 - past-scheduled :: forwarded scheduled item
17668 - block :: entry has date block including date
17669 - todo :: The TODO keyword, if any
17670 - tags :: All tags including inherited ones, separated by colons
17671 - date :: The relevant date, like 2007-2-14
17672 - time :: The time, like 15:00-16:50
17673 - extra :: String with extra planning info
17674 - priority-l :: The priority letter if any was given
17675 - priority-n :: The computed numerical priority
17677 {{{noindent}}} Time and date will only be given if a timestamp (or
17678 deadline/scheduled) led to the selection of the item.
17680 A CSV list like this is very easy to use in a post-processing script.
17681 For example, here is a Perl program that gets the TODO list from
17682 Emacs/Org and prints all the items, preceded by a checkbox:
17685 #+header: :exports code
17689 # define the Emacs command to run
17690 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
17692 # run it and capture the output
17693 $agenda = qx@{$cmd 2>/dev/null@};
17695 # loop over all lines
17696 foreach $line (split(/\n/,$agenda)) @{
17697 # get the individual values
17698 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
17699 $priority_l,$priority_n) = split(/,/,$line);
17700 # process and print
17701 print "[ ] $head\n";
17705 ** Using the property API
17707 :DESCRIPTION: Writing programs that use entry properties
17709 #+cindex: API, for properties
17710 #+cindex: properties, API
17712 Here is a description of the functions that can be used to work with
17715 #+attr_texinfo: :options org-entry-properties &optional pom which
17717 Get all properties of the entry at point-or-marker POM.
17718 This includes the TODO keyword, the tags, time strings for deadline,
17719 scheduled, and clocking, and any additional properties defined in the
17720 entry. The return value is an alist. Keys may occur multiple times
17721 if the property key was used several times.@*
17722 POM may also be nil, in which case the current entry is used.
17723 If WHICH is nil or `all', get all properties. If WHICH is
17724 `special' or `standard', only get that subclass.
17727 #+vindex: org-use-property-inheritance
17728 #+findex: org-insert-property-drawer
17729 #+attr_texinfo: :options org-entry-get pom property &optional inherit
17731 Get value of PROPERTY for entry at point-or-marker POM. By default,
17732 this only looks at properties defined locally in the entry. If INHERIT
17733 is non-nil and the entry does not have the property, then also check
17734 higher levels of the hierarchy. If INHERIT is the symbol
17735 ~selective~, use inheritance if and only if the setting of
17736 ~org-use-property-inheritance~ selects PROPERTY for inheritance.
17739 #+attr_texinfo: :options org-entry-delete pom property
17741 Delete the property PROPERTY from entry at point-or-marker POM.
17744 #+attr_texinfo: :options org-entry-put pom property value
17746 Set PROPERTY to VALUE for entry at point-or-marker POM.
17749 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
17751 Get all property keys in the current buffer.
17753 #+attr_texinfo: :options org-insert-property-drawer
17755 Insert a property drawer for the current entry. Also
17758 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
17760 Set PROPERTY at point-or-marker POM to VALUES. VALUES should be a list of
17761 strings. They will be concatenated, with spaces as separators.
17764 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
17766 Treat the value of the property PROPERTY as a whitespace-separated list of
17767 values and return the values as a list of strings.
17770 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
17772 Treat the value of the property PROPERTY as a whitespace-separated list of
17773 values and make sure that VALUE is in this list.
17776 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
17778 Treat the value of the property PROPERTY as a whitespace-separated list of
17779 values and make sure that VALUE is /not/ in this list.
17782 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
17784 Treat the value of the property PROPERTY as a whitespace-separated list of
17785 values and check if VALUE is in this list.
17788 #+attr_texinfo: :options org-property-allowed-value-functions
17790 Hook for functions supplying allowed values for a specific property.
17791 The functions must take a single argument, the name of the property, and
17792 return a flat list of allowed values. If {{{samp(:ETC)}}} is one of
17793 the values, use the values as completion help, but allow also other values
17794 to be entered. The functions must return ~nil~ if they are not
17795 responsible for this property.
17798 ** Using the mapping API
17800 :DESCRIPTION: Mapping over all or selected entries
17802 #+cindex: API, for mapping
17803 #+cindex: mapping entries, API
17805 Org has sophisticated mapping capabilities to find all entries satisfying
17806 certain criteria. Internally, this functionality is used to produce agenda
17807 views, but there is also an API that can be used to execute arbitrary
17808 functions for each or selected entries. The main entry point for this API
17811 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
17813 Call FUNC at each headline selected by MATCH in SCOPE.
17815 FUNC is a function or a Lisp form. The function will be called without
17816 arguments, with the cursor positioned at the beginning of the headline.
17817 The return values of all calls to the function will be collected and
17818 returned as a list.
17820 The call to FUNC will be wrapped into a save-excursion form, so FUNC
17821 does not need to preserve point. After evaluation, the cursor will be
17822 moved to the end of the line (presumably of the headline of the
17823 processed entry) and search continues from there. Under some
17824 circumstances, this may not produce the wanted results. For example,
17825 if you have removed (e.g., archived) the current (sub)tree it could
17826 mean that the next entry will be skipped entirely. In such cases, you
17827 can specify the position from where search should continue by making
17828 FUNC set the variable `org-map-continue-from' to the desired buffer
17831 MATCH is a tags/property/todo match as it is used in the agenda match view.
17832 Only headlines that are matched by this query will be considered during
17833 the iteration. When MATCH is nil or t, all headlines will be
17834 visited by the iteration.
17836 SCOPE determines the scope of this command. It can be any of:
17838 #+attr_texinfo: :table-type table :indic @code
17841 The current buffer, respecting the restriction, if any.
17845 The subtree started with the entry at point.
17849 The entries within the active region, if any.
17853 The current buffer, without restriction.
17855 - file-with-archives ::
17857 The current buffer, and any archives associated with it.
17863 - agenda-with-archives ::
17865 All agenda files with any archive files associated with them.
17867 - (file1 file2 ...) ::
17869 If this is a list, all files in the list will be scanned.
17872 {{{noindent}}} The remaining args are treated as settings for the
17873 skipping facilities of the scanner. The following items can be given
17876 #+vindex: org-agenda-skip-function
17877 #+attr_texinfo: :table-type table :indic @asis
17880 Skip trees with the archive tag.
17884 Skip trees with the COMMENT keyword.
17886 - function or Lisp form ::
17888 Will be used as value for ~org-agenda-skip-function~, so whenever the
17889 function returns t, FUNC will not be called for that entry and search
17890 will continue from the point where the function leaves it.
17893 The function given to that mapping routine can really do anything you like.
17894 It can use the property API (see [[Using the property API]]) to gather more
17895 information about the entry, or in order to change metadata in the entry.
17896 Here are a few functions that might be handy:
17898 #+attr_texinfo: :options org-todo &optional arg
17900 Change the TODO state of the entry. See the docstring of the functions for
17901 the many possible values for the argument ARG.
17904 #+attr_texinfo: :options org-priority &optional action
17906 Change the priority of the entry. See the docstring of this function for the
17907 possible values for ACTION.
17910 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
17912 Toggle the tag TAG in the current entry. Setting ONOFF to either ~on~
17913 or ~off~ will not toggle tag, but ensure that it is either on or off.
17916 #+attr_texinfo: :options org-promote
17918 Promote the current entry.
17921 #+attr_texinfo: :options org-demote
17923 Demote the current entry.
17926 The following simple example will turn all entries in the current file
17927 with a tag ~TOMORROW~ into TODO entries with the keyword ~UPCOMING~.
17928 Entries in comment trees and in archive trees will be ignored.
17931 #+header: :exports code
17932 #+begin_src emacs-lisp
17934 '(org-todo "UPCOMING")
17935 "+TOMORROW" 'file 'archive 'comment)
17938 The following example counts the number of entries with TODO keyword
17939 ~WAITING~, in all agenda files.
17942 #+header: :exports code
17943 #+begin_src emacs-lisp
17944 (length (org-map-entries t "/+WAITING" 'agenda))
17949 :DESCRIPTION: Viewing and capture on a mobile device
17950 :APPENDIX: Appendix
17953 #+cindex: MobileOrg
17954 #+cindex: Moreland, Richard
17955 #+cindex: Jones, Matt
17957 MobileOrg is the name of the mobile companion app for Org mode,
17958 currently available for iOS and for Android. MobileOrg offers
17959 offline viewing and capture support for an Org mode system rooted on a
17960 ``real'' computer. It does also allow you to record changes to
17961 existing entries. The [[http://mobileorg.ncogni.to/][iOS implementation]] for the iPhone/iPod
17962 Touch/iPad series of devices, was developed by Richard Moreland.
17963 Android users should check out [[http://wiki.github.com/matburt/mobileorg-android/][MobileOrg Android]] by Matt Jones. The
17964 two implementations are not identical but offer similar features.
17966 This appendix describes the support Org has for creating agenda views
17967 in a format that can be displayed by MobileOrg, and for integrating
17968 notes captured and changes made by MobileOrg into the main system.
17970 For changing tags and TODO states in MobileOrg, you should have set up
17971 the customization variables ~org-todo-keywords~ and ~org-tags-alist~
17972 to cover all important tags and TODO keywords, even if individual
17973 files use only part of these. MobileOrg will also offer you states and
17974 tags set up with in-buffer settings, but it will understand the
17975 logistics of TODO state /sets/ (see [[Per-file keywords]]) and /mutually
17976 exclusive/ tags (see [[Setting tags]]) only for those set in these
17979 ** Setting up the staging area
17981 :DESCRIPTION: Where to interact with the mobile device
17984 MobileOrg needs to interact with Emacs through a directory on a
17985 server. If you are using a public server, you should consider to
17986 encrypt the files that are uploaded to the server. This can be done
17987 with Org mode 7.02 and with MobileOrg 1.5 (iPhone version), and you
17988 need an {{{file(openssl)}}} installation on your system. To turn on
17989 encryption, set a password in MobileOrg and, on the Emacs side,
17990 configure the variable ~org-mobile-use-encryption~.[fn:164]
17992 The easiest way to create that directory is to use a free [[http://dropbox.com][Dropbox]]
17993 account.[fn:165] When MobileOrg first connects to your Dropbox, it
17994 will create a directory MobileOrg inside the Dropbox. After the
17995 directory has been created, tell Emacs about it:
17998 #+header: :exports code
17999 #+begin_src emacs-lisp
18000 (setq org-mobile-directory "~/Dropbox/MobileOrg")
18003 Org mode has commands to put files for MobileOrg into that
18004 directory, and to read captured notes from there.
18006 ** Pushing to MobileOrg
18008 :DESCRIPTION: Uploading Org files and agendas
18011 This operation copies all files currently listed in ~org-mobile-files~
18012 to the directory ~org-mobile-directory~. By default this list contains
18013 all agenda files (as listed in ~org-agenda-files~), but additional
18014 files can be included by customizing ~org-mobile-files~. File names
18015 will be staged with paths relative to ~org-directory~, so all files
18016 should be inside this directory.[fn:184]
18018 The push operation also creates a special Org file
18019 {{{file(agendas.org)}}} with all custom agenda view defined by the
18022 Finally, Org writes the file {{{file(index.org)}}}, containing links
18023 to all other files. MobileOrg first reads this file from the server,
18024 and then downloads all agendas and Org files listed in it. To speed up
18025 the download, MobileOrg will only read files whose checksums have
18028 ** Pulling from MobileOrg
18030 :DESCRIPTION: Integrating captured and flagged items
18033 When MobileOrg synchronizes with the server, it not only pulls the
18034 Org files for viewing. It also appends captured entries and pointers
18035 to flagged and changed entries to the file {{{file(mobileorg.org)}}}
18036 on the server. Org has a /pull/ operation that integrates this
18037 information into an inbox file and operates on the pointers to flagged
18038 entries. Here is how it works:
18040 1. Org moves all entries found in {{{file(mobileorg.org)}}} and
18041 appends them to the file pointed to by the variable
18042 ~org-mobile-inbox-for-pull~.[fn:168] Each captured entry and each
18043 editing event will be a top-level entry in the inbox file.
18045 2. After moving the entries, Org will attempt to implement the changes
18046 made in MobileOrg. Some changes are applied directly and without
18047 user interaction. Examples are all changes to tags, TODO state,
18048 headline and body text that can be cleanly applied. Entries that
18049 have been flagged for further action will receive a tag
18050 ~:FLAGGED:~, so that they can be easily found again. When there is
18051 a problem finding an entry or applying the change, the pointer
18052 entry will remain in the inbox and will be marked with an error
18053 message. You need to later resolve these issues by hand.
18055 3. Org will then generate an agenda view with all flagged entries. The
18056 user should then go through these entries and do whatever actions
18057 are necessary. If a note has been stored while flagging an entry in
18058 MobileOrg, that note will be displayed in the echo area when the
18059 cursor is on the corresponding agenda line.
18061 #+attr_texinfo: :table-type table :indic @asis
18065 Pressing {{{kbd(?)}}} in that special agenda will display the full
18066 flagging note in another window and also push it onto the kill ring.
18067 So you could use {{{kbd(? z C-y C-c C-c)}}} to store that flagging
18068 note as a normal note in the entry. Pressing {{{kbd(?)}}} twice in
18069 succession will offer to remove the ~:FLAGGED:~ tag along with the
18070 recorded flagging note (which is stored in a property). In this way
18071 you indicate that the intended processing for this flagged entry is
18077 If you are not able to process all flagged entries directly, you can always
18078 return to this agenda view using {{{kbd(C-c a ?)}}}.[fn:169]
18080 * History and acknowledgments
18082 :DESCRIPTION: How Org came into being
18083 :ALT_TITLE: History and Acknowledgments
18084 :APPENDIX: Appendix
18088 Org was born in 2003, out of frustration over the user interface of
18089 the Emacs Outline mode. I was trying to organize my notes and
18090 projects, and using Emacs seemed to be the natural way to go. However,
18091 having to remember eleven different commands with two or three keys
18092 per command, only to hide and show parts of the outline tree, that
18093 seemed entirely unacceptable to me. Also, when using outlines to take
18094 notes, I constantly wanted to restructure the tree, organizing it
18095 parallel to my thoughts and plans. /Visibility cycling/ and /structure
18096 editing/ were originally implemented in the package
18097 {{{file(outline-magic.el)}}}, but quickly moved to the more general
18098 {{{file(org.el)}}}. As this environment became comfortable for project
18099 planning, the next step was adding /TODO entries/, basic /timestamps/,
18100 and /table support/. These areas highlighted the two main goals that
18101 Org still has today: to be a new, outline-based, plain text mode with
18102 innovative and intuitive editing features, and to incorporate project
18103 planning functionality directly into a notes file.
18105 Since the first release, literally thousands of emails to me or to the
18106 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
18107 new ideas, and sometimes patches and add-on code. Many thanks to
18108 everyone who has helped to improve this package. I am trying to keep
18109 here a list of the people who had significant influence in shaping one
18110 or more aspects of Org. The list may not be complete, if I have
18111 forgotten someone, please accept my apologies and let me know.
18113 Before I get to this list, a few special mentions are in order:
18115 #+attr_texinfo: :table-type table :indic @asis
18116 - Bastien Guerry ::
18118 Bastien has written a large number of extensions to Org (most of them
18119 integrated into the core by now), including the LaTeX exporter and
18120 the plain list parser. His support during the early days, when he
18121 basically acted as co-maintainer, was central to the success of this
18122 project. Bastien also invented Worg, helped establishing the Web
18123 presence of Org, and sponsored hosting costs for the ~orgmode.org~
18126 - Eric Schulte and Dan Davison ::
18128 Eric and Dan are jointly responsible for the Org-babel system, which
18129 turns Org into a multi-language environment for evaluating code and
18130 doing literate programming and reproducible research.
18134 John has contributed a number of great ideas and patches directly to
18135 Org, including the attachment system ({{{file(org-attach.el)}}}),
18136 integration with Apple Mail ({{{file(org-mac-message.el)}}}),
18137 hierarchical dependencies of TODO items, habit tracking
18138 ({{{file(org-habits.el)}}}), and encryption
18139 ({{{file(org-crypt.el)}}}). Also, the capture system is really an
18140 extended copy of his great {{{file(remember.el)}}}.
18142 - Sebastian Rose ::
18144 Without Sebastian, the HTML/XHTML publishing of Org would be the
18145 pitiful work of an ignorant amateur. Sebastian has pushed this part of
18146 Org onto a much higher level. He also wrote {{{file(org-info.js)}}}, a
18147 Java script for displaying webpages derived from Org using an
18148 Info-like or a folding interface with single-key navigation.
18151 {{{noindent}}} See [[List of contributions][below]] for the full list of contributions! Again,
18152 please let me know what I am missing here!
18156 I (Bastien) have been maintaining Org since January 2011. This
18157 appendix would not be complete without adding a few more
18158 acknowledgements and thanks to Carsten's ones above.
18160 I am first grateful to Carsten for his trust while handing me over the
18161 maintainership of Org. His support as been great since day one of this
18162 new adventure, and it helped a lot.
18164 When I took over maintainership, I knew I would have to make Org more
18165 collaborative than ever, as I would have to rely on people that are
18166 more knowledgeable than I am on many parts of the code. Here is a list
18167 of the persons I could rely on, they should really be considered
18168 co-maintainers, either of the code or the community:
18170 #+attr_texinfo: :table-type table :indic @asis
18173 Eric is maintaining the Babel parts of Org. His reactivity here kept
18174 me away from worrying about possible bugs here and let me focus on
18177 - Nicolas Goaziou ::
18179 Nicolas is maintaining the consistency of the deepest parts of Org.
18180 His work on {{{file(org-element.el)}}} and {{{file(org-export.el)}}}
18181 has been outstanding, and opened the doors for many new ideas and
18186 Jambunathan contributed the ODT exporter, definitly a killer feature
18187 of Org mode. He also contributed the new HTML exporter, which is
18188 another core feature of Org. Here too, I knew I could rely on him to
18189 fix bugs in these areas and to patiently explain the users what was
18190 the problems and solutions.
18194 Achim rewrote the building process of Org, turning some /ad hoc/ tools
18195 into a flexible and conceptually clean process. He patiently coped
18196 with the many hicups that such a change can create for users.
18200 The Org mode mailing list would not be such a nice place without Nick,
18201 who patiently helped users so many times. It is impossible to
18202 overestimate such a great help, and the list would not be so active
18206 I received support from so many users that it is clearly impossible to be
18207 fair when shortlisting a few of them---but Org's history would not be
18208 complete if the ones above were not mentioned in this manual.
18210 ** List of contributions
18212 - Russel Adams came up with the idea for drawers.
18214 - Thomas Baumann wrote {{{file(org-bbdb.el)}}} and {{{file(org-mhe.el)}}}.
18216 - Christophe Bataillon created the great unicorn logo that we use on
18217 the Org mode website.
18219 - Alex Bochannek provided a patch for rounding timestamps.
18221 - Jan Böcker wrote {{{file(org-docview.el)}}}.
18223 - Brad Bozarth showed how to pull RSS feed data into Org mode files.
18225 - Tom Breton wrote {{{file(org-choose.el)}}}.
18227 - Charles Cave's suggestion sparked the implementation of templates
18228 for Remember, which are now templates for capture.
18230 - Pavel Chalmoviansky influenced the agenda treatment of items with
18233 - Gregory Chernov patched support for Lisp forms into table
18234 calculations and improved XEmacs compatibility, in particular by
18235 porting {{{file(nouline.el)}}} to XEmacs.
18237 - Sacha Chua suggested copying some linking code from Planner.
18239 - Baoqiu Cui contributed the DocBook exporter.
18241 - Eddward DeVilla proposed and tested checkbox statistics. He also
18242 came up with the idea of properties, and that there should be an API
18245 - Nick Dokos tracked down several nasty bugs.
18247 - Kees Dullemond used to edit projects lists directly in HTML and so
18248 inspired some of the early development, including HTML export. He
18249 also asked for a way to narrow wide table columns.
18251 - Thomas S. Dye contributed documentation on Worg and helped
18252 integrating the Org-Babel documentation into the manual.
18254 - Christian Egli converted the documentation into Texinfo format,
18255 inspired the agenda, patched CSS formatting into the HTML exporter,
18256 and wrote {{{file(org-taskjuggler.el)}}}.
18258 - David Emery provided a patch for custom CSS support in exported
18261 - Nic Ferrier contributed mailcap and XOXO support.
18263 - Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
18265 - John Foerch figured out how to make incremental search show
18266 context around a match in a hidden outline tree.
18268 - Raimar Finken wrote {{{file(org-git-line.el)}}}.
18270 - Mikael Fornius works as a mailing list moderator.
18272 - Austin Frank works as a mailing list moderator.
18274 - Eric Fraga drove the development of BEAMER export with ideas and
18277 - Barry Gidden did proofreading the manual in preparation for the
18278 book publication through Network Theory Ltd.
18280 - Niels Giesen had the idea to automatically archive DONE trees.
18282 - Nicolas Goaziou rewrote much of the plain list code.
18284 - Kai Grossjohann pointed out key-binding conflicts with other packages.
18286 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
18289 - Bernt Hansen has driven much of the support for auto-repeating
18290 tasks, task state change logging, and the clocktable. His clear
18291 explanations have been critical when we started to adopt the Git
18292 version control system.
18294 - Manuel Hermenegildo has contributed various ideas, small fixes
18297 - Phil Jackson wrote {{{file(org-irc.el)}}}.
18299 - Scott Jaderholm proposed footnotes, control over whitespace
18300 between folded entries, and column view for properties.
18302 - Matt Jones wrote /MobileOrg Android/.
18304 - Tokuya Kameshima wrote {{{file(org-wl.el)}}} and {{{file(org-mew.el)}}}.
18306 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it. He
18307 also provided frequent feedback and some patches.
18309 - Matt Lundin has proposed last-row references for table formulas
18310 and named invisible anchors. He has also worked a lot on the FAQ.
18312 - David Maus wrote {{{file(org-atom.el)}}}, maintains the issues
18313 file for Org, and is a prolific contributor on the mailing list with
18314 competent replies, small fixes and patches.
18316 - Jason F. McBrayer suggested agenda export to CSV format.
18318 - Max Mikhanosha came up with the idea of refiling.
18320 - Dmitri Minaev sent a patch to set priority limits on a per-file
18323 - Stefan Monnier provided a patch to keep the Emacs-Lisp compiler
18326 - Richard Moreland wrote /MobileOrg/ for the iPhone.
18328 - Rick Moynihan proposed allowing multiple TODO sequences in a file
18329 and being able to quickly restrict the agenda to a subtree.
18331 - Todd Neal provided patches for links to Info files and Elisp forms.
18333 - Greg Newman refreshed the unicorn logo into its current form.
18335 - Tim O'Callaghan suggested in-file links, search options for
18336 general file links, and TAGS.
18338 - Osamu Okano wrote {{{file(orgcard2ref.pl)}}}, a Perl program to
18339 create a text version of the reference card.
18341 - Takeshi Okano translated the manual and David O'Toole's tutorial
18344 - Oliver Oppitz suggested multi-state TODO items.
18346 - Scott Otterson sparked the introduction of descriptive text for
18347 links, among other things.
18349 - Pete Phillips helped during the development of the TAGS feature,
18350 and provided frequent feedback.
18352 - Martin Pohlack provided the code snippet to bundle character
18353 insertion into bundles of 20 for undo.
18355 - T.V. Raman reported bugs and suggested improvements.
18357 - Matthias Rempe (Oelde) provided ideas, Windows support, and
18360 - Paul Rivier provided the basic implementation of named footnotes.
18361 He also acted as mailing list moderator for some time.
18363 - Kevin Rogers contributed code to access VM files on remote hosts.
18365 - Frank Ruell solved the mystery of the ~keymapp nil~ bug, a
18366 conflict with {{{file(allout.el)}}}.
18368 - Jason Riedy generalized the send-receive mechanism for Orgtbl
18369 tables with extensive patches.
18371 - Philip Rooke created the Org reference card, provided lots of
18372 feedback, developed and applied standards to the Org documentation.
18374 - Christian Schlauer proposed angular brackets around links, among
18377 - Paul Sexton wrote {{{file(org-ctags.el)}}}.
18379 - Tom Shannon's {{{file(organizer-mode.el)}}} inspired linking to VM/BBDB/Gnus.
18381 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
18382 literal examples, and remote highlighting for referenced code lines.
18384 - Stathis Sideris wrote the {{{file(ditaa.jar)}}} ASCII to PNG
18385 converter that is now packaged into Org's {{{file(contrib)}}}
18388 - Daniel Sinder came up with the idea of internal archiving by
18391 - Dale Smith proposed link abbreviations.
18393 - James TD Smith has contributed a large number of patches for
18394 useful tweaks and features.
18396 - Adam Spiers asked for global linking commands, inspired the link
18397 extension system, added support for mairix, and proposed the mapping
18400 - Ulf Stegemann created the table to translate special symbols to
18401 HTML, LaTeX, UTF-8, Latin-1 and ASCII.
18403 - Andy Stewart contributed code to {{{file(org-w3m.el)}}}, to copy
18404 HTML content with links transformation to Org syntax.
18406 - David O'Toole wrote {{{file(org-publish.el)}}} and drafted the
18407 manual chapter about publishing.
18409 - Jambunathan K contributed the ODT exporter.
18411 - Sebastien Vauban reported many issues with LaTeX and BEAMER
18412 export and enabled source code highlighting in Gnus.
18414 - Stefan Vollmar organized a video-recorded talk at the
18415 Max-Planck-Institute for Neurology. He also inspired the creation
18416 of a concept index for HTML export.
18418 - J\"urgen Vollmer contributed code generating the table of contents
18421 - Samuel Wales has provided important feedback and bug reports.
18423 - Chris Wallace provided a patch implementing the {{{samp(QUOTE)}}}
18426 - David Wainberg suggested archiving, and improvements to the
18429 - Carsten Wimmer suggested some changes and helped fix a bug in
18432 - Roland Winkler requested additional key bindings to make Org work
18435 - Piotr Zielinski wrote {{{file(org-mouse.el)}}}, proposed agenda
18436 blocks and contributed various ideas and code snippets.
18438 * GNU Free Documentation License
18441 :DESCRIPTION: The license for this documentation.
18444 #+TEXINFO: @include ../doc/doclicense.texi
18448 :ALT_TITLE: Main Index
18450 :DESCRIPTION: Org's concepts and features
18455 :DESCRIPTION: Key bindings and where they are described
18456 :ALT_TITLE: Key Index
18460 * Command and function index
18462 :DESCRIPTION: Command names and some internal functions
18463 :ALT_TITLE: Command and Function Index
18469 :DESCRIPTION: Variables mentioned in the manual
18470 :ALT_TITLE: Variable Index
18474 This is not a complete index of variables and faces, only the ones
18475 that are mentioned in the manual. For a more complete list, use
18476 {{{kbdspckey(M-x org-customize,RET)}}} and then click yourself through
18484 This manual is for Org version {{{version}}}.
18486 Copyright (C) 2004-2013 Free Software Foundation, Inc.
18489 Permission is granted to copy, distribute and/or modify this document
18490 under the terms of the GNU Free Documentation License, Version 1.3 or
18491 any later version published by the Free Software Foundation; with no
18492 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
18493 and with the Back-Cover Texts as in (a) below. A copy of the license
18494 is included in the section entitled ``GNU Free Documentation License.''
18496 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
18497 modify this GNU manual. Buying copies from the FSF supports it in
18498 developing GNU and promoting software freedom.''
18500 This document is part of a collection distributed under the GNU Free
18501 Documentation License. If you want to distribute this document
18502 separately from the collection, you can do so by adding a copy of the
18503 license to the document, as described in section 6 of the license.
18506 * Macro definitions :noexport:
18508 # Version macro, with commit hash
18509 #+MACRO: version (eval (pcase (split-string (org-version nil t) "[ (_]" t) (`(,_ ,_ ,n ,_ ,r . ,_) (format "%s (release_%s)" n r))))
18511 # Markup macros. In texinfo export they will be marked up, otherwise
18512 # they will be inserted verbatim. markup is the generic form that can
18513 # be used to insert any @-command with the second variable being the
18515 #+MACRO: markup @@info:@$1{@@$2@@info:}@@
18516 #+MACRO: kbd {{{markup(kbd,$1)}}}
18517 #+MACRO: key {{{markup(key,$1)}}}
18518 #+MACRO: samp {{{markup(samp,$1)}}}
18519 #+MACRO: command {{{markup(command,$1)}}}
18520 #+MACRO: file {{{markup(file,$1)}}}
18521 #+MACRO: var {{{markup(var,$1)}}}
18522 #+MACRO: cite {{{markup(cite,$1)}}}
18523 #+MACRO: value {{{markup(value,$1)}}}
18525 #+MACRO: kbdkey {{{kbd($1{{{key($2)}}})}}}
18526 #+MACRO: kbdspckey {{{kbd($1 {{{key($2)}}})}}}
18527 #+MACRO: ksksksk {{{kbd($1 {{{key($2)}}} $3 {{{key($4)}}})}}}
18528 #+MACRO: ksksksksk {{{kbd($1 {{{key($2)}}} $3 {{{key($4)}}} {{{key($5)}}})}}}
18529 #+MACRO: kbdkeys {{{kbd($1{{{key($2)}}}{{{key($3)}}})}}}
18532 #+MACRO: noindent @@info:@noindent@@
18533 #+MACRO: result @@info:@result{}@@
18534 #+MACRO: page @@info:@page@@
18536 * Instructions for use :noexport:
18537 - [ ] Tangle the makefile, `C-c C-v t'
18538 - [ ] Execute [[Editing setup][this source code block]]
18539 - [ ] Asynchronously generate the info file, `C-e i i'
18541 * Improvements and fixes [10/12] :noexport:
18542 - [X] Jon will fix detailed node listing
18543 - [X] Jon will fix :INDEX: property
18544 - [ ] New link type to generate pxref? (asked on ML)
18545 - [X] New macro for kbdkey that preserves space, e.g., `C-c <RET>'
18546 - [X] Indent examples one more space to match indentation of footnotes
18547 - [X] How to generate @kbd{\}?
18548 - [X] How to generate @kbd{~}?
18549 - [X] How to include GNU Free Documentation License as Appendix D?
18550 - [X] Straighten out footnotes
18551 - [X] Truncated footnote (asked on ML)
18552 - [ ] Resolve macros with XXX arguments
18553 - [X] Get @appendix instead of @chapter?
18555 * Nicolas Goaziou's instructions for v.8 :noexport:
18558 All occurrences of "#+LABEL:" should be replaced with "#+NAME:".
18560 *** TODO Replace #+LABEL with #+NAME
18562 ** Chapter 2, Document Structure
18566 In "2. Document Structure", one section could be added about
18567 cross-referencing, which would point to "Internal links". There, targets
18568 in comments can be removed. Also most back-ends will turn links to
18569 targets into proper cross-reference number (see `org-export-get-ordinal'
18570 docstring for cases handled).
18572 *** TODO Add section about cross-referencing
18574 ** Chapter 4, Hyperlinks
18578 "Internal links". There, targets
18579 in comments can be removed. Also most back-ends will turn links to
18580 targets into proper cross-reference number (see `org-export-get-ordinal'
18581 docstring for cases handled).
18583 *** TODO Remove targets in comments
18585 ** Chapter 11, Markup for Rich Export
18589 *** Include Keyword
18590 The "#+INCLUDE:" keyword syntax and effect is slightly different. You
18591 may want to look at `org-export-expand-include-keyword'.
18593 **** TODO Revise Include keyword
18594 ** Chapter 12, Exporting
18599 In "12. Exporting", "Export options" section need an overhaul. See
18600 `org-export-options-alist' for the default list of export options. Other
18601 options are back-end specific and should be introduced in their own
18602 section. Also "#+KEYWORD:" renaming into ":EXPORT_KEYWORD:" property is
18605 **** TODO Overhaul Export options section
18607 **** TODO KEYWORD now EXPORT_KEYWORD
18610 There should also be a section about macros (and move it out of "11
18611 Markup for rich export"), general, hard-coded ({{{time(...)}}},
18612 {{{property(...)}}}, {{{input-file}}} and {{{modification-time(...)}}})
18613 and specific ({{{date}}}, {{{author}}}, {{{title}}} and {{{email}}}). It
18614 should be specified that macros are recursive and only apply to one
18615 line. Therefore, they are appropriate for small replacements. For more
18616 complex ones, one may use Babel instead.
18618 **** TODO Write macros section
18619 Subsections: General, Hard-coded, Specific
18622 There should also be a section about filters used to customize export
18623 output and another one about `org-export-define-derived-backend' which
18624 allow someone to tweak a back-end.
18626 **** TODO Write filters section
18628 *** Define derived back-end
18629 and another one about `org-export-define-derived-backend' which
18630 allow someone to tweak a back-end.
18632 **** TODO Write derived back-end section
18634 *** Export Snippets
18635 A section can be added about export snippets, i.e.
18637 @@ob-latex:\something{...}@@
18639 They are a generalization for @<html> tags.
18641 **** TODO Write export snippets section
18643 There may be a section about captions and their syntax. A note should
18644 specify that export back-ends may or may not respect a caption. On the
18645 other hand "11.2 Images and Tables" focuses on captions. Since these are
18646 not specific to Images and Tables, it may be removed.
18648 **** TODO Write captions section
18650 I would also regroup every back-end into a sub-section to not clutter
18653 Other options are back-end specific and should be introduced in their
18656 Also most back-ends will turn links to
18657 targets into proper cross-reference number (see `org-export-get-ordinal'
18658 docstring for cases handled).
18663 "DocBook export" (though texinfo back-end can export to DocBook) and
18664 "XOXO export" sections can be removed as the back-ends are discontinued.
18665 There is no equivalent to "Taskjuggler export" yet, so it can be removed
18668 ***** TODO Remove DocBook backend
18670 ***** TODO Remove XOXO backend
18672 ***** TODO Remove Taskjuggler backend
18674 **** Back-end template
18675 These are only suggestion. There is also probably many more things to
18676 do. But I think that the hardest part is to start writing it. If you
18677 come up with a good organization for e-latex back-end documentation, we
18678 can use it for other back-ends thereafter.
18680 ***** TODO Write back-end template
18682 ****** TODO Does back-end turn links to targets?
18684 **** LaTeX Back-end
18685 About the latex back-end, you know certainly a lot. It should be
18686 specified that it introduces 3 new keywords, namely "LATEX_CLASS",
18687 "LATEX_CLASS_OPTIONS" and "LATEX_HEADER". It also introduces
18688 "BEGIN_LATEX" and "BEGIN_TEX" blocks (the latter being just a synonym
18689 for the former). It would be worth to add that it handles footnotes in
18690 item tags and footnotes within footnotes. It also handles booktabs,
18691 paralist types, automatic babel language selection with #+LANGUAGE: in
18692 addition to already present features (minted/listings package handling).
18694 ***** TODO Write LaTeX back-end
18695 **** Beamer Back-end
18696 The BEAMER export back-end deserves, IMO, its own section.
18698 ***** TODO Write Beamer back-end
18699 **** TexInfo Back-end
18700 > BTW, it would be great to have a texinfo exporter so the Org
18701 > documentation could be written in Org-mode :)
18703 There is one, albeit barely tested: (require 'org-e-texinfo).
18705 though texinfo back-end can export to DocBook
18707 ***** TODO Write texinfo backend
18708 *** Export dispatcher
18709 I think that the export dispatcher doesn't deserve its own section. The
18710 introduction to Export subsystem can talk about "M-x
18711 org-export-dispatch" (bound to C-c C-e) instead.
18712 **** TODO Remove export dispatcher section
18715 There should be a section about smart-quotes too.
18717 **** TODO Add smart quotes section
18719 * Org-mode setup :noexport:
18721 #+name: setup-editing
18722 #+header: :results silent
18723 #+header: :noweb yes
18724 #+header: :eval no-export
18725 #+begin_src emacs-lisp
18726 (require 'ox-texinfo)
18727 (define-key org-mode-map (kbd "C-c e") 'org-export-dispatch)
18728 (setq org-src-preserve-indentation t)
18729 (setq org-export-in-background t)
18730 (setq org-export-async-debug t)
18731 (setq org-export-async-init-file (expand-file-name "init.el"))
18732 (setq org-pretty-entities nil)
18733 (setq org-footnote-auto-adjust nil)
18734 (setq org-confirm-babel-evaluate nil)
18735 (org-babel-do-load-languages
18736 'org-babel-load-languages
18741 (lambda (path desc format)
18744 (format "<span class=\"pxref\">%s</span>" path))
18745 ((eq format 'latex)
18746 (format "\\ref{%s}" path))
18747 ((eq format 'texinfo)
18748 (format "@pxref{%s,%s}" path desc)))))
18749 (add-to-list 'org-export-snippet-translation-alist
18750 '("info" . "texinfo"))
18754 This source code block requires paths to your Org mode installation.
18755 Modify accordingly.
18758 #+header: :tangle init.el
18759 #+header: :results silent
18760 #+header: :eval no-export
18761 #+begin_src emacs-lisp
18762 (setq load-path (cons "~/.emacs.d/src/org-mode/lisp" load-path))
18763 ; (setq load-path (cons "~/.emacs.d/src/org-mode/contrib/lisp" load-path))
18764 (require 'ox-texinfo)
18765 (setq org-src-preserve-indentation t)
18766 (setq org-confirm-babel-evaluate nil)
18767 (setq org-footnote-auto-adjust nil)
18768 (org-babel-do-load-languages
18769 'org-babel-load-languages
18773 (add-to-list 'org-export-snippet-translation-alist
18774 '("info" . "texinfo"))
18777 ** Texi -> Org helpers :noexport:
18778 This section contains source code blocks that help translate from
18779 =texinfo= to =Org=.
18781 #+name: tsd-helpers
18782 #+header: :noweb yes
18783 #+header: :eval no-export
18784 #+begin_src emacs-lisp
18785 <<tsd-index-to-macro>>
18786 <<tsd-samp-to-macro>>
18787 <<tsd-kbdkey-to-macro>>
18788 <<tsd-kbd-to-macro>>
18789 <<tsd-key-to-macro>>
18790 <<tsd-command-to-macro>>
18791 <<tsd-file-to-macro>>
18793 <<tsd-example-block-begin>>
18794 <<tsd-example-block-end>>
18795 <<tsd-table-begin>>
18802 <<tsd-code-to-markup>>
18803 <<tsd-emph-to-markup>>
18804 <<tsd-i-to-markup>>
18809 #+results: tsd-helpers
18812 #+name: tsd-index-to-macro
18813 #+header: :results silent
18814 #+header: :eval no-export
18815 #+begin_src emacs-lisp
18816 (defun tsd-index-to-macro ()
18817 "Make macros out of @[cpfvk]index commands. Doesn't handle commas."
18819 (query-replace-regexp "@\\([cpfvk]\\)index\\ \\(.*\\)$" "{{{\\1index(\\2)}}}" nil))
18822 #+name: tsd-samp-to-macro
18823 #+header: :results silent
18824 #+header: :eval no-export
18825 #+begin_src emacs-lisp
18826 (defun tsd-samp-to-macro ()
18827 "Make macros out of @samp commands."
18829 (query-replace-regexp "@samp{\\([^}]*\\)}" "{{{samp(\\1)}}}" nil))
18832 #+name: tsd-kbdkey-to-macro
18833 #+header: :results silent
18834 #+header: :eval no-export
18835 #+begin_src emacs-lisp
18836 (defun tsd-kbdkey-to-macro ()
18837 "Make macros out of @kbd,@key commands."
18839 (query-replace-regexp "@kbd{\\([^@]*\\)@key{\\([^}]*\\)}}" "{{{kbdkey(\\1,\\2)}}}" nil))
18842 #+name: tsd-kbd-to-macro
18843 #+header: :results silent
18844 #+header: :eval no-export
18845 #+begin_src emacs-lisp
18846 (defun tsd-kbd-to-macro ()
18847 "Make macros out of @kbd commands."
18849 (query-replace-regexp "@kbd{\\([^}]*\\)}" "{{{kbd(\\1)}}}" nil))
18852 #+name: tsd-key-to-macro
18853 #+header: :results silent
18854 #+header: :eval no-export
18855 #+begin_src emacs-lisp
18856 (defun tsd-key-to-macro ()
18857 "Make macros out of @key commands."
18859 (query-replace-regexp "@key{\\([^}]*\\)}" "{{{key(\\1)}}}" nil))
18862 #+name: tsd-command-to-macro
18863 #+header: :results silent
18864 #+header: :eval no-export
18865 #+begin_src emacs-lisp
18866 (defun tsd-command-to-macro ()
18867 "Make macros out of @command commands."
18869 (query-replace-regexp "@command{\\([^}]*\\)}" "{{{command(\\1)}}}" nil))
18872 #+name: tsd-file-to-macro
18873 #+header: :results silent
18874 #+header: :eval no-export
18875 #+begin_src emacs-lisp
18876 (defun tsd-file-to-macro ()
18877 "Make macros out of @file commands."
18879 (query-replace-regexp "@file{\\([^}]*\\)}" "{{{file(\\1)}}}" nil))
18882 #+name: tsd-noindent
18883 #+header: :results silent
18884 #+header: :eval no-export
18885 #+begin_src emacs-lisp
18886 (defun tsd-noindent ()
18887 "Make macros out of @noindent commands."
18889 (query-replace "@noindent" "{{{noindent}}}" t))
18892 #+name: tsd-example-block-begin
18893 #+header: :results silent
18894 #+header: :eval no-export
18895 #+begin_src emacs-lisp
18896 (defun tsd-example-block-begin ()
18897 "Convert example blocks."
18899 (query-replace "@example" "#+begin_example" t))
18902 #+name: tsd-example-block-end
18903 #+header: :results silent
18904 #+header: :eval no-export
18905 #+begin_src emacs-lisp
18906 (defun tsd-example-block-end ()
18907 "Convert example blocks."
18909 (query-replace "@end example" "#+end_example" nil))
18912 #+name: tsd-table-begin
18913 #+header: :results silent
18914 #+header: :eval no-export
18915 #+begin_src emacs-lisp
18916 (defun tsd-table-begin ()
18917 "Convert table blocks."
18919 (query-replace-regexp "@table\\ \\([@a-z]*\\)" "#+attr_texinfo: :table-type table :indic \\1 t))
18922 #+name: tsd-table-end
18923 #+header: :results silent
18924 #+header: :eval no-export
18925 #+begin_src emacs-lisp
18926 (defun tsd-table-end ()
18927 "Convert table blocks."
18929 (query-replace "@end table" "" nil))
18933 #+header: :results silent
18934 #+header: :eval no-export
18935 #+begin_src emacs-lisp
18936 (defun tsd-pxref ()
18937 "Convert @pxref to links."
18939 (query-replace-regexp "@pxref{\\([^}]*\\)}" "see \[\[\\1\]\]" nil))
18943 #+header: :results silent
18944 #+header: :eval no-export
18945 #+begin_src emacs-lisp
18947 "Convert @xref to links."
18949 (query-replace-regexp "@xref{\\([^}]*\\)}" "See \[\[\\1\]\]" nil))
18953 #+header: :results silent
18954 #+header: :eval no-export
18955 #+begin_src emacs-lisp
18957 "Convert @ref to links."
18959 (query-replace-regexp "@ref{\\([^}]*\\)}" "\[\[\\1\]\]" nil))
18963 #+header: :results silent
18964 #+header: :eval no-export
18965 #+begin_src emacs-lisp
18966 (defun tsd-orgcmd ()
18967 "Convert @orgcmd to list entry."
18969 (query-replace-regexp "@orgcmd{\\([^,]*\\),\\([^}]*\\)}" "- {{{kbd(\\1)}}}, ~\\2~ ::" nil))
18973 #+header: :results silent
18974 #+header: :eval no-export
18975 #+begin_src emacs-lisp
18976 (defun tsd-orgkey ()
18977 "Convert @orgkey to list entry."
18979 (query-replace-regexp "@orgkey{\\([^}]*\\)}" "- {{{kbd(\\1)}}} ::" nil))
18982 #+name: tsd-code-to-markup
18983 #+header: :results silent
18984 #+header: :eval no-export
18985 #+begin_src emacs-lisp
18986 (defun tsd-code-to-markup ()
18987 "Convert @code to markup."
18989 (query-replace-regexp "@code{\\([^}]*\\)}" "~\\1~" nil))
18992 #+name: tsd-emph-to-markup
18993 #+header: :results silent
18994 #+header: :eval no-export
18995 #+begin_src emacs-lisp
18996 (defun tsd-emph-to-markup ()
18997 "Convert @emph to markup."
18999 (query-replace-regexp "@emph{\\([^}]*\\)}" "/\\1/" nil))
19002 #+name: tsd-i-to-markup
19003 #+header: :results silent
19004 #+header: :eval no-export
19005 #+begin_src emacs-lisp
19006 (defun tsd-i-to-markup ()
19007 "Convert @i to markup."
19009 (query-replace-regexp "@i{\\([^}]*\\)}" "/\\1/" nil))
19012 #+name: tsd-b-to-markup
19013 #+header: :results silent
19014 #+header: :eval no-export
19015 #+begin_src emacs-lisp
19016 (defun tsd-b-to-markup ()
19017 "Convert @b to markup."
19019 (query-replace-regexp "@b{\\([^}]*\\)}" "*\\1*" nil))
19022 #+name: tsd-lisp-begin
19023 #+header: :results silent
19024 #+header: :eval no-export
19025 #+begin_src emacs-lisp
19026 (defun tsd-lisp-begin ()
19027 "Convert @lisp blocks."
19029 (query-replace "@lisp" "#+begin_src emacs-lisp" t))
19032 #+name: tsd-lisp-end
19033 #+header: :results silent
19034 #+header: :eval no-export
19035 #+begin_src emacs-lisp
19036 (defun tsd-lisp-end ()
19037 "Convert @lisp blocks."
19039 (query-replace "@end lisp" "#+end_src" nil))
19044 [fn:1] The iCalendar file will contain TODO and agenda items only.
19046 [fn:2] If your Emacs distribution does not come with Org,
19047 the function ~org-version~ will not be defined.
19049 [fn:3] The ~master~ branch is where development takes place.
19051 [fn:4] The output from install-info (if any) is system dependent. In
19052 particular, Debian and its derivatives use two different versions of
19053 install-info. You may safely ignore the message:
19055 This is not dpkg install-info anymore, but GNU install-info
19056 See the man page for ginstall-info for command line arguments
19058 returned by install-info.
19060 [fn:5] If you don't use font-lock globally, turn it on in an Org
19061 buffer with ~(add-hook 'org-mode-hook 'turn-on-font-lock)~.
19063 [fn:6] Please consider subscribing to the mailing list in order to
19064 minimize the work the mailing list moderators have to do.
19066 [fn:7] Easy templates insert lowercase keywords and Babel dynamically
19067 inserts ~#+results~.
19069 [fn:8] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
19070 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
19071 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines. Note
19072 also that clocking only works with headings indented less than 30
19075 [fn:9] See the option ~org-cycle-global-at-bob~.
19077 [fn:10] The indirect buffer will contain the entire buffer, but will
19078 be narrowed to the current tree. Editing the indirect buffer will also
19079 change the original buffer, but without affecting visibility in that
19080 buffer. For more information about indirect buffers,
19081 [[info:emacs:Indirect Buffers][GNU Emacs Manual]].
19083 [fn:11] If you do not want the line to be split, customize the
19084 variable ~org-M-RET-may-split-line~.
19086 [fn:12] See also the variables ~org-show-hierarchy-above~,
19087 ~org-show-following-heading~, ~org-show-siblings~, and
19088 ~org-show-entry-below~ for detailed control on how much context is
19089 shown around each match.
19091 [fn:13] This depends on the option ~org-remove-highlights-with-change~.
19093 [fn:14] This does not work under XEmacs, because XEmacs uses selective
19094 display for outlining, not text properties.
19096 [fn:15] When using ~*~ as a bullet, lines must be indented or they will
19097 be seen as top-level headlines. Also, when you are hiding leading
19098 stars to get a clean outline view, plain list items starting with a
19099 star may be hard to distinguish from true headlines. In short: even
19100 though ~*~ is supported, it may be better to not use it for plain list
19103 [fn:16] You can filter out any of them by configuring
19104 ~org-plain-list-ordered-item-terminator~.
19106 [fn:17] If there's a checkbox in the item, the cookie must be put
19107 _before_ the checkbox. If you have activated alphabetical lists, you
19108 can also use counters like ~[@b]~.
19110 [fn:18] Org only changes the filling settings for Emacs. For XEmacs,
19111 you should use Kyle E. Jones' {{{file(filladapt.el)}}}.
19113 [fn:19] If you do not want the item to be split, customize the
19114 variable ~org-M-RET-may-split-line~.
19116 [fn:20] If you want to cycle around items that way, you may customize
19117 ~org-list-use-circular-motion~.
19119 [fn:21] See ~org-list-use-circular-motion~ for a cyclic behavior.
19121 [fn:24] Centering does not work inside Emacs, but it does have an
19122 effect when exporting to HTML.
19124 [fn:26] For backward compatibility you can also use special names like
19125 ~$LR5~ and ~$LR12~ to refer in a stable way to the fifth and twelfth
19126 field in the last row of the table. However, this syntax is
19127 deprecated, it should not be used for new documents. Use ~@>$~
19130 [fn:25] Org will understand references typed by the user as
19131 {{{samp(B4)}}}, but it will not use this syntax when offering a
19132 formula for editing. You can customize this behavior using the
19133 variable ~org-table-use-standard-references~.
19135 [fn:22] To insert a vertical bar into a table field, use ~\vert~ or,
19136 inside a word ~abc\vert{}def~.
19138 [fn:23] This feature does not work on XEmacs.
19140 [fn:27] The computation time scales as O(N^2) because table FOO is
19141 parsed for each field to be copied.
19143 [fn:28] The {{{file(calc)}}} package has the non-standard
19144 convention that ~/~ has lower precedence than ~*~, so that ~a/b*c~ is
19145 interpreted as ~a/(b*c)~.
19147 [fn:29] The ~printf~ reformatting is limited in precision because the
19148 value passed to it is converted into an ~integer~ or ~double~. The
19149 ~integer~ is limited in size by truncating the signed value to 32
19150 bits. The ~double~ is limited in precision to 64 bits overall which
19151 leaves approximately 16 significant decimal digits.
19153 [fn:30] Such names must start with an alphabetic character and use
19154 only alphanumeric/underscore characters.
19156 [fn:31] Note that text before the first headline is usually not
19157 exported, so the first such target should be after the first headline,
19158 or in the line directly before the first headline.
19160 [fn:32] To insert a link targeting a headline, in-buffer completion
19161 can be used. Just type a star followed by a few optional letters into
19162 the buffer and press {{{kbdkey(M-,TAB)}}}. All headlines in the
19163 current buffer will be offered as completions.
19165 [fn:33] The actual behavior of the search will depend on the value of
19166 the variable ~org-link-search-must-match-exact-headline~. If its value
19167 is ~nil~, then a fuzzy text search will be done. If it is ~t~, then
19168 only the exact headline will be matched. If the value is
19169 {{{samp('query-to-create)}}}, then an exact headline will be searched;
19170 if it is not found, then the user will be queried to create it.
19172 [fn:34] If the headline contains a timestamp, it will be removed from
19173 the link and result in a wrong link -- you should avoid putting a
19174 timestamp in the headline.
19176 [fn:35] Note that you don't have to use this command to insert a link.
19177 Links in Org are plain text, and you can type or paste them straight
19178 into the buffer. By using this command, the links are automatically
19179 enclosed in double brackets, and you will be asked for the optional
19182 [fn:36] After insertion of a stored link, the link will be removed
19183 from the list of stored links. To keep it in the list later use, use a
19184 triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
19185 configure the option ~org-keep-stored-link-after-insertion~.
19187 [fn:37] This works if a function has been defined in the ~:complete~
19188 property of a link in ~org-link-parameters~.
19190 [fn:38] See the variable ~org-display-internal-link-with-indirect-buffer~.
19192 [fn:44] Check also the variable ~org-fast-tag-selection-include-todo~,
19193 it allows you to change the TODO state through the tags interface
19194 ([[Setting tags]]), in case you like to mingle the two concepts. Note that
19195 this means you need to come up with unique keys across both sets of
19198 [fn:39] For backward compatibility, line numbers can also follow a
19201 [fn:40] Of course, you can make a document that contains only long
19202 lists of TODO items, but this is not required.
19204 [fn:41] Changing the variable ~org-todo-keywords~ only becomes
19205 effective after restarting Org mode in a buffer.
19207 [fn:42] This is also true for the {{{kbd(t)}}} command in the timeline
19208 and agenda buffers.
19210 [fn:43] All characters are allowed except ~@^!~, which have a special
19213 [fn:45] Org mode parses these lines only when Org mode is activated
19214 after visiting a file. {{{kbd(C-c C-c)}}} with the cursor in a line
19215 starting with {{{samp(#+)}}} is simply restarting Org mode for the
19218 [fn:46] The corresponding in-buffer setting is: ~#+STARTUP: logdone~.
19220 [fn:47] The corresponding in-buffer setting is: ~#+STARTUP: lognotedone~.
19222 [fn:48] See the variable ~org-log-states-order-reversed~.
19224 [fn:54] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
19225 checkbox will add checkboxes to the rest of the list.
19227 [fn:49] It is possible that Org mode will record two timestamps when
19228 you are using both ~org-log-done~ and state change logging. However,
19229 it will never prompt for two notes---if you have configured both, the
19230 state change recording note will take precedence and cancel the
19231 {{{samp(Closing Note)}}}.
19233 [fn:50] See also the option ~org-priority-start-cycle-with-default~.
19235 [fn:51] To keep subtasks out of the global TODO list, see the
19236 ~org-agenda-todo-list-sublevels~.
19238 [fn:52] With the exception of description lists. But you can allow it
19239 by modifying ~org-list-automatic-rules~ accordingly.
19241 [fn:53] Set the variable ~org-hierarchical-checkbox-statistics~ if you
19242 want such cookies to count all checkboxes below the cookie, not just
19243 those belonging to direct children.
19245 [fn:55] As with all these in-buffer settings, pressing
19246 {{{kbd(C-c C-c)}}} activates any changes in the line.
19248 [fn:56] This is only true if the search does not involve more complex
19249 tests including properties (see [[Property searches]]).
19251 [fn:57] Keys will automatically be assigned to tags that have no
19254 [fn:58] Please note that the COLUMNS definition must be on a single
19255 line---it is wrapped here only because of formatting constraints.
19257 [fn:59] Contributed packages are not part of Emacs, but are
19258 distributed with the main distribution of Org (visit
19259 [[http://orgmode.org]]).
19261 [fn:60] The Org date format is inspired by the standard ISO 8601
19262 date/time format. To use an alternative format, see [[Custom time
19263 format]]. The day name is optional when you type the date yourself.
19264 However, any dates inserted or modified by Org will add that day name,
19265 for reading convenience.
19267 [fn:61] When working with the standard diary sexp functions, you need
19268 to be very careful with the order of the arguments. That order depends
19269 evilly on the variable ~calendar-date-style~ (or, for older Emacs
19270 versions, ~european-calendar-style~). For example, to specify a date
19271 December 12, 2005, the call might look like ~(diary-date 12 1 2005)~
19272 or ~(diary-date 1 12 2005)~ or ~(diary-date 2005 12 1)~, depending on
19273 the settings. This has been the source of much confusion. Org mode
19274 users can resort to special versions of these functions like
19275 ~org-date~ or ~org-anniversary~. These work just like the
19276 corresponding ~diary-~ functions, but with stable ISO order of
19277 arguments (year, month, day) wherever applicable, independent of the
19278 value of ~calendar-date-style~.
19280 [fn:62] See the variable ~org-read-date-prefer-future~. You may
19281 set that variable to the symbol ~time~ to even make a time before now
19282 shift the date to tomorrow.
19284 [fn:63] If you don't need/want the calendar, configure the variable
19285 ~org-popup-calendar-for-date-prompt~.
19287 [fn:64] If you find this distracting, turn off the display with
19288 ~org-read-date-display-live~.
19290 [fn:65] It will still be listed on that date after it has been marked
19291 DONE. If you don't like this, set the variable
19292 ~org-agenda-skip-scheduled-if-done~.
19294 [fn:66] The {{{samp(SCHEDULED)}}} and {{{samp(DEADLINE)}}} dates are
19295 inserted on the line right below the headline. Don't put any text
19296 between this line and the headline.
19298 [fn:67] Note the corresponding ~#+STARTUP~ keywords ~logredeadline~,
19299 ~lognoteredeadline~, and ~nologredeadline~.
19301 [fn:68] Note the corresponding ~#+STARTUP~ keywords ~logreschedule~,
19302 ~lognotereschedule~, and ~nologreschedule~.
19304 [fn:69] In fact, the target state is taken from, in this sequence, the
19305 ~REPEAT_TO_STATE~ property or the variable ~org-todo-repeat-to-state~.
19306 If neither of these is specified, the target state defaults to the
19307 first state of the TODO state sequence.
19309 [fn:70] You can change this using the option ~org-log-repeat~, or the
19310 ~#+STARTUP~ options ~logrepeat~, ~lognoterepeat~, and ~nologrepeat~.
19311 With ~lognoterepeat~, you will also be prompted for a note.
19313 [fn:71] Clocking only works if all headings are indented with less
19314 than 30 stars. This is a hardcoded limitation of ~lmax~ in
19317 [fn:72] To resume the clock under the assumption that you have worked
19318 on this task while outside Emacs, use ~(setq org-clock-persist t)~.
19320 [fn:73] To add an effort estimate ``on the fly'', hook a function
19321 doing this to ~org-clock-in-prepare-hook~.
19323 [fn:74] The last reset of the task is recorded by the ~LAST_REPEAT~
19326 [fn:75] See also the variable ~org-clock-modeline-total~.
19328 [fn:76] The corresponding in-buffer setting is:
19329 ~#+STARTUP: lognoteclock-out~.
19331 [fn:77] Language terms can be set through the variable
19332 ~org-clock-clocktable-language-setup~.
19334 [fn:78] Note that all parameters must be specified in a single
19335 line---the line is broken here only to fit it into the manual.
19337 [fn:79] On computers using Mac OS X, idleness is based on actual user
19338 idleness, not just Emacs' idle time. For X11, you can install a
19339 utility program {{{file(x11idle.c)}}}, available in the
19340 ~contrib/scripts~ directory of the Org git distribution, to get the
19341 same general treatment of idleness. On other systems, idle time refers
19342 to Emacs idle time only.
19344 [fn:80] You may change the property being used with the variable
19345 ~org-effort-property~.
19347 [fn:86] Note the corresponding ~#+STARTUP~ keywords ~logrefile~,
19348 ~lognoterefile~, and ~nologrefile~.
19350 [fn:81] Please select your own key, {{{kbd(C-c c)}}} is only a
19353 [fn:82] If you need one of these sequences literally, escape the
19354 {{{kbd(%)}}} with a backslash.
19356 [fn:83] If you define your own link types (see [[Adding hyperlink
19357 types]]), any property you store with ~org-store-link-props~ can be
19358 accessed in capture templates in a similar way.
19360 [fn:84] This will always be the other, not the user. See the variable
19361 ~org-from-is-user-regexp~.
19363 [fn:85] If you move entries or Org files from one directory to
19364 another, you may want to configure ~org-attach-directory~ to contain
19367 [fn:87] For backward compatibility, the following also works: If there
19368 are several such lines in a file, each specifies the archive location
19369 for the text below it. The first such line also applies to any text
19370 before its definition. However, using this method is /strongly/
19371 deprecated as it is incompatible with the outline structure of the
19372 document. The correct method for setting multiple archive locations in
19373 a buffer is using properties.
19375 [fn:94] Only tags filtering will be respected here, effort filtering
19378 [fn:88] When using the dispatcher, pressing {{{kbd(<)}}} before
19379 selecting a command will actually limit the command to the current
19380 file, and ignore ~org-agenda-files~ until the next dispatcher command.
19382 [fn:89] For backward compatibility, you can also press {{{kbd(1)}}} to
19383 restrict to the current buffer.
19385 [fn:90] For backward compatibility, you can also press {{{kbd(0)}}} to
19386 restrict to the current region/subtree.
19388 [fn:91] For backward compatibility, the universal prefix
19389 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
19390 This feature is deprecated, use the dedicated TODO list, or a block
19391 agenda instead (see [[Block agenda]]).
19393 [fn:92] But see [[x-agenda-skip-entry-regexp][skipping entries based on regexp]].
19395 [fn:93] For backward compatibility, the following also works: if
19396 there are several such lines in a file, each specifies the category
19397 for the text below it. The first category also applies to any text
19398 before the first CATEGORY line. However, using this method is
19399 /strongly/ deprecated as it is incompatible with the outline structure
19400 of the document. The correct method for setting multiple categories in
19401 a buffer is using a property.
19403 [fn:95] Custom commands can preset a filter by binding the variable
19404 ~org-agenda-tag-filter-preset~ as an option. This filter will then be
19405 applied to the view and persist as a basic filter through refreshes
19406 and more secondary filtering. The filter is a global property of the
19407 entire agenda view---in a block agenda, you should only set this in
19408 the global options section, not in the section of an individual block.
19410 [fn:96] You can also create persistent custom functions through
19411 ~org-agenda-bulk-custom-functions~.
19413 [fn:97] The Emacs diary file is parsed for the agenda when
19414 ~org-agenda-include-diary~ is set.
19416 [fn:98] You can provide a description for a prefix key by inserting a
19417 cons cell with the prefix and the description.
19419 [fn:99] For HTML you need to install Hrvoje Niksic's
19420 {{{file(htmlize.el)}}}. To create PDF output, the ghostscript
19421 {{{file(ps2pdf)}}} utility must be installed on the system. Selecting
19422 a PDF file will also create the postscript file.
19424 [fn:100] If you want to store standard views like the weekly agenda or
19425 the global TODO list as well, you need to define custom commands for
19426 them in order to be able to specify file names.
19428 [fn:101] Quoting depends on the system you use, please check the FAQ
19431 [fn:102] This works automatically for the HTML backend (it requires
19432 version 1.34 of the {{{file(htmlize.el)}}} package, which is
19433 distributed with Org). Fontified code chunks in LaTeX can be
19434 achieved using either the listings package or the [[http://code.google.com/p/minted][minted]] package.
19435 Refer to ~org-export-latex-listings~ documentation for details.
19437 [fn:103] Code in {{{samp(src)}}} blocks may also be evaluated either
19438 interactively or on export. See [[Working with source code]] for more
19439 information on evaluating code blocks.
19441 [fn:104] Adding ~-k~ to ~-n -r~ will /keep/ the labels in the source
19442 code while using line numbers for the links, which might be useful to
19443 explain those in an Org mode example code.
19445 [fn:105] Upon exit, lines starting with {{{samp(*)}}}, {{{samp(\,*)}}},
19446 {{{samp(#+)}}} and {{{samp(\,#+)}}} will get a comma prepended, to keep
19447 them from being interpreted by Org as outline nodes or special syntax.
19448 These commas will be stripped for editing with {{{kbd(C-c ')}}}, and
19451 [fn:106] You may select a different-mode with the variable
19452 ~org-edit-fixed-width-region-mode~.
19454 [fn:107] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
19455 system. Many of the features described here as LaTeX are really
19456 from TeX, but for simplicity I am blurring this distinction.
19458 [fn:108] You can turn this on by default by setting the variable
19459 ~org-pretty-entities~, or on a per-file base with the ~#+STARTUP~
19460 option ~entitiespretty~.
19462 [fn:109] If you plan to use this regularly or on pages with
19463 significant page views, you should install {{{file(MathJax)}}} on your
19464 own server in order to limit the load of our server.
19466 [fn:110] For this to work you need to be on a system with a working
19467 LaTeX installation. You also need the {{{file(dvipng)}}} program or
19468 the {{{file(convert)}}}, respectively available at
19469 [[http://sourceforge.net/projects/dvipng/]] and from the
19470 {{{file(ImageMagick)}}} suite. The LaTeX header that will be used
19471 when processing a fragment can be configured with the variable
19472 ~org-format-latex-header~.
19474 [fn:111] When {{{file(MathJax)}}} is used, only the environment
19475 recognized by {{{file(MathJax)}}} will be processed. When
19476 {{{file(dvipng)}}} is used to create images, any LaTeX environments
19479 [fn:112] Org mode has a method to test if the cursor is inside such a
19480 fragment, see the documentation of the function
19481 ~org-inside-LaTeX-fragment-p~.
19483 [fn:113] The variable ~org-export-date-timestamp-format~ defines how
19484 this timestamp will be exported.
19486 [fn:114] If you want to configure many options this way, you can use
19487 several ~#+OPTIONS~ lines.
19489 [fn:115] To make this behavior the default, customize the variable
19490 ~org-export-run-in-background~.
19492 [fn:116] This requires ~transient-mark-mode~ be turned on.
19494 [fn:117] To select the current subtree, use {{{kbd(C-c @)}}}.
19496 [fn:118] This requires ~transient-mark-mode~ be turned on.
19498 [fn:119] To select the current subtree, use {{{kbd(C-c @)}}}.
19500 [fn:120] But see the variable ~org-export-html-inline-images~.
19502 [fn:121] If you plan to use this regularly or on pages with
19503 significant page views, you should install MathJax on your own server
19504 in order to limit the load of our server. Installation instructions
19505 can be found on the MathJax website, see
19506 [[http://www.mathjax.org/resources/docs/?installation.html]].
19508 [fn:122] If the classes on TODO keywords and tags lead to conflicts,
19509 use the variables ~org-export-html-todo-kwd-class-prefix~ and
19510 ~org-export-html-tag-class-prefix~ to make them unique.
19512 [fn:123] This style is defined in the constant
19513 ~org-export-html-style-default~, which you should not modify. To turn
19514 inclusion of these defaults off, customize
19515 ~org-export-html-style-include-default~.
19517 [fn:124] The default LaTeX output is designed for processing with
19518 ~pdftex~ or LaTeX. It includes packages that are not compatible
19519 with ~xetex~ and possibly ~luatex~. See the variables
19520 ~org-export-latex-default-packages-alist~ and
19521 ~org-export-latex-packages-alist~.
19523 [fn:125] This requires ~transient-mark-mode~ be turned on.
19525 [fn:126] To select the current subtree, use {{{kbd(C-c @)}}}.
19527 [fn:127] Into which the values of
19528 ~org-export-latex-default-packages-alist~ and
19529 ~org-export-latex-packages-alist~ are spliced.
19531 [fn:128] One can also take advantage of this option to pass other,
19532 unrelated options into the figure or table environment. For an example
19533 see the section ``Exporting org files'' in
19534 [[http://orgmode.org/worg/org-hacks.html]].
19536 [fn:129] This requires ~transient-mark-mode~ to be turned on.
19538 [fn:130] To select the current subtree, use {{{kbd(C-c @)}}}.
19540 [fn:131] ODT export was added in Org mode version 7.8.
19542 [fn:132] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications (OpenDocument)
19545 [fn:133] This requires ~transient-mark-mode~ to be turned on.
19547 [fn:134] To select the current subtree, use {{{kbd(C-c @)}}}.
19549 [fn:135] The column widths are interpreted as weighted ratios with the
19550 default weight being 1.
19552 [fn:136] Use of {{{file(ImageMagick)}}} is only desirable. However, if
19553 you routinely produce documents that have large images or you export
19554 your Org files that has images using a Emacs batch script, then the
19555 use of {{{file(ImageMagick)}}} is mandatory.
19557 [fn:137] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
19559 [fn:138] Your {{{file(htmlfontify.el)}}} library must at least be at
19560 Emacs 24.1 levels for fontification to be turned on.
19562 [fn:139] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]].
19564 [fn:140] See the ~<table:table-template>~ element of the
19565 OpenDocument-v1.2 specification.
19567 [fn:141] See the attributes ~table:template-name~,
19568 ~table:use-first-row-styles~, ~table:use-last-row-styles~,
19569 ~table:use-first-column-styles~, ~table:use-last-column-styles~,
19570 ~table:use-banding-rows-styles~, and ~table:use-banding-column-styles~
19571 of the ~<table:table>~ element in the OpenDocument-v1.2 specification.
19573 [fn:142] Note that {{{file(.odt)}}} files are {{{samp(zip)}}}
19576 [fn:143] See the variables ~org-icalendar-use-deadline~ and
19577 ~org-icalendar-use-scheduled~.
19579 [fn:144] To add inherited tags or the TODO state, configure the
19580 variable ~org-icalendar-categories~.
19582 [fn:145] The LOCATION property can be inherited from higher in the
19583 hierarchy if you configure ~org-use-property-inheritance~ accordingly.
19585 [fn:146] The files {{{file(file-source.org)}}} and
19586 {{{file(file-source.org.html)}}} if source and publishing directories
19587 are equal. Note that with this kind of setup, you need to add
19588 ~:exclude "-source\\.org"~ to the project definition in
19589 ~org-publish-project-alist~ to prevent the published source files from
19590 being considered as new org files the next time the project is
19593 [fn:147] Note that {{{samp(src)}}} blocks may be inserted using Org
19594 mode's [[Easy templates]] system.
19596 [fn:148] Whenever code is evaluated there is a potential for that code
19597 to do harm. Org mode provides safeguards to ensure that code is only
19598 evaluated after explicit confirmation from the user. For information
19599 on these safeguards (and on how to disable them) see [[Code evaluation
19602 [fn:149] The ~org-babel-no-eval-on-ctrl-c-ctrl-c~ variable can be used
19603 to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
19605 [fn:150] Note that evaluation of header arguments is guaranteed to
19606 take place in the original Org mode file, while there is no such
19607 guarantee for evaluation of the code block body.
19609 [fn:151] The example requires that property inheritance be turned on
19610 for the ~noweb-ref~ property, see [[Property inheritance]].
19612 [fn:152] In certain languages this also contains the error output
19613 stream; this is an area for future work.
19615 [fn:153] The last evaluation performed by the interpreter is obtained
19616 in a language-specific manner: the value of the variable ~_~ in Python
19617 and Ruby, and the value of ~.Last.value~ in R.
19619 [fn:161] If the {{{samp(#+TBLFM)}}} line contains an odd number of
19620 dollar characters, this may cause problems with font-lock in LaTeX
19621 mode. As shown in the example you can fix this by adding an extra line
19622 inside the ~comment~ environment that is used to balance the dollar
19623 expressions. If you are using AUCTeX with the font-latex library, a
19624 much better solution is to add the ~comment~ environment to the
19625 variable ~LaTeX-verbatim-environments~.
19627 [fn:162] The HTML translator uses the same code that produces tables
19628 during HTML export.
19630 [fn:154] Note that ~org-indent-mode~ also sets the ~wrap-prefix~
19631 property, such that ~visual-line-mode~ (or purely setting ~word-wrap~)
19632 wraps long lines (including headlines) correctly indented.
19634 [fn:155] See the variable ~org-indent-indentation-per-level~.
19636 [fn:156] Turning on ~org-indent-mode~ sets ~org-hide-leading-stars~ to
19637 ~t~ and ~org-adapt-indentation~ to ~nil~.
19639 [fn:157] See also the variable ~org-adapt-indentation~.
19641 [fn:158] When you need to specify a level for a property search or
19642 refile targets, ~LEVEL=2~ will correspond to 3 stars, etc.
19644 [fn:159] The {{{file(org-R.el)}}} package has been replaced by the
19645 Org mode functionality described in [[Working with source code]] and is
19648 [fn:160] By default this works only for LaTeX, HTML, and Texinfo.
19649 Configure the variable ~orgtbl-radio-tables~ to install templates for
19652 [fn:163] Note that, when using ~org-odd-levels-only~, a level number
19653 corresponds to order in the hierarchy, not to the number of stars.
19655 [fn:164] If you can safely store the password in your Emacs setup, you
19656 might also want to configure `org-mobile-encryption-password'. Please
19657 read the docstring of that variable. Note that encryption will apply
19658 only to the contents of the `.org' files. The file names themselves
19659 will remain visible.
19661 [fn:165] If you cannot use Dropbox, or if your version of MobileOrg
19662 does not support it, you can use a webdav server. For more
19663 information, check out the documentation of MobileOrg and also this
19664 [[http://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
19666 [fn:166] While creating the agendas, Org mode will force ID properties
19667 on all referenced entries, so that these entries can be uniquely
19668 identified if /MobileOrg/ flags them for further action. If you do not
19669 want to get these properties in so many entries, you can set the
19670 variable ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode will
19671 then rely on outline paths, in the hope that these will be unique
19674 [fn:167] Checksums are stored automatically in the file
19675 {{{file(checksums.dat)}}}.
19677 [fn:168] The file {{{file(mobileorg.org)}}} will be empty after this
19680 [fn:169] Note, however, that there is a subtle difference. The view
19681 created automatically by {{{kbdspckey(M-x org-mobile-pull,RET)}}} is
19682 guaranteed to search all files that have been addressed by the last
19683 pull. This might include a file that is not currently in your list of
19684 agenda files. If you later use {{{kbd(C-c a ?)}}} to regenerate the
19685 view, only the current agenda files will be searched.
19687 [fn:170] You can also get `a.', `A.', `a)' and `A)' by configuring
19688 `org-alphabetical-lists'. To minimize confusion with normal text,
19689 those are limited to one character only. Beyond that limit, bullets
19690 will automatically fallback to numbers.
19692 [fn:171] See also ~org-empty-line-terminates-plain-lists~.
19694 [fn:172] You can define additional drawers on a per-file basis with a
19695 line like ~#+DRAWERS: HIDDEN STATE~.
19697 [fn:173] The corresponding in-buffer setting is: ~#+STARTUP: fninline~ or
19698 ~#+STARTUP: nofninline~.
19700 [fn:174] The corresponding in-buffer options are ~#+STARTUP: fnadjust~ and
19701 ~#+STARTUP: nofnadjust~.
19703 [fn:175] The file {{{file(constants.el)}}} can supply the values of constants in two
19704 different unit systems, ~SI~ and ~cgs~. Which one is used depends on
19705 the value of the variable ~constants-unit-system~. You can use the
19706 ~#+STARTUP:~ options ~constSI~ and ~constcgs~ to set this value for the
19709 [fn:176] The library {{{file(org-id)}}} must first be loaded, either through
19710 ~org-customize~ by enabling ~id~ in ~org-modules~, or by adding
19711 ~(require 'org-id)~ in your {{{file(.emacs)}}}.
19713 [fn:177] The variable ~org-startup-with-inline-images~ can be set
19714 within a buffer with the ~#+STARTUP:~ keywords ~inlineimages~ and
19717 [fn:178] Note that the ~LOGBOOK~ drawer is unfolded when pressing
19718 {{{key(SPC)}}} in the agenda to show an entry---use
19719 {{{kbdspckey(C-u,SPC)}}} to keep it folded here.
19721 [fn:179] Please note the pitfalls of summing hierarchical data in a flat
19722 list ([[Agenda column view]]).
19724 [fn:180] If the value of that variable is not a list, but a single file
19725 name, then the list of agenda files will be maintained in that external
19728 [fn:181] The variable ~org-anniversary~ used in the example
19729 is just like ~diary-anniversary~, but the argument order is
19730 always according to ISO and therefore independent of the value of
19731 ~calendar-date-style~.
19733 [fn:182] Emacs 23 and Org mode 6.29 are required.
19735 [fn:183] Emacs 23.1 can actually crash with ~org-indent-mode~.
19737 [fn:184] Symbolic links in ~org-directory~ need to have the same name
19742 # sentence-end-double-space: t