Remove deprecated syntax for Babel properties
[org-mode/org-tableheadings.git] / contrib / orgmanual.org
blobe48ae979f0700679763e627b3085a7bf8f0e1368
1 #+TITLE:     Org Mode
2 #+AUTHOR:    Carsten Dominik
3 #+EMAIL:     tsd@tsdye.com
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.
8 #+LANGUAGE:  en
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
11 #+SELECT_TAGS: export
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
23 # Contact Info
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}
29 #+STARTUP: overview
30 #+TODO: FIXME | FIXED
32 * Introduction
33   :PROPERTIES:
34   :TITLE: Introduction
35   :DESCRIPTION: Getting started
36   :END:
37 #+cindex: introduction
39 ** Summary
40    :PROPERTIES:
41    :DESCRIPTION: Brief summary of what Org-mode does
42    :END:
43 #+cindex: summary
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
85   - a TODO list editor
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
93 #+cindex: FAQ
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.]]
104 {{{page}}}
106 ** Installation
107    :PROPERTIES:
108    :DESCRIPTION: How to install a downloaded version of Org-mode
109    :END:
111 #+cindex: installation
112 #+cindex: XEmacs
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
130     your system
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
136       the executable
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
141     mode on your system
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
151     Org repository
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
157       installed
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
164     test suite
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
177     Org repository
178   - Run ~make compile~
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
187 #+header: :eval no
188 #+begin_src emacs-lisp
189 (add-to-list 'load-path "~/path/to/orgdir/lisp")
190 #+end_src
192 {{{noindent}}}
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
197 #+header: :eval no
198 #+begin_src emacs-lisp
199 (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
200 #+end_src
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:
215 #+begin_example
216    make install-info
217 #+end_example
219 Do not forget to activate Org as described in the following section.
220 {{{page}}}
222 ** Activation
223    :PROPERTIES:
224    :DESCRIPTION: How to activate Org-mode for certain buffers
225    :END:
226 #+cindex: activation
227 #+cindex: autoload
228 #+cindex: ELPA
229 #+cindex: global key bindings
230 #+cindex: key bindings, global
231 #+findex: org-agenda
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
241 #+header: :eval no
242 #+begin_src emacs-lisp
243 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
244 #+end_src
246 Org mode buffers need font-lock to be turned on - this is the default in
247 Emacs.[fn:5]
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
257 liking.
259 #+header: :exports code
260 #+header: :eval no
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)
266 #+end_src
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
271 like this:
273 #+begin_example
274    MY PROJECTS    -*- mode: org; -*-
275 #+end_example
277 #+vindex: org-insert-mode-line-in-empty-file
278 {{{noindent}}}
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
289 #+header: :eval no
290 #+begin_src emacs-lisp
291 (transient-mark-mode 1)
292 #+end_src
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.
298 ** Feedback
299    :PROPERTIES:
300    :DESCRIPTION: Bug reports, ideas, patches, etc.
301    :END:
302 #+cindex: feedback
303 #+cindex: bug reports
304 #+cindex: maintainer
305 #+cindex: author
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
335 #+end_src
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
343 #+header: :eval no
344 #+begin_src emacs-lisp
345 ;;; Minimal setup to load latest `org-mode'
347 ;; activate debugging
348 (setq debug-on-error t
349       debug-on-signal nil
350       debug-on-quit nil)
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))
355 #+end_src
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
368    :PROPERTIES:
369    :DESCRIPTION: The best way to report an error
370    :END:
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.
396 ** Conventions
397    :PROPERTIES:
398    :DESCRIPTION: Typesetting conventions in the manual
399    :END:
401 Conventions for typesetting keywords, keybindings, and commands in
402 this manual are described.
404 *** Three types of keywords
405     :PROPERTIES:
406     :DESCRIPTION: TODO, tags, and properties
407     :END:
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
413     are user-defined.
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
425     :PROPERTIES:
426     :DESCRIPTION: Bind useful commands to keys
427     :END:
429 #+kindex: C-c a
430 #+findex: org-agenda
431 #+kindex: C-c c
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
437 these keybindings.
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)}}}.
451 * Document structure
452   :PROPERTIES:
453   :DESCRIPTION: A tree works like your brain
454   :ALT_TITLE: Document Structure
455   :END:
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.
462 ** Outlines
463    :PROPERTIES:
464    :DESCRIPTION: Org mode is based on Outline mode
465    :END:
466 #+cindex: outlines
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.
478 ** Headlines
479    :PROPERTIES:
480    :DESCRIPTION: How to typeset Org tree headlines
481    :END:
482 #+cindex: 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:
491 #+begin_src org
492   ,* Top level headline
493   ,** Second level
494   ,*** Third level
495       some text
496   ,*** Third level
497       more text
498   ,* Another top level headline
499 #+end_src
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
514    :PROPERTIES:
515    :DESCRIPTION: Show and hide, much simplified
516    :ALT_TITLE: Visibility cycling
517    :END:
518 #+cindex: cycling, visibility
519 #+cindex: visibility cycling
520 #+cindex: trees, visibility
521 #+cindex: show hidden text
522 #+cindex: hide 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
536      states:
537      #+kindex: TAB
538      #+findex: org-cycle
539      
540      #+begin_src example
541        ,-> FOLDED -> CHILDREN -> SUBTREE --.
542        '-----------------------------------'
543      #+end_src
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
564      #+kindex: C-u TAB
565      #+kindex: S-TAB
566      #+findex: org-global-cycle
568      #+begin_example
569         ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
570         '--------------------------------------'
571      #+end_example
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
579      drawers.
581      #+kindex: C-u C-u C-u TAB
582      #+findex: show-all
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
593      #+kindex: C-c C-r
594      #+findex: org-reveal
595 - {{{kbd(C-c C-k)}}}, ~show-branches~ :: Expose all the headings of
596      the subtree, CONTENT view for just one subtree.
598      #+kindex: C-c C-k
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.
605      #+kindex: C-c TAB
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
613      buffer.
615      #+kindex: C-c C-x b
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
630 buffer:
632 #+begin_src org 
633   ,#+STARTUP: overview
634   ,#+STARTUP: content
635   ,#+STARTUP: showall
636   ,#+STARTUP: showeverything
637 #+end_src
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.
652 ** Motion
653    :PROPERTIES:
654    :DESCRIPTION: Jumping to other headlines
655    :END:
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.
663        #+kindex: C-c C-n
664        #+findex: outline-next-visible-heading
665   - {{{kbd(C-c C-p)}}}, ~outline-previous-visible-heading~ :: Previous heading.
666        #+kindex: C-c C-p
667        #+findex: outline-previous-visible-heading
668   - {{{kbd(C-c C-f)}}}, ~org-forward-same-level~ :: Next heading same level.
669        #+kindex: C-c C-f
670        #+findex: org-forward-same-level
671   - {{{kbd(C-c C-b)}}}, ~org-backward-same-level~ :: Previous heading same level.
672        #+kindex: C-c C-b
673        #+findex: org-backward-same-level
674   - {{{kbd(C-c C-u)}}}, ~outline-up-heading~ :: Backward to higher level heading.
675        #+kindex: C-c C-u
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:
682        #+kindex: C-c C-j
683        #+findex: org-goto
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.
692       - u  ::  One level up.
693       - 0--9 ::  Digit argument.
694       - q :: Quit.
696 #+vindex: org-goto-interface
697 {{{noindent}}} See also the variable ~org-goto-interface~.
699 ** Structure editing
700    :PROPERTIES:
701    :DESCRIPTION: Changing sequence and level of headlines
702    :ALT_TITLE: Structure editing
703    :END:
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
728        end of the subtree.
730        #+kindex: M-RET
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
737        the entry.
739        #+kindex: C-RET
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~.
745        #+kindex: M-S-RET
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
751        the current subtree.
753        #+kindex: C-S-RET
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.
761        #+kindex: @key{TAB}
762        #+findex: org-cycle
763   - {{{kbdkey(M-,left)}}}, ~org-do-promote~ :: Promote current heading
764        by one level.
766        #+kindex: M-left
767        #+findex: org-do-promote
768   - {{{kbdkey(M-,right)}}}, ~org-do-demote~ :: Demote current heading
769        by one level.
771        #+kindex: M-right
772        #+findex: org-do-demote
773   - {{{kbdkey(M-S-,left)}}}, ~org-promote-subtree~ :: Promote the
774        current subtree by one level.
776        #+kindex: M-S-left
777        #+findex: org-promote-subtree
778   - {{{kbdkey(M-S-,right)}}}, ~org-demote-subtree~ :: Demote the
779        current subtree by one level.
781        #+kindex: M-S-right
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).
786        #+kindex: M-S-up
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).
791        #+kindex: M-S-,down
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
801        subtrees.
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
824        folding.
826        #+kindex: C-y
827        #+findex: org-yank
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~.
838        #+kindex: C-c C-x c
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]].
843        #+kindex: C-c C-w
844        #+findex: org-refile
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.
857        #+kindex: C-c ^
858        #+findex: org-sort
859   - {{{kbd(C-x n s)}}}, ~org-narrow-to-subtree~ :: Narrow buffer to
860        current subtree.
862        #+kindex: C-x n s
863        #+findex: org-narrow-to-subtree
864   - {{{kbd(C-x n b)}}}, ~org-narrow-to-block~ :: Narrow buffer to
865        current block.
867        #+kindex: C-x n b
868        #+findex: org-narrow-to-block
869   - {{{kbd(C-x n w)}}}, ~widen~ :: Widen buffer to remove narrowing.
871        #+kindex: C-x n w
872        #+findex: widen
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.
882        #+kindex: C-c *
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.
897 ** Sparse trees
898    :PROPERTIES:
899    :DESCRIPTION: Matches embedded in context
900    :ALT_TITLE: Sparse trees
901    :END:
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.
924        #+kindex: C-c /
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.
938        #+kindex: C-c / r
939        #+findex: org-occur
940        #+vindex: org-remove-highlights-with-change
941   - {{{kbd(M-g n)}}}, ~next-error~ ::
942        @@info:@itemx@@ {{{kbd(M-g M-n)}}}
943        
944        Jump to the next sparse tree match in this buffer.
946        #+kindex: M-g n
947        #+kindex: M-g M-n
948        #+findex: next-error
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.
954        #+kindex: M-g p
955        #+kindex: M-g M-p
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
966 #+header: :eval no
967 #+begin_src emacs-lisp
968   (setq org-agenda-custom-commands
969         '(("f" occur-tree "FIXME")))
970 #+end_src
972 {{{noindent}}} will define the key {{{kbd(C-c a f)}}} as a
973 shortcut for creating a sparse tree matching the string
974 {{{samp(FIXME)}}}.
976 The other sparse tree commands select headings based on TODO keywords,
977 tags, or properties and will be discussed later in this manual.
979 #+kindex: C-c C-e v
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.
989 ** Plain lists
990    :PROPERTIES:
991    :DESCRIPTION: Additional structure within an entry
992    :ALT_TITLE: Plain lists
993    :END:
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
1016     numbering.
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:
1036 #+begin_src texinfo
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
1044         - on DVD only
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}.
1051 #+end_src
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
1080     #+kindex: TAB
1081     #+findex: org-cycle
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
1095     initial position.
1097   - {{{kbdkey(M-,RET)}}}, ~org-insert-heading~ :: 
1098     #+kindex: M-RET
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/
1108     the current one.
1110   - {{{kbdkey(M-S-,RET)}}} :: 
1111     #+kindex: M-S-RET
1113     Insert a new item with a checkbox (see [[Checkboxes]]).
1114   
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.
1122        
1123        #+kindex: S-up
1124        #+kindex: S-down
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.
1135        #+kindex: M-up
1136        #+kindex: M-down
1137   - {{{kbdkey(M-,left)}}} :: 
1138        @@info:@itemx@@ {{{kbdkey(M-,right)}}}
1140        Decrease/increase the indentation of an item, leaving children
1141        alone.
1143        #+kindex: M-left
1144        #+kindex: M-right
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.
1156        #+kindex: M-S-left
1157        #+kindex: M-S-right
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
1163        list.
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.
1168        #+kindex: C-c C-c
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.
1182        #+kindex: C-c -
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.
1188        #+kindex: C-c *
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).
1193        #+kindex: C-c C-*
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
1199        #+kindex: S-left
1200        #+kindex: S-right
1201   - {{{kbd(C-c ^)}}} :: Sort the plain list.  You will be prompted for
1202        the sorting method: numerically, alphabetically, by time, or by
1203        custom function.
1205        #+kindex: C-c ^
1207 ** Drawers
1208    :PROPERTIES:
1209    :DESCRIPTION: Tucking stuff away
1210    :END:
1211 #+cindex: drawers
1212 #+cindex: #+DRAWERS
1213 #+cindex: visibility cycling, drawers
1215 #+vindex: org-drawers
1216 #+cindex: org-insert-drawer
1217 #+kindex: C-c C-x d
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
1222 look like this:
1224 #+begin_src org
1225   ,** This is a headline
1226      Still outside the drawer
1227      :DRAWERNAME:
1228      This is inside the drawer.
1229      :END:
1230      After the drawer.
1231 #+end_src
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
1255       drawer.
1257       #+kindex: C-c C-z
1259 ** Blocks
1260    :PROPERTIES:
1261    :DESCRIPTION: Folding blocks
1262    :END:
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
1275 #+begin_src org
1276   ,#+STARTUP: hideblocks
1277   ,#+STARTUP: nohideblocks
1278 #+end_src
1280 ** Creating footnotes
1281    :PROPERTIES:
1282    :DESCRIPTION: Define footnotes in Org syntax
1283    :END:
1284 #+cindex: footnotes
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:
1296 #+begin_example
1297    The Org homepage[fn:1] now looks a lot better than it used to.
1298    ...
1299    [fn:1] The link is: http://orgmode.org
1300 #+end_example
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
1313            code snippet.
1315   - ~[fn:name]~ :: A named footnote reference, where ~name~ is
1316                  a unique label word, or, for simplicity of automatic
1317                  creation, a number.
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
1332 details.
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.
1338                  #+kindex: C-c C-x f
1340                  When the cursor is on a footnote reference, jump to the
1341                  definition.  When it is at a definition, jump to the
1342                  (first) reference.
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
1376             references to it.
1378     Depending on the variable ~org-footnote-auto-adjust~, renumbering
1379        and sorting footnotes can be automatic after each insertion or
1380        deletion.[fn:174]
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)}}}.
1387     #+kindex: C-c C-c
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.
1393     #+kindex: C-c C-o
1394     #+kindex: mouse-1
1395     #+kindex: mouse-2
1397 ** Orgstruct mode 
1398    :PROPERTIES:
1399    :DESCRIPTION: Structure editing outside Org
1400    :ALT_TITLE: Orgstruct mode
1401    :END:
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
1409 mode, with one of:
1411 #+header: :exports code
1412 #+header: :eval no
1413 #+begin_src emacs-lisp
1414   (add-hook 'message-mode-hook 'turn-on-orgstruct)
1415   (add-hook 'message-mode-hook 'turn-on-orgstruct++)
1416 #+end_src
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.
1427 * Tables
1428   :PROPERTIES:
1429   :DESCRIPTION: Pure magic for quick formatting
1430   :END:
1431 #+cindex: tables
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
1436 ([[info:calc]]).
1438 ** Built-in table editor 
1439    :PROPERTIES:
1440    :DESCRIPTION: Simple tables
1441    :END:
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:
1449 #+begin_src org
1450   | Name  | Phone | Age |
1451   |-------+-------+-----|
1452   | Peter |  1234 |  17 |
1453   | Anna  |  4321 |  25 |
1454 #+end_src
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
1465 only type
1467 #+begin_src org
1468   |Name|Phone|Age|
1469   |-
1470 #+end_src
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
1489     :PROPERTIES:
1490     :DESCRIPTION: Creating tabular data in Org
1491     :END:
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(|-
1505      ,TAB)}}}.
1507      #+kindex: C-c |
1508      #+findex: org-table-create-or-convert-from-region
1510 *** Re-aligning and field motion
1511     :PROPERTIES:
1512     :DESCRIPTION: Navigating and tidying
1513     :END:
1514 #+attr_texinfo: :table-type table :indic @asis
1515 - {{{kbd(C-c C-c)}}}, ~org-table-align~ :: Re-align the table without
1516      moving the cursor.
1518      #+kindex: C-c C-c
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.
1523      #+kindex: <TAB>
1524      #+findex: org-table-next-field
1525 - {{{kbdkey(S-,TAB)}}}, ~org-table-previous-field~ :: Re-align, move to
1526      previous field.
1528      #+kindex: S-TAB
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.
1535      #+kindex: RET
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.
1540      #+kindex: M-a
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.
1545      #+kindex: M-e
1546      #+findex: org-table-end-of-field
1548 *** Column and row editing
1549     :PROPERTIES:
1550     :DESCRIPTION: Insert, kill, or move
1551     :END:
1552 #+attr_texinfo: :table-type table :indic @asis
1553 - {{{kbdkey(M-,left)}}}, ~org-table-move-column-left~ ::
1554   #+kindex: M-left
1555   #+findex: org-table-move-column-left
1556      
1557   Move the current column left.
1559 - {{{kbdkey(M-,right)}}}, ~org-table-move-column-right~ ::
1560   #+kindex: M-right
1561   #+findex: org-table-move-column-right
1563   Move the current column right.
1565 - {{{kbdkey(M-S-,left)}}}, ~org-table-delete-column~ :: 
1566   #+kindex: M-S-left
1567   #+findex: org-table-delete-column
1569   Kill the current column.
1571 - {{{kbdkey(M-S-,right)}}}, ~org-table-insert-column~ :: 
1572   #+kindex: M-S-right
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~ ::
1578   #+kindex: M-up
1579   #+findex: org-table-move-row-up
1581   Move the current row up.
1583 - {{{kbdkey(M-,down)}}}, ~org-table-move-row-down~ ::
1584   #+kindex: M-down
1585   #+findex: org-table-move-row-down
1586      
1587   Move the current row down.
1589 - {{{kbdkey(M-S-,up)}}}, ~org-table-kill-row~ :: Kill the current row
1590      or horizontal line.
1592      #+kindex: M-S-up
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.
1599      #+kindex: M-S-down
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.
1606      #+kindex: C-c -
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.
1613      #+kindex: C-c RET
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.
1628      #+kindex: C-c ^
1629      #+findex: org-table-sort-lines
1630 *** Regions
1631     :PROPERTIES:
1632     :DESCRIPTION: Manipulate parts of a table
1633     :END:
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
1654      lines.
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.
1667      #+kindex: M-RET
1668      #+findex: org-table-wrap-region
1669 *** Calculations
1670     :PROPERTIES:
1671     :DESCRIPTION: Sum and copy
1672     :END:
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
1683      {{{kbd(C-y)}}}.
1685   #+kindex: C-c +
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]]).
1696      #+kindex: S-RET
1697      #+findex: org-table-copy-down
1698      #+vindex: org-table-copy-increment
1700 *** Misc
1701     :PROPERTIES:
1702     :DESCRIPTION: Some other useful operations
1703     :END:
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 `)}}}.
1715      #+kindex: 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]]).
1730      #+kindex: C-c |
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
1748 turn it off with
1750 #+header: :exports code
1751 #+header: :eval no
1752 #+begin_src emacs-lisp
1753 (setq org-enable-table-editor nil)
1754 #+end_src
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
1761    :PROPERTIES:
1762    :DESCRIPTION: Overrule the automatic settings
1763    :END:
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
1778 value.
1780 #+begin_example
1781    |---+------------------------------|               |---+--------|
1782    |   |                              |               |   | <6>    |
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    |---+------------------------------|               |---+--------|
1788 #+end_example
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:
1807 #+begin_src org
1808   ,#+STARTUP: align
1809   ,#+STARTUP: noalign
1810 #+end_src
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.
1820 ** Column groups
1821    :PROPERTIES:
1822    :DESCRIPTION: Grouping to trigger vertical lines
1823    :END:
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.
1836 Here is an example:
1838 #+begin_src org
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)))
1847 #+end_src
1849 It is also sufficient to just insert the column group starters after
1850 every vertical line you would like to have:
1852 #+begin_src org
1853   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1854   |----+-----+-----+-----+---------+------------|
1855   | /  | <   |     |     | <       |            |
1856 #+end_src
1858 ** The Orgtbl mode minor mode
1859    :PROPERTIES:
1860    :DESCRIPTION: The table editor as minor mode
1861    :ALT_TITLE: Ogtbl mode
1862    :END:
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
1873 #+header: :eval no
1874 #+begin_src emacs-lisp
1875 (add-hook 'message-mode-hook 'turn-on-orgtbl)
1876 #+end_src
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]].
1884 ** The spreadsheet
1885    :PROPERTIES:
1886    :DESCRIPTION: The table editor has spreadsheet capabilities
1887    :END:
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
1903 *** References
1904     :PROPERTIES:
1905     :DESCRIPTION: How to refer to another field or range
1906     :END:
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
1914 grid.
1916 **** Field references
1917      :PROPERTIES:
1918      :DESCRIPTION: Refer to a particular field
1919      :END:
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
1926 row.
1928 #+vindex: org-table-use-standard-references
1929 However, Org prefers to use another, more general representation that
1930 looks like this:[fn:25]
1932 #+begin_example
1933    @ROW$COLUMN
1934 #+end_example
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
1976      :PROPERTIES:
1977      :DESCRIPTION: Refer to a range of fields
1978      :END:
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
1994                    ~A2..C4~)
1995   - @-1$-2..@-1 :: three numbers from the column to the left, 2 up to
1996                    current row
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
2007      :PROPERTIES:
2008      :DESCRIPTION: Refer to fields in Lisp or Calc
2009      :END:
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
2030      :PROPERTIES:
2031      :DESCRIPTION: Name columns or constants
2032      :END:
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:
2045 #+begin_src org
2046   ,#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2047 #+end_src
2049 {{{noindent}}}
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
2062 numbers.[fn:175]
2064 **** Remote references
2065      :PROPERTIES:
2066      :DESCRIPTION: Refer to information in other tables
2067      :END:
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
2073 #+cindex: #+TBLNAME
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
2077 syntax is
2079 #+begin_example
2080    remote(NAME-OR-ID,REF)
2081 #+end_example
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
2091     :PROPERTIES:
2092     :DESCRIPTION: Using Calc to compute stuff
2093     :END:
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
2128   - L :: literal
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
2147        function
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
2164     :PROPERTIES:
2165     :DESCRIPTION: Writing formulas in Emacs Lisp
2166     :ALT_TITLE: Formula syntax for Lisp
2167     :END:
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
2178 after a semicolon.
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
2197 #+header: :eval no
2198 #+begin_src emacs-lisp
2199   '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
2200 #+end_src
2202 Add columns 1 and 2, equivalent to Calc's ~$1+$2~:
2203 #+header: :exports code
2204 #+header: :eval no
2205 #+begin_src emacs-lisp
2206   '(+ $1 $2);N
2207 #+end_src
2209 Compute the sum of columns 1-4, like Calc's ~vsum($1..$4)~}:
2210 #+header: :exports code
2211 #+header: :eval no
2212 #+begin_src emacs-lisp
2213   '(apply '+ '($1..$4));N
2214 #+end_src
2216 *** Duration and time values
2217     :PROPERTIES:
2218     :DESCRIPTION: How to compute duration and time values
2219     :END:
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:
2227 #+begin_example
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
2233 #+end_example
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
2247     :PROPERTIES:
2248     :DESCRIPTION: Formulas for specific (ranges of) fields
2249     :END:
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
2260 result.
2262 #+cindex: #+TBLFM
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
2277 following command
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.
2285        #+kindex: C-u C-c =
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
2302                      row.
2303   - $name= :: Named field, see [[Advanced features]].
2305 *** Column formulas
2306     :PROPERTIES:
2307     :DESCRIPTION: Formulas valid for an entire column
2308     :END:
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
2322      above.
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
2339 ~$>~.
2341 Instead of typing an equation into the field, you may also use the
2342 following command:
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.
2353        #+kindex: C-c =
2354        #+findex: org-table-eval-formula
2355 *** Lookup functions
2356     :PROPERTIES:
2357     :DESCRIPTION: Lookup functions for searching tables
2358     :END:
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
2371        #+header: :eval no
2372        #+begin_src emacs-lisp
2373          (PREDICATE VAL S)
2374        #+end_src
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
2392        Lisp functions.
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
2407     :PROPERTIES:
2408     :DESCRIPTION: Fixing formulas
2409     :END:
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]].
2427        #+kindex: C-c =
2428        #+kindex: C-u C-c =
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.
2443        #+kindex: C-c ?
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)}}}.
2452        #+kindex: 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.
2458        #+kindex: C-c @{
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
2468        commands:
2470        #+kindex: C-c '
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
2478        entire table.
2480        #+kindex: C-x C-s
2481        #+kindex: C-c C-c
2482        #+findex: org-table-fedit-finish
2483   - {{{kbd(C-c C-q)}}}, ~org-table-fedit-abort~ :: Exit the formula
2484        editor without installing changes.
2486        #+kindex: C-c C-q
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~).
2492        #+kindex: C-c C-r
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
2499        Lisp mode.
2501        #+kindex: TAB
2502        #+findex: org-table-fedit-lisp-indent
2503   - {{{kbdkey(M-,TAB)}}}, ~lisp-complete-symbol~ :: Complete Lisp
2504        symbols, just like in Emacs Lisp mode.
2506        #+kindex: M-TAB
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
2512        references.
2514        #+kindex: S-up
2515        #+kindex: S-down
2516        #+kindex: S-left
2517        #+kindex: S-right
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.
2526        #+kindex: M-S-up
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.
2533        #+kindex: M-S-down
2534        #+findex: org-table-fedit-line-down
2536   - {{{kbdkey(M-,up)}}}, ~org-table-fedit-scroll-up~ ::
2538        Scroll up the window displaying the table.
2540        #+kindex: M-up
2541        #+findex: org-table-fedit-scroll-up
2543   - {{{kbdkey(M-,down)}}}, ~org-table-fedit-scroll-down~ ::
2545        Scroll down the window displaying the table.
2547        #+kindex: M-down
2548        #+findex: org-table-fedit-scroll-down
2550   - {{{kbd(C-c })}}} :: Turn the coordinate grid in the table on and
2551        off.
2553        #+kindex: C-c @@
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.
2563 #+kindex: C-c C-c
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
2569     :PROPERTIES:
2570     :DESCRIPTION: Help fixing formulas
2571     :END:
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
2584     :PROPERTIES:
2585     :DESCRIPTION: Recomputing all dependent fields
2586     :END:
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
2595 following commands:
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.
2602        #+kindex: C-c *
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
2607        header.
2609        #+kindex: C-u C-c *
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~ ::
2612        
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
2631     :PROPERTIES:
2632     :DESCRIPTION: Field and column names, parameters, and automatic recalc
2633     :END:
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
2637 characters.[fn:30]
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.
2645        #+kindex: C-#
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:
2650 #+begin_src org
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
2666 #+end_src
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
2679          {{{samp($6)}}}.
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
2684          as ~$name= ...~.
2685   - _ :: Similar to {{{samp(^)}}}, but defines names for the fields in
2686          the row /below/.
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
2692          basis.
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
2709 functions.
2711 #+begin_src org
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
2723 #+end_src
2725 ** Org-Plot
2726    :PROPERTIES:
2727    :DESCRIPTION: Plotting from Org tables
2728    :END:
2729 #+cindex: graph, in tables
2730 #+cindex: plot tables using Gnuplot
2731 #+cindex: #+PLOT
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.
2738 #+begin_src org
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 |
2747 #+end_src
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
2759            graphing.
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
2766             ~ind~ column).
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
2776             script.
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
2789               file.
2791 * Hyperlinks
2792   :PROPERTIES:
2793   :DESCRIPTION: Notes in context
2794   :ORDERED:  t
2795   :END:
2796 #+cindex: hyperlinks
2798 Like HTML, Org provides links inside a file, external links to
2799 other files, Usenet articles, emails, and much more.
2801 ** Link format
2802    :PROPERTIES:
2803    :DESCRIPTION: How links in Org are formatted
2804    :END:
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:
2811 #+begin_src org
2812   [[link][description]] or  [[link]]
2813 #+end_src
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
2825 link.
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
2833 links~.
2835 ** Internal links
2836    :PROPERTIES:
2837    :DESCRIPTION: Links to other places in the current file
2838    :END:
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:
2854 #+begin_example
2855    [[My Target]] or [[My Target][Find my target]]
2856 #+end_example
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
2867 #+begin_src org
2868   # <<My Target>>
2869 #+end_src
2871 {{{noindent}}} In HTML export (see [[HTML export]]), such targets will
2872 become named anchors for direct access through {{{samp(http)}}}
2873 links.[fn:31]
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
2883 recorded earlier.
2885 ** Radio targets
2886     :PROPERTIES:
2887     :DESCRIPTION: Automatically create internal links
2888     :END:
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.
2903 ** External links
2904    :PROPERTIES:
2905    :DESCRIPTION: URL-like links to the world
2906    :END:
2907 #+cindex: links, external
2908 #+cindex: external links
2909 #+cindex: links, external
2910 #+cindex: Gnus links
2911 #+cindex: BBDB links
2912 #+cindex: IRC links
2913 #+cindex: URL links
2914 #+cindex: file links
2915 #+cindex: VM 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]]),
2974 for example:
2976 #+begin_src org
2977   [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2978 #+end_src
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
2984 file.
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
2993 brackets.
2995 ** Handling links
2996    :PROPERTIES:
2997    :DESCRIPTION: URL-like links to the world
2998    :END:
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
3013        #+kindex: C-c l
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
3038          and the subject.
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
3044                         the current entry.
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
3053                    
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
3068                      current line.
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
3082        #+kindex: C-c C-l
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
3087          {{{kbd(M-p/n)}}}).
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
3099          names.
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
3145          #+kindex: C-c C-o
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
3149                         point.
3151                         #+vindex: org-return-follows-link
3152                         #+kindex: RET
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.
3157          #+kindex: mouse-2
3158          #+kindex: mouse-1
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
3164          #+kindex: mouse-3
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~ ::
3183          #+kindex: C-c %
3184          #+findex: org-mark-ring-push
3185          #+cindex: mark ring
3187          Push the current position onto the mark ring, to be able to
3188          return easily.  Commands following an internal link do this
3189          automatically.
3191     - {{{kbd(C-c &)}}}, ~org-mark-ring-goto~ ::
3192          #+kindex: C-c &
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
3203        
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
3213        {{{kbd(C-p)}}}
3215        #+header: :exports code
3216        #+header: :eval no
3217        #+begin_src emacs-lisp
3218          (add-hook 'org-load-hook
3219                    (lambda ()
3220                      (define-key org-mode-map "\C-n" 'org-next-link)
3221                      (define-key org-mode-map "\C-p" 'org-previous-link)))
3222        #+end_src
3224 ** Using links outside Org
3225    :PROPERTIES:
3226    :DESCRIPTION: Linking from my C source code?
3227    :END:
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
3234 #+header: :eval no
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)
3238 #+end_src
3240 ** Link abbreviations
3241    :PROPERTIES:
3242    :DESCRIPTION: Shortcuts for writing complex links
3243    :END:
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
3251 #+begin_src org
3252 [[linkword:tag][description]]
3253 #+end_src
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
3264 #+header: :eval no
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")))
3273 #+end_src
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
3297 #+cindex: #+LINK
3298 #+begin_src org
3299   ,#+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
3300   ,#+LINK: google    http://www.google.com/search?q=%s
3301 #+end_src
3303 {{{noindent}}} In-buffer completion (see [[Completion]]) can be used after
3304 {{{samp([)}}} to complete link abbreviations.  You may also define a
3305 function ~org-PREFIX-complete-link~ that implements special (e.g.,
3306 completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
3307 Such a function should not accept any arguments, and return the full
3308 link with prefix.
3310 ** Search options
3311    :PROPERTIES:
3312    :DESCRIPTION: Linking to a specific location
3313    :END:
3314 #+cindex: search option in file links
3315 #+cindex: file links, searching
3317 File links can contain additional information to make Emacs jump to a
3318 particular location in the file when following a link.  This can be a
3319 line number or a search option after a double colon.[fn:39]
3320 For example, when the command {{{kbd(C-c l)}}} creates a link (see
3321 [[Handling links]]) to a file, it encodes the words in the current line as
3322 a search string that can be used to find this line back later when
3323 following the link with {{{kbd(C-c C-o)}}}.
3325 Here is the syntax of the different ways to attach a search to a file
3326 link, together with an explanation:
3328 #+begin_src org
3329   [[file:~/code/main.c::255]]
3330   [[file:~/xx.org::My Target]]
3331   [[file:~/xx.org::*My Target]]
3332   [[file:~/xx.org::#my-custom-id]]
3333   [[file:~/xx.org::/regexp/]]
3334 #+end_src
3336 #+attr_texinfo: :indic @code
3337 - 255 :: Jump to line 255.
3338 - My Target :: Search for a link target ~<<My Target>>~, or do a text search for {{{samp(my target)}}},
3339      similar to the search in internal links, see [[Internal links]].
3340      In HTML export (see [[HTML export]]), such a file link will
3341      become a HTML reference to the corresponding named anchor in the
3342      linked file.
3343 - *My Target :: In an Org file, restrict search to headlines.
3344 - #my-custom-id :: Link to a heading with a ~CUSTOM_ID~ property
3345 - /regexp/ :: Do a regular expression search for ~regexp~.  This
3346                     uses the Emacs command ~occur~ to list all matches
3347                     in a separate window.  If the target file is in
3348                     Org mode, ~org-occur~ is used to create a sparse
3349                     tree with the matches.  @c If the target file is a
3350                     directory, @c ~grep~ will be used to search all
3351                     files in the directory.
3353 As a degenerate case, a file link with an empty file name can be used
3354 to search the current file.  For example, ~[[file:::find me]]~ does a
3355 search for ~find me~ in the current file, just as
3356 ~[[find me]]~ would.
3358 ** Custom searches
3359    :PROPERTIES:
3360    :DESCRIPTION: When the default search is not enough
3361    :END:
3362 #+cindex: custom search strings
3363 #+cindex: search strings, custom
3365 The default mechanism for creating search strings and for doing the
3366 actual search related to a file link may not work correctly in all
3367 cases.  For example, BibTeX database files have many entries like
3368 {{{samp(year="1993")}}} which would not result in good search strings,
3369 because the only unique identification for a BibTeX entry is the
3370 citation key.
3372 #+vindex: org-create-file-search-functions
3373 #+vindex: org-execute-file-search-functions
3375 If you come across such a problem, you can write custom functions to
3376 set the right search string for a particular file type, and to do the
3377 search for the string in the file.  Using ~add-hook~, these functions
3378 need to be added to the hook variables
3379 ~org-create-file-search-functions~ and
3380 ~org-execute-file-search-functions~.  See the docstring for these
3381 variables for more information.  Org actually uses this mechanism for
3382 BibTeX database files, and you can use the corresponding code as an
3383 implementation example.  See the file {{{file(org-bibtex.el)}}}.
3385 * TODO items
3386   :PROPERTIES:
3387   :DESCRIPTION: Every tree branch can be a TODO item
3388   :ALT_TITLE: TODO Items
3389   :END:
3390 #+cindex: TODO items
3392 Org mode does not maintain TODO lists as separate documents.[fn:40]
3393 Instead, TODO items are an integral part of the notes file, because
3394 TODO items usually come up while taking notes! With Org mode, simply
3395 mark any entry in a tree as being a TODO item.  In this way,
3396 information is not duplicated, and the entire context from which the
3397 TODO item emerged is always present.
3399 Of course, this technique for managing TODO items scatters them
3400 throughout your notes file.  Org mode compensates for this by providing
3401 methods to give you an overview of all the things that you have to do.
3403 ** TODO basics
3404    :PROPERTIES:
3405    :DESCRIPTION: Marking and displaying TODO entries
3406    :TITLE:    Basic TODO functionality
3407    :END:
3409 Any headline becomes a TODO item when it starts with the word
3410 {{{samp(TODO)}}}, for example:
3412 #+begin_src org
3413   ,*** TODO Write letter to Sam Fortune
3414 #+end_src
3416 {{{noindent}}} The most important commands to work with TODO entries
3417 are:
3419 #+attr_texinfo: :table-type table :indic @asis
3420 - {{{kbd(C-c C-t)}}}, ~org-todo~ ::
3421   #+kindex: C-c C-t
3422   #+cindex: cycling, of TODO states
3424   Rotate the TODO state of the current item among
3426   #+begin_example
3427      ,-> (unmarked) -> TODO -> DONE --.
3428      '--------------------------------'
3429   #+end_example
3431  The same rotation can also be done ``remotely'' from the timeline and
3432  agenda buffers with the {{{kbd(t)}}} command key (see [[Agenda commands]]).
3434 - {{{kbd(C-u C-c C-t)}}} ::
3435   #+kindex: C-u C-c C-t
3437   Select a specific keyword using completion or (if it has been set up)
3438   the fast selection interface.  For the latter, you need to assign keys
3439   to TODO states, see [[Per-file keywords]], and [[Setting tags]], for
3440   more information.
3442   #+kindex: S-@key{right}
3443   #+kindex: S-@key{left}
3445 - {{{kbdkey(S-,right)}}} {{{kbdkey(S-,left)}}} ::
3447   #+vindex: org-treat-S-cursor-todo-selection-as-state-change
3449      Select the following/preceding TODO state, similar to cycling.
3450      Useful mostly if more than two TODO states are possible 
3451      (see [[TODO extensions]]).  See also [[Conflicts]], for a discussion of the
3452      interaction with ~shift-selection-mode~.  See also the variable
3453      ~org-treat-S-cursor-todo-selection-as-state-change~.
3455 - {{{kbd(C-c / t)}}}, ~org-show-todo-tree~ ::
3456   #+kindex: C-c / t
3458   #+cindex: sparse tree, for TODO
3459   #+vindex: org-todo-keywords
3461   View TODO items in a /sparse tree/ (see [[Sparse trees]]).  Folds the entire
3462   buffer, but shows all TODO items (with not-DONE state) and the
3463   headings hierarchy above them.  With a prefix argument (or by using
3464   {{{kbd(C-c / T)}}}), search for a specific TODO.  You will be
3465   prompted for the keyword, and you can also give a list of keywords
3466   like ~KWD1|KWD2|...~ to list entries that match any one of these
3467   keywords.  With a numeric prefix argument N, show the tree for the
3468   Nth keyword in the variable ~org-todo-keywords~.  With two prefix
3469   arguments, find all TODO states, both un-done and done.
3471 - {{{kbd(C-c a t)}}}, ~org-todo-list~ ::
3472   #+kindex: C-c a t
3474   Show the global TODO list.  Collects the TODO items (with not-DONE states)
3475   from all agenda files (see [[Agenda views]]) into a single buffer.  The new
3476   buffer will be in ~agenda-mode~, which provides commands to examine and
3477   manipulate the TODO entries from the new buffer (see [[Agenda commands]]).
3478   See [[Global TODO list]], for more information.
3480 - {{{kbdkey(S-M-,RET)}}}, ~org-insert-todo-heading~ ::
3481   #+kindex: S-M-@key{RET}
3483    Insert a new TODO entry below the current one.
3486 {{{noindent}}}
3487 #+vindex: org-todo-state-tags-triggers
3488 Changing a TODO state can also trigger tag changes.  See the docstring of the
3489 option ~org-todo-state-tags-triggers~ for details.
3491 ** TODO extensions
3492    :PROPERTIES:
3493    :DESCRIPTION: Work flow and assignments
3494    :TITLE:    Extended use of TODO keywords
3495    :END:
3497 #+cindex: extended TODO keywords
3499 #+vindex: org-todo-keywords
3501 By default, marked TODO entries have one of only two states: TODO and
3502 DONE.  Org mode allows you to classify TODO items in more complex ways
3503 with /TODO keywords/ (stored in ~org-todo-keywords~).  With special
3504 setup, the TODO keyword system can work differently in different
3505 files.
3507 Note that /tags/ are another way to classify headlines in general and
3508 TODO items in particular (see [[Tags]]).
3510 *** Workflow states
3511     :PROPERTIES:
3512     :DESCRIPTION: From TODO to DONE in steps
3513     :TITLE:    TODO keywords as workflow states
3514     :END:
3515 #+cindex: TODO workflow
3516 #+cindex: workflow states as TODO keywords
3518 You can use TODO keywords to indicate different /sequential/ states
3519 in the process of working on an item, for example:[fn:41]
3521 #+header: :exports code
3522 #+header: :eval no
3523 #+begin_src emacs-lisp
3524 (setq org-todo-keywords
3525   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3526 #+end_src
3528 The vertical bar separates the TODO keywords (states that /need
3529 action/) from the DONE states (which need /no further action/).  If
3530 you don't provide the separator bar, the last state is used as the DONE
3531 state.
3533 #+cindex: completion, of TODO keywords
3535 With this setup, the command {{{kbd(C-c C-t)}}} will cycle an entry
3536 from TODO to FEEDBACK, then to VERIFY, and finally to DONE and
3537 DELEGATED.  You may also use a numeric prefix argument to quickly
3538 select a specific state.  For example {{{kbd(C-3 C-c C-t)}}} will
3539 change the state immediately to VERIFY.  Or you can use
3540 {{{kbdkey(S-,left)}}} to go backward through the sequence.  If you
3541 define many keywords, you can use in-buffer completion (see [[Completion]]) or
3542 even a special one-key selection scheme (see [[Fast access to TODO states]])
3543 to insert these words into the buffer.  Changing a TODO state can be
3544 logged with a timestamp, see [[Tracking TODO state changes]], for
3545 more information.
3547 *** TODO types
3548     :PROPERTIES:
3549     :DESCRIPTION: I do this, Fred does the rest
3550     :TITLE:    TODO keywords as types
3551     :END:
3552 #+cindex: TODO types
3553 #+cindex: names as TODO keywords
3554 #+cindex: types as TODO keywords
3556 The second possibility is to use TODO keywords to indicate different
3557 /types/ of action items.  For example, you might want to indicate
3558 that items are for ``work'' or ``home''.  Or, when you work with several
3559 people on a single project, you might want to assign action items
3560 directly to persons, by using their names as TODO keywords.  This would
3561 be set up like this:
3563 #+header: :exports code
3564 #+header: :eval no
3565 #+begin_src emacs-lisp
3566 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3567 #+end_src
3569 In this case, different keywords do not indicate a sequence, but rather
3570 different types.  So the normal work flow would be to assign a task to a
3571 person, and later to mark it DONE.  Org mode supports this style by adapting
3572 the workings of the command {{{kbd(C-c C-t)}}}.[fn:42]  When used several
3573 times in succession, it will still cycle through all names, in order to first
3574 select the right type for a task.  But when you return to the item after some
3575 time and execute {{{kbd(C-c C-t)}}} again, it will switch from any name directly
3576 to DONE.  Use prefix arguments or completion to quickly select a specific
3577 name.  You can also review the items of a specific TODO type in a sparse tree
3578 by using a numeric prefix to {{{kbd(C-c / t)}}}.  For example, to see all things
3579 Lucy has to do, you would use {{{kbd(C-3 C-c / t)}}}.  To collect Lucy's items
3580 from all agenda files into a single buffer, you would use the numeric prefix
3581 argument as well when creating the global TODO list: {{{kbd(C-3 C-c a t)}}}.
3583 *** Multiple sets in one file
3584     :PROPERTIES:
3585     :DESCRIPTION: Mixing it all, and still finding your way
3586     :TITLE:    Multiple keyword sets in one file
3587     :END:
3588 #+cindex: TODO keyword sets
3590 Sometimes you may want to use different sets of TODO keywords in
3591 parallel.  For example, you may want to have the basic
3592 ~TODO~ / ~DONE~, but also a workflow for bug fixing, and a
3593 separate state indicating that an item has been canceled (so it is not
3594 DONE, but also does not require action).  Your setup would then look
3595 like this:
3597 #+header: :exports code
3598 #+header: :eval no
3599 #+begin_src emacs-lisp
3600 (setq org-todo-keywords
3601       '((sequence "TODO" "|" "DONE")
3602         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3603         (sequence "|" "CANCELED")))
3604 #+end_src
3606 The keywords should all be different, this helps Org mode to keep track
3607 of which subsequence should be used for a given entry.  In this setup,
3608 {{{kbd(C-c C-t)}}} only operates within a subsequence, so it switches from
3609 ~DONE~ to (nothing) to ~TODO~, and from ~FIXED~ to
3610 (nothing) to ~REPORT~.  Therefore you need a mechanism to initially
3611 select the correct sequence.  Besides the obvious ways like typing a
3612 keyword or using completion, you may also apply the following commands:
3614 #+kindex: C-S-@key{right}
3615 #+kindex: C-S-@key{left}
3616 #+kindex: C-u C-u C-c C-t
3617 #+attr_texinfo: :table-type table :indic @asis
3618 - {{{kbd(C-u C-u C-c C-t)}}} {{{kbdkey(C-S-,right)}}} {{{kbdkey(C-S-,left)}}} ::
3620   These keys jump from one TODO subset to the next.  In the above
3621   example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbdkey(C-S-,right)}}}
3622   would jump from ~TODO~ or ~DONE~ to ~REPORT~, and any of the
3623   words in the second row to ~CANCELED~.  Note that the
3624   {{{kbd(C-S-)}}} key binding conflict with ~shift-selection-mode~
3625   (see [[Conflicts]]).
3627 - {{{kbdkey(S-,right)}}} {{{kbdkey(S-,left)}}} ::
3628   #+kindex: S-@key{right}
3629   #+kindex: S-@key{left}
3631   {{{kbdkey(S-,left)}}} and {{{kbdkey(S-,right)}}} walk through /all/
3632   keywords from all sets, so for example {{{kbdkey(S-,right)}}} would switch
3633   from ~DONE~ to ~REPORT~ in the example above.  See also
3634   [[Conflicts]], for a discussion of the interaction with
3635   ~shift-selection-mode~.
3637 *** Fast access to TODO states
3638     :PROPERTIES:
3639     :DESCRIPTION: Single letter selection of state
3640     :END:
3641 If you would like to quickly change an entry to an arbitrary TODO state
3642 instead of cycling through the states, you can set up keys for single-letter
3643 access to the states.  This is done by adding the selection character after
3644 each keyword, in parentheses.[fn:43]  For example:
3646 #+header: :exports code
3647 #+header: :eval no
3648 #+begin_src emacs-lisp
3649 (setq org-todo-keywords
3650       '((sequence "TODO(t)" "|" "DONE(d)")
3651         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3652         (sequence "|" "CANCELED(c)")))
3653 #+end_src
3655 #+vindex: org-fast-tag-selection-include-todo
3657 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
3658 the entry will be switched to this state.  {{{kbd(SPC)}}} can be used
3659 to remove any TODO keyword from an entry.[fn:44]
3661 *** Per-file keywords
3662     :PROPERTIES:
3663     :DESCRIPTION: Different files, different requirements
3664     :TITLE:    Setting up keywords for individual files
3665     :END:
3666 #+cindex: keyword options
3667 #+cindex: per-file keywords
3668 #+cindex: #+TODO
3669 #+cindex: #+TYP_TODO
3670 #+cindex: #+SEQ_TODO
3672 It can be very useful to use different aspects of the TODO mechanism in
3673 different files.  For file-local settings, you need to add special lines
3674 to the file which set the keywords and interpretation for that file
3675 only.  For example, to set one of the two examples discussed above, you
3676 need one of the following lines, starting in column zero anywhere in the
3677 file:
3679 #+begin_example
3680    ,#+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3681 #+end_example
3683 {{{noindent}}} (you may also write ~#+SEQ_TODO~ to be explicit about the
3684 interpretation, but it means the same as ~#+TODO~), or
3686 #+begin_example
3687    ,#+TYP_TODO: Fred Sara Lucy Mike | DONE
3688 #+end_example
3690 A setup for using several sets in parallel would be:
3692 #+begin_example
3693    ,#+TODO: TODO | DONE
3694    ,#+TODO: REPORT BUG KNOWNCAUSE | FIXED
3695    ,#+TODO: | CANCELED
3696 #+end_example
3698 #+cindex: completion, of option keywords
3699 #+kindex: M-@key{TAB}
3700 {{{noindent}}} To make sure you are using the correct keyword, type
3701 {{{samp(#+)}}} into the buffer and then use {{{kbdkey(M-,TAB)}}} completion.
3703 #+cindex: DONE, final TODO keyword
3704 Remember that the keywords after the vertical bar (or the last keyword
3705 if no bar is there) must always mean that the item is DONE (although you
3706 may use a different word).  After changing one of these lines, use
3707 {{{kbd(C-c C-c)}}} with the cursor still in the line to make the changes
3708 known to Org mode.[fn:45]
3710 *** Faces for TODO keywords
3711     :PROPERTIES:
3712     :DESCRIPTION: Highlighting states
3713     :END:
3714 #+cindex: faces, for TODO keywords
3715 #+vindex: org-todo @r{(face)}
3716 #+vindex: org-done @r{(face)}
3717 #+vindex: org-todo-keyword-faces
3719 Org mode highlights TODO keywords with special faces: ~org-todo~
3720 for keywords indicating that an item still has to be acted upon, and
3721 ~org-done~ for keywords indicating that an item is finished.  If
3722 you are using more than 2 different states, you might want to use
3723 special faces for some of them.  This can be done using the variable
3724 ~org-todo-keyword-faces~.  For example:
3726 #+header: :exports code
3727 #+header: :eval no
3728 #+begin_src emacs-lisp
3729 (setq org-todo-keyword-faces
3730       '(("TODO" . org-warning) ("STARTED" . "yellow")
3731         ("CANCELED" . (:foreground "blue" :weight bold))))
3732 #+end_src
3734 While using a list with face properties as shown for CANCELED /should/
3735 work, this does not always seem to be the case.  If necessary, define a
3736 special face and use that.  A string is interpreted as a color.  The variable
3737 ~org-faces-easy-properties~ determines if that color is interpreted as a
3738 foreground or a background color.
3740 *** TODO dependencies
3741     :PROPERTIES:
3742     :DESCRIPTION: When one task needs to wait for others
3743     :END:
3744 #+cindex: TODO dependencies
3745 #+cindex: dependencies, of TODO states
3746 #+vindex: org-enforce-todo-dependencies
3747 #+cindex: property, ORDERED
3749 The structure of Org files (hierarchy and lists) makes it easy to define TODO
3750 dependencies.  Usually, a parent TODO task should not be marked DONE until
3751 all subtasks (defined as children tasks) are marked as DONE.  And sometimes
3752 there is a logical sequence to a number of (sub)tasks, so that one task
3753 cannot be acted upon before all siblings above it are done.  If you customize
3754 the variable ~org-enforce-todo-dependencies~, Org will block entries
3755 from changing state to DONE while they have children that are not DONE.
3756 Furthermore, if an entry has a property ~ORDERED~, each of its children
3757 will be blocked until all earlier siblings are marked DONE.  Here is an
3758 example:
3760 #+begin_src org
3761   ,* TODO Blocked until (two) is done
3762   ,** DONE one
3763   ,** TODO two
3764   
3765   ,* Parent
3766     :PROPERTIES:
3767     :ORDERED: t
3768     :END:
3769   ,** TODO a
3770   ,** TODO b, needs to wait for (a)
3771   ,** TODO c, needs to wait for (a) and (b)
3772 #+end_src
3774 #+attr_texinfo: :table-type table :indic @asis
3775 - {{{kbd(C-c C-x o)}}}, ~org-toggle-ordered-property~ ::
3776   #+kindex: C-c C-x o
3777   #+vindex: org-track-ordered-property-with-tag
3778   #+cindex: property, ORDERED
3780   Toggle the ~ORDERED~ property of the current entry.  A property is used
3781   for this behavior because this should be local to the current entry, not
3782   inherited like a tag.  However, if you would like to /track/ the value of
3783   this property with a tag for better visibility, customize the variable
3784   ~org-track-ordered-property-with-tag~.
3785 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
3786   #+kindex: C-u C-u C-u C-c C-t
3788   Change TODO state, circumventing any state blocking.
3791 #+vindex: org-agenda-dim-blocked-tasks
3793 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
3794 that cannot be closed because of such dependencies will be shown in a dimmed
3795 font or even made invisible in agenda views (see [[Agenda views]]).
3797 #+cindex: checkboxes and TODO dependencies
3798 #+vindex: org-enforce-todo-dependencies
3800 You can also block changes of TODO states by looking at checkboxes
3801 (see [[Checkboxes]]).  If you set the variable
3802 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
3803 checkboxes will be blocked from switching to DONE.
3805 If you need more complex dependency structures, for example dependencies
3806 between entries in different trees or files, check out the contributed
3807 module {{{file(org-depend.el)}}}.
3809 {{{page}}}
3811 ** Progress logging
3812    :PROPERTIES:
3813    :DESCRIPTION: Dates and notes for progress
3814    :END:
3815 #+cindex: progress logging
3816 #+cindex: logging, of progress
3818 Org mode can automatically record a timestamp and possibly a note when
3819 you mark a TODO item as DONE, or even each time you change the state of
3820 a TODO item.  This system is highly configurable, settings can be on a
3821 per-keyword basis and can be localized to a file or even a subtree.  For
3822 information on how to clock working time for a task, see [[Clocking work time]].
3824 *** Closing items
3825     :PROPERTIES:
3826     :DESCRIPTION: When was this entry marked DONE?
3827     :END:
3829 The most basic logging is to keep track of /when/ a certain TODO
3830 item was finished.  This is achieved with:[fn:46]
3832 #+header: :exports code
3833 #+header: :eval no
3834 #+begin_src emacs-lisp
3835 (setq org-log-done 'time)
3836 #+end_src
3838 {{{noindent}}} Then each time you turn an entry from a TODO (not-done)
3839 state into any of the DONE states, a line {{{samp(CLOSED: [timestamp])}}} will be inserted just after the headline.  If you turn
3840 the entry back into a TODO item through further state cycling, that
3841 line will be removed again.  If you want to record a note along with
3842 the timestamp, use:[fn:47]
3844 #+header: :exports code
3845 #+header: :eval no
3846 #+begin_src emacs-lisp
3847 (setq org-log-done 'note)
3848 #+end_src
3850 {{{noindent}}} You will then be prompted for a note, and that note
3851 will be stored below the entry with a {{{samp(Closing Note)}}}
3852 heading.
3854 In the timeline (see [[Timeline for a single file]]) and in the agenda
3855 (see [[Weekly/daily agenda]]), you can then use the {{{kbd(l)}}} key to
3856 display the TODO items with a {{{samp(CLOSED)}}} timestamp on each
3857 day, giving you an overview of what has been done.
3859 *** Tracking TODO state changes
3860     :PROPERTIES:
3861     :DESCRIPTION: When did the status change?
3862     :END:
3863 #+cindex: drawer, for state change recording
3864 #+vindex: org-log-states-order-reversed
3865 #+vindex: org-log-into-drawer
3866 #+cindex: property, LOG_INTO_DRAWER
3868 When TODO keywords are used as workflow states (see [[Workflow
3869 states]]), you might want to keep track of when a state change occurred
3870 and maybe take a note about this change.  You can either record just a
3871 timestamp, or a time-stamped note for a change.  These records will be
3872 inserted after the headline as an itemized list, newest first.[fn:48]
3873 When taking a lot of notes, you might want to get the notes out of the
3874 way into a drawer (see [[Drawers]]).  Customize the variable
3875 ~org-log-into-drawer~ to get this behavior---the recommended drawer
3876 for this is called ~LOGBOOK~.[fn:178] You can also overrule the setting
3877 of this variable for a subtree by setting a ~LOG_INTO_DRAWER~
3878 property.
3880 Since it is normally too much to record a note for every state, Org
3881 mode expects configuration on a per-keyword basis for this.  This is
3882 achieved by adding special markers {{{samp(!)}}} (for a timestamp) or
3883 {{{samp(@)}}} (for a note with timestamp) in parentheses after each
3884 keyword.  For example, with the setting:
3886 #+header: :exports code
3887 #+header: :eval no
3888 #+begin_src emacs-lisp
3889 (setq org-todo-keywords
3890   '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
3891 #+end_src
3893 {{{noindent}}}
3894 #+vindex: org-log-done
3896 you not only define global TODO keywords and fast access keys, but
3897 also request that a time is recorded when the entry is set to
3898 DONE, and that a note is recorded when switching to WAIT or
3899 CANCELED.[fn:49] The setting for WAIT is even more special: the {{{samp(!)}}}
3900 after the slash means that in addition to the note taken when entering
3901 the state, a timestamp should be recorded when /leaving/ the WAIT
3902 state, if and only if the /target/ state does not configure logging
3903 for entering it.  So it has no effect when switching from WAIT to DONE,
3904 because DONE is configured to record a timestamp only.  But when
3905 switching from WAIT back to TODO, the {{{samp(/!)}}} in the WAIT
3906 setting now triggers a timestamp even though TODO has no logging
3907 configured.
3909 To record a timestamp without a note for TODO keywords configured with
3910 {{{samp(@)}}}, just type {{{kbd(C-c C-c)}}} to enter a blank note
3911 when prompted.
3913 You can use the exact same syntax for setting logging preferences local
3914 to a buffer:
3916 #+begin_example
3917    ,#+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
3918 #+end_example
3920 #+cindex: property, LOGGING
3922 In order to define logging settings that are local to a subtree or a
3923 single item, define a LOGGING property in this entry.  Any non-empty
3924 LOGGING property resets all logging settings to nil.  You may then turn
3925 on logging for this specific tree using STARTUP keywords like
3926 ~lognotedone~ or ~logrepeat~, as well as adding state specific
3927 settings like ~TODO(!)~.  For example:
3929 #+begin_example
3930    ,* TODO Log each state with only a time
3931      :PROPERTIES:
3932      :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3933      :END:
3934    ,* TODO Only log when switching to WAIT, and when repeating
3935      :PROPERTIES:
3936      :LOGGING: WAIT(@) logrepeat
3937      :END:
3938    ,* TODO No logging at all
3939      :PROPERTIES:
3940      :LOGGING: nil
3941      :END:
3942 #+end_example
3944 *** Tracking your habits
3945     :PROPERTIES:
3946     :DESCRIPTION: How consistent have you been?
3947     :END:
3948     :LOGBOOK:
3949     - State "DONE"       from "DONE"       [2013-01-07 Mon 14:10]
3950     - State "DONE"       from ""           [2013-01-07 Mon 14:10]
3951     :END:
3952 #+cindex: habits
3954 Org has the ability to track the consistency of a special category of TODOs,
3955 called "habits."  A habit has the following properties:
3957   1. You have enabled the ~habits~ module by customizing the variable
3958      ~org-modules~.
3960   2. The habit is a TODO item, with a TODO keyword representing an
3961      open state.
3963   3. The property ~STYLE~ is set to the value ~habit~.
3965   4. The TODO has a scheduled date, usually with a ~.+~ style repeat
3966      interval.  A ~++~ style may be appropriate for habits with time
3967      constraints, e.g., must be done on weekends, or a ~+~ style for
3968      an unusual habit that can have a backlog, e.g., weekly reports.
3970   5. The TODO may also have minimum and maximum ranges specified by
3971      using the syntax {{{samp(.+2d/3d)}}}, which says that you want to
3972      do the task at least every three days, but at most every two
3973      days.
3975   6. You must also have state logging for the ~DONE~ state enabled
3976      (see [[Tracking TODO state changes]]), in order for historical
3977      data to be represented in the consistency graph.  If it is not
3978      enabled it is not an error, but the consistency graphs will be
3979      largely meaningless.
3982 To give you an idea of what the above rules look like in action, here's an
3983 actual habit with some history:
3985 #+begin_example
3986    ,** TODO Shave
3987       SCHEDULED: <2009-10-17 Sat .+2d/4d>
3988       - State "DONE"       from "TODO"       [2009-10-15 Thu]
3989       - State "DONE"       from "TODO"       [2009-10-12 Mon]
3990       - State "DONE"       from "TODO"       [2009-10-10 Sat]
3991       - State "DONE"       from "TODO"       [2009-10-04 Sun]
3992       - State "DONE"       from "TODO"       [2009-10-02 Fri]
3993       - State "DONE"       from "TODO"       [2009-09-29 Tue]
3994       - State "DONE"       from "TODO"       [2009-09-25 Fri]
3995       - State "DONE"       from "TODO"       [2009-09-19 Sat]
3996       - State "DONE"       from "TODO"       [2009-09-16 Wed]
3997       - State "DONE"       from "TODO"       [2009-09-12 Sat]
3998       :PROPERTIES:
3999       :STYLE:    habit
4000       :LAST_REPEAT: [2009-10-19 Mon 00:36]
4001       :END:
4002 #+end_example
4004 What this habit says is: I want to shave at most every 2 days (given
4005 by the ~SCHEDULED~ date and repeat interval) and at least every 4
4006 days.  If today is the 15th, then the habit first appears in the agenda
4007 on Oct 17, after the minimum of 2 days has elapsed, and will appear
4008 overdue on Oct 19, after four days have elapsed.
4010 What's really useful about habits is that they are displayed along
4011 with a consistency graph, to show how consistent you've been at
4012 getting that task done in the past.  This graph shows every day that
4013 the task was done over the past three weeks, with colors for each day.
4014 The colors used are:
4016 #+attr_texinfo: :table-type table :indic @asis
4017   - ~Blue~ :: If the task wasn't to be done yet on that day.
4018   - ~Green~ :: If the task could have been done on that day.
4019   - ~Yellow~ :: If the task was going to be overdue the next day.
4020   - ~Red~ :: If the task was overdue on that day.
4023 In addition to coloring each day, the day is also marked with an
4024 asterisk if the task was actually done that day, and an exclamation
4025 mark to show where the current day falls in the graph.
4027 There are several configuration variables that can be used to change
4028 the way habits are displayed in the agenda.
4030 #+attr_texinfo: :table-type table :indic @asis
4031   - ~org-habit-graph-column~ :: The buffer column at which the
4032        consistency graph should be drawn.  This will overwrite any text
4033        in that column, so it is a good idea to keep your habits'
4034        titles brief and to the point.
4036   - ~org-habit-preceding-days~ :: The amount of history, in days before
4037        today, to appear in consistency graphs.
4039   - ~org-habit-following-days~ :: The number of days after today that
4040        will appear in consistency graphs.
4042   - ~org-habit-show-habits-only-for-today~ :: If non-nil, only show
4043        habits in today's agenda view.  This is set to true by default.
4046 Lastly, pressing {{{kbd(K)}}} in the agenda buffer will cause habits
4047 to temporarily be disabled and they won't appear at all.  Press
4048 {{{kbd(K)}}} again to bring them back.  They are also subject to tag
4049 filtering, if you have habits which should only be done in certain
4050 contexts, for example.
4052 ** FIXME Priorities
4053    :PROPERTIES:
4054    :DESCRIPTION: Some things are more important than others
4055    :END:
4056 #+cindex: priorities
4058 If you use Org mode extensively, you may end up with enough TODO items that
4059 it starts to make sense to prioritize them.  Prioritizing can be done by
4060 placing a /priority cookie/ into the headline of a TODO item, like this:
4062 #+begin_example
4063    ,*** TODO [#A] Write letter to Sam Fortune
4064 #+end_example
4066 #+vindex: org-priority-faces
4068 {{{noindent}}} By default, Org mode supports three priorities: {{{samp(A)}}},
4069 {{{samp(B)}}}, and {{{samp(C)}}}.  {{{samp(A)}}} is the highest
4070 priority.  An entry without a cookie is treated just like priority
4071 {{{samp(B)}}}.  Priorities make a difference only for sorting in the
4072 agenda (see [[Weekly/daily agenda]]); outside the agenda, they have no
4073 inherent meaning to Org mode.  The cookies can be highlighted with
4074 special faces by customizing the variable ~org-priority-faces~.
4076 Priorities can be attached to any outline node; they do not need to be TODO
4077 items.
4079 #+attr_texinfo: :table-type table :indic @asis
4080   - {{{kbd(C-c XXX)}}} ::
4081     #+kindex: C-c ,
4082     # #+kindex: @key{C-c ,}
4083     # Preceding line won't export to pdf
4084     #+findex: org-priority
4085     # Should be C-c ,
4086     Set the priority of the current headline (~org-priority~).  The
4087     command prompts for a priority character {{{samp(A)}}}, {{{samp(B)}}}
4088     or {{{samp(C)}}}.  When you press {{{key(SPC)}}}} instead, the priority
4089     cookie is removed from the headline.  The priorities can also be
4090     changed ``remotely'' from the timeline and agenda buffer with the
4091     {{{kbd(\,)}}} command (see [[Agenda commands]]).
4092   
4093   - {{{kbdkey(S-,up)}}}, {{{kbdkey(S-,down)}}}, {{{command(org-priority-up)}}}, {{{command(org-priority-down)}}} ::
4094     #+vindex: org-priority-start-cycle-with-default
4095     
4096     Increase/decrease priority of current headline.[fn:50] Note
4097     that these keys are also used to modify timestamps
4098     (see [[Creating timestamps]]).  See also [[Conflicts]], for a
4099     discussion of the interaction with ~shift-selection-mode~.
4102 #+vindex: org-highest-priority
4103 #+vindex: org-lowest-priority
4104 #+vindex: org-default-priority
4106 You can change the range of allowed priorities by setting the
4107 variables ~org-highest-priority~, ~org-lowest-priority~, and
4108 ~org-default-priority~.  For an individual buffer, you may set these
4109 values (highest, lowest, default) like this (please make sure that the
4110 highest priority is earlier in the alphabet than the lowest priority):
4112 #+cindex: #+PRIORITIES
4114 #+begin_example
4115    ,#+PRIORITIES: A C B
4116 #+end_example
4118 ** Breaking down tasks
4119    :PROPERTIES:
4120    :DESCRIPTION: Splitting a task into manageable pieces
4121    :END:
4122 #+cindex: tasks, breaking down
4123 #+cindex: statistics, for TODO items
4124 #+vindex: org-agenda-todo-list-sublevels
4126 It is often advisable to break down large tasks into smaller,
4127 manageable subtasks.  You can do this by creating an outline tree below
4128 a TODO item, with detailed subtasks on the tree.[fn:51] To keep the
4129 overview over the fraction of subtasks that are already completed,
4130 insert either {{{samp([/])}}} or {{{samp([%])}}} anywhere in the
4131 headline.  These cookies will be updated each time the TODO status of a
4132 child changes, or when pressing {{{kbd(C-c C-c)}}} on the cookie.  For
4133 example:
4135 #+begin_example
4136    ,* Organize Party [33%]
4137    ,** TODO Call people [1/2]
4138    ,*** TODO Peter
4139    ,*** DONE Sarah
4140    ,** TODO Buy food
4141    ,** DONE Talk to neighbor
4142 #+end_example
4144 #+cindex: property, COOKIE_DATA
4146 If a heading has both checkboxes and TODO children below it, the
4147 meaning of the statistics cookie become ambiguous.  Set the property
4148 ~COOKIE_DATA~ to either {{{samp(checkbox)}}} or {{{samp(todo)}}} to
4149 resolve this issue.
4151 #+vindex: org-hierarchical-todo-statistics
4153 If you would like to have the statistics cookie count any TODO entries
4154 in the subtree (not just direct children), configure the variable
4155 ~org-hierarchical-todo-statistics~.  To do this for a single subtree,
4156 include the word {{{samp(recursive)}}} into the value of the
4157 ~COOKIE_DATA~ property.
4159 #+begin_example
4160    ,* Parent capturing statistics [2/20]
4161      :PROPERTIES:
4162      :COOKIE_DATA: todo recursive
4163      :END:
4164 #+end_example
4166 If you would like a TODO entry to automatically change to DONE
4167 when all children are done, you can use the following setup:
4169 #+header: :exports code
4170 #+header: :eval no
4171 #+begin_src emacs-lisp
4172 (defun org-summary-todo (n-done n-not-done)
4173   "Switch entry to DONE when all subentries are done, to TODO otherwise."
4174   (let (org-log-done org-log-states)   ; turn off logging
4175     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
4177 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
4178 #+end_src
4180 Another possibility is the use of checkboxes to identify (a hierarchy
4181 of) a large number of subtasks (see [[Checkboxes]]).
4183 ** Checkboxes
4184    :PROPERTIES:
4185    :DESCRIPTION: Tick-off lists
4186    :END:
4188 #+cindex: checkboxes
4189 #+vindex: org-list-automatic-rules
4191 Every item in a plain list (see [[Plain lists]]) can be made into a
4192 checkbox by starting it with the string {{{samp([ ])}}}.[fn:52] This
4193 feature is similar to TODO items (see [[TODO items]]), but is more
4194 lightweight.  Checkboxes are not included into the global TODO list, so
4195 they are often great to split a task into a number of simple steps.  Or
4196 you can use them in a shopping list.  To toggle a checkbox, use
4197 {{{kbd(C-c C-c)}}}, or use the mouse (thanks to Piotr Zielinski's
4198 {{{file(org-mouse.el)}}}).
4200 Here is an example of a checkbox list.
4202 #+begin_example
4203    ,* TODO Organize party [2/4]
4204      - [-] call people [1/3]
4205        - [ ] Peter
4206        - [X] Sarah
4207        - [ ] Sam
4208      - [X] order food
4209      - [ ] think about what music to play
4210      - [X] talk to the neighbors
4211 #+end_example
4213 Checkboxes work hierarchically, so if a checkbox item has children
4214 that are checkboxes, toggling one of the children checkboxes will make
4215 the parent checkbox reflect if none, some, or all of the children are
4216 checked.
4218 #+cindex: statistics, for checkboxes
4219 #+cindex: checkbox statistics
4220 #+cindex: property, COOKIE_DATA
4221 #+vindex: org-hierarchical-checkbox-statistics
4223 The {{{samp([2/4])}}} and {{{samp([1/3])}}} in the first and second
4224 line are cookies indicating how many checkboxes present in this entry
4225 have been checked off, and the total number of checkboxes present.
4226 This can give you an idea on how many checkboxes remain, even without
4227 opening a folded entry.  The cookies can be placed into a headline or
4228 into (the first line of) a plain list item.  Each cookie covers
4229 checkboxes of direct children structurally below the headline/item on
4230 which the cookie appears.[fn:53] You have to insert the cookie
4231 yourself by typing either {{{samp([/])}}} or {{{samp([%])}}}.  With
4232 {{{samp([/])}}} you get an {{{samp(n out of m)}}} result, as in the
4233 examples above.  With {{{samp([%])}}} you get information about the
4234 percentage of checkboxes checked (in the above example, this would be
4235 {{{samp([50%])}}} and {{{samp([33%])}}}, respectively).  In a headline,
4236 a cookie can count either checkboxes below the heading or TODO states
4237 of children, and it will display whatever was changed last.  Set the
4238 property ~COOKIE_DATA~ to either {{{samp(checkbox)}}} or
4239 {{{samp(todo)}}} to resolve this issue.
4241 #+cindex: blocking, of checkboxes
4242 #+cindex: checkbox blocking
4243 #+cindex: property, ORDERED
4245 If the current outline node has an ~ORDERED~ property, checkboxes must
4246 be checked off in sequence, and an error will be thrown if you try to
4247 check off a box while there are unchecked boxes above it.
4249 {{{noindent}}} The following commands work with checkboxes:
4251 #+attr_texinfo: :table-type table :indic @asis
4252 - {{{kbd(C-c C-c)}}}, ~org-toggle-checkbox~ :: Toggle checkbox status
4253      or (with prefix arg) checkbox presence at point.  With a single
4254      prefix argument, add an empty checkbox or remove the current
4255      one.[fn:54] With a double prefix argument, set it to
4256      {{{samp([-])}}}, which is considered to be an intermediate state.
4258 - {{{kbd(C-c C-x C-b)}}}, ~org-toggle-checkbox~ :: Toggle checkbox
4259      status or (with prefix arg) checkbox presence at point.  With
4260      double prefix argument, set it to {{{samp([-])}}}, which is
4261      considered to be an intermediate state.
4263   - If there is an active region, toggle the first checkbox in the region
4264     and set all remaining boxes to the same status as the first.  With a prefix
4265     arg, add or remove the checkbox for all items in the region.
4267   - If the cursor is in a headline, toggle checkboxes in the region
4268     between this headline and the next (so /not/ the entire subtree).
4270   - If there is no active region, just toggle the checkbox at point.
4273 - {{{kbdkey(M-S-,RET)}}}, ~org-insert-todo-heading~ :: Insert a new
4274      item with a checkbox.  This works only if the cursor is already in
4275      a plain list item (see [[Plain lists]]).
4277 - {{{kbd(C-c C-x o)}}}, ~org-toggle-ordered-property~ ::
4278   #+kindex: C-c C-x o
4279   #+vindex: org-track-ordered-property-with-tag
4280   #+cindex: property, ORDERED
4281   
4282   Toggle the ~ORDERED~ property of the entry, to toggle if checkboxes
4283   must be checked off in sequence.  A property is used for this
4284   behavior because this should be local to the current entry, not
4285   inherited like a tag.  However, if you would like to /track/ the
4286   value of this property with a tag for better visibility,
4287   customize the variable ~org-track-ordered-property-with-tag~.
4289 - {{{kbd(C-c #)}}}, ~org-update-statistics-cookies~ ::
4290   #+kindex: C-c #
4292   Update the statistics cookie in the current outline entry.  When
4293   called with a {{{kbd(C-u)}}} prefix, update the entire file.
4294   Checkbox statistic cookies are updated automatically if you
4295   toggle checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
4296   {{{kbdkey(M-S-,RET)}}}.  TODO statistics cookies update when
4297   changing TODO states.  If you delete boxes/entries or add/change
4298   them by hand, use this command to get things back into sync.
4300 * Tags
4301   :PROPERTIES:
4302   :DESCRIPTION: Tagging headlines and matching sets of tags
4303   :END:
4304 #+cindex: tags
4305 #+cindex: headline tagging
4306 #+cindex: matching, tags
4307 #+cindex: sparse tree, tag based
4309 An excellent way to implement labels and contexts for
4310 cross-correlating information is to assign /tags/ to headlines.  Org
4311 mode has extensive support for tags.
4313 #+vindex: org-tag-faces
4315 Every headline can contain a list of tags; they occur at the end of
4316 the headline.  Tags are normal words containing letters, numbers,
4317 {{{samp(_)}}}, and {{{samp(@)}}}.  Tags must be preceded and followed
4318 by a single colon, e.g., {{{samp(:work:)}}}.  Several tags can be
4319 specified, as in {{{samp(:work:urgent:)}}}.  Tags will by default be in
4320 bold face with the same color as the headline.  You may specify special
4321 faces for specific tags using the variable ~org-tag-faces~, in much
4322 the same way as you can for TODO keywords (see [[Faces for TODO keywords]]).
4324 ** Tag inheritance
4325    :PROPERTIES:
4326    :DESCRIPTION: Tags use the tree structure of an outline
4327    :END:
4328 #+cindex: tag inheritance
4329 #+cindex: inheritance, of tags
4330 #+cindex: sublevels, inclusion into tags match
4332 /Tags/ make use of the hierarchical structure of outline trees.  If a
4333 heading has a certain tag, all subheadings will inherit the tag as
4334 well.  For example, in the list
4336 #+begin_example
4337    ,* Meeting with the French group      :work:
4338    ,** Summary by Frank                  :boss:notes:
4339    ,*** TODO Prepare slides for him      :action:
4340 #+end_example
4342 {{{noindent}}} the final heading will have the tags
4343 {{{samp(:work:)}}}, {{{samp(:boss:)}}}, {{{samp(:notes:)}}}, and
4344 {{{samp(:action:)}}} even though the final heading is not explicitly
4345 marked with those tags.  You can also set tags that all entries in a
4346 file should inherit just as if these tags were defined in a
4347 hypothetical level zero that surrounds the entire file.  Use a line
4348 like this:[fn:55]
4350 #+cindex: #+FILETAGS
4351 #+begin_example
4352    ,#+FILETAGS: :Peter:Boss:Secret:
4353 #+end_example
4355 #+vindex: org-use-tag-inheritance
4356 #+vindex: org-tags-exclude-from-inheritance
4358 {{{noindent}}} To limit tag inheritance to specific tags, or to turn
4359 it off entirely, use the variables ~org-use-tag-inheritance~ and
4360 ~org-tags-exclude-from-inheritance~.
4362 #+vindex: org-tags-match-list-sublevels
4364 When a headline matches during a tags search while tag inheritance is
4365 turned on, all the sublevels in the same tree will (for a simple match
4366 form) match as well.[fn:56] The list of matches may then become very
4367 long.  If you only want to see the first tags match in a subtree,
4368 configure the variable ~org-tags-match-list-sublevels~ (not
4369 recommended).
4371 ** Setting tags
4372    :PROPERTIES:
4373    :DESCRIPTION: How to assign tags to a headline
4374    :END:
4375 #+cindex: setting tags
4376 #+cindex: tags, setting
4377 #+kindex: M-@key{TAB}
4379 Tags can simply be typed into the buffer at the end of a headline.
4380 After a colon, {{{kbdkey(M-,TAB)}}} offers completion on tags.  There is
4381 also a special command for inserting tags:
4383 #+attr_texinfo: :table-type table :indic @asis
4384 - {{{kbd(C-c C-q)}}}, ~org-set-tags-command~ ::
4385   #+kindex: C-c C-q
4387   #+cindex: completion, of tags
4388   #+vindex: org-tags-column
4390   Enter new tags for the current headline.  Org mode will either offer
4391   completion or a special single-key interface for setting tags, see
4392   below.  After pressing {{{key(RET)}}}, the tags will be inserted and aligned
4393   to ~org-tags-column~.  When called with a {{{kbd(C-u)}}} prefix, all
4394   tags in the current buffer will be aligned to that column, just to make
4395   things look nice.  TAGS are automatically realigned after promotion,
4396   demotion, and TODO state changes (see [[TODO basics]]).
4398 - {{{kbd(C-c C-c)}}}, ~org-set-tags-command~ ::
4399   #+kindex: C-c C-c
4401   When the cursor is in a headline, this does the same as {{{kbd(C-c C-q)}}}.
4404 #+vindex: org-tag-alist
4406 Org supports tag insertion based on a /list of tags/.  By default this
4407 list is constructed dynamically, containing all tags currently used in
4408 the buffer.  You may also globally specify a hard list of tags with the
4409 variable ~org-tag-alist~.  Finally you can set the default tags for a
4410 given file with lines like
4412 #+cindex: #+TAGS
4413 #+begin_example
4414    ,#+TAGS: @work @home @tennisclub
4415    ,#+TAGS: laptop car pc sailboat
4416 #+end_example
4418 If you have globally defined your preferred set of tags using the
4419 variable ~org-tag-alist~, but would like to use a dynamic tag list
4420 in a specific file, add an empty TAGS option line to that file:
4422 #+begin_example
4423    ,#+TAGS:
4424 #+end_example
4426 #+vindex: org-tag-persistent-alist
4428 If you have a preferred set of tags that you would like to use in
4429 every file, in addition to those defined on a per-file basis by TAGS
4430 option lines, then you may specify a list of tags with the variable
4431 ~org-tag-persistent-alist~.  You may turn this off on a per-file basis
4432 by adding a STARTUP option line to that file:
4434 #+begin_example
4435    ,#+STARTUP: noptag
4436 #+end_example
4438 By default Org mode uses the standard minibuffer completion facilities
4439 for entering tags.  However, it also implements another, quicker, tag
4440 selection method called /fast tag selection/.  This allows you to
4441 select and deselect tags with just a single key press.  For this to
4442 work well you should assign unique letters to most of your commonly
4443 used tags.  You can do this globally by configuring the variable
4444 ~org-tag-alist~ in your {{{file(.emacs)}}} file.  For example, you may
4445 find the need to tag many items in different files with
4446 {{{samp(:@home:)}}}.  In this case you can set something like:
4448 #+header: :eval no
4449 #+header: :exports code
4450 #+begin_src emacs-lisp
4451 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
4452 #+end_src
4454 {{{noindent}}} If the tag is only relevant to the file you are working
4455 on, then you can instead set the TAGS option line as:
4457 #+begin_example
4458    ,#+TAGS: @work(w)  @home(h)  @tennisclub(t)  laptop(l)  pc(p)
4459 #+end_example
4461 {{{noindent}}} The tags interface will show the available tags in a splash
4462 window.  If you want to start a new line after a specific tag, insert
4463 ~\n~ into the tag list, like this:
4465 #+begin_example
4466    ,#+TAGS: @work(w)  @home(h)  @tennisclub(t) \n laptop(l)  pc(p)
4467 #+end_example
4469 {{{noindent}}} or write them in two lines:
4471 #+begin_example
4472    ,#+TAGS: @work(w)  @home(h)  @tennisclub(t)
4473    ,#+TAGS: laptop(l)  pc(p)
4474 #+end_example
4476 {{{noindent}}}
4477 You can also group together tags that are mutually exclusive by using
4478 braces, as in:
4480 #+begin_example
4481    ,#+TAGS: { @work(w)  @home(h)  @tennisclub(t) }  laptop(l)  pc(p)
4482 #+end_example
4484 {{{noindent}}} you indicate that at most one of {{{samp(@work)}}},
4485 {{{samp(@home)}}}, and {{{samp(@tennisclub)}}} should be selected.
4486 Multiple such groups are allowed.
4488 {{{noindent}}} Don't forget to press {{{kbd(C-c C-c)}}} with the
4489 cursor in one of these lines to activate any changes.
4491 {{{noindent}}} To set these mutually exclusive groups in the variable
4492 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
4493 ~:endgroup~ instead of the braces.  Similarly, you can use ~:newline~
4494 to indicate a line break.  The previous example would be set globally
4495 by the following configuration:
4497 #+header: :eval no
4498 #+header: :exports code
4499 #+begin_src emacs-lisp
4500 (setq org-tag-alist '((:startgroup . nil)
4501                       ("@@work" . ?w) ("@@home" . ?h)
4502                       ("@@tennisclub" . ?t)
4503                       (:endgroup . nil)
4504                       ("laptop" . ?l) ("pc" . ?p)))
4505 #+end_src
4507 If at least one tag has a selection key then pressing {{{kbd(C-c C-c)}}} will
4508 automatically present you with a special interface, listing inherited tags,
4509 the tags of the current headline, and a list of all valid tags with
4510 corresponding keys.[fn:57]  In this interface, you can use the following
4511 keys:
4513 #+attr_texinfo: :table-type table :indic @asis
4514 - {{{kbd(a-z...)}}} ::
4515   #+kindex: a-z...
4517   Pressing keys assigned to tags will add or remove them from the list of
4518   tags in the current line.  Selecting a tag in a group of mutually
4519   exclusive tags will turn off any other tags from that group.
4521 - {{{key(TAB)}}} ::
4522   #+kindex: @key{TAB}
4524   Enter a tag in the minibuffer, even if the tag is not in the predefined
4525   list.  You will be able to complete on all tags present in the buffer.
4526   You can also add several tags: just separate them with a comma.
4528 - {{{key(SPC)}}} ::
4529   #+kindex: @key{SPC}
4531   Clear all tags for this line.
4533 - {{{key(RET)}}} ::
4534   #+kindex: @key{RET}
4536   Accept the modified set.
4538 - C-g ::
4540   Abort without installing changes.
4542 - q ::
4544   If {{{kbd(q)}}} is not assigned to a tag, it aborts like {{{kbd(C-g)}}}.
4546 - ! ::
4548   Turn off groups of mutually exclusive tags.  Use this to (as an
4549   exception) assign several tags from such a group.
4551 - C-c ::
4553   Toggle auto-exit after the next change (see below).
4554   If you are using expert mode, the first {{{kbd(C-c)}}} will display the
4555   selection window.
4558 {{{noindent}}} This method lets you assign tags to a headline with
4559 very few keys.  With the above setup, you could clear the current tags
4560 and set {{{samp(@home)}}}, {{{samp(laptop)}}} and {{{samp(pc)}}} tags
4561 with just the following keys: {{{ksksksk(C-c C-c,SPC,h l p,RET)}}}.  Switching from {{{samp(@home)}}} to
4562 {{{samp(@work)}}} would be done with {{{kbdspckey(C-c C-c w,RET)}}} or
4563 alternatively with {{{kbd(C-c C-c C-c w)}}}.  Adding the non-predefined
4564 tag {{{samp(Sarah)}}} could be done with 
4565 {{{ksksksksk(C-c C-c,TAB,S a r a h,RET,RET)}}}.
4567 #+vindex: org-fast-tag-selection-single-key
4569 If you find that most of the time you need only a single key press to
4570 modify your list of tags, set the variable
4571 ~org-fast-tag-selection-single-key~.  Then you no longer have to press
4572 {{{key(RET)}}} to exit fast tag selection---it will immediately exit after
4573 the first change.  If you then occasionally need more keys, press
4574 {{{kbd(C-c)}}} to turn off auto-exit for the current tag selection
4575 process (in effect: start selection with {{{kbd(C-c C-c C-c)}}}
4576 instead of {{{kbd(C-c C-c)}}}).  If you set the variable to the value
4577 ~expert~, the special window is not even shown for single-key tag
4578 selection, it comes up only when you press an extra {{{kbd(C-c)}}}.
4580 ** Tag searches
4581    :PROPERTIES:
4582    :DESCRIPTION: Searching for combinations of tags
4583    :END:
4584 #+cindex: tag searches
4585 #+cindex: searching for tags
4587 Once a system of tags has been set up, it can be used to collect related
4588 information into special lists.
4590 #+attr_texinfo: :table-type table :indic @asis
4591 - {{{kbd(C-c / m)}}}, ~C-c \~ ~org-match-sparse-tree~ ::
4593   Create a sparse tree with all headlines matching a tags search.  With a
4594   {{{kbd(C-u)}}} prefix argument, ignore headlines that are not a TODO
4595   line.
4597 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
4598   #+kindex: C-c a m
4600   Create a global list of tag matches from all agenda files.
4601   See [[Matching tags and properties]].
4603 - {{{kbd(C-c a M)}}}, ~org-tags-view~ ::
4604   #+kindex: C-c a M
4605   #+vindex: org-tags-match-list-sublevels
4607   Create a global list of tag matches from all agenda files, but check
4608   only TODO items and force checking subitems (see variable
4609   ~org-tags-match-list-sublevels~).
4612 These commands all prompt for a match string which allows basic
4613 Boolean logic like {{{samp(+boss+urgent-project1)}}}, to find entries
4614 with tags {{{samp(boss)}}} and {{{samp(urgent)}}}, but not
4615 {{{samp(project1)}}}, or {{{samp(Kathy|Sally)}}} to find entries which
4616 are tagged, like {{{samp(Kathy)}}} or {{{samp(Sally)}}}.  The full
4617 syntax of the search string is rich and allows also matching against
4618 TODO keywords, entry levels and properties.  For a complete description
4619 with many examples, see [[Matching tags and properties]].
4621 * Properties and columns
4622   :PROPERTIES:
4623   :DESCRIPTION: Storing information about an entry
4624   :ALT_TITLE: Properties and Columns
4625   :END:
4626 #+cindex: properties
4628 A property is a key-value pair associated with an entry.  Properties
4629 can be set so they are associated with a single entry, with every
4630 entry in a tree, or with every entry in an Org mode file.
4632 There are two main applications for properties in Org mode.  First,
4633 properties are like tags, but with a value.  Imagine maintaining a file
4634 where you document bugs and plan releases for a piece of software.
4635 Instead of using tags like ~:release_1:~, ~:release_2:~, you can use a
4636 property, say ~:Release:~, that in different subtrees has different
4637 values, such as ~1.0~ or ~2.0~.  Second, you can use properties to
4638 implement (very basic) database capabilities in an Org buffer.  Imagine
4639 keeping track of your music CDs, where properties could be things such
4640 as the album, artist, date of release, number of tracks, and so on.
4642 Properties can be conveniently edited and viewed in column view
4643 (see [[Column view]]).
4645 ** Property syntax
4646    :PROPERTIES:
4647    :DESCRIPTION: How properties are spelled out
4648    :END:
4649 #+cindex: property syntax
4650 #+cindex: drawer, for properties
4652 Properties are key-value pairs.  When they are associated with a single
4653 entry or with a tree they need to be inserted into a special drawer
4654 (see [[Drawers]]) with the name ~PROPERTIES~.  Each property is specified
4655 on a single line, with the key (surrounded by colons) first, and the
4656 value after it.  Here is an example:
4658 #+begin_example
4659    ,* CD collection
4660    ,** Classic
4661    ,*** Goldberg Variations
4662    ,    :PROPERTIES:
4663    ,    :Title:     Goldberg Variations
4664    ,    :Composer:  J.S. Bach
4665    ,    :Artist:    Glen Gould
4666    ,    :Publisher: Deutsche Grammophon
4667    ,    :NDisks:    1
4668    ,    :END:
4669 #+end_example
4671 Depending on the value of ~org-use-property-inheritance~, a property
4672 set this way will either be associated with a single entry, or the
4673 sub-tree defined by the entry, see [[Property inheritance]].
4675 You may define the allowed values for a particular property
4676 {{{samp(:Xyz:)}}} by setting a property {{{samp(:Xyz_ALL:)}}}.  This
4677 special property is /inherited/, so if you set it in a level 1 entry,
4678 it will apply to the entire tree.  When allowed values are defined,
4679 setting the corresponding property becomes easier and is less prone to
4680 typing errors.  For the example with the CD collection, we can
4681 predefine publishers and the number of disks in a box like this:
4683 #+begin_example
4684    ,* CD collection
4685    ,  :PROPERTIES:
4686    ,  :NDisks_ALL:  1 2 3 4
4687    ,  :Publisher_ALL: "Deutsche Grammophon" Philips EMI
4688    ,  :END:
4689 #+end_example
4691 If you want to set properties that can be inherited by any entry in a
4692 file, use a line like:
4694 #+cindex: property, _ALL
4695 #+cindex: #+PROPERTY
4696 #+begin_example
4697    ,#+PROPERTY: NDisks_ALL 1 2 3 4
4698 #+end_example
4700 If you want to add to the value of an existing property, append a ~+~
4701 to the property name.  The following results in the property ~var~
4702 having the value ``foo=1 bar=2''.
4704 #+cindex: property, +
4705 #+begin_example
4706    ,#+PROPERTY: var  foo=1
4707    ,#+PROPERTY: var+ bar=2
4708 #+end_example
4710 It is also possible to add to the values of inherited properties.  The
4711 following results in the ~genres~ property having the value ``Classic
4712 Baroque'' under the ~Goldberg Variations~ subtree.
4714 #+cindex: property, +
4715 #+begin_example
4716    ,* CD collection
4717    ,** Classic
4718    ,    :PROPERTIES:
4719    ,    :GENRES: Classic
4720    ,    :END:
4721    ,*** Goldberg Variations
4722    ,    :PROPERTIES:
4723    ,    :Title:     Goldberg Variations
4724    ,    :Composer:  J.S. Bach
4725    ,    :Artist:    Glen Gould
4726    ,    :Publisher: Deutsche Grammophon
4727    ,    :NDisks:    1
4728    ,    :GENRES+:   Baroque
4729    ,    :END:
4730 #+end_example
4731 Note that a property can only have one entry per Drawer.
4733 #+vindex: org-global-properties
4735 Property values set with the global variable ~org-global-properties~
4736 can be inherited by all entries in all Org files.
4738 {{{noindent}}}
4739 The following commands help to work with properties:
4741 #+attr_texinfo: :table-type table :indic @asis
4742 - {{{kbdkey(M-,TAB)}}}, ~pcomplete~ ::
4743   #+kindex: M-@key{TAB}
4745   After an initial colon in a line, complete property keys.  All keys
4746   used in the current file will be offered as possible completions.
4748 - {{{kbd(C-c C-x p)}}}, ~org-set-property~ ::
4749   #+kindex: C-c C-x p
4751   Set a property.  This prompts for a property name and a value.  If
4752   necessary, the property drawer is created as well.
4754 - C-u M-x org-insert-drawer RET ::
4755   #+cindex: org-insert-drawer
4757   Insert a property drawer into the current entry.  The drawer will be
4758   inserted early in the entry, but after the lines with planning
4759   information like deadlines.
4761 - {{{kbd(C-c C-c)}}}, ~org-property-action~ ::
4762   #+kindex: C-c C-c
4764   With the cursor in a property drawer, this executes property commands.
4766 - {{{kbd(C-c C-c s)}}}, ~org-set-property~ ::
4767   #+kindex: C-c C-c s
4769   Set a property in the current entry.  Both the property and the value
4770   can be inserted using completion.
4772 - {{{kbdkey(S-,right)}}} {{{kbdkey(S-,left)}}}, ~org-property-next-allowed-value~ ~org-property-previous-allowed-value~ ::
4773   #+kindex: S-@key{right}
4775   Switch property at point to the next/previous allowed value.
4777 - {{{kbd(C-c C-c d)}}}, ~org-delete-property~ ::
4778   #+kindex: C-c C-c d
4780   Remove a property from the current entry.
4782 - {{{kbd(C-c C-c D)}}}, ~org-delete-property-globally~ ::
4783   #+kindex: C-c C-c D
4785   Globally remove a property, from all entries in the current file.
4787 - {{{kbd(C-c C-c c)}}}, ~org-compute-property-at-point~ ::
4788   #+kindex: C-c C-c c
4790   Compute the property at point, using the operator and scope from the
4791   nearest column format definition.
4793 ** Special properties
4794    :PROPERTIES:
4795    :DESCRIPTION: Access to other Org mode features
4796    :END:
4797 #+cindex: properties, special
4799 Special properties provide an alternative access method to Org mode
4800 features, like the TODO state or the priority of an entry, discussed
4801 in the previous chapters.  This interface exists so that you can
4802 include these states in a column view (see [[Column view]]), or to use
4803 them in queries.  The following property names are special and (except
4804 for ~:CATEGORY:~) should not be used as keys in the properties drawer:
4806 #+cindex: property, special, ID
4807 #+cindex: property, special, TODO
4808 #+cindex: property, special, TAGS
4809 #+cindex: property, special, ALLTAGS
4810 #+cindex: property, special, CATEGORY
4811 #+cindex: property, special, PRIORITY
4812 #+cindex: property, special, DEADLINE
4813 #+cindex: property, special, SCHEDULED
4814 #+cindex: property, special, CLOSED
4815 #+cindex: property, special, TIMESTAMP
4816 #+cindex: property, special, TIMESTAMP_IA
4817 #+cindex: property, special, CLOCKSUM
4818 #+cindex: property, special, CLOCKSUM_T
4819 #+cindex: property, special, BLOCKED
4820 # guessing that ITEM is needed in this area; also, should this list be sorted?
4821 #+cindex: property, special, ITEM
4822 #+cindex: property, special, FILE
4824 #+attr_texinfo: :columns 0.3 0.7
4825 | ID           | A globally unique ID used for synchronization during           |
4826 |              | iCalendar or MobileOrg export.                                 |
4827 | TODO         | The TODO keyword of the entry.                                 |
4828 | TAGS         | The tags defined directly in the headline.                     |
4829 | ALLTAGS      | All tags, including inherited ones.                            |
4830 | CATEGORY     | The category of an entry.                                      |
4831 | PRIORITY     | The priority of the entry, a string with a single letter.      |
4832 | DEADLINE     | The deadline time string, without the angular brackets.        |
4833 | SCHEDULED    | The scheduling timestamp, without the angular brackets.        |
4834 | CLOSED       | When was this entry closed?                                    |
4835 | TIMESTAMP    | The first keyword-less timestamp in the entry.                 |
4836 | TIMESTAMP_IA | The first inactive timestamp in the entry.                     |
4837 | CLOCKSUM     | The sum of CLOCK intervals in the subtree.  ~org-clock-sum~    |
4838 |              | must be run first to compute the values in the current buffer. |
4839 | CLOCKSUM_T   | The sum of CLOCK intervals in the subtree for today.           |
4840 |              | ~org-clock-sum-today~ must be run first to compute the         |
4841 |              | values in the current buffer.                                  |
4842 | BLOCKED      | "t" if task is currently blocked by children or siblings       |
4843 | ITEM         | The headline of the entry.                                     |
4844 | FILE         | The filename the entry is located in.                          |
4846 ** Property searches
4847    :PROPERTIES:
4848    :DESCRIPTION: Matching property values
4849    :END:
4850 #+cindex: properties, searching
4851 #+cindex: searching, of properties
4853 To create sparse trees and special lists with selection based on properties,
4854 the same commands are used as for tag searches (see [[Tag searches]]).
4856 #+attr_texinfo: :table-type table :indic @asis
4857 - {{{kbd(C-c / m)}}}, ~C-c \~ ~org-match-sparse-tree~ ::
4858   #+kindex: C-c / m
4860   Create a sparse tree with all matching entries.  With a {{{kbd(C-u)}}}
4861   prefix argument, ignore headlines that are not a TODO line.
4863 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
4864   #+kindex: C-c a m
4866   Create a global list of tag/property matches from all agenda files.
4867   See [[Matching tags and properties]].
4869 - {{{kbd(C-c a M)}}}, ~org-tags-view~ ::
4870   #+kindex: C-c a M
4871   #+vindex: org-tags-match-list-sublevels
4873   Create a global list of tag matches from all agenda files, but check
4874   only TODO items and force checking of subitems (see variable
4875   ~org-tags-match-list-sublevels~).
4878 The syntax for the search string is described in [[Matching tags and
4879 properties]].
4881 There is also a special command for creating sparse trees based on a
4882 single property:
4884 #+attr_texinfo: :table-type table :indic @asis
4885 - {{{kbd(C-c / p)}}} ::
4886   #+kindex: C-c / p
4888   Create a sparse tree based on the value of a property.  This first
4889   prompts for the name of a property, and then for a value.  A sparse
4890   tree is created with all entries that define this property with the
4891   given value.  If you enclose the value in curly braces, it is
4892   interpreted as a regular expression and matched against the property
4893   values.
4895 ** Property inheritance
4896    :PROPERTIES:
4897    :DESCRIPTION: Passing values down a tree
4898    :END:
4899 #+cindex: properties, inheritance
4900 #+cindex: inheritance, of properties
4902 #+vindex: org-use-property-inheritance
4904 The outline structure of Org mode documents lends itself to an
4905 inheritance model of properties: if the parent in a tree has a certain
4906 property, the children can inherit this property.  Org mode does not
4907 turn this on by default, because it can slow down property searches
4908 significantly and is often not needed.  However, if you find
4909 inheritance useful, you can turn it on by setting the variable
4910 ~org-use-property-inheritance~.  It may be set to ~t~ to make all
4911 properties inherited from the parent, to a list of properties that
4912 should be inherited, or to a regular expression that matches inherited
4913 properties.  If a property has the value {{{samp(nil)}}}, this is
4914 interpreted as an explicit undefine of the property, so that
4915 inheritance search will stop at this value and return ~nil~.
4917 Org mode has a few properties for which inheritance is hard-coded, at
4918 least for the special applications for which they are used:
4921 #+attr_texinfo: :table-type table :indic @asis
4922 - ~COLUMNS~ ::
4923   #+cindex: property, COLUMNS
4925   The ~:COLUMNS:~ property defines the format of column view (see [[Column
4926   view]]).  It is inherited in the sense that the level where a ~:COLUMNS:~
4927   property is defined is used as the starting point for a column view
4928   table, independently of the location in the subtree from where columns
4929   view is turned on.
4931 - ~CATEGORY~ ::
4932   #+cindex: property, CATEGORY
4934   For agenda view, a category set through a ~:CATEGORY:~ property
4935   applies to the entire subtree.
4937 - ~ARCHIVE~ ::
4938   #+cindex: property, ARCHIVE
4940   For archiving, the ~:ARCHIVE:~ property may define the archive
4941   location for the entire subtree (see [[Moving subtrees]]).
4943 - ~LOGGING~ ::
4944   #+cindex: property, LOGGING
4946   The LOGGING property may define logging settings for an entry or a
4947   subtree (see [[Tracking TODO state changes]]).
4949 ** Column view
4950    :PROPERTIES:
4951    :DESCRIPTION: Tabular viewing and editing
4952    :END:
4954 A great way to view and edit properties in an outline tree is /column
4955 view/.  In column view, each outline node is turned into a table row.
4956 Columns in this table provide access to properties of the entries.  Org
4957 mode implements columns by overlaying a tabular structure over the
4958 headline of each item.  While the headlines have been turned into a
4959 table row, you can still change the visibility of the outline tree.
4960 For example, you get a compact table by switching to CONTENTS view
4961 ({{{kbdkey(S-,TAB)}}}} {{{kbdkey(S-,TAB)}}}), or simply {{{kbd(c)}}} while
4962 column view is active), but you can still open, read, and edit the
4963 entry below each headline.  Or, you can switch to column view after
4964 executing a sparse tree command and in this way get a table only for
4965 the selected items.  Column view also works in agenda buffers (see
4966 [[Agenda views]]) where queries have collected selected items, possibly
4967 from a number of files.
4969 *** Defining columns
4970     :PROPERTIES:
4971     :DESCRIPTION: The COLUMNS format property
4972     :END:
4973 #+cindex: column view, for properties
4974 #+cindex: properties, column view
4976 Setting up a column view first requires defining the columns.  This is
4977 done by defining a column format line.
4979 **** Scope of column definitions
4980      :PROPERTIES:
4981      :DESCRIPTION: Where defined, where valid?
4982      :END:
4984 To define a column format for an entire file, use a line like:
4986 #+cindex: #+COLUMNS
4987 #+begin_example
4988    ,#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4989 #+end_example
4991 To specify a format that only applies to a specific tree, add a
4992 ~:COLUMNS:~ property to the top node of that tree, for example:
4994 #+begin_example
4995    ,** Top node for columns view
4996    ,   :PROPERTIES:
4997    ,   :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4998    ,   :END:
4999 #+end_example
5001 If a ~:COLUMNS:~ property is present in an entry, it defines columns
5002 for the entry itself, and for the entire subtree below it.  Since the
5003 column definition is part of the hierarchical structure of the
5004 document, you can define columns on level 1 that are general enough
5005 for all sublevels, and more specific columns further down, when you
5006 edit a deeper part of the tree.
5008 **** Column attributes
5009      :PROPERTIES:
5010      :DESCRIPTION: Appearance and content of a column
5011      :END:
5012 A column definition sets the attributes of a column.  The general
5013 definition looks like this:
5015   %[{{{var(width)}}}]{{{var(property)}}}[({{{var(title)}}})][{{{{var(summary-type)}}}}]
5017 {{{noindent}}} Except for the percent sign and the property name, all
5018 items are optional.  The individual parts have the following meaning:
5020 #+attr_texinfo: :columns 0.2 0.8
5021 | Variable                | Meaning                                                      |
5022 |-------------------------+--------------------------------------------------------------|
5023 | {{{var(width)}}}        | An integer specifying the width of the column in characters. |
5024 |                         | If omitted, the width will be determined automatically.      |
5025 | {{{var(property)}}}     | The property that should be edited in this column.           |
5026 |                         | Special properties representing meta data are allowed here   |
5027 |                         | as well (see [[Special properties]])                         |
5028 | {{{var(title)}}}        | The header text for the column.  If omitted, the property    |
5029 |                         | name is used.                                                |
5030 | {{{var(summary-type)}}} | The summary type.  If specified, the column values for       |
5031 |                         | parent nodes are computed from the children.                 |
5033 {{{noindent}}} Supported summary types are:
5035 #+attr_texinfo: :columns 0.2 0.8
5036 | Type     | Meaning                                                               |
5037 |----------+-----------------------------------------------------------------------|
5038 | ~+~      | Sum numbers in this column.                                           |
5039 | ~+;%.1f~ | Like ~+~, but format result with {{{samp(%.1f)}}}.                    |
5040 | ~$~      | Currency, short for {{{samp(+;%.2f)}}}.                               |
5041 | ~:~      | Sum times, HH:MM, plain numbers are hours.                            |
5042 | ~X~      | Checkbox status, {{{samp([X])}}} if all children are {{{samp([X])}}}. |
5043 | ~X/~     | Checkbox status, {{{samp([n/m])}}}.                                   |
5044 | ~X%~     | Checkbox status, {{{samp([n%])}}}.                                    |
5045 | ~min~    | Smallest number in column.                                            |
5046 | ~max~    | Largest number.                                                       |
5047 | ~mean~   | Arithmetic mean of numbers.                                           |
5048 | ~:min~   | Smallest time value in column.                                        |
5049 | ~:max~   | Largest time value.                                                   |
5050 | ~:mean~  | Arithmetic mean of time values.                                       |
5051 | ~@min~   | Minimum age (in days/hours/mins/seconds).                             |
5052 | ~@max~   | Maximum age (in days/hours/mins/seconds).                             |
5053 | ~@mean~  | Arithmetic mean of ages (in days/hours/mins/seconds).                 |
5054 | ~est+~   | Add low-high estimates.                                               |
5057 {{{noindent}}} Be aware that you can only have one summary type for
5058 any property you include.  Subsequent columns referencing the same
5059 property will all display the same summary information.
5061 The ~est+~ summary type requires further explanation.  It is used for
5062 combining estimates, expressed as low-high ranges.  For example,
5063 instead of estimating a particular task will take 5 days, you might
5064 estimate it as 5-6 days if you're fairly confident you know how much
5065 work is required, or 1-10 days if you don't really know what needs to
5066 be done.  Both ranges average at 5.5 days, but the first represents a
5067 more predictable delivery.
5069 When combining a set of such estimates, simply adding the lows and
5070 highs produces an unrealistically wide result.  Instead, ~est+~ adds
5071 the statistical mean and variance of the sub-tasks, generating a final
5072 estimate from the sum.  For example, suppose you had ten tasks, each of
5073 which was estimated at 0.5 to 2 days of work.  Straight addition
5074 produces an estimate of 5 to 20 days, representing what to expect if
5075 everything goes either extremely well or extremely poorly.  In
5076 contrast, ~est+~ estimates the full job more realistically, at 10-15
5077 days.
5079 Here is an example for a complete columns definition, along with allowed
5080 values.[fn:58]
5082 #+begin_example
5083    :COLUMNS:  %25ITEM %9Approved(Approved?){X} %Owner %11Status \
5084                       %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
5085    :Owner_ALL:    Tammy Mark Karl Lisa Don
5086    :Status_ALL:   "In progress" "Not started yet" "Finished" ""
5087    :Approved_ALL: "[ ]" "[X]"
5088 #+end_example
5090 {{{noindent}}} The first column, {{{samp(%25ITEM)}}}, means the first
5091 25 characters of the item itself, i.e., of the headline.  You probably
5092 always should start the column definition with the {{{samp(ITEM)}}}
5093 specifier.  The other specifiers create columns {{{samp(Owner)}}} with
5094 a list of names as allowed values, for {{{samp(Status)}}} with four
5095 different possible values, and for a checkbox field
5096 {{{samp(Approved)}}}.  When no width is given after the {{{samp(%)}}}
5097 character, the column will be exactly as wide as it needs to be in
5098 order to fully display all values.  The {{{samp(Approved)}}} column
5099 does have a modified title ({{{samp(Approved?)}}}, with a question
5100 mark).  Summaries will be created for the {{{samp(Time_Estimate)}}}
5101 column by adding time duration expressions like HH:MM, and for the
5102 {{{samp(Approved)}}} column, by providing an {{{samp([X])}}} status if
5103 all children have been checked.  The {{{samp(CLOCKSUM)}}} and
5104 {{{samp(CLOCKSUM_T)}}} columns are special, they lists the sums of
5105 CLOCK intervals in the subtree, either for all clocks or just for
5106 today.
5108 *** Using column view
5109     :PROPERTIES:
5110     :DESCRIPTION: How to create and use column view
5111     :END:
5113 The following commands turn column view on or off:
5115 #+attr_texinfo: :table-type table :indic @asis
5116 - {{{kbd(C-c C-x C-c)}}}, ~org-columns~ ::
5117   #+kindex: C-c C-x C-c
5118   #+vindex: org-columns-default-format
5120   Turn on column view.  If the cursor is before the first headline in the
5121   file, column view is turned on for the entire file, using the
5122   ~#+COLUMNS~ definition.  If the cursor is somewhere inside the outline,
5123   this command searches the hierarchy, up from point, for a ~:COLUMNS:~
5124   property that defines a format.  When one is found, the column view
5125   table is established for the tree starting at the entry that contains
5126   the ~:COLUMNS:~ property.  If no such property is found, the format is
5127   taken from the ~#+COLUMNS~ line or from the variable
5128   ~org-columns-default-format~, and column view is established for the
5129   current entry and its subtree.
5131 - {{{kbd(r)}}}, ~org-columns-redo~ ::
5132   #+kindex: r
5134   Recreate the column view, to include recent changes made in the
5135   buffer.
5137 - {{{kbd(g)}}}, ~org-columns-redo~ ::
5138   #+kindex: g
5140   Same as {{{kbd(r)}}}.
5142 - {{{kbd(q)}}}, ~org-columns-quit~ ::
5143   #+kindex: q
5145   Exit column view.
5147 The following commands let you edit information in column view:
5149 #+attr_texinfo: :table-type table :indic @asis
5150 - {{{key(left)}}} {{{key(right)}}} {{{key(up)}}} {{{key(down)}}} ::
5152   Move through the column view from field to field.
5154 -  {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}} ::
5155   #+kindex: S-@key{left}
5156   #+kindex: S-@key{right}
5158   Switch to the next/previous allowed value of the field.  For this, you
5159   have to have specified allowed values for a property.
5161 - {{{kbd(1..9\,0)}}} ::
5162   #+kindex: 1..9,0
5164   Directly select the Nth allowed value, {{{kbd(0)}}} selects the 10th
5165   value.
5167 - {{{kbd(n)}}} {{{kbd(p)}}}, ~org-columns-next-allowed-value~ ~org-columns-previous-allowed-value~ ::
5168   #+kindex: n
5170   Same as {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}
5172 - {{{kbd(e)}}}, ~org-columns-edit-value~ ::
5173   #+kindex: e
5175   Edit the property at point.  For the special properties, this will
5176   invoke the same interface that you normally use to change that
5177   property.  For example, when editing a TAGS property, the tag
5178   completion or fast selection interface will pop up.
5180 - {{{kbd(C-c C-c)}}}, ~org-columns-set-tags-or-toggle~ ::
5181   #+kindex: C-c C-c
5183   When there is a checkbox at point, toggle it.
5185 - {{{kbd(v)}}}, ~org-columns-show-value~ ::
5186   #+kindex: v
5188   View the full value of this property.  This is useful if the width of
5189   the column is smaller than that of the value.
5191 - {{{kbd(a)}}}, ~org-columns-edit-allowed~ ::
5192   #+kindex: a
5194   Edit the list of allowed values for this property.  If the list is found
5195   in the hierarchy, the modified values is stored there.  If no list is
5196   found, the new value is stored in the first entry that is part of the
5197   current column view.
5200 The following commands modify column view on-the-fly:
5202 #+attr_texinfo: :table-type table :indic @asis
5203 - {{{kbd(<)}}} {{{kbd(>)}}}, ~org-columns-narrow~ ~org-columns-widen~ ::
5204   #+kindex: <
5206   Make the column narrower/wider by one character.
5208 - {{{kbdkey(S-M-,right)}}}, ~org-columns-new~ ::
5209   #+kindex: S-M-@key{right}
5211   Insert a new column, to the left of the current column.
5213 - {{{kbdkey(S-M-,left)}}}, ~org-columns-delete~ ::
5214   #+kindex: S-M-@key{left}
5215   
5216   Delete the current column.
5218 *** Capturing column view
5219     :PROPERTIES:
5220     :DESCRIPTION: A dynamic block for column view
5221     :END:
5223 Since column view is just an overlay over a buffer, it cannot be
5224 exported or printed directly.  If you want to capture a column view,
5225 use a ~columnview~ dynamic block (see [[Dynamic blocks]]).  The frame of
5226 this block looks like this:
5228 #+cindex: #+BEGIN, columnview
5229 #+begin_example
5230    ,* The column view
5231    ,#+BEGIN: columnview :hlines 1 :id "label"
5233    ,#+END:
5234 #+end_example
5236 {{{noindent}}} This dynamic block has the following parameters:
5238 #+attr_texinfo: :table-type table :indic @asis
5239 - ~:id~ ::
5241   This is the most important parameter.  Column view is a feature that is
5242   often localized to a certain (sub)tree, and the capture block might be
5243   at a different location in the file.  To identify the tree whose view
5244   to capture, you can use 4 values:
5246   #+cindex: property, ID
5247   #+attr_texinfo: :columns 0.35 0.65
5248   | Value               | Meaning                                                       |
5249   |---------------------+---------------------------------------------------------------|
5250   | local               | Use the tree in which the capture block is located.           |
5251   | global              | Make a global view, including all headings in the file.       |
5252   | =file:PATH-TO-FILE= | Run column view at the top of this file.                      |
5253   | ID                  | Call column view in the tree that has an ~:ID:~               |
5254   |                     | property with the value /label/.  You can use                 |
5255   |                     | {{{kbd(M-x org-id-copy)}}} to create a globally unique ID for |
5256   |                     | the current entry and copy it to the kill-ring.               |
5258   - local ::
5259     
5260     Use the tree in which the capture block is located.
5262   - global :: 
5264     Make a global view, including all headings in the file.
5266   - =file:PATH-TO-FILE= ::
5267     
5268     Run column view at the top of this file.
5270   - ID :: 
5271     
5272     Call column view in the tree that has an ~:ID:~ property with the
5273     value /label/.  You can use {{{kbd(M-x org-id-copy)}}} to
5274     create a globally unique ID for the current entry and copy
5275     it to the kill-ring.
5277 - ~:hlines~ ::
5279   When ~t~, insert an hline after every line.  When a number ~N~,
5280               insert an hline before each headline with level ~<=~
5281               {{{var(N)}}}.
5283 - ~:vlines~ ::
5285   When set to ~t~, force column groups to get vertical lines.
5287 - ~:maxlevel~ ::
5289   When set to a number, don't capture entries below this level.
5291 - ~:skip-empty-rows~ ::
5293   When set to ~t~, skip rows where the only non-empty specifier of the
5294   column view is ~ITEM~.
5298 {{{noindent}}} The following commands insert or update the dynamic
5299 block:
5301 #+attr_texinfo: :table-type table :indic @asis
5302 - {{{kbd(C-c C-x i)}}}, ~org-insert-columns-dblock~ ::
5303   #+kindex: C-c C-x i
5305   Insert a dynamic block capturing a column view.  You will be prompted
5306   for the scope or ID of the view.
5308 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}}, ~org-dblock-update~ ::
5309   #+kindex: C-c C-c
5311   Update dynamic block at point.  The cursor needs to be in the ~#+BEGIN~
5312   line of the dynamic block.
5314 - {{{kbd(C-u C-c C-x C-u)}}}, ~org-update-all-dblocks~ ::
5315   #+kindex: C-u C-c C-x C-u
5317   Update all dynamic blocks (see [[Dynamic blocks]]).  This is useful if you
5318   have several clock table blocks, column-capturing blocks or other
5319   dynamic blocks in a buffer.
5322 You can add formulas to the column view table and you may add plotting
5323 instructions in front of the table---these will survive an update of the
5324 block.  If there is a ~#+TBLFM:~ after the table, the table will
5325 actually be recalculated automatically after an update.
5327 An alternative way to capture and process property values into a table
5328 is provided by Eric Schulte's {{{file(org-collector.el)}}} which is a
5329 contributed package.[fn:59] It provides a general API to collect
5330 properties from entries in a certain scope, and arbitrary Lisp
5331 expressions to process these values before inserting them into a table
5332 or a dynamic block.
5334 ** Property API
5335    :PROPERTIES:
5336    :DESCRIPTION: Properties for Lisp programmers
5337    :END:
5338 #+cindex: properties, API
5339 #+cindex: API, for properties
5341 There is a full API for accessing and changing properties.  This API
5342 can be used by Emacs Lisp programs to work with properties and to
5343 implement features based on them.  For more information see [[Using the
5344 property API]].
5346 * Dates and times
5347   :PROPERTIES:
5348   :DESCRIPTION: Making items useful for planning
5349   :ALT_TITLE: Dates and Times
5350   :END:
5351 #+cindex: dates
5352 #+cindex: times
5353 #+cindex: timestamp
5354 #+cindex: date stamp
5356 To assist project planning, TODO items can be labeled with a date and/or
5357 a time.  The specially formatted string carrying the date and time
5358 information is called a /timestamp/ in Org mode.  This may be a
5359 little confusing because timestamp is often used as indicating when
5360 something was created or last changed.  However, in Org mode this term
5361 is used in a much wider sense.
5363 ** Timestamps
5364    :PROPERTIES:
5365    :DESCRIPTION: Assigning a time to a tree entry
5366    :TITLE:    Timestamps, deadlines, and scheduling
5367    :END:
5368 #+cindex: timestamps
5369 #+cindex: ranges, time
5370 #+cindex: date stamps
5371 #+cindex: deadlines
5372 #+cindex: scheduling
5374 A timestamp is a specification of a date (possibly with a time or a
5375 range of times) in a special format, either ~<2003-09-16 Tue>~ or
5376 ~<2003-09-16 Tue 09:39>~ or ~<2003-09-16 Tue 12:00-12:30>~.[fn:60] A
5377 timestamp can appear anywhere in the headline or body of an Org tree
5378 entry.  Its presence causes entries to be shown on specific dates in
5379 the agenda (see [[Weekly/daily agenda]]).  We distinguish:
5381 #+attr_texinfo: :table-type table :indic @asis
5382 - Plain timestamp; Event; Appointment ::
5383   #+cindex: timestamp
5384   #+cindex: appointment
5386   A simple timestamp just assigns a date/time to an item.  This is just
5387   like writing down an appointment or event in a paper agenda.  In the
5388   timeline and agenda displays, the headline of an entry associated with
5389   a plain timestamp will be shown exactly on that date.
5391   #+begin_example
5392      ,* Meet Peter at the movies
5393        <2006-11-01 Wed 19:15>
5394      ,* Discussion on climate change
5395        <2006-11-02 Thu 20:00-22:00>
5396   #+end_example
5398 - Timestamp with repeater interval ::
5399   #+cindex: timestamp, with repeater interval
5401   A timestamp may contain a /repeater interval/, indicating that it
5402   applies not only on the given date, but again and again after a
5403   certain interval of N days (d), weeks (w), months (m), or years (y).
5404   The following will show up in the agenda every Wednesday:
5406   #+begin_example
5407      ,* Pick up Sam at school
5408        <2007-05-16 Wed 12:30 +1w>
5409   #+end_example
5411 - Diary-style sexp entries ::
5413   For more complex date specifications, Org mode supports using the
5414   special sexp diary entries implemented in the Emacs calendar/diary
5415   package.[fn:61] For example, with optional time:
5417   #+begin_example
5418      ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5419        <%%(org-float t 4 2)>
5420   #+end_example
5422 - Time/Date range ::
5423   #+cindex: timerange
5424   #+cindex: date range
5426   Two timestamps connected by {{{samp(--)}}} denote a range.  The headline
5427   will be shown on the first and last day of the range, and on any dates
5428   that are displayed and fall in the range.  Here is an example:
5430   #+begin_example
5431      ,** Meeting in Amsterdam
5432         <2004-08-23 Mon>--<2004-08-26 Thu>
5433   #+end_example
5435 - Inactive timestamp ::
5436   #+cindex: timestamp, inactive
5437   #+cindex: inactive timestamp
5439   Just like a plain timestamp, but with square brackets instead of
5440   angular ones.  These timestamps are inactive in the sense that they do
5441   /not/ trigger an entry to show up in the agenda.
5443   #+begin_example
5444      ,* Gillian comes late for the fifth time
5445        [2006-11-01 Wed]
5446   #+end_example
5448 ** Creating timestamps
5449    :PROPERTIES:
5450    :DESCRIPTION: Commands to insert timestamps
5451    :END:
5452 For Org mode to recognize timestamps, they need to be in the specific
5453 format.  All commands listed below produce timestamps in the correct
5454 format.
5456 #+attr_texinfo: :table-type table :indic @asis
5457 - {{{kbd(C-c .)}}}, ~org-time-stamp~ ::
5458   #+kindex: C-c .
5460   Prompt for a date and insert a corresponding timestamp.  When the
5461   cursor is at an existing timestamp in the buffer, the command is used
5462   to modify this timestamp instead of inserting a new one.  When this
5463   command is used twice in succession, a time range is inserted.
5465 - {{{kbd(C-c !)}}}, ~org-time-stamp-inactive~ ::
5466   #+kindex: C-c !
5468   Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that will not
5469   cause an agenda entry.
5471 - {{{kbd(C-u C-c .)}}} {{{kbd(C-u C-c !)}}} ::
5472   #+kindex: C-u C-c .
5473   #+kindex: C-u C-c .
5474   #+kindex: C-u C-c !
5475   #+vindex: org-time-stamp-rounding-minutes
5477   Like {{{kbd(C-c .)}}} and {{{kbd(C-c !)}}}, but use the alternative
5478   format which contains date and time.  The default time can be rounded
5479   to multiples of 5 minutes, see the option
5480   ~org-time-stamp-rounding-minutes~.
5482 - {{{kbd(C-c C-c)}}} ::
5483   #+kindex: C-c C-c
5485   Normalize timestamp, insert/fix day name if missing or wrong.
5487 - {{{kbd(C-c <)}}}, ~org-date-from-calendar~ ::
5488   #+kindex: C-c <
5490   Insert a timestamp corresponding to the cursor date in the Calendar.
5492 - {{{kbd(C-c >)}}}, ~org-goto-calendar~ ::
5493   #+kindex: C-c >
5495   Access the Emacs calendar for the current date.  If there is a
5496   timestamp in the current line, go to the corresponding date instead.
5498 - {{{kbd(C-c C-o)}}}, ~org-open-at-point~ ::
5499   #+kindex: C-c C-o
5501   Access the agenda for the date given by the timestamp or -range at
5502   point (see [[Weekly/daily agenda]]).
5504 - {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}, ~org-timestamp-down-day~ ~org-timestamp-up-day~ ::
5505   #+kindex: S-@key{left}
5507   Change date at cursor by one day.  These key bindings conflict with
5508   shift-selection and related modes (see [[Conflicts]]).
5510 - {{{kbdkey(S-,up)}}} {{{kbdkey(S-,down)}}}, ~org-timestamp-up~ ~org-timestamp-down-down~ ::
5511   #+kindex: S-@key{up}
5513   Change the item under the cursor in a timestamp.  The cursor can be on
5514   a year, month, day, hour or minute.  When the timestamp contains a time
5515   range like {{{samp(15:30-16:30)}}}, modifying the first time will also
5516   shift the second, shifting the time block with constant length.  To
5517   change the length, modify the second time.  Note that if the cursor is
5518   in a headline and not at a timestamp, these same keys modify the
5519   priority of an item.  (see [[Priorities]]).  The key bindings also conflict
5520   with shift-selection and related modes (see [[Conflicts]]).
5522 - {{{kbd(C-c C-y)}}}, ~org-evaluate-time-range~ ::
5523   #+kindex: C-c C-y
5524   #+cindex: evaluate time range
5526   Evaluate a time range by computing the difference between start and
5527   end.  With a prefix argument, insert result after the time range (in a
5528   table: into the following column).
5530 *** The date/time prompt
5531     :PROPERTIES:
5532     :DESCRIPTION: How Org mode helps you enter dates and times
5533     :END:
5534 #+cindex: date, reading in minibuffer
5535 #+cindex: time, reading in minibuffer
5537 #+vindex: org-read-date-prefer-future
5539 When Org mode prompts for a date/time, the default is shown in default
5540 date/time format, and the prompt therefore seems to ask for a specific
5541 format.  But it will in fact accept date/time information in a variety
5542 of formats.  Generally, the information should start at the beginning
5543 of the string.  Org mode will find whatever information is in there and
5544 derive anything you have not specified from the /default date and
5545 time/.  The default is usually the current date and time, but when
5546 modifying an existing timestamp, or when entering the second stamp of
5547 a range, it is taken from the stamp in the buffer.  When filling in
5548 information, Org mode assumes that most of the time you will want to
5549 enter a date in the future: if you omit the month/year and the given
5550 day/month is /before/ today, it will assume that you mean a future
5551 date.[fn:62] If the date has been automatically shifted into the
5552 future, the time prompt will show this with {{{samp((=>F))}}}.
5554 For example, let's assume that today is *June 13, 2006*.  Here is how
5555 various inputs will be interpreted, the items filled in by Org mode
5556 are in *bold*.
5558 | Input        | Interpretation                                       |
5559 |--------------+------------------------------------------------------|
5560 | 3-2-5        | {{{result}}} 2003-02-05                              |
5561 | 2/5/3        | {{{result}}} 2003-02-05                              |
5562 | 14           | {{{result}}} *2006*-*06*-14                          |
5563 | 12           | {{{result}}} *2006*-*07*-12                          |
5564 | 2/5          | {{{result}}} *2007*-02-05                            |
5565 | Fri          | {{{result}}} nearest Friday (default date or later)  |
5566 | sep 15       | {{{result}}} *2006*-09-15                            |
5567 | feb 15       | {{{result}}} *2007*-02-15                            |
5568 | sep 12 9     | {{{result}}} 2009-09-12                              |
5569 | 12:45        | {{{result}}} *2006*-*06*-*13* 12:45                  |
5570 | 22 sept 0:34 | {{{result}}} *2006*-09-22 0:34                       |
5571 | w4           | {{{result}}} ISO week for of the current year *2006* |
5572 | 2012 w4 fri  | {{{result}}} Friday of ISO week 4 in 2012            |
5573 | 2012-w04-5   | {{{result}}} Same as above                           |
5576 Furthermore you can specify a relative date by giving, as the /first/
5577 thing in the input: a plus/minus sign, a number and a letter ([dwmy])
5578 to indicate change in days, weeks, months, or years.  With a single
5579 plus or minus, the date is always relative to today.  With a double
5580 plus or minus, it is relative to the default date.  If instead of a
5581 single letter, you use the abbreviation of day name, the date will be
5582 the Nth such day, e.g.:
5584 | Input | Interpretation                           |
5585 |-------+------------------------------------------|
5586 |    +0 | {{{result}}} today                       |
5587 |     . | {{{result}}} today                       |
5588 |   +4d | {{{result}}} four days from today        |
5589 |    +4 | {{{result}}} same as +4d                 |
5590 |   +2w | {{{result}}} two weeks from today        |
5591 |   ++5 | {{{result}}} five days from default date |
5592 | +2tue | {{{result}}} second Tuesday from now     |
5595 #+vindex: parse-time-months
5596 #+vindex: parse-time-weekdays
5598 The function understands English month and weekday abbreviations.  If
5599 you want to use unabbreviated names and/or other languages, configure
5600 the variables ~parse-time-months~ and ~parse-time-weekdays~.
5602 #+vindex: org-read-date-force-compatible-dates
5604 Not all dates can be represented in a given Emacs implementation.  By
5605 default Org mode forces dates into the compatibility range 1970--2037
5606 which works on all Emacs implementations.  If you want to use dates
5607 outside of this range, read the docstring of the variable
5608 ~org-read-date-force-compatible-dates~.
5610 You can specify a time range by giving start and end times or by
5611 giving a start time and a duration (in HH:MM format).  Use one or two
5612 dash(es) as the separator in the former case and use '+' as the
5613 separator in the latter case, e.g.:
5615 | Range        | Result                     |
5616 |--------------+----------------------------|
5617 | 11am-1:15pm  | {{{result}}} 11:00-13:15   |
5618 | 11am--1:15pm | {{{result}}} same as above |
5619 | 11am+2:15    | {{{result}}} same as above |
5621 #+cindex: calendar, for selecting date
5622 #+vindex: org-popup-calendar-for-date-prompt
5624 Parallel to the minibuffer prompt, a calendar is popped up.[fn:63]
5625 When you exit the date prompt, either by clicking on a date in the
5626 calendar, or by pressing {{{key(RET)}}}, the date selected in the
5627 calendar will be combined with the information entered at the prompt.
5628 You can control the calendar fully from the minibuffer:
5630 #+kindex: <
5631 #+kindex: >
5632 #+kindex: M-v
5633 #+kindex: C-v
5634 #+kindex: mouse-1
5635 #+kindex: S-@key{right}
5636 #+kindex: S-@key{left}
5637 #+kindex: S-@key{down}
5638 #+kindex: S-@key{up}
5639 #+kindex: M-S-@key{right}
5640 #+kindex: M-S-@key{left}
5641 #+kindex: @key{RET}
5643 #+attr_texinfo: :columns 0.3 0.7
5644 | Key binding               | Meaning                                |
5645 |---------------------------+----------------------------------------|
5646 | {{{key(RET)}}}            | Choose date at cursor in calendar.     |
5647 | {{{key(mouse-1)}}}        | Select date by clicking on it.         |
5648 | {{{kbdkey(S-,right)}}}    | One day forward.                       |
5649 | {{{kbdkey(S-,left)}}}     | One day backward.                      |
5650 | {{{kbdkey(S-,down)}}}     | One week forward.                      |
5651 | {{{kbdkey(S-,up)}}}       | One week backward.                     |
5652 | {{{kbdkey(M-S-,right)}}}  | One month forward.                     |
5653 | {{{kbdkey(M-S-,left)}}}   | One month backward.                    |
5654 | {{{kbd(>)}}}              | Scroll calendar forward by one month.  |
5655 | {{{kbd(<)}}}              | Scroll calendar backward by one month. |
5656 | {{{kbd(M-v)}}}            | Scroll calendar forward by 3 months.   |
5657 | {{{kbd(C-v)}}}            | Scroll calendar backward by 3 months.  |
5660 #+vindex: org-read-date-display-live
5662 The actions of the date/time prompt may seem complex, but I assure you they
5663 will grow on you, and you will start getting annoyed by pretty much any other
5664 way of entering a date/time out there.  To help you understand what is going
5665 on, the current interpretation of your input will be displayed live in the
5666 minibuffer.[fn:64]
5668 *** Custom time format
5669     :PROPERTIES:
5670     :DESCRIPTION: Making dates look different
5671     :END:
5672 #+cindex: custom date/time format
5673 #+cindex: time format, custom
5674 #+cindex: date format, custom
5676 #+vindex: org-display-custom-times
5677 #+vindex: org-time-stamp-custom-formats
5679 Org mode uses the standard ISO notation for dates and times as it is
5680 defined in ISO 8601.  If you cannot get used to this and require
5681 another representation of date and time to keep you happy, you can get
5682 it by customizing the variables ~org-display-custom-times~ and
5683 ~org-time-stamp-custom-formats~.
5685 #+attr_texinfo: :table-type table :indic @asis
5686 - {{{kbd(C-c C-x C-t)}}}, ~org-toggle-time-stamp-overlays~ ::
5687   #+kindex: C-c C-x C-t
5689   Toggle the display of custom formats for dates and times.
5692 {{{noindent}}}
5693 Org mode needs the default format for scanning, so the custom date/time
5694 format does not /replace/ the default format---instead it is put
5695 /over/ the default format using text properties.  This has the
5696 following consequences:
5699 - You cannot place the cursor onto a timestamp anymore, only before or
5700   after.
5702 - The {{{kbdkey(S-,up)}}} {{{kbdkey(S-,down)}}} keys can no longer be
5703   used to adjust each component of a timestamp.  If the cursor is at
5704   the beginning of the stamp, {{{kbdkey(S-,up)}}}
5705   {{{kbdkey(S-,down)}}} will change the stamp by one day, just like
5706   {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}.  At the end of the
5707   stamp, the time will be changed by one minute.
5709 -  If the timestamp contains a range of clock times or a repeater,
5710    these will not be overlaid, but remain in the buffer as they were.
5712 -  When you delete a timestamp character-by-character, it will only
5713    disappear from the buffer after /all/ (invisible) characters
5714    belonging to the ISO timestamp have been removed.
5716 - If the custom timestamp format is longer than the default and you
5717   are using dates in tables, table alignment will be messed up.  If
5718   the custom format is shorter, things do work as expected.
5720 ** Deadlines and scheduling
5721    :PROPERTIES:
5722    :DESCRIPTION: Planning your work
5723    :END:
5725 A timestamp may be preceded by special keywords to facilitate planning:
5727 #+attr_texinfo: :table-type table :indic @asis
5728 - ~DEADLINE~ ::
5729   #+cindex: DEADLINE keyword
5731   Meaning: the task (most likely a TODO item, though not necessarily) is
5732   supposed to be finished on that date.
5734   #+vindex: org-deadline-warning-days
5736   On the deadline date, the task will be listed in the agenda.  In
5737   addition, the agenda for /today/ will carry a warning about the
5738   approaching or missed deadline, starting ~org-deadline-warning-days~
5739   before the due date, and continuing until the entry is marked DONE.  An
5740   example:
5742   #+begin_example
5743      ,*** TODO write article about the Earth for the Guide
5744          DEADLINE: <2004-02-29 Sun>
5745          The editor in charge is [[bbdb:Ford Prefect]]
5746   #+end_example
5748   You can specify a different lead time for warnings for a specific
5749   deadlines using the following syntax.  Here is an example with a
5750   warning period of 5 days ~DEADLINE: <2004-02-29 Sun -5d>~.
5752 - ~SCHEDULED~ ::
5753   #+cindex: SCHEDULED keyword
5755   Meaning: you are planning to start working on that task on the given
5756   date.
5758   #+vindex: org-agenda-skip-scheduled-if-done
5760   The headline will be listed under the given date.[fn:65] In addition,
5761   a reminder that the scheduled date has passed will be present in the
5762   compilation for /today/, until the entry is marked DONE, i.e., the
5763   task will automatically be forwarded until completed.
5765   #+begin_example
5766      ,*** TODO Call Trillian for a date on New Years Eve.
5767          SCHEDULED: <2004-12-25 Sat>
5768   #+end_example
5770   {{{noindent}}}
5771   *Important:* Scheduling an item in Org mode should /not/ be
5772   understood in the same way that we understand /scheduling a meeting/.
5773   Setting a date for a meeting is just a simple appointment, you should
5774   mark this entry with a simple plain timestamp, to get this item shown
5775   on the date where it applies.  This is a frequent misunderstanding by
5776   Org users.  In Org mode, /scheduling/ means setting a date when you
5777   want to start working on an action item.
5780 You may use timestamps with repeaters in scheduling and deadline
5781 entries.  Org mode will issue early and late warnings based on the
5782 assumption that the timestamp represents the /nearest instance/ of
5783 the repeater.  However, the use of diary sexp entries like
5785 ~<%%(org-float t 42)>~
5787 in scheduling and deadline timestamps is limited.  Org mode does not
5788 know enough about the internals of each sexp function to issue early and
5789 late warnings.  However, it will show the item on each day where the
5790 sexp entry matches.
5792 *** Inserting deadline/schedule
5793     :PROPERTIES:
5794     :DESCRIPTION: Planning items
5795     :TITLE:    Inserting deadlines or schedules
5796     :END:
5798 The following commands allow you to quickly insert a deadline or to schedule
5799 an item:[fn:66]
5801 #+attr_texinfo: :table-type table :indic @asis
5802 - {{{kbd(C-c C-d)}}}, ~org-deadline~ ::
5803   #+kindex: C-c C-d
5805   Insert {{{samp(DEADLINE)}}} keyword along with a stamp.  The insertion
5806   will happen in the line directly following the headline.  Any CLOSED
5807   timestamp will be removed.  When called with a prefix arg, an existing
5808   deadline will be removed from the entry.  Depending on the variable
5809   ~org-log-redeadline~, a note will be taken when changing an existing
5810   deadline.[fn:67]
5812 - {{{kbd(C-c C-s)}}}, ~org-schedule~ ::
5813   #+kindex: C-c C-s
5815   Insert {{{samp(SCHEDULED)}}} keyword along with a stamp.  The insertion
5816   will happen in the line directly following the headline.  Any
5817   {{{samp(CLOSED)}}} timestamp will be removed.  When called with a
5818   prefix argument, remove the scheduling date from the entry.  Depending
5819   on the variable ~org-log-reschedule~, a note will be taken when
5820   changing an existing scheduling time.[fn:68]
5822 - {{{kbd(C-c C-x C-k)}}}, ~org-mark-entry-for-agenda-action~ ::
5823   #+kindex: C-c C-x C-k
5824   #+kindex: k a
5825   #+kindex: k s
5827   Mark the current entry for agenda action.  After you have marked the
5828   entry like this, you can open the agenda or the calendar to find an
5829   appropriate date.  With the cursor on the selected date, press 
5830   {{{kbd(k s)}}} or {{{kbd(k d)}}} to schedule the marked item.
5832 - {{{kbd(C-c / d)}}}, ~org-check-deadlines~ ::
5833   #+kindex: C-c / d
5834   #+cindex: sparse tree, for deadlines
5835   #+vindex: org-deadline-warning-days
5837   Create a sparse tree with all deadlines that are either past-due, or
5838   which will become due within ~org-deadline-warning-days~.  With
5839   {{{kbd(C-u)}}} prefix, show all deadlines in the file.  With a numeric
5840   prefix, check that many days.  For example, {{{kbd(C-1 C-c / d)}}}
5841   shows all deadlines due tomorrow.
5843 - {{{kbd(C-c / b)}}}, ~org-check-before-date~ ::
5844   #+kindex: C-c / b
5846   Sparse tree for deadlines and scheduled items before a given date.
5848 - {{{kbd(C-c / a)}}}, ~org-check-after-date~ ::
5849   #+kindex: C-c / a
5850   
5851   Sparse tree for deadlines and scheduled items after a given date.
5854 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
5855 by indicating a relative time: e.g.  +1d will set the date to the next
5856 day after today, and --1w will set the date to the previous week
5857 before any current timestamp.
5859 *** Repeated tasks
5860     :PROPERTIES:
5861     :DESCRIPTION: Items that show up again and again
5862     :END:
5863 #+cindex: tasks, repeated
5864 #+cindex: repeated tasks
5866 Some tasks need to be repeated again and again.  Org mode helps to
5867 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
5868 or plain timestamp.  In the following example:
5870 #+begin_example
5871    ,** TODO Pay the rent
5872       DEADLINE: <2005-10-01 Sat +1m>
5873 #+end_example
5875 {{{noindent}}} the ~+1m~ is a repeater; the intended interpretation is
5876 that the task has a deadline on <2005-10-01> and repeats itself every
5877 (one) month starting from that time.  You can use yearly, monthly,
5878 weekly, daily and hourly repeat cookies by using the ~y/w/m/d/h~
5879 letters.  If you need both a repeater and a special warning period in a
5880 deadline entry, the repeater should come first and the warning period
5881 last: ~DEADLINE: <2005-10-01 Sat +1m -3d>~.
5883 #+vindex: org-todo-repeat-to-state
5885 Deadlines and scheduled items produce entries in the agenda when they
5886 are over-due, so it is important to be able to mark such an entry as
5887 completed once you have done so.  When you mark a DEADLINE or a
5888 SCHEDULE with the TODO keyword DONE, it will no longer produce entries
5889 in the agenda.  The problem with this is, however, that then also the
5890 /next/ instance of the repeated entry will not be active.  Org mode
5891 deals with this in the following way: When you try to mark such an
5892 entry DONE (using {{{kbd(C-c C-t)}}}), it will shift the base date of
5893 the repeating timestamp by the repeater interval, and immediately set
5894 the entry state back to TODO.[fn:69] In the example above, setting the
5895 state to DONE would actually switch the date like this:
5897 #+begin_example
5898    ,** TODO Pay the rent
5899       DEADLINE: <2005-11-01 Tue +1m>
5900 #+end_example
5902 #+vindex: org-log-repeat
5904 A timestamp will be added under the deadline, to keep a record that
5905 you actually acted on the previous instance of this deadline.[fn:70]
5907 As a consequence of shifting the base date, this entry will no longer be
5908 visible in the agenda when checking past dates, but all future instances
5909 will be visible.
5911 With the {{{samp(+1m)}}} cookie, the date shift will always be exactly one
5912 month.  So if you have not paid the rent for three months, marking this
5913 entry DONE will still keep it as an overdue deadline.  Depending on the
5914 task, this may not be the best way to handle it.  For example, if you
5915 forgot to call your father for 3 weeks, it does not make sense to call
5916 him 3 times in a single day to make up for it.  Finally, there are tasks
5917 like changing batteries which should always repeat a certain time
5918 /after/ the last time you did it.  For these tasks, Org mode has
5919 special repeaters  {{{samp(++)}}} and {{{samp(.+)}}}.  For example:
5921 #+begin_example
5922    ,** TODO Call Father
5923       DEADLINE: <2008-02-10 Sun ++1w>
5924       Marking this DONE will shift the date by at least one week,
5925       but also by as many weeks as it takes to get this date into
5926       the future.  However, it stays on a Sunday, even if you called
5927       and marked it done on Saturday.
5928    ,** TODO Check the batteries in the smoke detectors
5929       DEADLINE: <2005-11-01 Tue .+1m>
5930       Marking this DONE will shift the date to one month after
5931       today.
5932 #+end_example
5934 You may have both scheduling and deadline information for a specific
5935 task---just make sure that the repeater intervals on both are the
5936 same.
5938 An alternative to using a repeater is to create a number of copies of
5939 a task subtree, with dates shifted in each copy.  The command
5940 {{{kbd(C-c C-x c)}}} was created for this purpose, it is described in
5941 [[Structure editing]].
5943 ** Clocking work time
5944    :PROPERTIES:
5945    :DESCRIPTION: Tracking how long you spend on a task
5946    :END:
5947 #+cindex: clocking time
5948 #+cindex: time clocking
5950 Org mode allows you to clock the time you spend on specific tasks in a
5951 project.  When you start working on an item, you can start the clock.  When
5952 you stop working on that task, or when you mark the task done, the clock is
5953 stopped and the corresponding time interval is recorded.  It also computes
5954 the total time spent on each subtree of a project.[fn:71]  And it remembers a
5955 history or tasks recently clocked, to that you can jump quickly between a
5956 number of tasks absorbing your time.
5958 To save the clock history across Emacs sessions, use:
5960 #+header: :eval no
5961 #+header: :exports code
5962 #+begin_src emacs-lisp
5963   (setq org-clock-persist 'history)
5964   (org-clock-persistence-insinuate)
5965 #+end_src
5967 When you clock into a new task after resuming Emacs, the incomplete
5968 clock will be found (see [[Resolving idle time]]) and you will be prompted
5969 about what to do with it.[fn:72]
5971 *** Clocking commands
5972     :PROPERTIES:
5973     :DESCRIPTION: Starting and stopping a clock
5974     :END:
5976 #+attr_texinfo: :table-type table :indic @asis
5977 - {{{kbd(C-c C-x C-i)}}}, ~org-clock-in~ ::
5978   #+kindex: C-c C-x C-i
5979   #+vindex: org-clock-into-drawer
5980   #+vindex: org-clock-continuously
5981   #+cindex: property, LOG_INTO_DRAWER
5983   Start the clock on the current item (clock-in).  This inserts the CLOCK
5984   keyword together with a timestamp.  If this is not the first clocking
5985   of this item, the multiple CLOCK lines will be wrapped into a
5986   ~:LOGBOOK:~ drawer (see also the variable ~org-clock-into-drawer~).
5987   You can also overrule the setting of this variable for a subtree by
5988   setting a ~CLOCK_INTO_DRAWER~ or ~LOG_INTO_DRAWER~ property.  When
5989   called with a {{{kbd(C-u)}}} prefix argument, select the task from a
5990   list of recently clocked tasks.  With two {{{kbd(C-u C-u)}}} prefixes,
5991   clock into the task at point and mark it as the default task; the
5992   default task will then always be available with letter {{{kbd(d)}}}
5993   when selecting a clocking task.  With three {{{kbd(C-u C-u C-u)}}}
5994   prefixes, force continuous clocking by starting the clock when the
5995   last clock stopped.@*
5997   #+cindex: property: CLOCK_MODELINE_TOTAL
5998   #+cindex: property: LAST_REPEAT
5999   #+vindex: org-clock-modeline-total
6001   While the clock is running, the current clocking time is shown in the
6002   mode line, along with the title of the task.  The clock time shown will
6003   be all time ever clocked for this task and its children.  If the task
6004   has an effort estimate (see [[Effort estimates]]), the mode line displays
6005   the current clocking time against it.[fn:73] If the task is a
6006   repeating one (see [[Repeated tasks]]), only the time since the last reset
6007   of the task will be shown.[fn:74] More control over what time is shown
6008   can be exercised with the ~CLOCK_MODELINE_TOTAL~ property.  It may have
6009   the values ~current~ to show only the current clocking instance,
6010   ~today~ to show all time clocked on this tasks today (see also the
6011   variable ~org-extend-today-until~), ~all~ to include all time, or
6012   ~auto~ which is the default.[fn:75]  Clicking with {{{kbd(mouse-1)}}}
6013   onto the mode line entry will pop up a menu with clocking options.
6015 - {{{kbd(C-c C-x C-o)}}}, ~org-clock-out~ ::
6016   #+kindex: C-c C-x C-o
6017   #+vindex: org-log-note-clock-out
6019   Stop the clock (clock-out).  This inserts another timestamp at the same
6020   location where the clock was last started.  It also directly computes
6021   the resulting time in inserts it after the time range as
6022   {{{samp(=>HH:MM)}}}.  See the variable ~org-log-note-clock-out~ for the
6023   possibility to record an additional note together with the clock-out
6024   timestamp.[fn:76]
6026 - {{{kbd(C-c C-x C-x)}}}, ~org-clock-in-last~ ::
6027   #+kindex: C-c C-x C-x
6028   #+vindex: org-clock-continuously
6030   Reclock the last clocked task.  With one {{{kbd(C-u)}}} prefix
6031   argument, select the task from the clock history.  With two
6032   {{{kbd(C-u)}}} prefixes, force continuous clocking by starting the
6033   clock when the last clock stopped.
6035 - {{{kbd(C-c C-x C-e)}}}, ~org-clock-modify-effort-estimate~ ::
6036   #+kindex: C-c C-x C-e
6038   Update the effort estimate for the current clock task.
6039 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-y)}}}, ~org-evaluate-time-range~ ::
6040   #+kindex: C-c C-c
6041   #+kindex: C-c C-y
6042   #+kindex: C-c C-c
6044   Recompute the time interval after changing one of the timestamps.  This
6045   is only necessary if you edit the timestamps directly.  If you change
6046   them with {{{kbdkey(S-,cursor)}}} keys, the update is automatic.
6048 - {{{kbdkey(C-S-,up)}}} {{{kbdkey(C-S-,down)}}}, ~org-clock-timestamps-up/down~ ::
6049   #+kindex: C-S-@key{up/down}
6051   On ~CLOCK~ log lines, increase/decrease both timestamps so that the
6052   clock duration keeps the same.
6054 - {{{kbdkey(S-M-,up)}}} {{{kbdkey(S-M-,down)}}}, ~org-timestamp-up/down~ ::
6055   #+kindex: S-M-@key{up/down}
6057   On ~CLOCK~ log lines, increase/decrease the timestamp at point and the
6058   one of the previous (or the next clock) timestamp by the same
6059   duration.  For example, if you hit {{{kbdkey(S-M-,up)}}} to increase a
6060   clocked-out timestamp by five minutes, then the clocked-in timestamp
6061   of the next clock will be increased by five minutes.
6063 - {{{kbd(C-c C-t)}}}, ~org-todo~ ::
6064   #+kindex: C-c C-t
6066   Changing the TODO state of an item to DONE automatically stops the
6067   clock if it is running in this same item.
6069 - {{{kbd(C-c C-x C-q)}}}, ~org-clock-cancel~ ::
6070   #+kindex: C-c C-x C-q
6072   Cancel the current clock.  This is useful if a clock was started by
6073   mistake, or if you ended up working on something else.
6075 - {{{kbd(C-c C-x C-j)}}}, ~org-clock-goto~ ::
6076   #+kindex: C-c C-x C-j
6078   Jump to the headline of the currently clocked in task.  With a
6079   {{{kbd(C-u)}}} prefix arg, select the target task from a list of
6080   recently clocked tasks.
6082 - {{{kbd(C-c C-x C-d)}}}, ~org-clock-display~ ::
6083   #+kindex: C-c C-x C-d
6084   #+vindex: org-remove-highlights-with-change
6086   Display time summaries for each subtree in the current buffer.  This
6087   puts overlays at the end of each headline, showing the total time
6088   recorded under that heading, including the time of any subheadings.
6089   You can use visibility cycling to study the tree, but the overlays
6090   disappear when you change the buffer (see variable
6091   ~org-remove-highlights-with-change~) or press {{{kbd(C-c C-c)}}}.
6094 The {{{kbd(l)}}} key may be used in the timeline (see [[Timeline for a
6095 single file]]) and in the agenda (see [[Weekly/daily agenda]]) to show which
6096 tasks have been worked on or closed during a day.
6098 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
6099 can have a global keybinding and will not modify the window
6100 disposition.
6102 *** The clock table
6103     :PROPERTIES:
6104     :DESCRIPTION: Detailed reports
6105     :END:
6106 #+cindex: clocktable, dynamic block
6107 #+cindex: report, of clocked time
6109 Org mode can produce quite complex reports based on the time clocking
6110 information.  Such a report is called a /clock table/, because it is
6111 formatted as one or several Org tables.
6113 #+attr_texinfo: :table-type table :indic @asis
6114 - {{{kbd(C-c C-x C-r)}}}, ~org-clock-report~ ::
6115   #+kindex: C-c C-x C-r
6117   Insert a dynamic block (see [[Dynamic blocks]]) containing a clock report
6118   as an Org mode table into the current file.  When the cursor is at an
6119   existing clock table, just update it.  When called with a prefix
6120   argument, jump to the first clock report in the current document and
6121   update it.  The clock table always includes also trees with ~:ARCHIVE:~
6122   tag.
6124 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}}, ~org-dblock-update~ ::
6125   #+kindex: C-c C-c
6127   Update dynamic block at point.  The cursor needs to be in the
6128   ~#+BEGIN~ line of the dynamic block.
6130 - {{{kbd(C-u C-c C-x C-u)}}} ::
6131   #+kindex: C-u C-c C-x C-u
6133   Update all dynamic blocks (see [[Dynamic blocks]]).  This is useful if you
6134   have several clock table blocks in a buffer.
6136 - {{{kbdkey(S-,left)}}} {{{kbdkey(S-,right)}}}, ~org-clocktable-try-shift~ ::
6138   Shift the current ~:block~ interval and update the table.  The cursor
6139   needs to be in the ~#+BEGIN: clocktable~ line for this command.  If
6140   ~:block~ is ~today~, it will be shifted to ~today-1~ etc.
6143 Here is an example of the frame for a clock table as it is inserted
6144 into the buffer with the {{{kbd(C-c C-x C-r)}}} command:
6146 #+cindex: #+BEGIN, clocktable
6147 #+begin_example
6148    ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
6149    ,#+END: clocktable
6150 #+end_example
6151 {{{noindent}}}
6152 #+vindex: org-clocktable-defaults
6153 The {{{samp(BEGIN)}}} line and specify a number of options to define the scope,
6154 structure, and formatting of the report.  Defaults for all these options can
6155 be configured in the variable ~org-clocktable-defaults~.
6157 {{{noindent}}} First there are options that determine which clock entries are to
6158 be selected:
6160 #+attr_texinfo: :table-type table :indic @asis
6161 - :maxlevel ::    
6163   Maximum level depth to which times are listed in the table.  Clocks at
6164   deeper levels will be summed into the upper level.
6166 - :scope ::      
6168   The scope to consider.  This can be any of the following:
6170   - nil ::        the current buffer or narrowed region
6171   - file ::      the full current buffer
6172   - subtree ::   the subtree where the clocktable is located
6173   - tree {{{var(N)}}} :: the surrounding level {{{var(N)}}} tree, for example ~tree3~
6174   - tree ::      the surrounding level 1 tree
6175   - agenda ::    all agenda files
6176   - ("file"..) :: scan these files
6177   - file-with-archives ::    current file and its archives
6178   - agenda-with-archives ::  all agenda files, including archives
6180 - :block ::       
6182   The time block to consider.  This block is specified either absolute,
6183   or relative to the current time and may be any of these formats:
6185   - 2007-12-31 ::   New year eve 2007
6186   - 2007-12 ::      December 2007
6187   - 2007-W50 ::     ISO-week 50 in 2007
6188   - 2007-Q2 ::      2nd quarter in 2007
6189   - 2007 ::         the year 2007
6190   - today, yesterday, today-{{{var(N)}}} ::          a relative day
6191   - thisweek, lastweek, thisweek-{{{var(N)}}} ::     a relative week
6192   - thismonth, lastmonth, thismonth-{{{var(N)}}} ::  a relative month
6193   - thisyear, lastyear, thisyear-{{{var(N)}}} ::     a relative year
6195   Use {{{kbdkey(S-,left)}}} or {{{kbdkey(S-,right)}}} to shift the
6196   time interval.
6198 - :tstart ::     
6200   A time string specifying when to start considering times.
6202 - :tend  ::       
6204   A time string specifying when to stop considering times.
6206 - :step  ::  
6208   Set to ~week~ or ~day~ to split the table into chunks.  To use this,
6209   ~:block~ or ~:tstart~, ~:tend~ are needed.
6211 - :stepskip0 ::   
6213   Do not show steps that have zero time.
6215 - :fileskip0 ::  
6217   Do not show table sections from files which did not contribute.
6219 - :tags ::        
6221   A tags match to select entries that should contribute.  See [[Matching
6222   tags and properties]] for the match syntax.
6225 Then there are options which determine the formatting of the table.  There
6226 options are interpreted by the function ~org-clocktable-write-default~,
6227 but you can specify your own function using the ~:formatter~ parameter.
6229 #+attr_texinfo: :table-type table :indic @asis
6230 - :emphasize ::   
6232   When ~t~, emphasize level one and level two items.
6234 - :lang ::        
6236   Language to use for descriptive cells like "Task".[fn:77]
6238 - :link ::       
6240   Link the item headlines in the table to their origins.
6242 - :narrow ::     
6244   An integer to limit the width of the headline column in the org table.
6245   If you write it like {{{samp(50!)}}}, then the headline will also be
6246   shortened in export.
6248 - :indent  ::    
6250   Indent each headline field according to its level.
6252 - :tcolumns ::   
6254   Number of columns to be used for times.  If this is smaller than
6255   ~:maxlevel~, lower levels will be lumped into one column.
6257 - :level ::      
6259   Should a level number column be included?
6261 - :compact ::    
6263   Abbreviation for ~:level nil :indent t :narrow 40! :tcolumns 1~.  All
6264   are overwritten except if there is an explicit ~:narrow~.
6266 - :timestamp ::  
6268   A timestamp for the entry, when available.  Look for SCHEDULED,
6269   DEADLINE, TIMESTAMP and TIMESTAMP_IA, in this order.
6271 - :properties :: 
6273   List of properties that should be shown in the table.  Each property
6274   will get its own column.
6276 - :inherit-props :: 
6278   When this flag is ~t~, the values for ~:properties~ will be inherited.
6280 - :formula  ::   
6282   Content of a ~#+TBLFM~ line to be added and evaluated.  As a special
6283   case, {{{samp(:formula %)}}} adds a column with % time.  If you do not
6284   specify a formula here, any existing formula below the clock table
6285   will survive updates and be evaluated.
6287 - :formatter ::  
6289   A function to format clock data and insert it into the buffer.
6292 To get a clock summary of the current level 1 tree, for the current
6293 day, you could write:
6295 #+begin_example
6296    ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
6297    ,#+END: clocktable
6298 #+end_example
6300 {{{noindent}}} To use a specific time range you could write:[fn:78]
6302 #+begin_example
6303    ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
6304                        :tend "<2006-08-10 Thu 12:00>"
6305    ,#+END: clocktable
6306 #+end_example
6308 A summary of the current subtree with % times would be:
6310 #+begin_example
6311    ,#+BEGIN: clocktable :scope subtree :link t :formula %
6312    ,#+END: clocktable
6313 #+end_example
6315 A horizontally compact representation of everything clocked during
6316 last week would be:
6318 #+begin_example
6319    ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
6320    ,#+END: clocktable
6321 #+end_example
6323 *** Resolving idle time
6324     :PROPERTIES:
6325     :DESCRIPTION: Resolving time when you've been idle
6326     :TITLE:    Resolving idle time and continuous clocking
6327     :END:
6329 #+cindex: resolve idle time
6330 #+cindex: idle, resolve, dangling
6332 If you clock in on a work item, and then walk away from your
6333 computer---perhaps to take a phone call---you often need to
6334 ``resolve'' the time you were away by either subtracting it from the
6335 current clock, or applying it to another one.
6337 #+vindex: org-clock-idle-time
6339 By customizing the variable ~org-clock-idle-time~ to some integer,
6340 such as 10 or 15, Emacs can alert you when you get back to your
6341 computer after being idle for that many minutes, and ask what you want
6342 to do with the idle time.[fn:79] There will be a question waiting for you
6343 when you get back, indicating how much idle time has passed
6344 (constantly updated with the current amount), as well as a set of
6345 choices to correct the discrepancy:
6347 #+attr_texinfo: :table-type table :indic @asis
6348 - {{{kbd(k)}}} ::
6349   #+kindex: k
6351   To keep some or all of the minutes and stay clocked in, press
6352   {{{kbd(k)}}}.  Org will ask how many of the minutes to keep.  Press
6353   {{{key(RET)}}} to keep them all, effectively changing nothing, or
6354   enter a number to keep that many minutes.
6356 - {{{kbd(K)}}} ::
6357   #+kindex: K
6359   If you use the shift key and press {{{kbd(K)}}}, it will keep however
6360   many minutes you request and then immediately clock out of that task.
6361   If you keep all of the minutes, this is the same as just clocking out
6362   of the current task.
6364 - {{{kbd(s)}}} ::
6365   #+kindex: s
6367   To keep none of the minutes, use {{{kbd(s)}}} to subtract all the away
6368   time from the clock, and then check back in from the moment you
6369   returned.
6371 - {{{kbd(S)}}} ::
6372   #+kindex: S
6374   To keep none of the minutes and just clock out at the start of the
6375   away time, use the shift key and press {{{kbd(S)}}}.  Remember that
6376   using shift will always leave you clocked out, no matter which option
6377   you choose.
6379 - {{{kbd(C)}}} ::
6380   #+kindex: C
6382   To cancel the clock altogether, use {{{kbd(C)}}}.  Note that if instead
6383   of canceling you subtract the away time, and the resulting clock
6384   amount is less than a minute, the clock will still be canceled rather
6385   than clutter up the log with an empty entry.
6388 What if you subtracted those away minutes from the current clock, and
6389 now want to apply them to a new clock? Simply clock in to any task
6390 immediately after the subtraction.  Org will notice that you have
6391 subtracted time ``on the books'', so to speak, and will ask if you
6392 want to apply those minutes to the next task you clock in on.
6394 There is one other instance when this clock resolution magic occurs.
6395 Say you were clocked in and hacking away, and suddenly your cat chased
6396 a mouse who scared a hamster that crashed into your UPS's power
6397 button! You suddenly lose all your buffers, but thanks to auto-save
6398 you still have your recent Org mode changes, including your last clock
6401 If you restart Emacs and clock into any task, Org will notice that you
6402 have a dangling clock which was never clocked out from your last
6403 session.  Using that clock's starting time as the beginning of the
6404 unaccounted-for period, Org will ask how you want to resolve that
6405 time.  The logic and behavior is identical to dealing with away time
6406 due to idleness; it is just happening due to a recovery event rather
6407 than a set amount of idle time.
6409 You can also check all the files visited by your Org agenda for
6410 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks RET)}}}
6411  (or {{{kbd(C-c C-x C-z)}}}).
6413 *** Continuous clocking
6414 #+cindex: continuous clocking
6415 #+vindex: org-clock-continuously
6417 You may want to start clocking from the time when you clocked out the
6418 previous task.  To enable this systematically, set
6419 ~org-clock-continuously~ to ~t~.  Each time you clock in, Org retrieves
6420 the clock-out time of the last clocked entry for this session, and
6421 start the new clock from there.
6423 If you only want this from time to time, use three universal prefix
6424 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
6425 ~org-clock-in-last~.
6427 ** Effort estimates
6428    :PROPERTIES:
6429    :DESCRIPTION: Planning work effort in advance
6430    :END:
6431 #+cindex: effort estimates
6432 #+cindex: property, Effort
6433 #+vindex: org-effort-property
6435 If you want to plan your work in a very detailed way, or if you need
6436 to produce offers with quotations of the estimated work effort, you
6437 may want to assign effort estimates to entries.  If you are also
6438 clocking your work, you may later want to compare the planned effort
6439 with the actual working time, a great way to improve planning
6440 estimates.  Effort estimates are stored in a special property
6441 {{{samp(Effort)}}}.[fn:80] You can set the effort for an entry with
6442 the following commands:
6444 #+attr_texinfo: :table-type table :indic @kbd
6445 - {{{kbd(C-c C-x e)}}}, ~org-set-effort~ ::
6446   #+kindex: C-c C-x e
6448   Set the effort estimate for the current entry.  With a numeric prefix
6449   argument, set it to the Nth allowed value (see below).  This command is
6450   also accessible from the agenda with the {{{kbd(e)}}} key.
6452 - {{{kbd(C-c C-x C-e)}}}, ~org-clock-modify-effort-estimate~ ::
6453   #+kindex: C-c C-x C-e
6455   Modify the effort estimate of the item currently being clocked.
6458 Clearly the best way to work with effort estimates is through column
6459 view (see [[Column view]]).  You should start by setting up discrete values
6460 for effort estimates, and a ~COLUMNS~ format that displays these
6461 values together with clock sums (if you want to clock your time).  For
6462 a specific buffer you can use:
6464 #+begin_example
6465    ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
6466    ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
6467 #+end_example
6469 #+vindex: org-global-properties
6470 #+vindex: org-columns-default-format
6472 {{{noindent}}} or, even better, you can set up these values globally
6473 by customizing the variables ~org-global-properties~ and
6474 ~org-columns-default-format~.  In particular if you want to use this
6475 setup also in the agenda, a global setup may be advised.
6477 The way to assign estimates to individual items is then to switch to
6478 column mode, and to use {{{kbdkey(S-,right)}}} and
6479 {{{kbdkey(S-,left)}}} to change the value.  The values you enter will
6480 immediately be summed up in the hierarchy.  In the column next to it,
6481 any clocked time will be displayed.
6483 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
6485 If you switch to column view in the daily/weekly agenda, the effort column
6486 will summarize the estimated work effort for each day, and you can use this to find space in your schedule.  To get
6487 an overview of the entire part of the day that is committed, you can set the
6488 option ~org-agenda-columns-add-appointments-to-effort-sum~.[fn:179] The
6489 appointments on a day that take place over a specified time interval will
6490 then also be added to the load estimate of the day.
6492 Effort estimates can be used in secondary agenda filtering that is
6493 triggered with the {{{kbd(/)}}} key in the agenda (see [[Agenda
6494 commands]]).  If you have these estimates defined consistently, two or
6495 three key presses will narrow down the list to stuff that fits into an
6496 available time slot.
6498 ** Relative timer
6499    :PROPERTIES:
6500    :DESCRIPTION: Notes with a running timer
6501    :TITLE:    Taking notes with a relative timer
6502    :END:
6503 #+cindex: relative timer
6505 When taking notes during, for example, a meeting or a video viewing, it can
6506 be useful to have access to times relative to a starting time.  Org provides
6507 such a relative timer and make it easy to create timed notes.
6509 #+attr_texinfo: :table-type table :indic @asis
6510 - {{{kbd(C-c C-x .)}}}, ~org-timer~ ::
6511   #+kindex: C-c C-x .
6513   Insert a relative time into the buffer.  The first time you use this, the
6514   timer will be started.  When called with a prefix argument, the timer is
6515   restarted.
6517 - {{{kbd(C-c C-x -)}}}, ~org-timer-item~ ::
6518   #+kindex: C-c C-x -
6520   Insert a description list item with the current relative time.  With a prefix
6521   argument, first reset the timer to 0.
6523 - {{{kbdkey(M-,RET)}}}, ~org-insert-heading~ ::
6524   #+kindex: M-@key{RET}
6526   Once the timer list is started, you can also use {{{kbdkey(M-,RET)}}}
6527   to insert new timer items.
6529 - {{{kbd(C-c C-x \,)}}} ::
6530   #+kindex: C-c C-x ,
6531   #+kindex: C-c C-x ,
6533   Pause the timer, or continue it if it is already paused
6534   ({{{command(org-timer-pause-or-continue)}}}).
6536 - {{{kbd(C-u C-c C-x \,)}}} ::
6537   #+kindex: C-u C-c C-x ,
6538   #+kindex: C-u C-c C-x ,
6540   Stop the timer.  After this, you can only start a new timer, not
6541   continue the old one.  This command also removes the timer from the
6542   mode line.
6544 - {{{kbd(C-c C-x 0)}}}, ~org-timer-start~ ::
6545   #+kindex: C-c C-x 0
6547   Reset the timer without inserting anything into the buffer.  By
6548   default, the timer is reset to 0.  When called with a {{{kbd(C-u)}}}
6549   prefix, reset the timer to specific starting offset.  The user is
6550   prompted for the offset, with a default taken from a timer string at
6551   point, if any, So this can be used to restart taking notes after a
6552   break in the process.  When called with a double prefix argument
6553   {{{kbd(C-u C-u)}}}, change all timer strings in the active region by a
6554   certain amount.  This can be used to fix timer strings if the timer was
6555   not started at exactly the right moment.
6557 ** Countdown timer
6558    :PROPERTIES:
6559    :DESCRIPTION: Starting a countdown timer for a task
6560    :END:
6561 #+cindex: Countdown timer
6562 #+kindex: C-c C-x ;
6563 #+kindex: ;
6565 Calling ~org-timer-set-timer~ from an Org mode buffer runs a countdown
6566 timer.  Use {{{kbd(;)}}} from agenda buffers, {{{key(C-c C-x ;)}}}
6567 everywhere else.
6569 ~org-timer-set-timer~ prompts the user for a duration and displays a
6570 countdown timer in the modeline.  ~org-timer-default-timer~ sets the
6571 default countdown value.  Giving a prefix numeric argument overrides this
6572 default value.
6574 * Capture - Refile - Archive
6575   :PROPERTIES:
6576   :DESCRIPTION: The ins and outs for projects
6577   :END:
6578 #+cindex: capture
6580 An important part of any organization system is the ability to quickly
6581 capture new ideas and tasks, and to associate reference material with
6582 them.  Org does this using a process called /capture/.  It also can
6583 store files related to a task (/attachments/) in a special directory.
6584 Once in the system, tasks and projects need to be moved around.  Moving
6585 completed project trees to an archive file keeps the system compact
6586 and fast.
6588 ** Capture
6589    :PROPERTIES:
6590    :DESCRIPTION: Capturing new stuff
6591    :END:
6592 #+cindex: capture
6594 Org's method for capturing new items is heavily inspired by John
6595 Wiegley excellent remember package.  Up to version 6.36 Org used a
6596 special setup for {{{file(remember.el)}}}.  The file {{{file(org-remember.el)}}}
6597 is still part of Org mode for backward compatibility with existing
6598 setups.  You can find the documentation for org-remember at
6599 [[http://orgmode.org/org-remember.pdf]].
6601 The new capturing setup described here is preferred and should be used by new
6602 users.  To convert your ~org-remember-templates~, run the following command:
6603 {{{kbdspckey(M-x org-capture-import-remember-templates,RET)}}}
6605 {{{noindent}}} and then customize the new variable with 
6606 {{{kbd(M-x customize-variable org-capture-templates)}}}, check the result, and
6607 save the customization.  You can then use both remember and capture
6608 until you are familiar with the new mechanism.
6610 Capture lets you quickly store notes with little interruption of your work
6611 flow.  The basic process of capturing is very similar to remember, but Org
6612 does enhance it with templates and more.
6614 *** Setting up capture
6615     :PROPERTIES:
6616     :DESCRIPTION: Where notes will be stored
6617     :END:
6619 The following customization sets a default target file for notes, and defines
6620 a global key for capturing new material.[fn:81]
6622 #+vindex: org-default-notes-file
6623 #+header: :eval no
6624 #+header: :exports code
6625 #+begin_src emacs-lisp
6626 (setq org-default-notes-file (concat org-directory "/notes.org"))
6627 (define-key global-map "\C-cc" 'org-capture)
6628 #+end_src
6630 *** Using capture
6631     :PROPERTIES:
6632     :DESCRIPTION: Commands to invoke and terminate capture
6633     :END:
6635 #+attr_texinfo: :table-type table :indic @asis
6636 - {{{kbd(C-c c)}}}, ~org-capture~ ::
6637   #+kindex: C-c c
6638   #+cindex: date tree
6640   Call the command ~org-capture~.  Note that this keybinding is global
6641   and not active by default - you need to install it.  If you have
6642   templates defined (see [[Capture templates]], it will offer these
6643   templates for selection or use a new Org outline node as the default
6644   template.  It will insert the template into the target file and switch
6645   to an indirect buffer narrowed to this new node.  You may then insert
6646   the information you want.
6648 - {{{kbd(C-c C-c)}}}, ~org-capture-finalize~ ::
6649   #+kindex: C-c C-c
6651   Once you have finished entering information into the capture buffer,
6652   {{{kbd(C-c C-c)}}} will return you to the window configuration before
6653   the capture process, so that you can resume your work without further
6654   distraction.  When called with a prefix argument, finalize and then
6655   jump to the captured item.
6657 - {{{kbd(C-c C-w)}}}, ~org-capture-refile~ ::
6658   #+kindex: C-c C-w
6660   Finalize the capture process by refiling the note to a different place
6661   (see [[Refile and copy]]).  Please realize that this is a normal refiling
6662   command that will be executed---so the cursor position at the moment
6663   you run this command is important.  If you have inserted a tree with a
6664   parent and children, first move the cursor back to the parent.  Any
6665   prefix argument given to this command will be passed on to the
6666   ~org-refile~ command.
6668 - {{{kbd(C-c C-k)}}}, ~org-capture-kill~ ::
6669   #+kindex: C-c C-k
6671   Abort the capture process and return to the previous state.
6674 You can also call ~org-capture~ in a special way from the agenda,
6675 using the {{{kbd(k c)}}} key combination.  With this access, timestamps
6676 inserted by the selected capture template will default to the cursor
6677 date in the agenda, rather than to the current date.
6679 To find the locations of the last stored capture, use ~org-capture~ with
6680 prefix commands:
6682 #+attr_texinfo: :table-type table :indic @asis
6683 - {{{kbd(C-u C-c c)}}} ::
6684   #+kindex: C-u C-c c
6686   Visit the target location of a capture template.  You get to select the
6687   template in the usual way.
6689 - {{{kbd(C-u C-u C-c c)}}} ::
6690   #+kindex: C-u C-u C-c c
6692   Visit the last stored capture item in its buffer.
6695 #+vindex: org-capture-bookmark
6696 #+cindex: org-capture-last-stored
6698 You can also jump to the bookmark ~org-capture-last-stored~, which
6699 will automatically be created unless you set ~org-capture-bookmark~ to
6700 ~nil~.
6702 To insert the capture at point in an Org buffer, call ~org-capture~
6703 with a ~C-0~ prefix argument.
6705 *** Capture templates
6706     :PROPERTIES:
6707     :DESCRIPTION: Define the outline of different note types
6708     :END:
6709 #+cindex: templates, for Capture
6711 You can use templates for different types of capture items, and for
6712 different target locations.  The easiest way to create such templates
6713 is through the customize interface.
6715 #+attr_texinfo: :table-type table :indic @asis
6716 - {{{kbd(C-c c C)}}} ::
6717   #+kindex: C-c c C
6719   Customize the variable ~org-capture-templates~.
6722 Before we give the formal description of template definitions, let's
6723 look at an example.  Say you would like to use one template to create
6724 general TODO entries, and you want to put these entries under the
6725 heading {{{samp(Tasks)}}} in your file {{{file(~/org/gtd.org)}}}.
6726 Also, a date tree in the file {{{file(journal.org)}}} should capture
6727 journal entries.  A possible configuration would look like:
6729 #+header: :eval no
6730 #+header: :exports code
6731 #+begin_src emacs-lisp
6732 (setq org-capture-templates
6733  '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
6734         "* TODO %?\n  %i\n  %a")
6735    ("j" "Journal" entry (file+datetree "~/org/journal.org")
6736         "* %?\nEntered on %U\n  %i\n  %a")))
6737 #+end_src
6739 {{{noindent}}} If you then press {{{kbd(C-c c t)}}}, Org will prepare
6740 the template for you like this:
6742 #+begin_example
6743    ,* TODO
6744      [[file:link to where you initiated capture]]
6745 #+end_example
6747 {{{noindent}}} During expansion of the template, ~%a~ has been
6748 replaced by a link to the location from where you called the capture
6749 command.  This can be extremely useful for deriving tasks from emails,
6750 for example.  You fill in the task definition, press ~C-c C-c~ and Org
6751 returns you to the same place where you started the capture process.
6753 To define special keys to capture to a particular template without
6754 going through the interactive template selection, you can create your
6755 key binding like this:
6757 #+header: :eval no
6758 #+header: :exports code
6759 #+begin_src emacs-lisp
6760 (define-key global-map "\C-cx"
6761    (lambda () (interactive) (org-capture nil "x")))
6762 #+end_src
6764 **** Template elements
6765      :PROPERTIES:
6766      :DESCRIPTION: What is needed for a complete template entry
6767      :END:
6769 Now lets look at the elements of a template definition.  Each entry in
6770 ~org-capture-templates~ is a list with the following items:
6772 #+attr_texinfo: :table-type table :indic @asis
6773 - ~keys~ ::
6775   The keys that will select the template, as a string, characters
6776   only, for example "a" for a template to be selected with a
6777   single key, or "BTW" for selection with two keys.  When using
6778   several keys, keys using the same prefix key must be sequential
6779   in the list and preceded by a 2-element entry explaining the
6780   prefix key, for example:
6782   #+header: :eval no
6783   #+header: :exports code
6784   #+begin_src emacs-lisp
6785     ("b" "Templates for marking stuff to buy")
6786   #+end_src
6788   {{{noindent}}} If you do not define a template for the {{{kbd(C)}}}
6789   key, this key will be used to open the customize buffer for this
6790   complex variable.
6792 - ~description~ ::
6794   A short string describing the template, which will be shown during
6795   selection.
6797 - ~type~ ::
6799   The type of entry, a symbol.  Valid values are:
6801   - ~entry~ ::
6803     An Org mode node, with a headline.  Will be filed as the child of the
6804     target entry or as a top-level entry.  The target file should be an Org
6805     mode file.
6807   - ~item~ ::
6809     A plain list item, placed in the first plain list at the target
6810     location.  Again the target file should be an Org file.
6812   - ~checkitem~ ::
6814     A checkbox item.  This only differs from the plain list item by the
6815     default template.
6817   - ~table-line~ ::
6819     A new line in the first table at the target location.  Where exactly
6820     the line will be inserted depends on the properties ~:prepend~ and
6821     ~:table-line-pos~ (see below).
6823   - plain ::
6825     Text to be inserted as it is.
6827 - target ::
6828   #+vindex: org-default-notes-file
6830   Specification of where the captured item should be placed.  In Org mode
6831   files, targets usually define a node.  Entries will become children of this
6832   node.  Other types will be added to the table or list in the body of this
6833   node.  Most target specifications contain a file name.  If that file name is
6834   the empty string, it defaults to ~org-default-notes-file~.  A file can
6835   also be given as a variable, function, or Emacs Lisp form.
6837   Valid values are:
6839   - ~(file "path/to/file")~ ::
6841     Text will be placed at the beginning or end of that file.
6843   - ~(id "id of existing org entry")~ ::
6845     Filing as child of this entry, or in the body of the entry.
6847   - ~(file+headline "path/to/file" "node headline")~ ::
6849     Fast configuration if the target heading is unique in the file.
6851   - ~(file+olp "path/to/file" "Level 1 heading" "Level 2" ...)~ ::
6853     For non-unique headings, the full path is safer.
6855   - ~(file+regexp  "path/to/file" "regexp to find location")~ ::
6857     Use a regular expression to position the cursor.
6859   - ~(file+datetree "path/to/file")~ ::
6861     Will create a heading in a date tree for today's date.
6863   - ~(file+datetree+prompt "path/to/file")~ ::
6865     Will create a heading in a date tree, but will prompt for the date.
6867   - ~(file+function "path/to/file" function-finding-location)~ ::
6869     A function to find the right location in the file.
6871   - ~(clock)~ ::
6873     File to the entry that is currently being clocked.
6875   - ~(function function-finding-location)~ ::
6877     Most general way, write your own function to find both
6878     file and location.
6880 - ~template~ ::
6882   The template for creating the capture item.  If you leave this empty,
6883   an appropriate default template will be used.  Otherwise this is a
6884   string with escape codes, which will be replaced depending on time and
6885   context of the capture call.  The string with escapes may be loaded
6886   from a template file, using the special syntax 
6887   ~(file "path/to/template")~.  See below for more details.
6889 - ~properties~ ::
6891   The rest of the entry is a property list of additional options.
6892   Recognized properties are:
6894   - ~:prepend~ ::
6896     Normally new captured information will be appended at the target
6897     location (last child, last table line, last list item, ...).  Setting
6898     this property will change that.
6900   - ~:immediate-finish~ ::
6902     When set, do not offer to edit the information, just file it away
6903     immediately.  This makes sense if the template only needs information
6904     that can be added automatically.
6906   - ~:empty-lines~ ::
6908     Set this to the number of lines to insert before and after the new
6909     item.  The default is 0, and the only other common value is 1.
6911   - ~:clock-in~ ::
6913     Start the clock in this item.
6915   - ~:clock-keep~ ::
6917     Keep the clock running when filing the captured entry.
6919   - ~:clock-resume~ ::
6921     If starting the capture interrupted a clock, restart that clock when
6922     finished with the capture.  Note that ~:clock-keep~ has precedence over
6923     ~:clock-resume~.  When setting both to ~t~, the current clock will run
6924     and the previous one will not be resumed.
6926   - ~:unnarrowed~ ::
6928     Do not narrow the target buffer, simply show the full buffer.  Default
6929     is to narrow it so that you only see the new material.
6931   - ~:table-line-pos~ ::
6933     Specification of the location in the table where the new line should
6934     be inserted.  It should be a string like "II-3" meaning that the new
6935     line should become the third line before the second horizontal
6936     separator line.
6938   - ~:kill-buffer~ ::
6940     If the target file was not yet visited when capture was invoked, kill
6941     the buffer again after capture is completed.
6943 **** Template expansion
6944      :PROPERTIES:
6945      :DESCRIPTION: Filling in information about time and context
6946      :END:
6948 In the template itself, special {{{kbd(%)}}}-escapes allow dynamic
6949 insertion of content.[fn:82] The templates are expanded in the order given
6950 here:
6952 #+attr_texinfo: :table-type table :indic @asis
6953 - %[{{{var(file)}}}] ::    
6955   Insert the contents of the file given by {{{var(file)}}}.
6957 - %({{{var(sexp)}}}) ::    
6959   Evaluate Elisp {{{var(sexp)}}} and replace with the result.  The
6960   {{{var(sexp)}}} must return a string.
6962 - %<...> ::     
6964   The result of format-time-string on the ...  format specification.
6966 - %t ::         
6968   Timestamp, date only.
6970 - %T ::         
6972   Timestamp, with date and time.
6974 - %u, %U ::     
6976   Like ~%t~, ~%T~ above, but inactive timestamps.
6978 - %i ::         
6980   Initial content, the region when capture is called while the region is
6981   active.  The entire text will be indented like ~%i~ itself.
6983 - %a ::         
6985   Annotation, normally the link created with ~org-store-link~.
6987 - %A ::         
6989   Like ~%a~, but prompt for the description part.
6991 - %l ::         
6993   Like ~%a~, but only insert the literal link.
6995 - %c ::         
6997   Current kill ring head.
6999 - %x ::         
7001   Content of the X clipboard.
7003 - %k ::         
7005   Title of the currently clocked task.
7007 - %K ::         
7009   Link to the currently clocked task.
7011 - %n ::         
7013   User name (taken from ~user-full-name~).
7015 - %f ::         
7017   File visited by current buffer when org-capture was called.
7019 - %F ::         
7021   Full path of the file or directory visited by current buffer.
7023 - %:keyword ::   
7025   Specific information for certain link types, see below.
7027 - %^g  ::       
7029   Prompt for tags, with completion on tags in target file.
7031 - %^G  ::       
7033   Prompt for tags, with completion all tags in all agenda files.
7035 - %^t  ::       
7037   Like ~%t~, but prompt for date.  Similarly ~%^T~, ~%^u~, ~%^U~.  You may
7038   define a prompt like ~%^{Birthday}t~.
7040 - %^C  ::       
7042   Interactive selection of which kill or clip to use.
7044 - %^L  ::       
7046   Like ~%^C~, but insert as link.
7048 - %^{PROP}p ::  
7050   Prompt the user for a value for property {{{var(prop)}}}.
7052 - %^{PROMPT} ::  
7054   Prompt the user for a string and replace this sequence with it.  You
7055   may specify a default value and a completion table with
7056   ~%^{prompt|default|completion2|completion3...}~.  The arrow keys access
7057   a prompt-specific history.
7059 - %\n ::        
7061   Insert the text entered at the nth %^{PROMPT}, where ~n~ is
7062   a number, starting from 1.
7064 - %? ::          
7066   After completing the template, position cursor here.
7069 {{{noindent}}} For specific link types, the following keywords will be
7070 defined:[fn:83]
7072 #+vindex: org-from-is-user-regexp
7075 #+attr_texinfo: :table-type table :indic @asis
7076 - bbdb :: ~%:name %:company~ 
7077 - irc ::   ~%:server %:port %:nick~              
7078 - vm vm-imap wl mh mew rmail ::   
7079   ~%:type %:subject %:message-id~       
7080   ~%:from %:fromname %:fromaddress~     
7081   ~%:to %:toname %:toaddress~           
7082   ~%:date~ (message date header field)                   
7083   ~%:date-timestamp~ (date as active timestamp)          
7084   ~%:date-timestamp-inactive~ (date as inactive timestamp)
7085   ~%:fromto~ (either "to NAME" or "from NAME")[fn:84]
7086 - gnus :: ~%:group~, for messages also all email fields            
7087 - w3 w3m :: ~%:url~                               
7088 - info :: ~%:file %:node~                       
7089 - calendar :: ~%:date~                              
7091 {{{noindent}}} To place the cursor after template expansion use:
7093 #+begin_example
7094    %?          After completing the template, position cursor here.
7095 #+end_example
7097 **** Templates in contexts
7098      :PROPERTIES:
7099      :DESCRIPTION: Only show a template in a specific context
7100      :END:
7102 #+vindex: org-capture-templates-contexts
7104 To control whether a capture template should be accessible from a
7105 specific context, you can customize ~org-capture-templates-contexts~.
7106 Let's say, for example, that you have a capture template "p" for
7107 storing Gnus emails containing patches.  Then you would configure this
7108 option like this:
7110 #+header: :eval no
7111 #+header: :exports code
7112 #+begin_src emacs-lisp
7113 (setq org-capture-templates-contexts
7114       '(("p" (in-mode . "message-mode"))))
7115 #+end_src
7117 You can also tell that the command key "p" should refer to another
7118 template.  In that case, add this command key like this:
7120 #+header: :eval no
7121 #+header: :exports code
7122 #+begin_src emacs-lisp
7123 (setq org-capture-templates-contexts
7124       '(("p" "q" (in-mode . "message-mode"))))
7125 #+end_src
7127 See the docstring of the variable ~org-capture-templates-contexts~ for
7128 more information.
7130 ** Attachments
7131    :PROPERTIES:
7132    :DESCRIPTION: Add files to tasks
7133    :END:
7134 #+cindex: attachments
7135 #+vindex: org-attach-directory
7137 It is often useful to associate reference material with an outline
7138 node/task.  Small chunks of plain text can simply be stored in the
7139 subtree of a project.  Hyperlinks (see [[Hyperlinks]]) can establish
7140 associations with files that live elsewhere on your computer or in the
7141 cloud, like emails or source code files belonging to a project.
7142 Another method is /attachments/, which are files located in a
7143 directory belonging to an outline node.  Org uses directories named by
7144 the unique ID of each entry.  These directories are located in the
7145 {{{file(data)}}} directory which lives in the same directory where
7146 your Org file lives.[fn:85] If you initialize this directory with
7147 ~git init~, Org will automatically commit changes when it sees them.
7148 The attachment system has been contributed to Org by John Wiegley.
7150 In cases where it seems better to do so, you can also attach a
7151 directory of your choice to an entry.  You can also make children
7152 inherit the attachment directory from a parent, so that an entire
7153 subtree uses the same attached directory.
7155 {{{noindent}}} The following commands deal with attachments:
7157 #+attr_texinfo: :table-type table :indic @asis
7158 - {{{kbd(C-c C-a)}}}, ~org-attach~ ::
7159   #+kindex: C-c C-a
7161   The dispatcher for commands related to the attachment system.  After
7162   these keys, a list of commands is displayed and you must press an
7163   additional key to select a command:
7165   - {{{kbd(a)}}}, ~org-attach-attach~ ::
7166     #+kindex: C-c C-a a
7167     #+vindex: org-attach-method
7169     Select a file and move it into the task's attachment directory.  The
7170     file will be copied, moved, or linked, depending on
7171     ~org-attach-method~.  Note that hard links are not supported on all
7172     systems.
7174   - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
7175     #+kindex: C-c C-a c
7176     #+kindex: C-c C-a m
7177     #+kindex: C-c C-a l
7179     Attach a file using the copy/move/link method.  Note that hard links
7180     are not supported on all systems.
7182   - {{{kbd(n)}}}, ~org-attach-new~ ::
7183     #+kindex: C-c C-a n
7185     Create a new attachment as an Emacs buffer.
7187   - {{{kbd(z)}}}, ~org-attach-sync~ ::
7188     #+kindex: C-c C-a z
7190     Synchronize the current task with its attachment directory, in case
7191     you added attachments yourself.
7193   - {{{kbd(o)}}}, ~org-attach-open~ ::
7194     #+kindex: C-c C-a o
7195     #+vindex: org-file-apps
7197     Open current task's attachment.  If there is more than one, prompt for
7198     a file name first.  Opening will follow the rules set by
7199     ~org-file-apps~.  For more details, see the information on following
7200     hyperlinks (see [[Handling links]]).
7202   - {{{kbd(O)}}}, ~org-attach-open-in-emacs~ ::
7203     #+kindex: C-c C-a O
7205     Also open the attachment, but force opening the file in Emacs.
7207   - {{{kbd(f)}}}, ~org-attach-reveal~ ::
7208     #+kindex: C-c C-a f
7210     Open the current task's attachment directory.
7212   - {{{kbd(F)}}}, ~org-attach-reveal-in-emacs~ ::
7213     #+kindex: C-c C-a F
7215     Also open the directory, but force using @command{dired} in Emacs.
7217   - {{{kbd(d)}}}, ~org-attach-delete-one~ ::
7218     #+kindex: C-c C-a d
7220     Select and delete a single attachment.
7222   - {{{kbd(D)}}}, ~org-attach-delete-all~ ::
7223     #+kindex: C-c C-a D
7225     Delete all of a task's attachments.  A safer way is to open the
7226     directory in {{{command(dired)}}} and delete from there.
7228   - {{{kbd(s)}}}, ~org-attach-set-directory~ ::
7229     #+kindex: C-c C-a s
7230     #+cindex: property, ATTACH_DIR
7232     Set a specific directory as the entry's attachment directory.  This
7233     works by putting the directory path into the ~ATTACH_DIR~ property.
7235   - {{{kbd(i)}}}, ~org-attach-set-inherit~ ::
7236     #+kindex: C-c C-a i
7237     #+cindex: property, ATTACH_DIR_INHERIT
7239     Set the ~ATTACH_DIR_INHERIT~ property, so that children will use the
7240     same directory for attachments as the parent does.
7242 ** RSS feeds
7243    :PROPERTIES:
7244    :DESCRIPTION: Getting input from RSS feeds
7245    :END:
7246 #+cindex: RSS feeds
7247 #+cindex: Atom feeds
7249 Org can add and change entries based on information found in RSS feeds and
7250 Atom feeds.  You could use this to make a task out of each new podcast in a
7251 podcast feed.  Or you could use a phone-based note-creating service on the
7252 web to import tasks into Org.  To access feeds, configure the variable
7253 ~org-feed-alist~.  The docstring of this variable has detailed
7254 information.  Here is an example:
7256 #+header: :eval no
7257 #+header: :exports code
7258 #+begin_src emacs-lisp
7259 (setq org-feed-alist
7260      '(("Slashdot"
7261          "http://rss.slashdot.org/Slashdot/slashdot"
7262          "~/txt/org/feeds.org" "Slashdot Entries")))
7263 #+end_src
7265 {{{noindent}}} will configure that new items from the feed provided by
7266 ~rss.slashdot.org~ will result in new entries in the file
7267 {{{file(~/org/feeds.org)}}} under the heading ~Slashdot Entries~,
7268 whenever the following command is used:
7270 #+attr_texinfo: :table-type table :indic @asis
7271 - {{{kbd(C-c C-x g)}}}, ~org-feed-update-all~ ::
7272   #+kindex: C-c C-x g
7274   Collect items from the feeds configured in ~org-feed-alist~ and act
7275   upon them.
7277 - {{{kbd(C-c C-x G)}}}, ~org-feed-goto-inbox~ ::
7278   #+kindex: C-c C-x G
7280   Prompt for a feed name and go to the inbox configured for this feed.
7283 Under the same headline, Org will create a drawer
7284 {{{samp(FEEDSTATUS)}}} in which it will store information about the
7285 status of items in the feed, to avoid adding the same item several
7286 times.  You should add {{{samp(FEEDSTATUS)}}} to the list of drawers in
7287 that file:
7289 #+begin_example
7290    ,#+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
7291 #+end_example
7293 For more information, including how to read atom feeds, see
7294 {{{file(org-feed.el)}}} and the docstring of ~org-feed-alist~.
7296 ** Protocols
7297    :PROPERTIES:
7298    :DESCRIPTION: External (e.g., browser) access to Emacs and Org
7299    :TITLE:    Protocols for external access
7300    :END:
7302 #+cindex: protocols, for external access
7303 #+cindex: emacsserver
7305 You can set up Org for handling protocol calls from outside
7306 applications that are passed to Emacs through the
7307 {{{file(emacsserver)}}}.  For example, you can configure bookmarks in
7308 your web browser to send a link to the current page to Org and create
7309 a note from it using capture (see [[Capture]]).  Or you could create a
7310 bookmark that will tell Emacs to open the local source file of a
7311 remote website you are looking at with the browser.  See
7312 [[http://orgmode.org/worg/org-contrib/org-protocol.php]] for detailed
7313 documentation and setup instructions.
7315 ** Refile and copy
7316    :PROPERTIES:
7317    :DESCRIPTION: Moving/copying a tree from one place to another
7318    :END:
7319 #+cindex: refiling notes
7320 #+cindex: copying notes
7322 When reviewing the captured data, you may want to refile or to copy some of
7323 the entries into a different list, for example into a project.  Cutting,
7324 finding the right location, and then pasting the note is cumbersome.  To
7325 simplify this process, you can use the following special command:
7327 #+attr_texinfo: :table-type table :indic @asis
7328 - {{{kbd(C-c M-w)}}}, ~org-copy~ ::
7329   #+kindex: C-c M-w
7330   #+findex: org-copy
7332   Copying works like refiling, except that the original note is not deleted.
7334 - {{{kbd(C-c C-w)}}}, ~org-refile~ ::
7335   #+kindex: C-c C-w
7336   #+findex: org-refile
7337   #+vindex: org-reverse-note-order
7338   #+vindex: org-refile-targets
7339   #+vindex: org-refile-use-outline-path
7340   #+vindex: org-outline-path-complete-in-steps
7341   #+vindex: org-refile-allow-creating-parent-nodes
7342   #+vindex: org-log-refile
7343   #+vindex: org-refile-use-cache
7345   Refile the entry or region at point.  This command offers possible
7346   locations for refiling the entry and lets you select one with
7347   completion.  The item (or all items in the region) is filed below the
7348   target heading as a subitem.  Depending on ~org-reverse-note-order~, it
7349   will be either the first or last subitem.
7351   By default, all level 1 headlines in the current buffer are considered
7352   to be targets, but you can have more complex definitions across a
7353   number of files.  See the variable ~org-refile-targets~ for details.  If
7354   you would like to select a location via a file-path-like completion
7355   along the outline path, see the variables
7356   ~org-refile-use-outline-path~ and
7357   ~org-outline-path-complete-in-steps~.  If you would like to be able to
7358   create new nodes as new parents for refiling on the fly, check the
7359   variable ~org-refile-allow-creating-parent-nodes~.  When the variable
7360   ~org-log-refile~ is set, a timestamp or a note will be recorded when
7361   an entry has been refiled.[fn:86]
7363 - {{{kbd(C-u C-c C-w)}}} ::
7364   #+kindex: C-u C-c C-w
7366   Use the refile interface to jump to a heading.
7368 - {{{kbd(C-u C-u C-c C-w)}}}, ~org-refile-goto-last-stored~ ::
7369   #+kindex: C-u C-u C-c C-w
7371   Jump to the location where ~org-refile~ last moved a tree to.
7373 - {{{kbd(C-2 C-c C-w)}}} ::
7374   #+kindex: C-2 C-c C-w
7376   Refile as the child of the item currently being clocked.
7378 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}}, ~org-refile-cache-clear~ ::
7379   #+kindex: C-u C-u C-u C-c C-w
7380   #+kindex: C-0 C-c C-w
7382   Clear the target cache.  Caching of refile targets can be turned on by
7383   setting ~org-refile-use-cache~.  To make the command see new possible
7384   targets, you have to clear the cache with this command.
7386 ** Archiving
7387    :PROPERTIES:
7388    :DESCRIPTION: What to do with finished products
7389    :END:
7390 #+cindex: archiving
7392 When a project represented by a (sub)tree is finished, you may want to
7393 move the tree out of the way and to stop it from contributing to the
7394 agenda.  Archiving is important to keep your working files compact and
7395 global searches like the construction of agenda views fast.
7397 #+attr_texinfo: :table-type table :indic @asis
7398 - {{{kbd(C-c C-x C-a)}}}, ~org-archive-subtree-default~ ::
7399   #+kindex: C-c C-x C-a
7400   #+vindex: org-archive-default-command
7402   Archive the current entry using the command specified in the variable
7403   ~org-archive-default-command~.
7405 *** Moving subtrees
7406     :PROPERTIES:
7407     :DESCRIPTION: Moving a tree to an archive file
7408     :TITLE:    Moving a tree to an archive file
7409     :END:
7410 #+cindex: external archiving
7412 The most common archiving action is to move a project tree to another file,
7413 the archive file.
7415 #+attr_texinfo: :table-type table :indic @asis
7416 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}}, ~org-archive-subtree~ ::
7417   #+kindex: C-c C-x C-s
7418   #+kindex: C-c $
7419   #+vindex: org-archive-location
7421   Archive the subtree starting at the cursor position to the location
7422   given by ~org-archive-location~.
7424 - {{{Kbd(C-u C-c C-x C-s)}}} ::
7425   #+kindex: C-u C-c C-x C-s
7427   Check if any direct children of the current headline could be moved to
7428   the archive.  To do this, each subtree is checked for open TODO
7429   entries.  If none are found, the command offers to move it to the
7430   archive location.  If the cursor is /not/ on a headline when this
7431   command is invoked, the level 1 trees will be checked.
7434 #+cindex: archive locations
7436 The default archive location is a file in the same directory as the
7437 current file, with the name derived by appending {{{file(_archive)}}}
7438 to the current file name.  You can also choose what heading to file
7439 archived items under, with the possibility to add them to a datetree
7440 in a file.  For information and examples on how to specify the file and
7441 the heading, see the documentation string of the variable
7442 ~org-archive-location~.
7444 There is also an in-buffer option for setting this variable, for
7445 example:[fn:87]
7447 #+cindex: #+ARCHIVE
7448 #+begin_example
7449    ,#+ARCHIVE: %s_done::
7450 #+end_example
7452 #+cindex: property, ARCHIVE
7454 {{{noindent}}} If you would like to have a special ARCHIVE location
7455 for a single entry or a (sub)tree, give the entry an ~:ARCHIVE:~
7456 property with the location as the value (see [[Properties and columns]]).
7458 #+vindex: org-archive-save-context-info
7460 When a subtree is moved, it receives a number of special properties
7461 that record context information like the file from where the entry
7462 came, its outline path the archiving time etc.  Configure the variable
7463 ~org-archive-save-context-info~ to adjust the amount of information
7464 added.
7466 *** Internal archiving
7467     :PROPERTIES:
7468     :DESCRIPTION: Switch off a tree but keep it in the file
7469     :END:
7471 If you want to just switch off (for agenda views) certain subtrees
7472 without moving them to a different file, you can use the ~ARCHIVE
7473 tag~.
7475 A headline that is marked with the ARCHIVE tag (see [[Tags]]) stays at
7476 its location in the outline tree, but behaves in the following way:
7478 - It does not open when you attempt to do so with a visibility cycling
7479   command (see [[Visibility cycling]]).  You can force cycling archived
7480   subtrees with {{{kbdkey(C-,TAB)}}}, or by setting the option
7481   ~org-cycle-open-archived-trees~.  Also normal outline commands like
7482   ~show-all~ will open archived subtrees.
7484   #+vindex: org-cycle-open-archived-trees
7486 - During sparse tree construction (see [[Sparse trees]]), matches in
7487   archived subtrees are not exposed, unless you configure the option
7488   ~org-sparse-tree-open-archived-trees~.
7490   #+vindex: org-sparse-tree-open-archived-trees
7492 - During agenda view construction (see [[Agenda views]]), the content of
7493   archived trees is ignored unless you configure the option
7494   ~org-agenda-skip-archived-trees~, in which case these trees will
7495   always be included.  In the agenda you can press {{{kbd(v a)}}} to
7496   get archives temporarily included.
7498   #+vindex: org-agenda-skip-archived-trees
7500 - Archived trees are not exported (see [[Exporting]]), only the headline
7501   is.  Configure the details using the variable
7502   ~org-export-with-archived-trees~.
7504   #+vindex: org-export-with-archived-trees
7506 - Archived trees are excluded from column view unless the variable
7507   ~org-columns-skip-archived-trees~ is configured to ~nil~.
7509   #+vindex: org-columns-skip-archived-trees
7512 The following commands help manage the ARCHIVE tag:
7514 #+attr_texinfo: :table-type table :indic @asis
7515 - {{{kbd(C-c C-x a)}}}, ~org-toggle-archive-tag~ ::
7516   #+kindex: C-c C-x a
7518   Toggle the ARCHIVE tag for the current headline.  When the tag is set,
7519   the headline changes to a shadowed face, and the subtree below it is
7520   hidden.
7522 - {{{kbd(C-u C-c C-x a)}}} ::
7523   #+kindex: C-u C-c C-x a
7525   Check if any direct children of the current headline should be
7526   archived.  To do this, each subtree is checked for open TODO entries.
7527   If none are found, the command offers to set the ARCHIVE tag for the
7528   child.  If the cursor is /not/ on a headline when this command is
7529   invoked, the level 1 trees will be checked.
7531 - {{{kbdkey(C-,TAB)}}}, ~org-force-cycle-archived~ ::
7533   Cycle a tree even if it is tagged with ARCHIVE.
7535 - {{{kbd(C-c C-x A)}}}, ~org-archive-to-archive-sibling~ ::
7536   #+kindex: C-c C-x A
7538   Move the current entry to the /Archive Sibling/.  This is a sibling of
7539   the entry with the heading {{{samp(Archive)}}} and the tag
7540   {{{samp(ARCHIVE)}}}.  The entry becomes a child of that sibling and in
7541   this way retains a lot of its original context, including inherited
7542   tags and approximate position in the outline.
7544 * FIXME Agenda views
7545   :PROPERTIES:
7546   :DESCRIPTION: Collecting information into views
7547   :ALT_TITLE: Agenda Views
7548   :END:
7550 Due to the way Org works, TODO items, time-stamped items, and tagged
7551 headlines can be scattered throughout a file or even a number of
7552 files.  To get an overview of open action items, or of events that are
7553 important for a particular date, this information must be collected,
7554 sorted and displayed in an organized way.
7556 Org can select items based on various criteria and display them
7557 in a separate buffer.  Seven different view types are provided:
7559 - an /agenda/ that is like a calendar and shows information for
7560   specific dates,
7562 - a /TODO list/ that covers all unfinished action items,
7564 - a /match view/, showings headlines based on the tags, properties,
7565   and TODO state associated with them,
7567 - a /timeline view/ that shows all events in a single Org file, in
7568   time-sorted view,
7570 - a /text search view/ that shows all entries from multiple files that
7571   contain specified keywords,
7573 - a /stuck projects view/ showing projects that currently don't move
7574   along, and
7576 - /custom views/ that are special searches and combinations of
7577   different views.
7580 {{{noindent}}} The extracted information is displayed in a special
7581 /agenda buffer/.  This buffer is read-only, but provides commands to
7582 visit the corresponding locations in the original Org files, and even
7583 to edit these files remotely.
7585 #+vindex: org-agenda-window-setup
7586 #+vindex: org-agenda-restore-windows-after-quit
7588 Two variables control how the agenda buffer is displayed and whether
7589 the window configuration is restored when the agenda exits:
7590 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
7592 ** Agenda files
7593    :PROPERTIES:
7594    :DESCRIPTION: Files being searched for agenda information
7595    :END:
7596 #+cindex: agenda files
7597 #+cindex: files for agenda
7598 #+vindex: org-agenda-files
7600 The information to be shown is normally collected from all /agenda
7601 files/, the files listed in the variable ~org-agenda-files~.[fn:180] If
7602 a directory is part of this list, all files with the extension
7603 {{{file(.org)}}} in this directory will be part of the list.
7605 Thus, even if you only work with a single Org file, that file should
7606 be put into the list.[fn:88]  You can customize ~org-agenda-files~, but
7607 the easiest way to maintain it is through the following commands
7609 #+cindex: files, adding to agenda list
7610 #+attr_texinfo: :table-type table :indic @asis
7611 - {{{kbd(C-c [)}}}, ~org-agenda-file-to-front~ ::
7612   #+kindex: C-c [
7614   Add current file to the list of agenda files.  The file is added to the
7615   front of the list.  If it was already in the list, it is moved to the
7616   front.  With a prefix argument, file is added/moved to the end.
7618 - {{{kbd(C-c ])}}}, ~org-remove-file~ ::
7619   #+kindex: C-c ]
7621   Remove current file from the list of agenda files.
7623 - {{{kbd(C-')}}} {{{kbd(C-)}}}, ~org-cycle-agenda-files~ ::
7624   #+kindex: C-'
7625   #+kindex: C-,
7626   #+cindex: cycling, of agenda files
7628   Cycle through agenda file list, visiting one file after the other.
7630 - {{{kbd(M-x org-iswitchb)}}} ::
7631   #+findex: org-iswitchb
7633   Command to use an ~iswitchb~-like interface to switch to and between
7634   Org buffers.
7637 {{{noindent}}} The Org menu contains the current list of files and can
7638 be used to visit any of them.
7640 If you would like to focus the agenda temporarily on a file not in
7641 this list, or on just one file in the list, or even on only a subtree
7642 in a file, then this can be done in different ways.  For a single
7643 agenda command, you may press {{{kbd(<)}}} once or several times in
7644 the dispatcher (see [[Agenda dispatcher]]).  To restrict the agenda scope
7645 for an extended period, use the following commands:
7647 #+attr_texinfo: :table-type table :indic @asis
7648 - {{{kbd(C-c C-x <)}}}, ~org-agenda-set-restriction-lock~ ::
7649   #+kindex: C-c C-x <
7651   Permanently restrict the agenda to the current subtree.  When with a
7652   prefix argument, or with the cursor before the first headline in a
7653   file, the agenda scope is set to the entire file.  This restriction
7654   remains in effect until removed with {{{kbd(C-c C-x >)}}}, or by
7655   typing either {{{kbd(<)}}} or {{{kbd(>)}}} in the agenda dispatcher.
7656   If there is a window displaying an agenda view, the new restriction
7657   takes effect immediately.
7659 - {{{kbd(C-c C-x >)}}}, ~org-agenda-remove-restriction-lock~ ::
7660   #+kindex: C-c C-x >
7662   Remove the permanent restriction created by {{{kbd(C-c C-x <)}}}.
7665 {{{noindent}}} When working with {{{file(speedbar.el)}}}, you can use
7666 the following commands in the Speedbar frame:
7668 #+attr_texinfo: :table-type table :indic @asis
7669 - {{{kbd(<)}}} in the speedbar frame ~org-speedbar-set-agenda-restriction~ ::
7670   #+kindex: <
7672   Permanently restrict the agenda to the item---either an Org file or a
7673   subtree in such a file---at the cursor in the Speedbar frame.  If there
7674   is a window displaying an agenda view, the new restriction takes
7675   effect immediately.
7677 - {{{kbd(>)}}} in the speedbar frame ~org-agenda-remove-restriction-lock~ ::
7678   #+kindex: >
7680   Lift the restriction.
7682 ** Agenda dispatcher
7683    :PROPERTIES:
7684    :DESCRIPTION: Keyboard access to agenda views
7685    :TITLE:    The agenda dispatcher
7686    :END:
7687 #+cindex: agenda dispatcher
7688 #+cindex: dispatching agenda commands
7690 The views are created through a dispatcher, which should be bound to a
7691 global key---for example {{{kbd(C-c a)}}} (see [[Activation]]).  In the
7692 following we will assume that {{{kbd(C-c a)}}} is indeed how the
7693 dispatcher is accessed and list keyboard access to commands
7694 accordingly.  After pressing {{{kbd(C-c a)}}}, an additional letter is
7695 required to execute a command.  The dispatcher offers the following
7696 default commands:
7698 #+attr_texinfo: :table-type table :indic @asis
7699 - {{{kbd(a)}}} ::
7700   #+kindex: C-c a a
7702   Create the calendar-like agenda (see [[Weekly/daily agenda]]).
7704 - {{{kbd(t)}}} or {{{kbd(T)}}} ::
7705   #+kindex: C-c a t
7706   #+kindex: C-c a T
7708   Create a list of all TODO items (see [[Global TODO list]]).
7710 - {{{kbd(m)}}} or {{{kbd(M)}}} ::
7711   #+kindex: C-c a m
7712   #+kindex: C-c a M
7714   Create a list of headlines matching a TAGS expression (see [[Matching tags and properties]]).
7716 - {{{kbd(L)}}} ::
7717   #+kindex: C-c a L
7719   Create the timeline view for the current buffer 
7720   (see [[Timeline for a single file]]).
7722 - {{{kbd(s)}}} ::
7723   #+kindex: C-c a s
7725   Create a list of entries selected by a boolean expression of keywords
7726   and/or regular expressions that must or must not occur in the entry.
7728 - {{{kbd(/)}}} ::
7729   #+kindex: C-c a /
7730   #+vindex: org-agenda-text-search-extra-files
7732   Search for a regular expression in all agenda files and additionally
7733   in the files listed in ~org-agenda-text-search-extra-files~.  This uses
7734   the Emacs command ~multi-occur~.  A prefix argument can be used to
7735   specify the number of context lines for each match, default is
7736   1.
7738 - {{{kbd(#)}}} or {{{kbd(!)}}} ::
7739   #+kindex: C-c a #
7740   #+kindex: C-c a !
7741   Create a list of stuck projects (see [[Stuck projects]]).
7743 - {{{kbd(<)}}} ::
7744   #+kindex: C-c a <
7746   Restrict an agenda command to the current buffer.[fn:89] After
7747   pressing {{{kbd(<)}}}, you still need to press the character selecting
7748   the command.
7750 - {{{kbd(< <)}}} ::
7751   #+kindex: C-c a < <
7753   If there is an active region, restrict the following agenda command to
7754   the region.  Otherwise, restrict it to the current subtree.[fn:90]
7755   After pressing {{{kbd(< <)}}}, you still need to press the character
7756   selecting the command.
7758 - {{{kbd(*)}}} ::
7759   #+kindex: C-c a *
7760   #+vindex: org-agenda-sticky
7762   Toggle sticky agenda views.  By default, Org maintains only a single
7763   agenda buffer and rebuilds it each time you change the view, to make
7764   sure everything is always up to date.  If you switch between views
7765   often and the build time bothers you, you can turn on sticky agenda
7766   buffers (make this the default by customizing the variable
7767   ~org-agenda-sticky~).  With sticky agendas, the dispatcher only
7768   switches to the selected view, you need to update it by hand with
7769   {{{kbd(r)}}} or {{{kbd(g)}}}.  You can toggle sticky agenda view any
7770   time with ~org-toggle-sticky-agenda~.
7773 You can also define custom commands that will be accessible through
7774 the dispatcher, just like the default commands.  This includes the
7775 possibility to create extended agenda buffers that contain several
7776 blocks together, for example the weekly agenda, the global TODO list
7777 and a number of special tags matches.  See [[Custom agenda views]].
7779 ** Built-in agenda views
7780    :PROPERTIES:
7781    :DESCRIPTION: What is available out of the box?
7782    :TITLE: The built-in agenda views
7783    :END:
7784 In this section we describe the built-in views.
7786 *** FIXED Weekly/daily agenda
7787     :PROPERTIES:
7788     :DESCRIPTION: The calendar page with current tasks
7789     :END:
7790 #+cindex: agenda
7791 #+cindex: weekly agenda
7792 #+cindex: daily agenda
7794 The purpose of the weekly/daily /agenda/ is to act like a page of a
7795 paper agenda, showing all the tasks for the current week or day.
7797 #+attr_texinfo: :table-type table :indic @asis
7798 - {{{kbd(C-c a a)}}}, ~org-agenda-list~ ::
7799   #+cindex: org-agenda, command
7801   Compile an agenda for the current week from a list of Org files.  The
7802   agenda shows the entries for each day.  With a numeric prefix (like
7803   {{{kbd(C-u 2 1 C-c a a)}}}) you may set the number of days to be
7804   displayed.[fn:91]
7807 #+vindex: org-agenda-span
7808 #+vindex: org-agenda-ndays
7809 The default number of days displayed in the agenda is set by the variable
7810 ~org-agenda-span~ (or the obsolete ~org-agenda-ndays~).  This
7811 variable can be set to any number of days you want to see by default in the
7812 agenda, or to a span name, such a ~day~, ~week~, ~month~ or
7813 ~year~.
7815 Remote editing from the agenda buffer means, for example, that you can
7816 change the dates of deadlines and appointments from the agenda buffer.
7817 The commands available in the Agenda buffer are listed in [[Agenda
7818 commands]].
7820 **** FIXED Calendar/Diary integration
7821      :PROPERTIES:
7822      :DESCRIPTION: Integrate the Emacs diary with Org
7823      :END:
7824 #+cindex: calendar integration
7825 #+cindex: diary integration
7826 #+cindex: Reingold, Edward M.
7828 Emacs contains the calendar and diary by Edward M.  Reingold.  The
7829 calendar displays a three-month calendar with holidays from different
7830 countries and cultures.  The diary allows you to keep track of
7831 anniversaries, lunar phases, sunrise/set, recurrent appointments
7832 (weekly, monthly) and more.  In this way, it is quite complementary to
7833 Org.  It can be very useful to combine output from Org with
7834 the diary.
7836 In order to include entries from the Emacs diary into Org mode's
7837 agenda, you only need to customize the variable
7839 #+begin_src emacs-lisp
7840   (setq org-agenda-include-diary t)
7841 #+end_src
7843 {{{noindent}}} After that, everything will happen automatically.  All diary
7844 entries including holidays, anniversaries, etc., will be included in the
7845 agenda buffer created by Org mode.  {{{key(SPC)}}}, {{{key(TAB)}}}, and
7846 {{{key(RET)}}} can be used from the agenda buffer to jump to the diary
7847 file in order to edit existing diary entries.  The {{{kbd(i)}}} command to
7848 insert new entries for the current date works in the agenda buffer, as
7849 well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and {{{kbd(C)}}} to display
7850 Sunrise/Sunset times, show lunar phases and to convert to other
7851 calendars, respectively.  {{{kbd(c)}}} can be used to switch back and forth
7852 between calendar and agenda.
7854 If you are using the diary only for sexp entries and holidays, it is
7855 faster to not use the above setting, but instead to copy or even move
7856 the entries into an Org file.  Org mode evaluates diary-style sexp
7857 entries, and does it faster because there is no overhead for first
7858 creating the diary display.  Note that the sexp entries must start at
7859 the left margin, no whitespace is allowed before them.  For example,
7860 the following segment of an Org file will be processed and entries
7861 will be made in the agenda:[fn:181]
7863 #+begin_example
7864    ,* Birthdays and similar stuff
7865    ,#+CATEGORY: Holiday
7866    %%(org-calendar-holiday)   ; special function for holiday names
7867    ,#+CATEGORY: Ann
7868    %%(org-anniversary 1956  5 14) Arthur Dent is %d years old
7869    %%(org-anniversary 1869 10  2) Mahatma Gandhi would be %d years old
7870 #+end_example
7872 **** FIXED Anniversaries from BBDB
7873      :PROPERTIES:
7874      :DESCRIPTION: Integrate Big Brother Database and Org
7875      :END:
7877 #+cindex: BBDB, anniversaries
7878 #+cindex: anniversaries, from BBDB
7880 If you are using the Big Brothers Database to store your contacts, you will
7881 very likely prefer to store anniversaries in BBDB rather than in a
7882 separate Org or diary file.  Org supports this and will show BBDB
7883 anniversaries as part of the agenda.  All you need to do is to add the
7884 following to one of your agenda files:
7886 #+begin_example
7887    ,* Anniversaries
7888    ,  :PROPERTIES:
7889    ,  :CATEGORY: Anniv
7890    ,  :END:
7891    ,%%(org-bbdb-anniversaries)
7892 #+end_example
7894 You can then go ahead and define anniversaries for a BBDB record.
7895 Basically, you need to press {{{kbdspckey(C-o anniversary,RET)}}} with
7896 the cursor in a BBDB record and then add the date in the format
7897 ~YYYY-MM-DD~ or ~MM-DD~, followed by a space and the class of the
7898 anniversary ({{{samp(birthday)}}} or {{{samp(wedding)}}}, or a format
7899 string).  If you omit the class, it will default to
7900 {{{samp(birthday)}}}.  Here are a few examples, the header for the file
7901 {{{file(org-bbdb.el)}}} contains more detailed information.
7903 #+begin_example
7904    1973-06-22
7905    06-22
7906    1955-08-02 wedding
7907    2008-04-14 %s released version 6.01 of org mode, %d years ago
7908 #+end_example
7910 After a change to BBDB, or for the first agenda display during an
7911 Emacs session, the agenda display will suffer a short delay as Org
7912 updates its hash with anniversaries.  However, from then on things will
7913 be very fast---much faster in fact than a long list of
7914 {{{samp(%%(diary-anniversary))}}} entries in an Org or Diary file.
7916 **** FIXED Appointment reminders
7917      :PROPERTIES:
7918      :DESCRIPTION: Integrate the Emacs appointment facility and Org
7919      :END:
7920 #+cindex: @file{appt.el}
7921 #+cindex: appointment reminders
7922 #+cindex: appointment
7923 #+cindex: reminders
7925 Org can interact with Emacs appointments notification facility.  To add the
7926 appointments of your agenda files, use the command ~org-agenda-to-appt~.
7927 This command lets you filter through the list of your appointments and add
7928 only those belonging to a specific category or matching a regular expression.
7929 It also reads a ~APPT_WARNTIME~ property which will then override the
7930 value of ~appt-message-warning-time~ for this appointment.  See the
7931 docstring for details.
7933 *** FIXED Global TODO list
7934     :PROPERTIES:
7935     :DESCRIPTION: All unfinished action items
7936     :END:
7937 #+cindex: global TODO list
7938 #+cindex: TODO list, global
7940 The global TODO list contains all unfinished TODO items formatted and
7941 collected into a single place.
7943 #+attr_texinfo: :table-type table :indic @asis
7944 - {{{kbd(C-c a t)}}}, ~org-todo-list~ ::
7946   Show the global TODO list.  This collects the TODO items from all
7947   agenda files (see [[Agenda views]]) into a single buffer.  By default, this
7948   lists items with a state the is not a DONE state.  The buffer is in
7949   ~agenda-mode~, so there are commands to examine and manipulate the
7950   TODO entries directly from that buffer (see [[Agenda commands]]).
7952 - {{{kbd(C-c a T)}}}, ~org-todo-list~ ::
7954   #+cindex: TODO keyword matching
7955   #+vindex: org-todo-keywords
7957   Like the above, but allows selection of a specific TODO keyword.  You
7958   can also do this by specifying a prefix argument to {{{kbd(C-c a
7959   t)}}}.  You are prompted for a keyword, and you may also specify
7960   several keywords by separating them with {{{samp(|)}}} as the boolean
7961   OR operator.  With a numeric prefix, the Nth keyword in
7962   ~org-todo-keywords~ is selected.
7964   #+kindex: r
7966   The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you can give
7967   a prefix argument to this command to change the selected TODO keyword,
7968   for example {{{kbd(3 r)}}}.  If you often need a search for a specific
7969   keyword, define a custom command for it (see [[Agenda dispatcher]]).
7971   Matching specific TODO keywords can also be done as part of a tags
7972   search (see [[Tag searches]]).
7975 Remote editing of TODO items means that you can change the state of a
7976 TODO entry with a single key press.  The commands available in the
7977 TODO list are described in [[Agenda commands]].
7979 #+cindex: sublevels, inclusion into TODO list
7981 Normally the global TODO list simply shows all headlines with TODO
7982 keywords.  This list can become very long.  There are two ways to keep
7983 it more compact:
7986 - Some people view a TODO item that has been /scheduled/ for execution
7987   or have a /deadline/ (see [[Timestamps]]) as no longer /open/.  Configure
7988   the variables ~org-agenda-todo-ignore-scheduled~,
7989   ~org-agenda-todo-ignore-deadlines~,
7990   ~org-agenda-todo-ignore-timestamp~ and/or
7991   ~org-agenda-todo-ignore-with-date~ to exclude such items from the
7992   global TODO list.
7994   #+vindex: org-agenda-todo-ignore-scheduled
7995   #+vindex: org-agenda-todo-ignore-deadlines
7996   #+vindex: org-agenda-todo-ignore-timestamp
7997   #+vindex: org-agenda-todo-ignore-with-date
7999 - TODO items may have sublevels to break up the task into subtasks.  In
8000   such cases it may be enough to list only the highest level TODO
8001   headline and omit the sublevels from the global list.  Configure the
8002   variable ~org-agenda-todo-list-sublevels~ to get this behavior.
8004   #+vindex: org-agenda-todo-list-sublevels
8006 *** Matching tags and properties
8007     :PROPERTIES:
8008     :DESCRIPTION: Structured information with fine-tuned search
8009     :END:
8010 #+cindex: matching, of tags
8011 #+cindex: matching, of properties
8012 #+cindex: tags view
8013 #+cindex: match view
8015 If headlines in the agenda files are marked with /tags/ (see [[Tags]]), or
8016 have properties (see [[Properties and columns]]), you can select headlines
8017 based on this metadata and collect them into an agenda buffer.  The
8018 match syntax described here also applies when creating sparse trees
8019 with {{{kbd(C-c / m)}}}.
8021 #+attr_texinfo: :table-type table :indic @asis
8022 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
8024   Produce a list of all headlines that match a given set of tags.  The
8025   command prompts for a selection criterion, which is a boolean logic
8026   expression with tags, like {{{samp(+work+urgent-withboss)}}} or
8027   {{{samp(work|home)}}} (see [[Tags]]).  If you often need a specific search,
8028   define a custom command for it (see [[Agenda dispatcher]]).
8030 - {{{kbd(C-c a M)}}}, ~org-tags-view~ ::
8032   #+vindex: org-tags-match-list-sublevels
8033   #+vindex: org-agenda-tags-todo-honor-ignore-options
8035   Like {{{kbd(C-c a m)}}}, but only select headlines that are also TODO
8036   items in a not-DONE state and force checking subitems (see the variable
8037   ~org-tags-match-list-sublevels~).  To exclude scheduled/deadline items,
8038   see the variable ~org-agenda-tags-todo-honor-ignore-options~.  Matching
8039   specific TODO keywords together with a tags match is also possible,
8040   see [[Tag searches]].
8043 The commands available in the tags list are described in [[Agenda
8044 commands]].
8047 #+cindex: Boolean logic, for tag or property searches
8049 A search string can use Boolean operators {{{samp(&)}}} for AND and
8050 {{{samp(|)}}} for OR.  {{{samp(&)}}} binds more strongly than
8051 {{{samp(|)}}}.  Parentheses are currently not implemented.  Each element
8052 in the search is either a tag, a regular expression matching tags, or
8053 an expression like ~PROPERTY OPERATOR VALUE~ with a comparison
8054 operator, accessing a property value.  Each element may be preceded by
8055 {{{samp(-)}}}, to select against it, and {{{samp(+)}}} is syntactic
8056 sugar for positive selection.  The AND operator {{{samp(&)}}} is
8057 optional when {{{samp(+)}}} or {{{samp(-)}}} is present.  Here are some
8058 examples, using only tags.
8060 #+attr_texinfo: :table-type table :indic @samp
8061 - +work-boss ::
8063   Select headlines tagged {{{samp(:work:)}}}, but discard those also
8064   tagged {{{samp(:boss:)}}}.
8066 - work|laptop ::
8068   Selects lines tagged {{{samp(:work:)}}} or {{{samp(:laptop:)}}}.
8070 - work|laptop+night ::
8072   Like before, but require the {{{samp(:laptop:)}}} lines to be tagged
8073   also {{{samp(:night:)}}}.
8076 #+cindex: regular expressions, with tags search
8078 Instead of a tag, you may also specify a regular expression enclosed
8079 in curly braces.  For example, {{{samp(work+{^boss.*})}}} matches
8080 headlines that contain the tag {{{samp(:work:)}}} and any tag
8081 /starting/ with {{{samp(boss)}}}.
8083 #+cindex: TODO keyword matching, with tags search
8084 #+cindex: level, require for tags/property match
8085 #+cindex: category, require for tags/property match
8086 #+vindex: org-odd-levels-only
8088 You may also test for properties (see [[Properties and columns]]) at the
8089 same time as matching tags.  The properties may be real properties, or
8090 special properties that represent other metadata (see [[Special
8091 properties]]).  For example, the "property" ~TODO~ represents the TODO
8092 keyword of the entry.  Or, the "property" ~LEVEL~ represents the
8093 level of an entry.  So a search {{{samp(+LEVEL=3+boss-TODO="DONE")}}}
8094 lists all level three headlines that have the tag {{{samp(boss)}}} and
8095 are /not/ marked with the TODO keyword DONE.  In buffers with
8096 ~org-odd-levels-only~ set, {{{samp(LEVEL)}}} does not count the number
8097 of stars, but {{{samp(LEVEL=2)}}} will correspond to 3 stars etc.  The
8098 ITEM special property cannot currently be used in tags/property
8099 searches.[fn:92]
8101 Here are more examples:
8103 #+attr_texinfo: :table-type table :indic @samp
8104 - work+TODO="WAITING" ::
8106   Select {{{samp(:work:)}}}-tagged TODO lines with the specific TODO
8107   keyword {{{samp(WAITING)}}}.
8109 - work+TODO="WAITING"|home+TODO="WAITING" ::
8111   Waiting tasks both at work and at home.
8114 When matching properties, a number of different operators can be used to test
8115 the value of a property.  Here is a complex example:
8117 #+begin_example
8118    +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2         
8119             +With={Sarah|Denny}+SCHEDULED>="<2008-10-11>"
8120 #+end_example
8122 {{{noindent}}} The type of comparison will depend on how the
8123 comparison value is written:
8125 - If the comparison value is a plain number, a numerical comparison is
8126   done, and the allowed operators are ~<~, ~=~, ~>~, ~<=~, ~>=~, and
8127   ~<>~.
8129 - If the comparison value is enclosed in double-quotes, a string
8130   comparison is done, and the same operators are allowed.
8132 - If the comparison value is enclosed in double-quotes /and/ angular
8133   brackets (like {{{samp(DEADLINE<="<2008-12-24 18:30>")}}}), both
8134   values are assumed to be date/time specifications in the standard
8135   Org way, and the comparison will be done accordingly.  Special values
8136   that will be recognized are ~"<now>"~ for now (including time), and
8137   ~"<today>"~, and ~"<tomorrow>"~ for these days at 0:00 hours, i.e.@:
8138   without a time specification.  Also strings like ~"<+5d>"~ or
8139   ~"<-2m>"~ with units ~d~, ~w~, ~m~, and ~y~ for day, week, month,
8140   and year, respectively, can be used.
8142 - If the comparison value is enclosed in curly braces, a regexp match
8143   is performed, with {{{samp(=)}}} meaning that the regexp matches the
8144   property value, and ~<>~ meaning that it does not match.
8147 So the search string in the example finds entries tagged
8148 {{{samp(:work:)}}} but not {{{samp(:boss:)}}}, which also have a
8149 priority value {{{samp(A)}}}, a {{{samp(:Coffee:)}}} property with the
8150 value {{{samp(unlimited)}}}, an {{{samp(Effort)}}} property that is
8151 numerically smaller than 2, a {{{samp(:With:)}}} property that is
8152 matched by the regular expression {{{samp(Sarah|Denny)}}}, and that
8153 are scheduled on or after October 11, 2008.
8155 Accessing TODO, LEVEL, and CATEGORY during a search is fast.  Accessing
8156 any other properties will slow down the search.  However, once you have
8157 paid the price by accessing one property, testing additional
8158 properties is cheap again.
8160 You can configure Org mode to use property inheritance during a
8161 search, but beware that this can slow down searches considerably.  See
8162 [[Property inheritance]], for details.
8164 For backward compatibility, and also for typing speed, there is also a
8165 different way to test TODO states in a search.  For this, terminate the
8166 tags/property part of the search string (which may include several
8167 terms connected with {{{samp(|)}}}) with a {{{samp(/)}}} and then
8168 specify a Boolean expression just for TODO keywords.  The syntax is
8169 then similar to that for tags, but should be applied with care: for
8170 example, a positive selection on several TODO keywords cannot
8171 meaningfully be combined with boolean AND.  However, /negative
8172 selection/ combined with AND can be meaningful.  To make sure that only
8173 lines are checked that actually have any TODO keyword (resulting in a
8174 speed-up), use {{{kbd(C-c a M)}}}, or equivalently start the TODO part
8175 after the slash with {{{samp(!)}}}.  Using {{{kbd(C-c a M)}}} or
8176 {{{samp(/!)}}} will not match TODO keywords in a DONE state.  Examples:
8178 #+attr_texinfo: :table-type table :indic @samp
8179 - work/WAITING ::
8181   Same as {{{samp(work+TODO="WAITING")}}}
8183 - work/!-WAITING-NEXT ::
8184   
8185   Select {{{samp(:work:)}}}-tagged TODO lines that are neither {{{samp(WAITING)}}}
8186   nor {{{samp(NEXT)}}}
8188 - work/!+WAITING|+NEXT ::
8190   Select {{{samp(:work:)}}}-tagged TODO lines that are either
8191   {{{samp(WAITING)}}} or {{{samp(NEXT)}}}.
8193 *** FIXED Timeline for a single file
8194     :PROPERTIES:
8195     :DESCRIPTION: Time-sorted view for a single file
8196     :ALT_TITLE: Timeline
8197     :END:
8199 #+cindex: timeline, single file
8200 #+cindex: time-sorted view
8202 The timeline summarizes all time-stamped items from a single Org mode
8203 file in a /time-sorted view/.  The main purpose of this command is
8204 to give an overview over events in a project.
8206 #+attr_texinfo: :table-type table :indic @asis
8207 - {{{kbd(C-c a L)}}}, ~org-timeline~ ::
8209   Show a time-sorted view of the Org file, with all time-stamped items.
8210   When called with a {{{kbd(C-u)}}} prefix, all unfinished TODO entries
8211   (scheduled or not) are also listed under the current date.
8214 {{{noindent}}} The commands available in the timeline buffer are
8215 listed in [[Agenda commands]].
8217 *** FIXED Search view
8218     :PROPERTIES:
8219     :DESCRIPTION: Find entries by searching for text
8220     :END:
8221 #+cindex: search view
8222 #+cindex: text search
8223 #+cindex: searching, for text
8225 This agenda view is a general text search facility for Org mode entries.
8226 It is particularly useful to find notes.
8228 #+attr_texinfo: :table-type table :indic @asis
8229 - {{{kbd(C-c a s)}}}, ~org-search-view~ ::
8231   This is a special search that lets you select entries by matching a
8232   substring or specific words using a boolean logic.
8235 For example, the search string {{{samp(computer equipment)}}} will
8236 find entries that contain {{{samp(computer equipment)}}} as a
8237 substring.  If the two words are separated by more space or a line
8238 break, the search will still match.  Search view can also search for
8239 specific keywords in the entry, using Boolean logic.  The search string
8240 {{{samp(+computer +wifi -ethernet -{8.11[bg]})}}} will search for
8241 note entries that contain the keywords ~computer~ and ~wifi~, but not
8242 the keyword ~ethernet~, and which are also not matched by the regular
8243 expression ~8.11[bg]~, meaning to exclude both 8.11b and 8.11g.  The
8244 first {{{samp(+)}}} is necessary to turn on word search, other
8245 {{{samp(+)}}} characters are optional.  For more details, see the
8246 docstring of the command ~org-search-view~.
8248 #+vindex: org-agenda-text-search-extra-files
8250 Note that in addition to the agenda files, this command will also
8251 search the files listed in ~org-agenda-text-search-extra-files~.
8253 *** FIXED Stuck projects
8254     :PROPERTIES:
8255     :DESCRIPTION: Find projects you need to review
8256     :END:
8257 #+pindex: GTD, Getting Things Done
8259 If you are following a system like David Allen's GTD to organize your
8260 work, one of the "duties" you have is a regular review to make sure
8261 that all projects move along.  A /stuck/ project is a project that has
8262 no defined next actions, so it will never show up in the TODO lists
8263 Org mode produces.  During the review, you need to identify such
8264 projects and define next actions for them.
8266 #+attr_texinfo: :table-type table :indic @asis
8267 - {{{kbd(C-c a #)}}}, ~org-agenda-list-stuck-projects~ ::
8269   List projects that are stuck.
8271 - {{{kbd(C-c a !)}}} ::
8273   #+vindex: org-stuck-projects
8274   #+kindex: C-c a !
8276   Customize the variable ~org-stuck-projects~ to define what a stuck
8277   project is and how to find it.
8280 You almost certainly will have to configure this view before it will
8281 work for you.  The built-in default assumes that all your projects are
8282 level-2 headlines, and that a project is not stuck if it has at least
8283 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
8285 Let's assume that you, in your own way of using Org mode, identify
8286 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
8287 indicate a project that should not be considered yet.  Let's further
8288 assume that the TODO keyword DONE marks finished projects, and that
8289 NEXT and TODO indicate next actions.  The tag @SHOP indicates shopping
8290 and is a next action even without the NEXT tag.  Finally, if the
8291 project contains the special word IGNORE anywhere, it should not be
8292 listed either.  In this case you would start by identifying eligible
8293 projects with a tags/todo match (see [[Tag searches]]).
8294 {{{samp(+PROJECT/-MAYBE-DONE)}}}, and then check for TODO, NEXT,
8295 @SHOP, and IGNORE in the subtree to identify projects that are not
8296 stuck.  The correct customization for this is:
8298 #+begin_src emacs-lisp
8299 (setq org-stuck-projects
8300       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
8301                                "\\<IGNORE\\>"))
8302 #+end_src
8304 Note that if a project is identified as non-stuck, the subtree of this entry
8305 will still be searched for stuck projects.
8307 ** Presentation and sorting
8308    :PROPERTIES:
8309    :DESCRIPTION: How agenda items are prepared for display
8310    :END:
8311 #+cindex: presentation, of agenda items
8312 #+vindex: org-agenda-prefix-format
8313 #+vindex: org-agenda-tags-column
8315 Before displaying items in an agenda view, Org mode visually prepares
8316 the items and sorts them.  Each item occupies a single line.  The line
8317 starts with a /prefix/ that contains the /category/ (see [[Categories]])
8318 of the item and other important information.  You can customize in
8319 which column tags will be displayed through ~org-agenda-tags-column~.
8320 You can also customize the prefix using the option
8321 ~org-agenda-prefix-format~.  This prefix is followed by a cleaned-up
8322 version of the outline headline associated with the item.
8324 *** Categories
8325     :PROPERTIES:
8326     :DESCRIPTION: Not all tasks are equal
8327     :END:
8329 #+cindex: category
8330 #+cindex: #+CATEGORY
8332 The category is a broad label assigned to each agenda item.  By
8333 default, the category is simply derived from the file name, but you
8334 can also specify it with a special line in the buffer, like
8335 this:[fn:93]
8337 #+begin_example
8338    ,#+CATEGORY: Thesis
8339 #+end_example
8341 {{{noindent}}}
8342 #+cindex: property, CATEGORY
8344 If you would like to have a special CATEGORY for a single entry or a
8345 (sub)tree, give the entry a ~:CATEGORY:~ property with the special
8346 category you want to apply as the value.
8348 {{{noindent}}} The display in the agenda buffer looks best if the
8349 category is not longer than 10 characters.
8351 {{{noindent}}} You can set up icons for category by customizing the
8352 ~org-agenda-category-icon-alist~ variable.
8353 #+vindex: org-agenda-category-icon-alist
8355 *** Time-of-day specifications
8356     :PROPERTIES:
8357     :DESCRIPTION: How the agenda knows the time
8358     :END:
8359 #+cindex: time-of-day specification
8361 Org mode checks each agenda item for a time-of-day specification.  The
8362 time can be part of the timestamp that triggered inclusion into the
8363 agenda, for example as in ~<2005-05-10 Tue 19:00>~.  Time
8364 ranges can be specified with two timestamps, like:
8366   ~<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>~.
8368 In the headline of the entry itself, a time(range) may also appear as
8369 plain text (like {{{samp(12:45)}}} or a {{{samp(8:30-1pm)}}}).  If the
8370 agenda integrates the Emacs diary (see [[Weekly/daily agenda]]), time
8371 specifications in diary entries are recognized as well.
8373 For agenda display, Org mode extracts the time and displays it in a
8374 standard 24 hour format as part of the prefix.  The example times in
8375 the previous paragraphs would end up in the agenda like this:
8377 #+begin_example
8378     8:30-13:00 Arthur Dent lies in front of the bulldozer
8379    12:45...... Ford Prefect arrives and takes Arthur to the pub
8380    19:00...... The Vogon reads his poem
8381    20:30-22:15 Marvin escorts the Hitchhikers to the bridge
8382 #+end_example
8384 #+cindex: time grid
8386 If the agenda is in single-day mode, or for the display of today, the
8387 timed entries are embedded in a time grid, like
8389 #+begin_example
8390     8:00...... ------------------
8391     8:30-13:00 Arthur Dent lies in front of the bulldozer
8392    10:00...... ------------------
8393    12:00...... ------------------
8394    12:45...... Ford Prefect arrives and takes Arthur to the pub
8395    14:00...... ------------------
8396    16:00...... ------------------
8397    18:00...... ------------------
8398    19:00...... The Vogon reads his poem
8399    20:00...... ------------------
8400    20:30-22:15 Marvin escorts the Hitchhikers to the bridge
8401 #+end_example
8403 #+vindex: org-agenda-use-time-grid
8404 #+vindex: org-agenda-time-grid
8406 The time grid can be turned on and off with the variable
8407 ~org-agenda-use-time-grid~, and can be configured with
8408 ~org-agenda-time-grid~.
8410 *** Sorting of agenda items
8411     :PROPERTIES:
8412     :DESCRIPTION: The order of things
8413     :END:
8414 #+cindex: sorting, of agenda items
8415 #+cindex: priorities, of agenda items
8417 Before being inserted into a view, the items are sorted.  How this is
8418 done depends on the type of view.
8420 - For the daily/weekly agenda, the items for each day are sorted.  The
8421   default order is to first collect all items containing an explicit
8422   time-of-day specification.  These entries will be shown at the
8423   beginning of the list, as a /schedule/ for the day.  After that,
8424   items remain grouped in categories, in the sequence given by
8425   ~org-agenda-files~.  Within each category, items are sorted by
8426   priority (see [[Priorities]]), which is composed of the base priority
8427   (2000 for priority {{{samp(A)}}}, 1000 for {{{samp(B)}}}, and 0 for
8428   {{{samp(C)}}}), plus additional increments for overdue scheduled or deadline items.
8430   #+vindex: org-agenda-files
8432 - For the TODO list, items remain in the order of categories, but
8433   within each category, sorting takes place according to priority (see
8434   [[Priorities]]).  The priority used for sorting derives from the
8435   priority cookie, with additions depending on how close an item is to
8436   its due or scheduled date.
8438 - For tags matches, items are not sorted at all, but just appear in
8439   the sequence in which they are found in the agenda files.
8442 #+vindex: org-agenda-sorting-strategy
8444 Sorting can be customized using the variable
8445 ~org-agenda-sorting-strategy~, and may also include criteria based on
8446 the estimated effort of an entry (see [[Effort estimates]]).
8448 ** FIXME Agenda commands
8449    :PROPERTIES:
8450    :DESCRIPTION: Remote editing of Org trees
8451    :TITLE:    Commands in the agenda buffer
8452    :END:
8453 #+cindex: commands, in agenda buffer
8455 Entries in the agenda buffer are linked back to the Org file or diary
8456 file where they originate.  You are not allowed to edit the agenda
8457 buffer itself, but commands are provided to show and jump to the
8458 original entry location, and to edit the Org files ``remotely'' from
8459 the agenda buffer.  In this way, all information is stored only once,
8460 removing the risk that your agenda and note files may diverge.
8462 Some commands can be executed with mouse clicks on agenda lines.  For
8463 the other commands, the cursor needs to be in the desired line.
8465 *** FIXME Motion2
8466 #+cindex: motion commands in agenda
8468 #+attr_texinfo: :table-type table :indic @asis
8469 - {{{kbd(n)}}}, ~org-agenda-next-line~ ::
8470   #+kindex: n
8472   Next line (same as {{{key(down)}}} and {{{kbd(C-n)}}}).
8474 - {{{kbd(p)}}}, ~org-agenda-previous-line~ ::
8475   #+kindex: p
8477   Previous line (same as {{{key(up)}}} and {{{kbd(C-p)}}}).
8479 *** View/Go to Org file
8480 #+cindex: view file commands in agenda
8482 #+attr_texinfo: :table-type table :indic @asis
8483 - {{{key(SPC)}}} or {{{key(mouse-3)}}}, ~org-agenda-show-and-scroll-up~ ::
8484   #+kindex: @key{SPC}
8485   #+kindex: mouse-3
8487   Display the original location of the item in another window.  With
8488   prefix arg, make sure that the entire entry is made visible in the
8489   outline, not only the heading.
8491 - {{{kbd(L)}}}, ~org-agenda-recenter~ ::
8492   #+kindex: L
8494   Display original location and recenter that window.
8496 - {{{key(TAB)}}} or {{{key(mouse-2)}}}, ~org-agenda-goto~ ::
8497   #+kindex: @key{TAB}
8498   #+kindex: mouse-2
8500   Go to the original location of the item in another window.
8502 - {{{key(RET)}}}, ~org-agenda-switch-to~ ::
8503   #+kindex: @key{RET}
8505   Go to the original location of the item and delete other windows.
8507 - {{{kbd(F)}}}, ~org-agenda-follow-mode~ ::
8508   #+kindex: F
8509   #+vindex: org-agenda-start-with-follow-mode
8511   Toggle Follow mode.  In Follow mode, as you move the cursor through the
8512   agenda buffer, the other window always shows the corresponding
8513   location in the Org file.  The initial setting for this mode in new
8514   agenda buffers can be set with the variable
8515   ~org-agenda-start-with-follow-mode~.
8517 - {{{kbd(C-c C-x b)}}}, ~org-agenda-tree-to-indirect-buffer~ ::
8518   #+kindex: C-c C-x b
8520   Display the entire subtree of the current item in an indirect buffer.
8521   With a numeric prefix argument N, go up to level N and then take that
8522   tree.  If N is negative, go up that many levels.  With a {{{kbd(C-u)}}}
8523   prefix, do not remove the previously used indirect buffer.
8525 - {{{kbd(C-c C-o)}}}, ~org-agenda-open-link~ ::
8526   #+kindex: C-c C-o
8528   Follow a link in the entry.  This will offer a selection of any links
8529   in the text belonging to the referenced Org node.  If there is only one
8530   link, it will be followed without a selection prompt.
8532 *** Change display
8533 #+cindex: change agenda display
8535 #+attr_texinfo: :table-type table :indic @asis
8536 - {{{kbd(A)}}} ::
8537   #+kindex: A
8538   #+cindex: display changing, in agenda
8540   Interactively select another agenda view and append it to the current
8541   view.
8543 - {{{kbd(o)}}} ::
8544   #+kindex: o
8546   Delete other windows.
8548 - {{{kbd(v d)}}} or short {{{kbd(d)}}}, ~org-agenda-day-view~ ::
8549   #+kindex: v d
8550   #+kindex: d
8551   #+vindex: org-agenda-span
8553   Switch to day view.  When switching to day view, this setting becomes
8554   the default for subsequent agenda refreshes.  A numeric prefix argument
8555   may be used to jump directly to a specific day of the year.  For
8556   example, {{{kbd(32 d)}}} jumps to February 1st.  When setting day view,
8557   a year may be encoded in the prefix argument as well.  For example,
8558   {{{kbd(200712 d)}}} will jump to January 12, 2007.  If such a year
8559   specification has only one or two digits, it will be mapped to the
8560   interval 1938-2037.
8562 - {{{kbd(v w)}}} or short {{{kbd(w)}}}, ~org-agenda-week-view~ ::
8563   #+kindex: v w
8564   #+kindex: w
8565   #+vindex: org-agenda-span
8567   Switch to week view.  When switching week view, this setting becomes
8568   the default for subsequent agenda refreshes.  A numeric prefix argument
8569   may be used to jump directly to a specific day of the ISO week.  For
8570   example {{{kbd(9 w)}}} to ISO week number 9.  When setting week view, a
8571   year may be encoded in the prefix argument as well.  For example,
8572   {{{kbd(200712 w)}}} will jump to week 12 in 2007.  If such a year
8573   specification has only one or two digits, it will be mapped to the
8574   interval 1938-2037.
8576 - {{{kbd(v m)}}}, ~org-agenda-month-view~ ::
8577   #+kindex: v m
8578   #+vindex: org-agenda-span
8580   Switch to month view.  Because month views are slow to create, they do
8581   not become the default for subsequent agenda refreshes.  A numeric
8582   prefix argument may be used to jump directly to a specific day of the
8583   month.  When setting month view, a year may be encoded in the prefix
8584   argument as well.  For example, {{{kbd(200712 m)}}} will jump to
8585   December, 2007.  If such a year specification has only one or two
8586   digits, it will be mapped to the interval 1938-2037.
8588 - {{{kbd(v y)}}}, ~org-agenda-year-view~ ::
8589   #+kindex: v y
8590   #+vindex: org-agenda-span
8592   Switch to year view.  Because year views are slow to create, they do
8593   not become the default for subsequent agenda refreshes.  A numeric
8594   prefix argument may be used to jump directly to a specific day of the
8595   year.
8597 - {{{kbdspckey(v,SPC)}}}, ~org-agenda-reset-view~ ::
8598   #+kindex: v @key{SPC}
8599   #+vindex: org-agenda-span
8601   Reset ~org-agenda-span~ to the current span.
8603 - {{{kbd(f)}}}, ~org-agenda-later~ ::
8604   #+kindex: f
8606   Go forward in time to display the following ~org-agenda-current-span~
8607   days.  For example, if the display covers a week, switch to the
8608   following week.  With prefix arg, go forward that many times
8609   ~org-agenda-current-span~ days.
8611 - {{{kbd(b)}}}, ~org-agenda-earlier~ ::
8612   #+kindex: b
8614   Go backward in time to display earlier dates.
8616 - {{{kbd(.)}}}, ~org-agenda-goto-today~ ::
8617   #+kindex: .
8619   Go to today.
8621 - {{{kbd(j)}}}, ~org-agenda-goto-date~ ::
8622   #+kindex: j
8623   
8624   Prompt for a date and go there.
8626 - {{{kbd(J)}}}, ~org-agenda-clock-goto~ ::
8627   #+kindex: J
8629    Go to the currently clocked-in task /in the agenda buffer/.
8631 - {{{kbd(D)}}}, ~org-agenda-toggle-diary~ ::
8632   #+kindex: D
8634    Toggle the inclusion of diary entries.  See [[Weekly/daily agenda]].
8636 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}}, ~org-agenda-log-mode~ ::
8637   #+kindex: v l
8638   #+kindex: l
8639   #+kindex: v L
8640   #+vindex: org-log-done
8641   #+vindex: org-agenda-log-mode-items
8643   Toggle Logbook mode.  In Logbook mode, entries that were marked DONE
8644   while logging was on (see the variable ~org-log-done~) are shown in
8645   the agenda, as are entries that have been clocked on that day.  You can
8646   configure the entry types that should be included in log mode using
8647   the variable ~org-agenda-log-mode-items~.  When called with a
8648   {{{kbd(C-u)}}} prefix, show all possible logbook entries, including
8649   state changes.  When called with two prefix args {{{kbd(C-u C-u)}}},
8650   show only logging information, nothing else.  {{{kbd(v L)}}} is
8651   equivalent to {{{kbd(C-u v l)}}}.
8653 - {{{kbd(v [)}}} or short {{{kbd([)}}}, ~org-agenda-manipulate-query-add~ ::
8654   #+kindex: v [
8655   #+kindex: [
8657   Include inactive timestamps into the current view.  Only for
8658   weekly/daily agenda and timeline views.
8660 - {{{kbd(v a)}}}, ~org-agenda-archives-mode~ ::
8661   #+kindex: v a
8663   Toggle Archives mode.  In Archives mode, trees that are marked
8664   ~ARCHIVED~ are also scanned when producing the agenda.  To exit
8665   archives mode, press {{{kbd(v a)}}} again.
8667 - {{{kbd(v A)}}}, ~org-agenda-archives-mode 'files~ ::
8669   Toggle Archives mode.  In Archives mode, trees that are marked
8670   ~ARCHIVED~ are also scanned when producing the agenda, including all
8671   archive files.  To exit archives mode, press {{{kbd(v a)}}}.
8673 - {{{kbd(v R)}}} or short {{{kbd(R)}}}, ~org-agenda-clockreport-mode~ ::
8674   #+kindex: v R
8675   #+kindex: R
8676   #+vindex: org-agenda-start-with-clockreport-mode
8677   #+vindex: org-clock-report-include-clocking-task
8679   Toggle Clockreport mode.  In Clockreport mode, the daily/weekly agenda
8680   will always show a table with the clocked times for the timespan and
8681   file scope covered by the current agenda view.  The initial setting for
8682   this mode in new agenda buffers can be set with the variable
8683   ~org-agenda-start-with-clockreport-mode~.  By using a prefix argument
8684   when toggling this mode (i.e., {{{kbd(C-u R)}}}), the clock table will
8685   not show contributions from entries that are hidden by agenda
8686   filtering.[fn:94] See also the variable
8687   ~org-clock-report-include-clocking-task~.
8689 - {{{kbd(v c)}}} ::
8690   #+kindex: v c
8691   #+vindex: org-agenda-clock-consistency-checks
8693   Show overlapping clock entries, clocking gaps, and other clocking
8694   problems in the current agenda range.  You can then visit clocking
8695   lines and fix them manually.  See the variable
8696   ~org-agenda-clock-consistency-checks~ for information on how to
8697   customize the definition of what constituted a clocking problem.  To
8698   return to normal agenda display, press {{{kbd(l)}}} to exit Logbook
8699   mode.
8701 - {{{kbd(v E)}}} or short {{{kbd(E)}}}, ~org-agenda-entry-text-mode~ ::
8702   #+kindex: v E
8703   #+kindex: E
8704   #+vindex: org-agenda-start-with-entry-text-mode
8705   #+vindex: org-agenda-entry-text-maxlines
8707   Toggle entry text mode.  In entry text mode, a number of lines from the
8708   Org outline node referenced by an agenda line will be displayed below
8709   the line.  The maximum number of lines is given by the variable
8710   ~org-agenda-entry-text-maxlines~.  Calling this command with a numeric
8711   prefix argument will temporarily modify that number to the prefix
8712   value.
8714 - {{{kbd(G)}}}, ~org-agenda-toggle-time-grid~ ::
8715   #+kindex: G
8716   #+vindex: org-agenda-use-time-grid
8717   #+vindex: org-agenda-time-grid
8719   Toggle the time grid on and off.  See also the variables
8720   ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
8722 - {{{kbd(r)}}}, ~org-agenda-redo~ ::
8723   #+kindex: r
8725   Recreate the agenda buffer, for example to reflect the changes after
8726   modification of the timestamps of items with {{{kbdkey(S-,left)}}} and
8727   {{{kbdkey(S-,right)}}}.  When the buffer is the global TODO list, a prefix
8728   argument is interpreted to create a selective list for a specific TODO
8729   keyword.
8731 - {{{kbd(g)}}}, ~org-agenda-redo~ ::
8732   #+kindex: g
8734   Same as {{{kbd(r)}}}.
8736 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}}, ~org-save-all-org-buffers~ ::
8737   #+kindex: C-x C-s
8738   #+kindex: s
8740   Save all Org buffers in the current Emacs session, and also the
8741   locations of IDs.
8743 - {{{kbd(C-c C-x C-c)}}}, ~org-agenda-columns~ ::
8744   #+kindex: C-c C-x C-c
8745   #+vindex: org-columns-default-format
8747   Invoke column view (see [[Column view]]) in the agenda buffer.  The column
8748   view format is taken from the entry at point, or (if there is no entry
8749   at point), from the first entry in the agenda view.  So whatever the
8750   format for that entry would be in the original buffer (taken from a
8751   property, from a ~#+COLUMNS~ line, or from the default variable
8752   ~org-columns-default-format~), will be used in the agenda.
8754 - {{{kbd(C-c C-x >)}}}, ~org-agenda-remove-restriction-lock~ ::
8755   #+kindex: C-c C-x >
8757   Remove the restriction lock on the agenda, if it is currently
8758   restricted to a file or subtree (see [[Agenda files]]).
8760 *** FIXME Secondary filtering and query editing
8761 #+cindex: filtering, by tag category and effort, in agenda
8762 #+cindex: tag filtering, in agenda
8763 #+cindex: category filtering, in agenda
8764 #+cindex: effort filtering, in agenda
8765 #+cindex: query editing, in agenda
8767 #+attr_texinfo: :table-type table :indic @asis
8768 - {{{kbd(<)}}}, ~org-agenda-filter-by-category~ ::
8769   #+kindex: <
8770   #+vindex: org-agenda-category-filter-preset
8772   Filter the current agenda view with respect to the category of the
8773   item at point.  Pressing {{{kbd(<)}}} another time will remove this
8774   filter.  You can add a filter preset through the option
8775   ~org-agenda-category-filter-preset~ (see below).
8777 - {{{kbd(/)}}}, ~org-agenda-filter-by-tag~ ::
8778   #+kindex: /
8779   #+vindex: org-agenda-tag-filter-preset
8781   Filter the current agenda view with respect to a tag and/or effort
8782   estimates.  The difference between this and a custom agenda command is
8783   that filtering is very fast, so that you can switch quickly between
8784   different filters without having to recreate the
8785   agenda.[fn:95]
8787   You will be prompted for a tag selection letter; {{{key(SPC)}}} will
8788   mean any tag at all.  Pressing {{{key(TAB)}}} at that prompt will offer
8789   use completion to select a tag (including any tags that do not have a
8790   selection character).  The command then hides all entries that do not
8791   contain or inherit this tag.  When called with prefix arg, remove the
8792   entries that /do/ have the tag.  A second {{{kbd(/)}}} at the prompt
8793   will turn off the filter and unhide any hidden entries.  If the first
8794   key you press is either {{{kbd(+)}}} or {{{kbd(-)}}}, the previous
8795   filter will be narrowed by requiring or forbidding the selected
8796   additional tag.  Instead of pressing {{{kbd(+)}}} or {{{kbd(-)}}} after
8797   {{{kbd(/)}}}, you can also immediately use the ~\~ command.
8799   #+vindex: org-sort-agenda-noeffort-is-high
8801   In order to filter for effort estimates, you should set up allowed
8802   efforts globally, for example:
8803   #+header: :eval no
8804   #+header: :exports code
8805   #+begin_src emacs-lisp
8806   (setq org-global-properties
8807       '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
8808   #+end_src
8810   You can then filter for an effort by first typing an operator, one of
8811   {{{kbd(<)}}}, {{{kbd(>)}}}, and {{{kbd(=)}}}, and then the one-digit
8812   index of an effort estimate in your array of allowed values, where
8813   {{{kbd(0)}}} means the 10th value.  The filter will then restrict to
8814   entries with effort smaller-or-equal, equal, or larger-or-equal than
8815   the selected value.  If the digits 0-9 are not used as fast access keys
8816   to tags, you can also simply press the index digit directly without an
8817   operator.  In this case, {{{kbd(<)}}} will be assumed.  For application
8818   of the operator, entries without a defined effort will be treated
8819   according to the value of ~org-sort-agenda-noeffort-is-high~.  To
8820   filter for tasks without effort definition, press {{{kbd(?)}}} as the
8821   operator.
8823   Org also supports automatic, context-aware tag filtering.  If the
8824   variable ~org-agenda-auto-exclude-function~ is set to a user-defined
8825   function, that function can decide which tags should be excluded from
8826   the agenda automatically.  Once this is set, the {{{kbd(/)}}} command
8827   then accepts {{{kbd(RET)}}} as a sub-option key and runs the auto
8828   exclusion logic.  For example, let's say you use a ~Net~ tag to
8829   identify tasks which need network access, an ~Errand~ tag for errands
8830   in town, and a ~Call~ tag for making phone calls.  You could
8831   auto-exclude these tags based on the availability of the Internet, and
8832   outside of business hours, with something like this:
8834   #+header: :eval no
8835   #+header: :exports code
8836   #+begin_src emacs-lisp
8837   (defun org-my-auto-exclude-function (tag)
8838     (and (cond
8839           ((string= tag "Net")
8840            (/= 0 (call-process "/sbin/ping" nil nil nil
8841                                "-c1" "-q" "-t1" "mail.gnu.org")))
8842           ((or (string= tag "Errand") (string= tag "Call"))
8843            (let ((hour (nth 2 (decode-time))))
8844              (or (< hour 8) (> hour 21)))))
8845          (concat "-" tag)))
8846   (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
8847   #+end_src
8849 - ~\~ ~org-agenda-filter-by-tag-refine~ ::
8850   #+kindex: XXX
8851   #+comment: Should be \
8852   Narrow the current agenda filter by an additional condition.  When
8853   called with prefix arg, remove the entries that /do/ have the tag, or
8854   that do match the effort criterion.  You can achieve the same effect by
8855   pressing {{{kbd(+)}}} or {{{kbd(-)}}} as the first key after the
8856   {{{kbd(/)}}} command.
8858 - {{{kbd([)}}} {{{kbd(])}}} {{{kbd({)}}} {{{kbd(})}}} in search view ::
8859   #+kindex: [
8860   #+kindex: ]
8861   #+kindex: @{
8862   #+kindex: @}
8864   Add new search words ({{{kbd([)}}} and {{{kbd(])}}}) or new regular
8865   expressions ({{{kbd({)}}} and {{{kbd(})}}}) to the query string.  The
8866   opening bracket/brace will add a positive search term prefixed by
8867   {{{samp(+)}}}, indicating that this search term /must/ occur/match in
8868   the entry.  The closing bracket/brace will add a negative search term
8869   which /must not/ occur/match in the entry for it to be selected.
8871 *** FIXME Remote editing
8872 #+cindex: remote editing, from agenda
8874 #+attr_texinfo: :table-type table :indic @asis
8875 - {{{kbd(0--9)}}} ::
8877   Digit argument.
8879 - {{{kbd(C-_)}}}, ~org-agenda-undo~ ::
8880   #+kindex: C-_
8881   #+cindex: undoing remote-editing events
8882   #+cindex: remote editing, undo
8884   Undo a change due to a remote editing command.  The change is undone
8885   both in the agenda buffer and in the remote buffer.
8887 - {{{kbd(t)}}}, ~org-agenda-todo~ ::
8888   #+kindex: t
8890   Change the TODO state of the item, both in the agenda and in the
8891   original org file.
8893 - {{{kbdkey(C-S-,right)}}}, ~org-agenda-todo-nextset~ ::
8894   #+kindex: C-S-@key{right}
8896   Switch to the next set of TODO keywords.
8898 - {{{kbdkey(C-S-,left)}}}, ~org-agenda-todo-previousset~ ::
8899   #+kindex: C-S-@key{left}
8901   Switch to the previous set of TODO keywords.
8903 - {{{kbd(C-k)}}}, ~org-agenda-kill~ ::
8904   #+kindex: C-k
8905   #+vindex: org-agenda-confirm-kill
8907   Delete the current agenda item along with the entire subtree belonging
8908   to it in the original Org file.  If the text to be deleted remotely is
8909   longer than one line, the kill needs to be confirmed by the user.  See
8910   variable ~org-agenda-confirm-kill~.
8912 - {{{kbd(C-c C-w)}}}, ~org-agenda-refile~ ::
8913   #+kindex: C-c C-w
8915   Refile the entry at point.
8917 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}}, ~org-agenda-archive-default-with-confirmation~ ::
8918   #+kindex: C-c C-x C-a
8919   #+kindex: a
8920   #+vindex: org-archive-default-command
8922   Archive the subtree corresponding to the entry at point using the
8923   default archiving command set in ~org-archive-default-command~.  When
8924   using the ~a~ key, confirmation will be required.
8926 - {{{kbd(C-c C-x a)}}}, ~org-agenda-toggle-archive-tag~ ::
8927   #+kindex: C-c C-x a
8929   Toggle the ARCHIVE tag for the current headline.
8931 - {{{kbd(C-c C-x A)}}}, ~org-agenda-archive-to-archive-sibling~ ::
8932   #+kindex: C-c C-x A
8934   Move the subtree corresponding to the current entry to its /archive
8935   sibling/.
8937 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}}, ~org-agenda-archive~ ::
8938   #+kindex: C-c C-x C-s
8939   #+kindex: $
8941   Archive the subtree corresponding to the current headline.  This means
8942   the entry will be moved to the configured archive location, most
8943   likely a different file.
8945 - {{{kbd(T)}}}, ~org-agenda-show-tags~ ::
8946   #+kindex: T
8947   #+vindex: org-agenda-show-inherited-tags
8949   Show all tags associated with the current item.  This is useful if you
8950   have turned off ~org-agenda-show-inherited-tags~, but still want to
8951   see all tags of a headline occasionally.
8953 - {{{kbd(:)}}}, ~org-agenda-set-tags~ ::
8954   #+kindex: :
8956   Set tags for the current headline.  If there is an active region in the
8957   agenda, change a tag for all headings in the region.
8959 - {{{kbd(\\\,)}}} ::
8960   #+kindex: ,
8961   Set the priority for the current item (~org-agenda-priority~).  Org
8962   mode prompts for the priority character.  If you reply with
8963   {{{key(SPC)}}}, the priority cookie is removed from the entry.
8965 - {{{kbd(P)}}}, ~org-agenda-show-priority~ ::
8966   #+kindex: P
8968   Display weighted priority of current item.
8970 - {{{kbd(+)}}} {{{kbdkey(S-,up)}}}, ~org-agenda-priority-up~ ::
8971   #+kindex: +
8973   Increase the priority of the current item.  The priority is changed in
8974   the original buffer, but the agenda is not resorted.  Use the
8975   {{{kbd(r)}}} key for this.
8977 - {{{kbd(-)}}} {{{kbdkey(S-,down)}}}, ~org-agenda-priority-down~ ::
8978   #+kindex: -
8980   Decrease the priority of the current item.
8982 - {{{kbd(z)}}} {{{kbd(C-c C-z)}}}, ~org-agenda-add-note~ ::
8983   #+kindex: z
8984   #+vindex: org-log-into-drawer
8986   Add a note to the entry.  This note will be recorded, and then filed to
8987   the same location where state change notes are put.  Depending on
8988   ~org-log-into-drawer~, this may be inside a drawer.
8990 - {{{kbd(C-c C-a)}}}, ~org-attach~ ::
8991   #+kindex: C-c C-a
8993   Dispatcher for all command related to attachments.
8995 - {{{kbd(C-c C-s)}}}, ~org-agenda-schedule~ ::
8996   #+kindex: C-c C-s
8998   Schedule this item.  With prefix arg remove the scheduling timestamp
9000 - {{{kbd(C-c C-d)}}}, ~org-agenda-deadline~ ::
9001   #+kindex: C-c C-d
9002   
9003   Set a deadline for this item.  With prefix arg remove the deadline.
9005 - {{{kbdkey(S-,right)}}}, ~org-agenda-do-date-later~ ::
9006   #+kindex: S-@key{right}
9008   Change the timestamp associated with the current line by one day into
9009   the future.  If the date is in the past, the first call to this command
9010   will move it to today.  With a numeric prefix argument, change it by
9011   that many days.  For example, {{{kbdkey(3 6 5 S-,right)}}} will change
9012   it by a year.  With a {{{kbd(C-u)}}} prefix, change the time by one
9013   hour.  If you immediately repeat the command, it will continue to
9014   change hours even without the prefix arg.  With a double 
9015   {{{kbd(C-u C-u)}}} prefix, do the same for changing minutes.  The stamp is changed
9016   in the original Org file, but the change is not directly reflected in
9017   the agenda buffer.  Use {{{kbd(r)}}} or {{{kbd(g)}}} to update the
9018   buffer.
9020 - {{{kbdkey(S-,left)}}}, ~org-agenda-do-date-earlier~ ::
9021   #+kindex: S-@key{left}
9023   Change the timestamp associated with the current line by one day
9024   into the past.
9026 - {{{kbd(>)}}}, ~org-agenda-date-prompt~ ::
9027   #+kindex: >
9029   Change the timestamp associated with the current line.  The key
9030   {{{kbd(>)}}} has been chosen, because it is the same as {{{kbd(S-.)}}}
9031   on my keyboard.
9033 - {{{kbd(I)}}}, ~org-agenda-clock-in~ ::
9034   #+kindex: I
9036   Start the clock on the current item.  If a clock is running already, it
9037   is stopped first.
9039 - {{{kbd(O)}}}, ~org-agenda-clock-out~ ::
9040   #+kindex: O
9042   Stop the previously started clock.
9044 - {{{kbd(X)}}}, ~org-agenda-clock-cancel~ ::
9045   #+kindex: X
9047   Cancel the currently running clock.
9049 - {{{kbd(J)}}}, ~org-agenda-clock-goto~ ::
9050   #+kindex: J
9052   Jump to the running clock in another window.
9054 - {{{kbd(k)}}}, ~org-agenda-capture~ ::
9055   #+kindex: k
9056   #+cindex: capturing, from agenda
9057   #+vindex: org-capture-use-agenda-date
9059   Like ~org-capture~, but use the date at point as the default date for
9060   the capture template.  See ~org-capture-use-agenda-date~ to make this
9061   the default behavior of ~org-capture~.
9063 *** Bulk remote editing selected entries
9064 #+cindex: remote editing, bulk, from agenda
9065 #+vindex: org-agenda-bulk-persistent-marks
9066 #+vindex: org-agenda-bulk-custom-functions
9068 #+attr_texinfo: :table-type table :indic @asis
9069 - {{{kbd(m)}}}, ~org-agenda-bulk-mark~ ::
9070   #+kindex: m
9072   Mark the entry at point for bulk action.  With prefix arg, mark that
9073   many successive entries.
9075 - {{{kbd(%)}}}, ~org-agenda-bulk-mark-regexp~ ::
9076   #+kindex: %
9078   Mark entries matching a regular expression for bulk action.
9080 - {{{kbd(u)}}}, ~org-agenda-bulk-unmark~ ::
9081   #+kindex: u
9083   Unmark entry for bulk action.
9085 - {{{kbd(U)}}}, ~org-agenda-bulk-remove-all-marks~ ::
9086   #+kindex: U
9088   Unmark all marked entries for bulk action.
9090 - {{{kbd(B)}}}, ~org-agenda-bulk-action~ ::
9091   #+kindex: B
9093   Bulk action: act on all marked entries in the agenda.  This will prompt
9094   for another key to select the action to be applied.  The prefix arg to
9095   {{{kbd(B)}}} will be passed through to the {{{kbd(s)}}} and
9096   {{{kbd(d)}}} commands, to bulk-remove these special timestamps.  By
9097   default, marks are removed after the bulk.  If you want them to
9098   persist, set ~org-agenda-bulk-persistent-marks~ to ~t~ or hit
9099   {{{kbd(p)}}} at the prompt.
9101   - {{{kbd(*)}}} ::  
9103     Toggle persistent marks.
9105   - {{{kbd($)}}} :: 
9107     Archive all selected entries.
9109   - {{{kbd(A)}}} :: 
9111     Archive entries by moving them to their respective archive siblings.
9113   - {{{kbd(t)}}} :: 
9115     Change TODO state.  This prompts for a single TODO keyword and changes
9116     the state of all selected entries, bypassing blocking and suppressing
9117     logging notes (but not timestamps).
9119   - {{{kbd(+)}}}  :: 
9121     Add a tag to all selected entries.
9123   - {{{kbd(-)}}}  :: 
9125     Remove a tag from all selected entries.
9127   - {{{kbd(s)}}}  :: 
9129     Schedule all items to a new date.  To shift existing schedule dates by
9130     a fixed number of days, use something starting with double plus at the
9131     prompt, for example {{{samp(++8d)}}} or {{{samp(++2w)}}}.
9133   - {{{kbd(d)}}}  :: 
9135     Set deadline to a specific date.
9137   - {{{kbd(r)}}}  :: 
9139     Prompt for a single refile target and move all entries.  The entries
9140     will no longer be in the agenda; refresh ({{{kbd(g)}}}) to bring them
9141     back.
9143   - {{{kbd(S)}}}  :: 
9145     Reschedule randomly into the coming N days.  N will be prompted for.
9146     With prefix arg ({{{kbd(C-u B S)}}}), scatter only across weekdays.
9148   - {{{kbd(f)}}}  :: 
9150     Apply a function to marked entries.[fn:96] For example, the function
9151     below sets the CATEGORY property of the entries to web.
9153     #+header: :eval no
9154     #+header: :exports code
9155     #+begin_src emacs-lisp
9156     (defun set-category ()
9157       (interactive "P")
9158       (let* ((marker (or (org-get-at-bol 'org-hd-marker)
9159                          (org-agenda-error)))
9160              (buffer (marker-buffer marker)))
9161         (with-current-buffer buffer
9162           (save-excursion
9163             (save-restriction
9164               (widen)
9165               (goto-char marker)
9166               (org-back-to-heading t)
9167               (org-set-property "CATEGORY" "web"))))))
9168     #+end_src
9170 *** Calendar commands
9171 #+cindex: calendar commands, from agenda
9173 #+attr_texinfo: :table-type table :indic @asis
9174 - {{{kbd(c)}}}, ~org-agenda-goto-calendar~ ::
9175   #+kindex: c
9177   Open the Emacs calendar and move to the date at the agenda cursor.
9179 - {{{kbd(c)}}}, ~org-calendar-goto-agenda~ ::
9180   #+kindex: c
9182   When in the calendar, compute and show the Org mode agenda for the
9183   date at the cursor.
9185 - {{{kbd(i)}}}, ~org-agenda-diary-entry~ ::
9186   #+kindex: i
9187   #+vindex: org-agenda-diary-file
9188   #+cindex: diary entries, creating from agenda
9190   Insert a new entry into the diary, using the date at the cursor and
9191   (for block entries) the date at the mark.  This will add to the Emacs
9192   diary file, in a way similar to the {{{kbd(i)}}} command in the
9193   calendar.[fn:97] The diary file will pop up in another window, where
9194   you can add the entry.
9196   If you configure ~org-agenda-diary-file~ to point to an Org mode file,
9197   Org will create entries (in Org mode syntax) in that file instead.
9198   Most entries will be stored in a date-based outline tree that will
9199   later make it easy to archive appointments from previous months/years.
9200   The tree will be built under an entry with a ~DATE_TREE~ property, or
9201   else with years as top-level entries.  Emacs will prompt you for the
9202   entry text---if you specify it, the entry will be created in
9203   ~org-agenda-diary-file~ without further interaction.  If you directly
9204   press {{{key(RET)}}} at the prompt without typing text, the target
9205   file will be shown in another window for you to finish the entry
9206   there.  See also the {{{kbd(k r)}}} command.
9208 - {{{kbd(M)}}}, ~org-agenda-phases-of-moon~ ::
9209   #+kindex: M
9211   Show the phases of the moon for the three months around current date.
9213 - {{{kbd(S)}}}, ~org-agenda-sunrise-sunset~ ::
9214   #+kindex: S
9216   Show sunrise and sunset times.  The geographical location must be set
9217   with calendar variables, see the documentation for the Emacs calendar.
9219 - {{{kbd(C)}}}, ~org-agenda-convert-date~ ::
9220   #+kindex: C
9222   Convert the date at cursor into many other cultural and historic
9223   calendars.
9225 - {{{kbd(H)}}}, ~org-agenda-holidays~ ::
9226   #+kindex: H
9228   Show holidays for three months around the cursor date.
9230 - {{{kbd(M-x org-export-icalendar-combine-agenda-files)}}} ::
9232   Export a single iCalendar file containing entries from all agenda
9233   files.  This is a globally available command, and also available in the
9234   agenda menu.
9236 *** Exporting to a file
9237 #+attr_texinfo: :table-type table :indic @asis
9238 - {{{kbd(C-x C-w)}}}, ~org-agenda-write~ ::
9239   #+kindex: C-x C-w
9240   #+cindex: exporting agenda views
9241   #+cindex: agenda views, exporting
9242   #+vindex: org-agenda-exporter-settings
9244   Write the agenda view to a file.  Depending on the extension of the
9245   selected file name, the view will be exported as HTML (extension
9246   {{{file(.html)}}} or {{{file(.htm)}}}), Postscript (extension
9247   {{{file(.ps)}}}), PDF (extension {{{file(.pdf)}}}), and plain text
9248   (any other extension).  When called with a {{{kbd(C-u)}}} prefix
9249   argument, immediately open the newly created file.  Use the variable
9250   ~org-agenda-exporter-settings~ to set options for {{{file(ps-print)}}}
9251   and for {{{file(htmlize)}}} to be used during export.
9253 *** Quit and exit
9254 #+attr_texinfo: :table-type table :indic @asis
9255 - {{{kbd(q)}}}, ~org-agenda-quit~ ::
9256   #+kindex: q
9258   Quit agenda, remove the agenda buffer.
9260 - {{{kbd(x)}}}, ~org-agenda-exit~ ::
9261   #+kindex: x
9262   #+cindex: agenda files, removing buffers
9264   Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
9265   for the compilation of the agenda.  Buffers created by the user to
9266   visit Org files will not be removed.
9268 ** Custom agenda views
9269    :PROPERTIES:
9270    :DESCRIPTION: Defining special searches and views
9271    :END:
9272 #+cindex: custom agenda views
9273 #+cindex: agenda views, custom
9275 Custom agenda commands serve two purposes: to store and quickly access
9276 frequently used TODO and tags searches, and to create special composite
9277 agenda buffers.  Custom agenda commands will be accessible through the
9278 dispatcher (see [[Agenda dispatcher]]), just like the default commands.
9280 *** Storing searches
9281     :PROPERTIES:
9282     :DESCRIPTION: Type once, use often
9283     :END:
9285 The first application of custom searches is the definition of keyboard
9286 shortcuts for frequently used searches, either creating an agenda
9287 buffer, or a sparse tree (the latter covering of course only the
9288 current buffer).
9290 #+kindex: C-c a C
9291 #+vindex: org-agenda-custom-commands
9293 Custom commands are configured in the variable
9294 ~org-agenda-custom-commands~.  You can customize this variable, for
9295 example by pressing {{{kbd(C-c a C)}}}.  You can also directly set it
9296 with Emacs Lisp in {{{file(.emacs)}}}.  The following example contains
9297 all valid search types:
9299 #+header: :eval no
9300 #+header: :exports code
9301 #+begin_src emacs-lisp
9302 (setq org-agenda-custom-commands
9303       '(("w" todo "WAITING")
9304         ("W" todo-tree "WAITING")
9305         ("u" tags "+boss-urgent")
9306         ("v" tags-todo "+boss-urgent")
9307         ("U" tags-tree "+boss-urgent")
9308         ("f" occur-tree "\\<FIXME\\>")
9309         ("h" . "HOME+Name tags searches") ; description for "h" prefix
9310         ("hl" tags "+home+Lisa")
9311         ("hp" tags "+home+Peter")
9312         ("hk" tags "+home+Kim")))
9313 #+end_src
9315 {{{noindent}}} The initial string in each entry defines the keys you
9316 have to press after the dispatcher command {{{kbd(C-c a)}}} in order
9317 to access the command.  Usually this will be just a single character,
9318 but if you have many similar commands, you can also define two-letter
9319 combinations where the first character is the same in several
9320 combinations and serves as a prefix key.[fn:98] The second parameter
9321 is the search type, followed by the string or regular expression to be
9322 used for the matching.  The example above will therefore define:
9324 #+attr_texinfo: :table-type table :indic @kbd
9325 - C-c a w ::
9327   A global search for TODO entries with {{{samp(WAITING)}}} as the TODO
9328   keyword.
9330 - C-c a W ::
9332   The same search, but only in the current buffer and displaying the
9333   results as a sparse tree.
9335 - C-c a u ::
9337   A global tags search for headlines marked {{{samp(:boss:)}}} but not
9338   {{{samp(:urgent:)}}}.
9340 - C-c a v ::
9342   The same search as {{{kbd(C-c a u)}}}, but limiting the search to
9343   headlines that are also TODO items.
9345 - C-c a U ::
9347   The same search as {{{kbd(C-c a u)}}}, but only in the current buffer and
9348   displaying the result as a sparse tree.
9350 - C-c a f ::
9352   Create a sparse tree (again: current buffer only) with all entries
9353   containing the word {{{samp(FIXME)}}}
9355 - C-c a h ::
9357   A prefix command for a HOME tags search where you have to press an
9358   additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or {{{kbd(k)}}}) to select
9359   a name (Lisa, Peter, or Kim) as additional tag to match.
9362 *** Block agenda
9363     :PROPERTIES:
9364     :DESCRIPTION: All the stuff you need in a single buffer
9365     :END:
9366 #+cindex: block agenda
9367 #+cindex: agenda, with block views
9369 Another possibility is the construction of agenda views that comprise
9370 the results of /several/ commands, each of which creates a block in
9371 the agenda buffer.  The available commands include ~agenda~ for the
9372 daily or weekly agenda (as created with {{{kbd(C-c a a)}}}), ~alltodo~
9373 for the global TODO list (as constructed with {{{kbd(C-c a t)}}}), and
9374 the matching commands discussed above: ~todo~, ~tags~, and
9375 ~tags-todo~.  Here are two examples:
9377 #+header: :eval no
9378 #+header: :exports code
9379 #+begin_src emacs-lisp
9380 (setq org-agenda-custom-commands
9381       '(("h" "Agenda and Home-related tasks"
9382          ((agenda "")
9383           (tags-todo "home")
9384           (tags "garden")))
9385         ("o" "Agenda and Office-related tasks"
9386          ((agenda "")
9387           (tags-todo "work")
9388           (tags "office")))))
9389 #+end_src
9391 {{{noindent}}} This will define {{{kbd(C-c a h)}}} to create a
9392 multi-block view for stuff you need to attend to at home.  The
9393 resulting agenda buffer will contain your agenda for the current week,
9394 all TODO items that carry the tag {{{samp(home)}}}, and also all lines
9395 tagged with {{{samp(garden)}}}.  Finally the command {{{kbd(C-c a o)}}}
9396 provides a similar view for office tasks.
9398 *** Setting options for custom commands
9399     :PROPERTIES:
9400     :DESCRIPTION: Changing the rules
9401     :END:
9402 #+cindex: options, for custom agenda views
9403 #+vindex: org-agenda-custom-commands
9405 Org mode contains a number of variables regulating agenda construction
9406 and display.  The global variables define the behavior for all agenda
9407 commands, including the custom commands.  However, if you want to
9408 change some settings just for a single custom view, you can do so.
9409 Setting options requires inserting a list of variable names and values
9410 at the right spot in ~org-agenda-custom-commands~.  For example:
9412 #+header: :eval no
9413 #+header: :exports code
9414 #+begin_src emacs-lisp
9415 (setq org-agenda-custom-commands
9416       '(("w" todo "WAITING"
9417          ((org-agenda-sorting-strategy '(priority-down))
9418           (org-agenda-prefix-format "  Mixed: ")))
9419         ("U" tags-tree "+boss-urgent"
9420          ((org-show-following-heading nil)
9421           (org-show-hierarchy-above nil)))
9422         ("N" search ""
9423          ((org-agenda-files '("~org/notes.org"))
9424           (org-agenda-text-search-extra-files nil)))))
9425 #+end_src
9427 {{{noindent}}} Now the {{{kbd(C-c a w)}}} command will sort the
9428 collected entries only by priority, and the prefix format is modified
9429 to just say {{{samp( Mixed: )}}} instead of giving the category of the
9430 entry.  The sparse tags tree of {{{kbd(C-c a U)}}} will now turn out
9431 ultra-compact, because neither the headline hierarchy above the match,
9432 nor the headline following the match will be shown.  The command
9433 {{{kbd(C-c a N)}}} will do a text search limited to only a single
9434 file.
9436 #+vindex: org-agenda-custom-commands
9438 For command sets creating a block agenda, ~org-agenda-custom-commands~
9439 has two separate spots for setting options.  You can add options that
9440 should be valid for just a single command in the set, and options that
9441 should be valid for all commands in the set.  The former are just added
9442 to the command entry; the latter must come after the list of command
9443 entries.  Going back to the block agenda example (see [[Block
9444 agenda]]), let's change the sorting strategy for the {{{kbd(C-c a
9445 h)}}} commands to ~priority-down~, but let's sort the results for
9446 GARDEN tags query in the opposite order, ~priority-up~.  This would
9447 look like this:
9449 #+header: :eval no
9450 #+header: :exports code
9451 #+begin_src emacs-lisp
9452 (setq org-agenda-custom-commands
9453       '(("h" "Agenda and Home-related tasks"
9454          ((agenda)
9455           (tags-todo "home")
9456           (tags "garden"
9457                 ((org-agenda-sorting-strategy '(priority-up)))))
9458          ((org-agenda-sorting-strategy '(priority-down))))
9459         ("o" "Agenda and Office-related tasks"
9460          ((agenda)
9461           (tags-todo "work")
9462           (tags "office")))))
9463 #+end_src
9465 As you see, the values and parentheses setting is a little complex.
9466 When in doubt, use the customize interface to set this variable---it
9467 fully supports its structure.  Just one caveat: when setting options in
9468 this interface, the /values/ are just Lisp expressions.  So if the
9469 value is a string, you need to add the double-quotes around the value
9470 yourself.
9472 #+vindex: org-agenda-custom-commands-contexts
9474 To control whether an agenda command should be accessible from a
9475 specific context, you can customize
9476 ~org-agenda-custom-commands-contexts~.  Let's say for example that you
9477 have an agenda command {{{kbd(o)}}} displaying a view that you only
9478 need when reading emails.  Then you would configure this option like
9479 this:
9481 #+header: :eval no
9482 #+header: :exports code
9483 #+begin_src emacs-lisp
9484 (setq org-agenda-custom-commands-contexts
9485       '(("o" (in-mode . "message-mode"))))
9486 #+end_src
9488 You can also tell that the command key {{{kbd(o)}}} should refer to another
9489 command key {{{kbd(r)}}}.  In that case, add this command key like this:
9491 #+header: :eval no
9492 #+header: :exports code
9493 #+begin_src emacs-lisp
9494 (setq org-agenda-custom-commands-contexts
9495       '(("o" "r" (in-mode . "message-mode"))))
9496 #+end_src
9498 See the docstring of the variable for more information.
9500 ** Exporting agenda views
9501    :PROPERTIES:
9502    :DESCRIPTION: Writing a view to a file
9503    :END:
9504 #+cindex: agenda views, exporting
9506 If you are away from your computer, it can be very useful to have a
9507 printed version of some agenda views to carry around.  Org mode can
9508 export custom agenda views as plain text, HTML, Postscript,
9509 PDF, and iCalendar files.[fn:99] If you want to
9510 do this only occasionally, use the following command:
9512 #+attr_texinfo: :table-type table :indic @asis
9513 - {{{kbd(C-x C-w)}}}, ~org-agenda-write~ ::
9515   #+cindex: exporting agenda views
9516   #+cindex: agenda views, exporting
9517   #+vindex: org-agenda-exporter-settings
9519   Write the agenda view to a file.  Depending on the extension of the
9520   selected file name, the view will be exported as HTML (extension
9521   {{{file(.html)}}} or {{{file(.htm)}}}), Postscript (extension
9522   {{{file(.ps)}}}), iCalendar (extension {{{file(.ics)}}}), or plain
9523   text (any other extension).  Use the variable
9524   ~org-agenda-exporter-settings~ to set options for {{{file(ps-print)}}}
9525   and for {{{file(htmlize)}}} to be used during export, for example:
9527   #+vindex: org-agenda-add-entry-text-maxlines
9528   #+vindex: htmlize-output-type
9529   #+vindex: ps-number-of-columns
9530   #+vindex: ps-landscape-mode
9532   #+header: :eval no
9533   #+header: :exports code
9534   #+begin_src emacs-lisp
9535   (setq org-agenda-exporter-settings
9536         '((ps-number-of-columns 2)
9537           (ps-landscape-mode t)
9538           (org-agenda-add-entry-text-maxlines 5)
9539           (htmlize-output-type 'css)))
9540   #+end_src
9543 If you need to export certain agenda views frequently, you can
9544 associate any custom agenda command with a list of output file
9545 names.[fn:100] Here is an example that first defines custom commands
9546 for the agenda and the global TODO list, together with a number of
9547 files to which to export them.  Then we define two block agenda
9548 commands and specify file names for them as well.  File names can be
9549 relative to the current working directory, or absolute.
9551 #+header: :eval no
9552 #+header: :exports code
9553 #+begin_src emacs-lisp
9554 (setq org-agenda-custom-commands
9555       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
9556         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
9557         ("h" "Agenda and Home-related tasks"
9558          ((agenda "")
9559           (tags-todo "home")
9560           (tags "garden"))
9561          nil
9562          ("~/views/home.html"))
9563         ("o" "Agenda and Office-related tasks"
9564          ((agenda)
9565           (tags-todo "work")
9566           (tags "office"))
9567          nil
9568          ("~/views/office.ps" "~/calendars/office.ics"))))
9569 #+end_src
9571 The extension of the file name determines the type of export.  If it is
9572 {{{file(.html)}}}, Org mode will use the {{{file(htmlize.el)}}}
9573 package to convert the buffer to HTML and save it to this file name.
9574 If the extension is {{{file(.ps)}}}, ~ps-print-buffer-with-faces~ is
9575 used to produce Postscript output.  If the extension is
9576 {{{file(.ics)}}}, iCalendar export is run export over all files that
9577 were used to construct the agenda, and limit the export to entries
9578 listed in the agenda.  Any other extension produces a plain ASCII file.
9580 The export files are /not/ created when you use one of those
9581 commands interactively because this might use too much overhead.
9582 Instead, there is a special command to produce /all/ specified
9583 files in one step:
9585 #+attr_texinfo: :table-type table :indic @asis
9586 - {{{kbd(C-c a e)}}}, ~org-store-agenda-views~ ::
9588   Export all agenda views that have export file names associated with
9589   them.
9592 You can use the options section of the custom agenda commands to also
9593 set options for the export commands.  For example:
9595 #+header: :eval no
9596 #+header: :exports code
9597 #+begin_src emacs-lisp
9598 (setq org-agenda-custom-commands
9599       '(("X" agenda ""
9600          ((ps-number-of-columns 2)
9601           (ps-landscape-mode t)
9602           (org-agenda-prefix-format " [ ] ")
9603           (org-agenda-with-colors nil)
9604           (org-agenda-remove-tags t))
9605          ("theagenda.ps"))))
9606 #+end_src
9608 {{{noindent}}} This command sets two options for the Postscript
9609 exporter, to make it print in two columns in landscape format---the
9610 resulting page can be cut in two and then used in a paper agenda.  The
9611 remaining settings modify the agenda prefix to omit category and
9612 scheduling information, and instead include a checkbox to check off
9613 items.  We also remove the tags to make the lines compact, and we don't
9614 want to use colors for the black-and-white printer.  Settings specified
9615 in ~org-agenda-exporter-settings~ will also apply, but the settings in
9616 ~org-agenda-custom-commands~ take precedence.
9618 {{{noindent}}} From the command line you may also use:
9620 #+begin_src sh
9621   emacs -eval (org-batch-store-agenda-views) -kill
9622 #+end_src
9624 {{{noindent}}} or, if you need to modify some parameters:[fn:101]
9626 #+begin_example
9627    emacs -eval '(org-batch-store-agenda-views                      \
9628                  org-agenda-span (quote month)                     \
9629                  org-agenda-start-day "2007-11-01"                 \
9630                  org-agenda-include-diary nil                      \
9631                  org-agenda-files (quote ("~/org/project.org")))'  \
9632          -kill
9633 #+end_example
9635 {{{noindent}}} which will create the agenda views restricted to the
9636 file {{{file(~/org/project.org)}}}, without diary entries and with a
9637 30-day extent.
9639 You can also extract agenda information in a way that allows further
9640 processing by other programs.  See [[Extracting agenda information]], for
9641 more information.
9643 ** Using column view in the agenda
9644    :PROPERTIES:
9645    :DESCRIPTION: Using column view for collected entries
9646    :ALT_TITLE: Agenda column view
9647    :END:
9648 #+cindex: column view, in agenda
9649 #+cindex: agenda, column view
9650 <<Agenda column view>>
9652 Column view (see [[Column view]]) is normally used to view and edit
9653 properties embedded in the hierarchical structure of an Org file.  It
9654 can be quite useful to use column view also from the agenda, where
9655 entries are collected by certain criteria.
9657 #+attr_texinfo: :table-type table :indic @asis
9658 - {{{kbd(C-c C-x C-c)}}}, ~org-agenda-columns~ ::
9660   Turn on column view in the agenda.
9663 To understand how to use this properly, it is important to realize that the
9664 entries in the agenda are no longer in their proper outline environment.
9665 This causes the following issues:
9667 1. Org needs to make a decision which ~COLUMNS~ format to use.  Since
9668    the entries in the agenda are collected from different files, and
9669    different files may have different ~COLUMNS~ formats, this is a
9670    non-trivial problem.  Org first checks if the variable
9671    ~org-agenda-overriding-columns-format~ is currently set, and if so,
9672    takes the format from there.  Otherwise it takes the format
9673    associated with the first item in the agenda, or, if that item does
9674    not have a specific format (defined in a property, or in its file),
9675    it uses ~org-columns-default-format~.
9677    #+vindex: org-columns-default-format
9678    #+vindex: org-overriding-columns-format
9680 2. If any of the columns has a summary type defined (see [[Column
9681    attributes]]), turning on column view in the agenda will visit all
9682    relevant agenda files and make sure that the computations of this
9683    property are up to date.  This is also true for the special
9684    ~CLOCKSUM~ property.  Org will then sum the values displayed in the
9685    agenda.  In the daily/weekly agenda, the sums will cover a single
9686    day; in all other views they cover the entire block.  It is vital to
9687    realize that the agenda may show the same entry /twice/ (for
9688    example as scheduled and as a deadline), and it may show two
9689    entries from the same hierarchy (for example a /parent/ and its
9690    /child/).  In these cases, the summation in the agenda will lead to
9691    incorrect results because some values will count double.
9693    #+cindex: property, special, CLOCKSUM
9695 3. When the column view in the agenda shows the ~CLOCKSUM~, that is
9696    always the entire clocked time for this item.  So even in the
9697    daily/weekly agenda, the clocksum listed in column view may
9698    originate from times outside the current view.  This has the
9699    advantage that you can compare these values with a column listing
9700    the planned total effort for a task---one of the major applications
9701    for column view in the agenda.  If you want information about
9702    clocked time in the displayed period use clock table mode (press
9703    {{{kbd(R)}}} in the agenda).
9705 4. When the column view in the agenda shows the ~CLOCKSUM_T~, that is
9706    always today's clocked time for this item.  So even in the weekly agenda,
9707    the clocksum listed in column view only originates from today.  This lets
9708    you compare the time you spent on a task for today, with the time already
9709    spent (via ~CLOCKSUM~) and with the planned total effort for it.
9711    #+cindex: property, special, CLOCKSUM_T
9713 * FIXME Markup for rich export
9714   :PROPERTIES:
9715   :DESCRIPTION: Prepare text for rich export
9716   :ALT_TITLE: Markup
9717   :END:
9719 When exporting Org mode documents, the exporter tries to reflect the
9720 structure of the document as accurately as possible in the backend.
9721 Since export targets like HTML, LaTeX, or DocBook allow much richer
9722 formatting, Org mode has rules on how to prepare text for rich export.
9723 This section summarizes the markup rules used in an Org mode buffer.
9725 ** Structural markup elements
9726    :PROPERTIES:
9727    :DESCRIPTION: The basic structure as seen by the exporter
9728    :END:
9730 *** Document title
9731     :PROPERTIES:
9732     :DESCRIPTION: Where the title is taken from
9733     :END:
9734 #+cindex: document title, markup rules
9736 {{{noindent}}} The title of the exported document is taken from the
9737 special line:
9739 #+cindex: #+TITLE
9740 #+begin_example
9741    ,#+TITLE: This is the title of the document
9742 #+end_example
9744 {{{noindent}}} If this line does not exist, the title is derived from
9745 the first non-empty, non-comment line in the buffer.  If no such line
9746 exists, or if you have turned off exporting of the text before the
9747 first headline (see below), the title will be the file name without
9748 extension.
9750 #+cindex: property, EXPORT_TITLE
9752 If you are exporting only a subtree by marking is as the region, the
9753 heading of the subtree will become the title of the document.  If the
9754 subtree has a property ~EXPORT_TITLE~, that will take precedence.
9756 *** Headings and sections
9757     :PROPERTIES:
9758     :DESCRIPTION: The document structure as seen by the exporter
9759     :END:
9760 #+cindex: headings and sections, markup rules
9762 #+vindex: org-export-headline-levels
9764 The outline structure of the document as described in [[Document
9765 structure]], forms the basis for defining sections of the exported
9766 document.  However, since the outline structure is also used for (for
9767 example) lists of tasks, only the first three outline levels will be
9768 used as headings.  Deeper levels will become itemized lists.  You can
9769 change the location of this switch globally by setting the variable
9770 ~org-export-headline-levels~, or on a per-file basis with the ~H~ option:
9772 #+cindex: #+OPTIONS
9773 #+begin_example
9774    ,#+OPTIONS: H:4
9775 #+end_example
9777 *** Table of contents
9778     :PROPERTIES:
9779     :DESCRIPTION: The if and where of the table of contents
9780     :END:
9781 #+cindex: table of contents, markup rules
9783 #+vindex: org-export-with-toc
9785 The table of contents is normally inserted directly before the first
9786 headline of the file.  If you would like to get it to a different
9787 location, insert the string ~[TABLE-OF-CONTENTS]~ on a line by itself
9788 at the desired location.  The depth of the table of contents is by
9789 default the same as the number of headline levels, but you can choose
9790 a smaller number, or turn off the table of contents entirely, by
9791 configuring the variable ~org-export-with-toc~, or on a per-file basis
9792 with the ~toc~ option:
9794 #+begin_example
9795    ,#+OPTIONS: toc:2          (only to two levels in TOC)
9796    ,#+OPTIONS: toc:nil        (no TOC at all)
9797 #+end_example
9799 *** Initial text
9800     :PROPERTIES:
9801     :DESCRIPTION: Text before the first heading?
9802     :TITLE:    Text before the first headline
9803     :END:
9804 #+cindex: text before first headline, markup rules
9805 #+cindex: #+TEXT
9807 Org mode normally exports the text before the first headline, and even uses
9808 the first line as the document title.  The text will be fully marked up.  If
9809 you need to include literal HTML, LaTeX, or DocBook code, use the special
9810 constructs described below in the sections for the individual exporters.
9812 #+vindex: org-export-skip-text-before-1st-heading
9814 Some people like to use the space before the first headline for setup
9815 and internal links and therefore would like to control the exported
9816 text before the first headline in a different way.  You can do so by
9817 setting the variable ~org-export-skip-text-before-1st-heading~ to ~t~.
9818 On a per-file basis, you can get the same effect with
9819 {{{samp(#+OPTIONS: skip:t)}}}.
9821 {{{noindent}}}
9823 If you still want to have some text before the first headline, use the
9824 ~#+TEXT~ construct:
9826 #+begin_example
9827    ,#+OPTIONS: skip:t
9828    ,#+TEXT: This text will go before the *first* headline.
9829    ,#+TEXT: [TABLE-OF-CONTENTS]
9830    ,#+TEXT: This goes between the table of contents and the *first* headline
9831 #+end_example
9833 *** Lists
9834     :PROPERTIES:
9835     :DESCRIPTION: Lists
9836     :END:
9837 #+cindex: lists, markup rules
9839 Plain lists as described in [[Plain lists]], are translated to the
9840 backend's syntax for such lists.  Most backends support unordered,
9841 ordered, and description lists.
9843 *** Paragraphs
9844     :PROPERTIES:
9845     :DESCRIPTION: Paragraphs
9846     :END:
9847 #+cindex: paragraphs, markup rules
9849 Paragraphs are separated by at least one empty line.  If you need to
9850 enforce a line break within a paragraph, use ~\\~ at the end
9851 of a line.
9853 To keep the line breaks in a region, but otherwise use normal
9854 formatting, you can use ~VERSE~ blocks, which can also be used to
9855 format poetry:
9857 #+cindex: #+BEGIN_VERSE
9858 #+begin_example
9859    #+BEGIN_VERSE
9860     Great clouds overhead
9861     Tiny black birds rise and fall
9862     Snow covers Emacs
9864         -- AlexSchroeder
9865    #+END_VERSE
9866 #+end_example
9868 When quoting a passage from another document, it is customary to
9869 format this as a paragraph that is indented on both the left and the
9870 right margin.  You can include quotations in Org mode documents like
9871 this:
9873 #+cindex: #+BEGIN_QUOTE
9874 #+begin_example
9875    #+BEGIN_QUOTE
9876    Everything should be made as simple as possible,
9877    but not any simpler -- Albert Einstein
9878    #+END_QUOTE
9879 #+end_example
9881 If you would like to center some text, do it like this:
9882 #+cindex: #+BEGIN_CENTER
9883 #+begin_example
9884    #+BEGIN_CENTER
9885    Everything should be made as simple as possible, \\
9886    but not any simpler
9887    #+END_CENTER
9888 #+end_example
9890 *** Footnote markup
9891     :PROPERTIES:
9892     :DESCRIPTION: Footnotes
9893     :END:
9894 #+cindex: footnotes, markup rules
9895 #+cindex: @file{footnote.el}
9897 Footnotes defined in the way described in [[Creating footnotes]], will be exported
9898 by all backends.  Org allows multiple references to the same note, and
9899 multiple footnotes side by side.
9901 *** Emphasis and monospace
9902     :PROPERTIES:
9903     :DESCRIPTION: Bold, italic, etc.
9904     :END:
9906 #+cindex: underlined text, markup rules
9907 #+cindex: bold text, markup rules
9908 #+cindex: italic text, markup rules
9909 #+cindex: verbatim text, markup rules
9910 #+cindex: code text, markup rules
9911 #+cindex: strike-through text, markup rules
9913 You can make words **bold**, //italic//, _underlined_, ~=code=~
9914 and ~~verbatim~~, and, if you must, {{{samp(+strike-through+)}}}.  Text
9915 in the code and verbatim string is not processed for Org mode specific
9916 syntax; it is exported verbatim.
9918 *** Horizontal rules
9919     :PROPERTIES:
9920     :DESCRIPTION: Make a line
9921     :END:
9922 #+cindex: horizontal rules, markup rules
9924 A line consisting of only dashes, and at least 5 of them, will be
9925 exported as a horizontal line (~<hr/>~ in HTML and ~\hrule~
9926 in LaTeX).
9928 *** Comment lines
9929     :PROPERTIES:
9930     :DESCRIPTION: What will *not* be exported
9931     :END:
9932 #+cindex: comment lines
9933 #+cindex: exporting, not
9934 #+cindex: #+BEGIN_COMMENT
9936 Lines starting with zero or more whitespace characters followed by one
9937 {{{samp(#)}}} and a whitespace are treated as comments and will never
9938 be exported.  Also entire subtrees starting with the word
9939 {{{samp(COMMENT)}}} will never be exported.  Finally, regions
9940 surrounded by {{{samp(#+BEGIN_COMMENT)}}} ...
9941 {{{samp(#+END_COMMENT)}}} will not be exported.
9943 #+attr_texinfo: :table-type table :indic @asis
9944 - {{{kbd(C-c ;)}}} ::
9945   #+kindex: C-c ;
9947   Toggle the COMMENT keyword at the beginning of an entry.
9949 ** Images and tables
9950    :PROPERTIES:
9951    :DESCRIPTION: Tables and images can be exported
9952    :END:
9954 #+cindex: tables, markup rules
9955 #+cindex: #+CAPTION
9956 #+cindex: #+LABEL
9958 Both the native Org mode tables (see [[Tables]]) and tables formatted with
9959 the {{{file(table.el)}}} package will be exported properly.  For Org
9960 mode tables, the lines before the first horizontal separator line will
9961 become table header lines.  You can use the following lines somewhere
9962 before the table to assign a caption and a label for cross references,
9963 and in the text you can refer to the object with
9964 ~\ref{tab:basic-data}~:
9966 #+begin_example
9967    #+CAPTION: This is the caption for the next table (or link)
9968    #+LABEL:   tab:basic-data
9969       | ... | ...|
9970       |-----|----|
9971 #+end_example
9973 Optionally, the caption can take the form:
9974 #+begin_example
9975    #+CAPTION: [Caption for list of figures]{Caption for table (or link).}
9976 #+end_example
9978 #+cindex: inlined images, markup rules
9980 Some backends (HTML, LaTeX, and DocBook) allow you to directly
9981 include images into the exported document.  Org does this, if a link to
9982 an image files does not have a description part, for example
9983 ~[[./img/a.jpg]]~.  If you wish to define a caption for the image and maybe
9984 a label for internal cross references, make sure that the link is on a
9985 line by itself and precede it with ~#+CAPTION~ and ~#+LABEL~ as
9986 follows:
9988 #+begin_example
9989    #+CAPTION: This is the caption for the next figure link (or table)
9990    #+LABEL:   fig:SED-HR4049
9991    [[./img/a.jpg]]
9992 #+end_example
9994 You may also define additional attributes for the figure.  As this is
9995 backend-specific, see the sections about the individual backends for
9996 more information.
9998 See [[Handling links][the discussion of image links]].
10000 ** Literal examples
10001    :PROPERTIES:
10002    :DESCRIPTION: Source code examples with special formatting
10003    :END:
10004 #+cindex: literal examples, markup rules
10005 #+cindex: code line references, markup rules
10007 You can include literal examples that should not be subjected to
10008 markup.  Such examples will be typeset in monospace, so this is well
10009 suited for source code and similar examples.
10010 #+cindex: #+BEGIN_EXAMPLE
10012 #+begin_example
10013    ,#+BEGIN_EXAMPLE
10014    Some example from a text file.
10015    ,#+END_EXAMPLE
10016 #+end_example
10018 Note that such blocks may be /indented/ in order to align nicely with
10019 indented text and in particular with plain list structure (see [[Plain
10020 lists]]).  For simplicity when using small examples, you can also start
10021 the example lines with a colon followed by a space.  There may also be
10022 additional whitespace before the colon:
10024 #+begin_example
10025    Here is an example
10026       : Some example from a text file.
10027 #+end_example
10029 #+cindex: formatting source code, markup rules
10031 If the example is source code from a programming language, or any
10032 other text that can be marked up by font-lock in Emacs, you can ask
10033 for the example to look like the fontified Emacs buffer.[fn:102] This
10034 is done with the {{{samp(src)}}} block, where you also need to specify
10035 the name of the major mode that should be used to fontify the example,
10036 see [[Easy templates]] for shortcuts to easily insert code blocks.[fn:103]
10038 #+cindex: #+BEGIN_SRC
10040 #+begin_example
10041    #+BEGIN_SRC emacs-lisp
10042      (defun org-xor (a b)
10043         "Exclusive or."
10044         (if a (not b) b))
10045    #+END_SRC
10046 #+end_example
10048 Both in ~example~ and in ~src~ snippets, you can add a ~-n~ switch to
10049 the end of the ~BEGIN~ line, to get the lines of the example numbered.
10050 If you use a ~+n~ switch, the numbering from the previous numbered
10051 snippet will be continued in the current one.  In literal examples, Org
10052 will interpret strings like {{{samp((ref:name))}}} as labels, and use
10053 them as targets for special hyperlinks like ~[[(name)]]~ (i.e., the
10054 reference name enclosed in single parenthesis).  In HTML, hovering the
10055 mouse over such a link will remote-highlight the corresponding code
10056 line, which is kind of cool.
10058 You can also add a ~-r~ switch which /removes/ the labels from the
10059 source code.[fn:104] With the ~-n~ switch, links to these references
10060 will be labeled by the line numbers from the code listing, otherwise
10061 links will use the labels with no parentheses.  Here is an example:
10063 #+begin_example
10064    #+BEGIN_SRC emacs-lisp -n -r
10065    (save-excursion                  (ref:sc)
10066       (goto-char (point-min))       (ref:jump)
10067    #+END_SRC
10068    In line [[(sc)]] we remember the current position.  [[(jump)][Line (jump)]]
10069    jumps to point-min.
10070 #+end_example
10072 #+vindex: org-coderef-label-format
10074 If the syntax for the label format conflicts with the language syntax,
10075 use a ~-l~ switch to change the format, for example
10076 {{{samp(#+BEGIN_SRC pascal -n -r -l "((%s))")}}}.  See also the
10077 variable ~org-coderef-label-format~.
10079 HTML export also allows examples to be published as text areas
10080 (see [[Text areas in HTML export]]).
10082 Because the ~#+BEGIN_...~ and ~#+END_...~ patterns need to be added so
10083 often, shortcuts are provided using the Easy Templates facility (see
10084 [[Easy templates]]).
10086 #+attr_texinfo: :table-type table :indic @asis
10087 - {{{kbd(C-c ')}}} ::
10088   #+kindex: C-c '
10090   Edit the source code example at point in its native mode.  This works
10091   by switching to a temporary buffer with the source code.  You need to
10092   exit by pressing {{{kbd(C-c ')}}} again.[fn:105] The edited version
10093   will then replace the old version in the Org buffer.  Fixed-width
10094   regions (where each line starts with a colon followed by a space) will
10095   be edited using ~artist-mode~ to allow creating ASCII drawings
10096   easily.[fn:106] Using this command in an empty line will create a new
10097   fixed-width region. 
10099 - {{{kbd(C-c l)}}} ::
10100   #+kindex: C-c l
10102   Calling ~org-store-link~ while editing a source code example in a
10103   temporary buffer created with {{{kbd(C-c ')}}} will prompt for a
10104   label.  Make sure that it is unique in the current buffer, and insert
10105   it with the proper formatting like {{{samp((ref:label))}}} at the end
10106   of the current line.  Then the label is stored as a link
10107   {{{samp((label))}}}, for retrieval with {{{kbd(C-c C-l)}}}.
10109 ** Include files
10110    :PROPERTIES:
10111    :DESCRIPTION: Include additional files into a document
10112    :END:
10113 #+cindex: include files, markup rules
10115 During export, you can include the content of another file.  For
10116 example, to include your {{{file(.emacs)}}} file, you could use:
10118 #+cindex: #+INCLUDE
10120 #+begin_example
10121    ,#+INCLUDE: "~/.emacs" src emacs-lisp
10122 #+end_example
10124 {{{noindent}}} The optional second and third parameter are the markup
10125 (e.g., {{{samp(quote)}}}, {{{samp(example)}}}, or {{{samp(src)}}}),
10126 and, if the markup is {{{samp(src)}}}, the language for formatting the
10127 contents.  The markup is optional; if it is not given, the text will be
10128 assumed to be in Org mode format and will be processed normally.  The
10129 include line will also allow additional keyword parameters ~:prefix1~
10130 and ~:prefix~ to specify prefixes for the first line and for each
10131 following line, ~:minlevel~ in order to get Org mode content demoted
10132 to a specified level, as well as any options accepted by the selected
10133 markup.  For example, to include a file as an item, use:
10135 #+begin_example
10136    ,#+INCLUDE: "~/snippets/xx" :prefix1 "   + " :prefix "     "
10137 #+end_example
10139 You can also include a portion of a file by specifying a lines range
10140 using the ~:lines~ parameter.  The line at the upper end of the range
10141 will not be included.  The start and/or the end of the range may be
10142 omitted to use the obvious defaults.
10144 #+attr_texinfo: :table-type table :indic @asis
10145 - #+INCLUDE: "~/.emacs" :lines "5-10" ::  
10147   Include lines 5 to 10, 10 excluded.
10149 - #+INCLUDE: "~/.emacs" :lines "-10"  ::  
10151   Include lines 1 to 10, 10 excluded.
10153 - #+INCLUDE: "~/.emacs" :lines "10-"  ::  
10155   Include lines from 10 to EOF.
10158 #+attr_texinfo: :table-type table :indic @asis
10159 - {{{kbd(C-c ')}}}
10160   #+kindex: C-c '
10162   Visit the include file at point.
10164 ** Index entries
10165    :PROPERTIES:
10166    :DESCRIPTION: Making an index
10167    :END:
10168 #+cindex: index entries, for publishing
10170 You can specify entries that will be used for generating an index
10171 during publishing.  This is done by lines starting with ~#+INDEX~.  An
10172 entry the contains an exclamation mark will create a sub item.  See
10173 [[Generating an index]] for more information.
10175 #+begin_example
10176    ,* Curriculum Vitae
10177    #+INDEX: CV
10178    #+INDEX: Application!CV
10179 #+end_example
10181 ** Macro replacement
10182    :PROPERTIES:
10183    :DESCRIPTION: Use macros to create complex output
10184    :END:
10185 #+cindex: macro replacement, during export
10186 #+cindex: #+MACRO
10188 You can define text snippets with a macro:
10190 #+begin_example
10191    ,#+MACRO: name   replacement text $1, $2 are arguments
10192 #+end_example
10194 {{{noindent}}} which can be referenced anywhere in the document (even in
10195 code examples) with ~{{{name(arg1,arg2)}}}~.  In addition to
10196 defined macros, ~{{{title}}}~, ~{{{author}}}~, etc.,
10197 will reference information set by the ~#+TITLE:~, ~#+AUTHOR:~, and
10198 similar lines.  Also, ~{{{date(FORMAT)}}}~ and
10199 ~{{{modification-time(FORMAT)}}}~ refer to current date time
10200 and to the modification time of the file being exported, respectively.
10201 ~FORMAT~ should be a format string understood by
10202 ~format-time-string~.
10204 Macro expansion takes place during export, and some people use it to
10205 construct complex HTML code.
10207 ** FIXME Embedded LaTeX
10208    :PROPERTIES:
10209    :DESCRIPTION: LaTeX can be freely used inside Org documents
10210    :ALT_TITLE: Embedded Latex
10211    :END:
10212 #+cindex: @TeX{} interpretation
10213 #+cindex: @LaTeX{} interpretation
10215 Plain ASCII is normally sufficient for almost all note taking.
10216 Exceptions include scientific notes, which often require mathematical
10217 symbols and the occasional formula.  LaTeX is widely used to typeset
10218 scientific documents.[fn:107] Org mode supports embedding LaTeX
10219 code into its files, because many academics are used to writing and
10220 reading LaTeX source code, and because it can be readily processed
10221 to produce pretty output for a number of export backends.
10223 *** Special symbols
10224     :PROPERTIES:
10225     :DESCRIPTION: Greek letters and other symbols
10226     :END:
10227 #+cindex: math symbols
10228 #+cindex: special symbols
10229 #+cindex: @TeX{} macros
10230 #+cindex: @LaTeX{} fragments, markup rules
10231 #+cindex: HTML entities
10232 #+cindex: @LaTeX{} entities
10234 You can use LaTeX macros to insert special symbols like
10235 ~\alpha~ to indicate the Greek letter, or ~\to~ to
10236 indicate an arrow.  Completion for these macros is available, just type
10237 ~\~ and maybe a few letters, and press {{{kbdkey(M-,TAB)}}}
10238 to see possible completions.  Unlike LaTeX code, Org mode allows
10239 these macros to be present without surrounding math delimiters, for
10240 example:
10242 #+begin_example
10243    Angles are written as Greek letters \alpha, \beta and \gamma.
10244 #+end_example
10246 #+vindex: org-entities
10248 During export, these symbols will be transformed into the native
10249 format of the exporter backend.  Strings like ~\alpha~ will be exported
10250 as ~&alpha;~ in the HTML output, and as ~$\alpha$~ in the LaTeX
10251 output.  Similarly, ~\nbsp~ will become ~&nbsp;~ in HTML and ~~~ in
10252 LaTeX.  If you need such a symbol inside a word, terminate it like
10253 this: ~\Aacute{}stor~.
10255 A large number of entities is provided, with names taken from both
10256 HTML and LaTeX; see the variable ~org-entities~ for the complete
10257 list.  ~\-~ is treated as a shy hyphen, and {{{samp(--)}}},
10258 {{{samp(---)}}}, and {{{samp(...)}}} are all converted into special
10259 commands creating hyphens of different lengths or a compact set of
10260 dots.
10262 If you would like to see entities displayed as UTF8 characters, use the
10263 following command:[fn:108]
10265 #+attr_texinfo: :table-type table :indic @asis
10266 - {{{kbd(C-c C-x XXX)}}} ::
10267   #+kindex: C-c C-x XXX
10268 # Should be \
10269   Toggle display of entities as UTF-8 characters.  This does not change
10270   the buffer content which remains plain ASCII, but it overlays the
10271   UTF-8 character for display purposes only.
10273 *** FIXME Subscripts and superscripts
10274     :PROPERTIES:
10275     :DESCRIPTION: Simple syntax for raising/lowering text
10276     :END:
10277 #+cindex: subscript
10278 #+cindex: superscript
10280 Just like in LaTeX, {{{samp(^)}}} and {{{samp(_)}}} are used to
10281 indicate super- and subscripts.  Again, these can be used without
10282 embedding them in math-mode delimiters.  To increase the readability of
10283 ASCII text, it is not necessary (but OK) to surround multi-character
10284 sub- and superscripts with curly braces.  For example
10286 #+begin_example
10287    The mass of the sun is M_sun = 1.989 x 10^30 kg.  The radius of
10288    the sun is R_{sun} = 6.96 x 10^8 m.
10289 #+end_example
10291 #+vindex: org-export-with-sub-superscripts
10293 To avoid interpretation as raised or lowered text, you can quote
10294 {{{kbd(^)}}} and {{{kbd(_)}}} with a backslash: ~\^~ and ~\_~.  If you
10295 write a text where the underscore is often used in a different
10296 context, Org's convention to always interpret these as subscripts can
10297 get in your way.  Configure the variable
10298 ~org-export-with-sub-superscripts~ to globally change this convention,
10299 or use, on a per-file basis:
10301 #+begin_example
10302    ,#+OPTIONS: ^:{}
10303 #+end_example
10305 {{{noindent}}} With this setting, ~a_b~ will not be interpreted as a
10306 subscript, but ~a_{b}~ will.
10308 #+attr_texinfo: :table-type table :indic @asis
10309 - {{{kbd(C-c C-x XXX)}}} ::
10310   #+kindex: C-c C-x XXX
10311 # Should be \
10312   In addition to showing entities as UTF-8 characters, this command will
10313   also format sub- and superscripts in a WYSIWYM way.
10315 *** LaTeX fragments
10316     :PROPERTIES:
10317     :DESCRIPTION: Complex formulas made easy
10318     :END:
10319 #+cindex: @LaTeX{} fragments
10320 #+vindex: org-format-latex-header
10322 Going beyond symbols and sub- and superscripts, a full formula
10323 language is needed.  Org mode can contain LaTeX math fragments, and
10324 it supports ways to process these for several export backends.  When
10325 exporting to LaTeX, the code is obviously left as it is.  When
10326 exporting to HTML, Org invokes the [[http://www.mathjax.org][MathJax library]] (see [[Math
10327 formatting in HTML export]]) to process and display the math.[fn:109]
10328 Finally, it can also process the mathematical expressions into images
10329 that can be displayed in a browser or in DocBook documents.[fn:110]
10331 LaTeX fragments don't need any special marking at all.  The following
10332 snippets will be identified as LaTeX source code:
10334 - Environments of any kind.[fn:111]  The only requirement is that the
10335   ~\begin~ statement appears on a new line, preceded by only whitespace.
10337 - Text within the usual LaTeX math delimiters.  To avoid conflicts
10338   with currency specifications, single ~$~ characters are
10339   only recognized as math delimiters if the enclosed text contains at
10340   most two line breaks, is directly attached to the ~$~
10341   characters with no whitespace in between, and if the closing
10342   ~$~ is followed by whitespace, punctuation or a dash.  For
10343   the other delimiters, there is no such restriction, so when in
10344   doubt, use ~\(...\)~ as inline math delimiters.
10347 {{{noindent}}} For example:
10349 #+begin_example
10350    \begin{equation}                          % arbitrary environments,
10351    x=\sqrt{b}                                % even tables, figures
10352    \end{equation}                            % etc
10354    If $a^2=b$ and \( b=2 \), then the solution must be
10355    either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
10356 #+end_example
10358 {{{noindent}}}
10359 #+vindex: org-format-latex-options
10361 If you need any of the delimiter ASCII sequences for other purposes,
10362 you can configure the option ~org-format-latex-options~ to deselect
10363 the ones you do not wish to have interpreted by the LaTeX
10364 converter.
10366 #+vindex: org-export-with-LaTeX-fragments
10368 LaTeX processing can be configured with the variable
10369 ~org-export-with-LaTeX-fragments~.  The default setting is ~t~ which
10370 means {{{file(MathJax)}}} for HTML, and no processing for DocBook,
10371 ASCII and LaTeX backends.  You can also set this variable on a
10372 per-file basis using one of these lines:
10374 #+attr_texinfo: :table-type table :indic @asis
10375 - #+OPTIONS: LaTeX:t ::          
10377   Do the right thing automatically (MathJax).
10379 - #+OPTIONS: LaTeX:dvipng ::    
10381   Force using dvipng images.
10383 - #+OPTIONS: LaTeX:nil ::        
10385   Do not process LaTeX fragments at all
10387 - #+OPTIONS: LaTeX:verbatim ::  
10389   Verbatim export, for jsMath or so.
10391 *** Previewing LaTeX fragments
10392     :PROPERTIES:
10393     :DESCRIPTION: What will this snippet look like?
10394     :END:
10395 #+cindex: @LaTeX{} fragments, preview
10397 If you have {{{file(dvipng)}}} installed, LaTeX fragments can be
10398 processed to produce preview images of the typeset expressions:
10400 #+attr_texinfo: :table-type table :indic @asis
10401 - {{{kbd(C-c C-x C-l)}}} ::
10402   #+kindex: C-c C-x C-l
10404   Produce a preview image of the LaTeX fragment at point and overlay
10405   it over the source code.  If there is no fragment at point, process all
10406   fragments in the current entry (between two headlines).  When called
10407   with a prefix argument, process the entire subtree.  When called with
10408   two prefix arguments, or when the cursor is before the first headline,
10409   process the entire buffer.
10411 - {{{kbd(C-c C-c)}}} ::
10412   #+kindex: C-c C-c
10414   Remove the overlay preview images.
10417 #+vindex: org-format-latex-options
10419 You can customize the variable ~org-format-latex-options~ to influence
10420 some aspects of the preview.  In particular, the ~:scale~ (and for HTML
10421 export, ~:html-scale~) property can be used to adjust the size of the
10422 preview images.
10424 *** CDLaTeX mode
10425     :PROPERTIES:
10426     :DESCRIPTION: Speed up entering of formulas
10427     :TITLE:    Using CDLaTeX to enter math
10428     :END:
10429 #+cindex: CD@LaTeX{}
10431 CDLaTeX mode is a minor mode that is normally used in combination
10432 with a major LaTeX mode like AUCTeX in order to speed-up
10433 insertion of environments and math templates.  Inside Org mode, you can
10434 make use of some of the features of CDLaTeX mode.  You need to
10435 install {{{file(cdlatex.el)}}} and {{{file(texmathp.el)}}} (the latter
10436 comes also with AUCTeX) from
10437 [[http://www.astro.uva.nl/~dominik/Tools/cdlatex]].  Don't use CDLaTeX
10438 mode itself under Org mode, but use the light version
10439 ~org-cdlatex-mode~ that comes as part of Org mode.  Turn it on for the
10440 current buffer with ~M-x org-cdlatex-mode~, or for all Org files with
10441 this hook:
10443 #+header: :eval no
10444 #+header: :exports code
10445 #+begin_src emacs-lisp
10446 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
10447 #+end_src
10449 When this mode is enabled, the following features are present (for more
10450 details see the documentation of CDLaTeX mode):
10452 #+attr_texinfo: :table-type table :indic @asis
10453 - {{{kbd(C-c {)}}} ::
10454   #+kindex: C-c @{
10456   Insert an environment template.
10458 - {{{key(TAB)}}} ::
10459   #+kindex: @key{TAB}
10461   Expand a template if the cursor is inside a LaTeX fragment.[fn:112]
10462   For example, {{{key(TAB)}}} will expand ~fr~ to ~\frac{}{}~ and
10463   position the cursor correctly inside the first brace.  Another
10464   {{{key(TAB)}}} will get you into the second brace.  Even outside
10465   fragments, {{{key(TAB)}}} will expand environment abbreviations at the
10466   beginning of a line.  For example, if you write {{{samp(equ)}}} at the
10467   beginning of a line and press {{{key(TAB)}}}, this abbreviation will
10468   be expanded to an ~equation~ environment.  To get a list of all
10469   abbreviations, type {{{kbd(M-x cdlatex-command-help)}}}.
10471 - {{{kbd(_)}}} {{{kbd(^)}}} ::
10472   #+kindex: _
10473   #+kindex: ^
10474   #+vindex: cdlatex-simplify-sub-super-scripts
10476   Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment will
10477   insert these characters together with a pair of braces.  If you use
10478   {{{key(TAB)}}} to move out of the braces, and if the braces surround
10479   only a single character or macro, they are removed again (depending on
10480   the variable ~cdlatex-simplify-sub-super-scripts~).
10482 - {{{kbd(`)}}} ::
10483   #+kindex: `
10485   Pressing the backquote followed by a character inserts math macros,
10486   also outside LaTeX fragments.  If you wait more than 1.5 seconds
10487   after the backquote, a help window will pop up.
10489 - {{{kbd(')}}} ::
10490   #+kindex: '
10492   Pressing the single-quote followed by another character modifies the
10493   symbol before point with an accent or a font.  If you wait more than
10494   1.5 seconds after the single-quote, a help window will pop up.
10495   Character modification will work only inside LaTeX fragments;
10496   outside the quote is normal.
10498 * FIXME Exporting
10499   :PROPERTIES:
10500   :DESCRIPTION: Sharing and publishing notes
10501   :END:
10502 #+cindex: exporting
10504 Org mode documents can be exported into a variety of other formats.
10505 For printing and sharing of notes, ASCII export produces a readable
10506 and simple version of an Org file.  HTML export allows you to publish a
10507 notes file on the web, while the XOXO format provides a solid base for
10508 exchange with a broad range of other applications.  LaTeX export
10509 lets you use Org mode and its structured editing functions to easily
10510 create LaTeX files.  DocBook export makes it possible to convert Org
10511 files to many other formats using DocBook tools.  OpenDocument Text
10512 (ODT) export allows seamless collaboration across organizational
10513 boundaries.  For project management you can create gantt and resource
10514 charts by using TaskJuggler export.  To incorporate entries with
10515 associated times like deadlines or appointments into a desktop
10516 calendar program like iCal, Org mode can also produce extracts in the
10517 iCalendar format.  Currently, Org mode only supports export, not import
10518 of these different formats.
10520 Org supports export of selected regions when ~transient-mark-mode~ is
10521 enabled (default in Emacs 23).
10523 ** Selective export
10524    :PROPERTIES:
10525    :DESCRIPTION: Using tags to select and exclude trees
10526    :END:
10527 #+cindex: export, selective by tags or TODO keyword
10528 #+vindex: org-export-select-tags
10529 #+vindex: org-export-exclude-tags
10530 #+cindex: org-export-with-tasks
10532 You may use tags to select the parts of a document that should be exported,
10533 or to exclude parts from export.  This behavior is governed by two variables:
10534 ~org-export-select-tags~ and ~org-export-exclude-tags~,
10535 respectively defaulting to ~:export:~ and ~:noexport:~.
10537 1. Org first checks if any of the /select/ tags is present in the
10538    buffer.  If yes, all trees that do not carry one of these tags will
10539    be excluded.  If a selected tree is a subtree, the heading hierarchy
10540    above it will also be selected for export, but not the text below
10541    those headings.
10543 2. If none of the select tags is found, the whole buffer will be
10544    selected for export.
10546 3. Finally, all subtrees that are marked by any of the /exclude/ tags
10547    will be removed from the export buffer.
10550 The variable ~org-export-with-tasks~ can be configured to select which
10551 kind of tasks should be included for export.  See the docstring of the
10552 variable for more information.
10554 ** FIXME Export options
10555    :PROPERTIES:
10556    :DESCRIPTION: Per-file export settings
10557    :END:
10558 #+cindex: options, for export
10559 #+cindex: completion, of option keywords
10561 The exporter recognizes special lines in the buffer which provide
10562 additional information.  These lines may be put anywhere in the file.
10563 The whole set of lines can be inserted into the buffer with 
10564 {{{kbd(C-c C-e t)}}}.  For individual lines, a good way to make sure the keyword
10565 is correct is to type {{{samp(#+)}}} and then use {{{kbdkey(M-,TAB)}}}
10566 completion (see [[Completion]]).  For a summary of other in-buffer settings
10567 not specifically related to export, see [[In-buffer settings]].  In
10568 particular, note that you can place commonly-used (export) options in
10569 a separate file which can be included using ~#+SETUPFILE~.
10571 #+attr_texinfo: :table-type table :indic @asis
10572 - {{{kbd(C-c C-e t)}}}, ~org-insert-export-options-template~ ::
10573   #+kindex: C-c C-e t
10575   Insert template with export options, see example below.
10578 #+cindex: #+TITLE
10579 #+cindex: #+AUTHOR
10580 #+cindex: #+DATE
10581 #+cindex: #+EMAIL
10582 #+cindex: #+DESCRIPTION
10583 #+cindex: #+KEYWORDS
10584 #+cindex: #+LANGUAGE
10585 #+cindex: #+TEXT
10586 #+cindex: #+OPTIONS
10587 #+cindex: #+BIND
10588 #+cindex: #+LINK_UP
10589 #+cindex: #+LINK_HOME
10590 #+cindex: #+EXPORT_SELECT_TAGS
10591 #+cindex: #+EXPORT_EXCLUDE_TAGS
10592 #+cindex: #+XSLT
10593 #+cindex: #+LaTeX_HEADER
10594 #+vindex: user-full-name
10595 #+vindex: user-mail-address
10596 #+vindex: org-export-default-language
10597 #+vindex: org-export-date-timestamp-format
10599 #+attr_texinfo: :table-type table :indic @asis
10600 - #+TITLE: ::      
10602   The title to be shown (default is the buffer name).
10604 - #+AUTHOR: ::     
10606   The author (default taken from ~user-full-name~).
10608 - #+DATE: ::       
10610   A date, an Org timestamp, or a format string for
10611   ~format-time-string~.[fn:113]
10613 - #+EMAIL: ::      
10615   His/her email address (default from ~user-mail-address~).
10617 - #+DESCRIPTION: :: 
10619   The page description, e.g., for the XHTML meta tag.
10621 - #+KEYWORDS: ::   
10623   The page keywords, e.g., for the XHTML meta tag.
10625 - #+LANGUAGE: ::   
10627   Language for HTML, e.g., en (~org-export-default-language~).
10629 - #+TEXT: ::       
10631   Some descriptive text to be inserted at the beginning.
10633 - #+TEXT: ::       
10635   Several lines may be given.
10637 - #+OPTIONS: ::    
10639   H:2 num:t toc:t \n:nil @:t ::t |:t ^:t f:t TeX:t ...
10641 - #+BIND: ::       
10643   Lisp-var lisp-val, e.g., org-export-latex-low-levels itemize.  You need
10644   to confirm using these, or configure ~org-export-allow-BIND~.
10646 - #+LINK_UP: ::    
10648   The ``up'' link of an exported page.
10650 - #+LINK_HOME: ::  
10652   The ``home'' link of an exported page.
10654 - #+LaTeX_HEADER: :: 
10656   Extra line(s) for the LaTeX header, like ~\usepackage{xyz}~.
10658 - #+EXPORT_SELECT_TAGS: ::  
10660   Tags that select a tree for export.
10662 - #+EXPORT_EXCLUDE_TAGS: :: 
10664   Tags that exclude a tree from export.
10666 - #+XSLT: ::       
10668   The XSLT stylesheet used by DocBook exporter to generate FO file.
10672 {{{noindent}}} The ~#+OPTIONS~ line is a compact form to specify
10673 export settings.[fn:114] Here you can:
10675 #+cindex: headline levels
10676 #+cindex: section-numbers
10677 #+cindex: table of contents
10678 #+cindex: line-break preservation
10679 #+cindex: quoted HTML tags
10680 #+cindex: fixed-width sections
10681 #+cindex: tables
10682 #+cindex: @TeX{}-like syntax for sub- and superscripts
10683 #+cindex: footnotes
10684 #+cindex: special strings
10685 #+cindex: emphasized text
10686 #+cindex: @TeX{} macros
10687 #+cindex: @LaTeX{} fragments
10688 #+cindex: author info, in export
10689 #+cindex: time info, in export
10690 #+vindex: org-export-plist-vars
10691 #+vindex: org-export-author-info
10692 #+vindex: org-export-creator-info
10693 #+vindex: org-export-email-info
10694 #+vindex: org-export-time-stamp-file
10696 #+attr_texinfo: :table-type table :indic @code
10697 - H: ::        
10699   Set the number of headline levels for export.
10701 - num: ::      
10703   Turn on/off section-numbers.
10705 - toc: ::      
10707   Turn on/off table of contents, or set level limit (integer).
10709 - \n: ::       
10711   Turn on/off line-break-preservation (DOES NOT WORK).
10713 - @: ::        
10715   Turn on/off quoted HTML tags.
10717 - :: ::        
10719   Turn on/off fixed-width sections.
10721 - |: ::        
10723   Turn on/off tables,
10725 - ^: ::        
10727   Turn on/off TeX-like syntax for sub- and superscripts.  If you write
10728   "^:{}", ~a_{b}~ will be interpreted, but the simple ~a_b~ will be left
10729   as it is.
10731 - : ::        
10733   Turn on/off conversion of special strings.
10735 - f: ::         
10737   Turn on/off footnotes like this: ~[1]~.
10739 - todo: ::      
10741   Turn on/off inclusion of TODO keywords into exported text.
10743 - tasks: ::     
10745   Turn on/off inclusion of tasks (TODO items), can be nil to remove all
10746   tasks, ~todo~ to remove DONE tasks, or list of keywords to keep.
10748 - pri: ::       
10750   Turn on/off priority cookies.
10752 - tags: ::     
10754   Turn on/off inclusion of tags, may also be ~not-in-toc~.
10756 - <: ::         
10758   Turn on/off inclusion of any time/date stamps like DEADLINES.
10760 - *: ::        
10762   Turn on/off emphasized text (bold, italic, underlined).
10764 - TeX: ::      
10766   Turn on/off simple TeX macros in plain text.
10768 - LaTeX: ::     
10770   Configure export of LaTeX fragments.  Default ~auto~.
10772 - skip: ::      
10774   Turn on/off skipping the text before the first heading.
10776 - author: ::    
10778   Turn on/off inclusion of author name/email into exported file.
10780 - email: ::     
10782   Turn on/off inclusion of author email into exported file.
10784 - creator: ::  
10786   Turn on/off inclusion of creator info into exported file.
10788 - timestamp: :: 
10790   Turn on/off inclusion creation time into exported file.
10792 - d: ::        
10794   Turn on/off inclusion of drawers, or list drawers to include.
10797 {{{noindent}}} These options take effect in both the HTML and LaTeX
10798 export, except for ~TeX~ and ~LaTeX~ options, which are respectively
10799 ~t~ and ~nil~ for the LaTeX export.
10801 The default values for these and many other options are given by a set
10802 of variables.  For a list of such variables, the corresponding OPTIONS
10803 keys and also the publishing keys (see [[Project alist]]), see the
10804 constant ~org-export-plist-vars~.
10806 When exporting only a single subtree by selecting it with
10807 {{{kbd(C-c @)}}} before calling an export command, the subtree can
10808 overrule some of the file's export settings with properties
10809 ~EXPORT_FILE_NAME~, ~EXPORT_TITLE~, ~EXPORT_TEXT~, ~EXPORT_AUTHOR~,
10810 ~EXPORT_DATE~, and ~EXPORT_OPTIONS~.
10812 ** The export dispatcher
10813    :PROPERTIES:
10814    :DESCRIPTION: How to access exporter commands
10815    :END:
10816 #+cindex: dispatcher, for export commands
10818 All export commands can be reached using the export dispatcher, which
10819 is a prefix key that prompts for an additional key specifying the
10820 command.  Normally the entire file is exported, but if there is an
10821 active region that contains one outline tree, the first heading is
10822 used as document title and the subtrees are exported.
10824 #+attr_texinfo: :table-type table :indic @asis
10825 - {{{kbd(C-c C-e)}}}, ~org-export~ ::
10826   #+kindex: C-c C-e
10827   #+vindex: org-export-run-in-background
10829   Dispatcher for export and publishing commands.  Displays a help-window
10830   listing the additional key(s) needed to launch an export or publishing
10831   command.  The prefix arg is passed through to the exporter.  A double
10832   prefix {{{kbd(C-u C-u)}}} causes most commands to be executed in the
10833   background, in a separate Emacs process.[fn:115]
10835 - {{{kbd(C-c C-e v)}}}, ~org-export-visible~ ::
10836   #+kindex: C-c C-e v
10838   Like {{{kbd(C-c C-e)}}}, but only export the text that is currently visible
10839   (i.e., not hidden by outline visibility).
10841 - {{{kbd(C-u C-u C-c C-e)}}}, ~org-export~ ::
10842   #+kindex: C-u C-u C-c C-e
10843   #+vindex: org-export-run-in-background
10845   Call the exporter, but reverse the setting of
10846   ~org-export-run-in-background~, i.e., request background processing if
10847   not set, or force processing in the current Emacs process if set.
10849 ** ASCII/Latin-1/UTF-8 export
10850    :PROPERTIES:
10851    :DESCRIPTION: Exporting to flat files with encoding
10852    :END:
10853 #+cindex: ASCII export
10854 #+cindex: Latin-1 export
10855 #+cindex: UTF-8 export
10857 ASCII export produces a simple and very readable version of an Org
10858 mode file, containing only plain ASCII.  Latin-1 and UTF-8 export
10859 augment the file with special characters and symbols available in
10860 these encodings.
10862 #+cindex: region, active
10863 #+cindex: active region
10864 #+cindex: transient-mark-mode
10866 #+attr_texinfo: :table-type table :indic @asis
10867 - {{{kbd(C-c C-e a)}}}, ~org-export-as-ascii~ ::
10868   #+kindex: C-c C-e a
10869   #+cindex: property, EXPORT_FILE_NAME
10871   Export as an ASCII file.  For an Org file, {{{file(myfile.org)}}}, the
10872   ASCII file will be {{{file(myfile.txt)}}}.  The file will be
10873   overwritten without warning.  If there is an active region, only the
10874   region will be exported.[fn:116] If the selected region is a single
10875   tree, the tree head will become the document title.[fn:117] If the
10876   tree head entry has or inherits an ~EXPORT_FILE_NAME~ property, that
10877   name will be used for the export.
10879 - {{{kbd(C-c C-e A)}}}, ~org-export-as-ascii-to-buffer~ ::
10880   #+kindex: C-c C-e A
10882   Export to a temporary buffer.  Do not create a file.
10884 - {{{kbd(C-c C-e n)}}}, ~org-export-as-latin1~ ::
10885   #+kindex: C-c C-e n
10887   Like {{{kbd(C-c C-e a)}}}, but use Latin-1 encoding.
10889 - {{{kbd(C-c C-e N)}}}, ~org-export-as-latin1-to-buffer~ ::
10890   #+kindex: C-c C-e N
10892   Like {{{kbd(C-c C-e A)}}}, but use Latin-1 encoding.
10894 - {{{kbd(C-c C-e u)}}}, ~org-export-as-utf8~ ::
10895   #+kindex: C-c C-e u
10897   Like {{{kbd(C-c C-e a)}}}, but use UTF-8 encoding.
10899 - {{{kbd(C-c C-e U)}}}, ~org-export-as-utf8-to-buffer~ ::
10900   #+kindex: C-c C-e U
10902   Like {{{kbd(C-c C-e A)}}}, but use UTF-8 encoding.
10905 - {{{kbd(C-c C-e v a/n/u)}}} ::
10906   #+kindex: C-c C-e v a
10907   #+kindex: C-c C-e v n
10908   #+kindex: C-c C-e v u
10910   Export only the visible part of the document.
10913 #+cindex: headline levels, for exporting
10915 In the exported version, the first 3 outline levels will become
10916 headlines, defining a general document structure.  Additional levels
10917 will be exported as itemized lists.  If you want that transition to
10918 occur at a different level, specify it with a prefix argument, e.g.:
10920 #+begin_example
10921    C-1 C-c C-e a
10922 #+end_example
10924 {{{noindent}}} This setting creates only top level headlines and
10925 exports the rest as items.  When headlines are converted to items, the
10926 indentation of the text following the headline is changed to fit
10927 nicely under the item.  This is done with the assumption that the first
10928 body line indicates the base indentation of the body text.  Any
10929 indentation larger than this is adjusted to preserve the layout
10930 relative to the first line.  Should there be lines with less
10931 indentation than the first one, these are left alone.
10933 #+vindex: org-export-ascii-links-to-notes
10935 Links will be exported in a footnote-like style, with the descriptive
10936 part in the text and the link in a note before the next heading.  See
10937 the variable ~org-export-ascii-links-to-notes~ for details and other
10938 options.
10940 ** HTML export
10941    :PROPERTIES:
10942    :DESCRIPTION: Exporting to HTML
10943    :END:
10944 #+cindex: HTML export
10945 #+cindex: Gruber, John
10947 Org mode contains a HTML (XHTML 1.0 strict) exporter with extensive
10948 HTML formatting, in ways similar to John Gruber's /markdown/ language,
10949 but with additional support for tables.
10951 *** HTML export commands
10952     :PROPERTIES:
10953     :DESCRIPTION: How to invoke HTML export
10954     :END:
10955 #+cindex: region, active
10956 #+cindex: active region
10957 #+cindex: transient-mark-mode
10959 #+attr_texinfo: :table-type table :indic @asis
10960 - {{{kbd(C-c C-e h)}}}, ~org-export-as-html~ ::
10961   #+kindex: C-c C-e h
10962   #+cindex: property, EXPORT_FILE_NAME
10964   Export as an HTML file.  For an Org file {{{file(myfile.org)}}}, the
10965   HTML file will be {{{file(myfile.html)}}}.  The file will be
10966   overwritten without warning.  If there is an active region, only the
10967   active region will be exported.[fn:118] If the selected region is a
10968   single tree, the tree head will become the document title.[fn:119] If
10969   the tree head entry has, or inherits, an ~EXPORT_FILE_NAME~ property,
10970   that name will be used for the export.
10972 - {{{kbd(C-c C-e b)}}}, ~org-export-as-html-and-open~ ::
10973   #+kindex: C-c C-e b
10975   Export as a HTML file and immediately open it with a browser.
10977 - {{{kbd(C-c C-e H)}}}, ~org-export-as-html-to-buffer~ ::
10978   #+kindex: C-c C-e H
10980   Export to a temporary buffer.  Do not create a file.
10982 - {{{kbd(C-c C-e R)}}}, ~org-export-region-as-html~ ::
10983   #+kindex: C-c C-e R
10985   Export the active region to a temporary buffer.  With a prefix
10986   argument, do not produce the file header and footer, but just the
10987   plain HTML section for the region.  This is good for cut-and-paste
10988   operations.
10990 - {{{kbd(C-c C-e v h/b/H/R)}}} ::
10991   #+kindex: C-c C-e v h
10992   #+kindex: C-c C-e v b
10993   #+kindex: C-c C-e v H
10994   #+kindex: C-c C-e v R
10996   Export only the visible part of the document.
10998 - {{{kbd(M-x org-export-region-as-html)}}} ::
11000   Convert the region to HTML under the assumption that it was in Org
11001   mode syntax before.  This is a global command that can be invoked in
11002   any buffer.
11004 - {{{kbd(M-x org-replace-region-by-HTML)}}} ::
11006   Replace the active region (assumed to be in Org mode syntax) by HTML
11007   code.
11010 #+cindex: headline levels, for exporting
11012 In the exported version, the first three outline levels will become
11013 headlines, defining a general document structure.  Additional levels
11014 will be exported as itemized lists.  If you want that transition to
11015 occur at a different level, specify it with a numeric prefix argument,
11016 e.g.:
11018 #+begin_example
11019    C-2 C-c C-e b
11020 #+end_example
11022 {{{noindent}}} This setting creates two levels of headings and exports
11023 the rest as list items.
11025 *** HTML preamble and postamble
11026     :PROPERTIES:
11027     :DESCRIPTION: How to insert a preamble and postamble
11028     :END:
11029 #+vindex: org-export-html-preamble
11030 #+vindex: org-export-html-postamble
11031 #+vindex: org-export-html-preamble-format
11032 #+vindex: org-export-html-postamble-format
11033 #+vindex: org-export-html-validation-link
11034 #+vindex: org-export-author-info
11035 #+vindex: org-export-email-info
11036 #+vindex: org-export-creator-info
11037 #+vindex: org-export-time-stamp-file
11039 The HTML exporter lets you define a preamble and a postamble.
11041 The default value for ~org-export-html-preamble~ is ~t~, which means
11042 that the preamble is inserted depending on the relevant format string
11043 in ~org-export-html-preamble-format~.
11045 Setting ~org-export-html-preamble~ to a string will override the default
11046 format string.  Setting it to a function, will insert the output of the
11047 function, which must be a string; such a function takes no argument but you
11048 can check against the value of ~opt-plist~, which contains the list of
11049 publishing properties for the current file.  Setting to ~nil~ will not
11050 insert any preamble.
11052 The default value for ~org-export-html-postamble~ is
11053 {{{samp('auto)}}}, which means that the HTML exporter will look for
11054 the value of ~org-export-author-info~, ~org-export-email-info~,
11055 ~org-export-creator-info~ and ~org-export-time-stamp-file~,
11056 ~org-export-html-validation-link~ and build the postamble from these
11057 values.  Setting ~org-export-html-postamble~ to ~t~ will insert the
11058 postamble from the relevant format string found in
11059 ~org-export-html-postamble-format~.  Setting it to ~nil~ will not
11060 insert any postamble.
11062 *** Quoting HTML tags
11063     :PROPERTIES:
11064     :DESCRIPTION: Using direct HTML in Org mode
11065     :END:
11067 Plain ~<~ and {{{samp(>)}}} are always transformed to
11068 {{{samp(&lt;)}}} and {{{samp(&gt;)}}} in HTML export.  If you want to
11069 include simple HTML tags which should be interpreted as such, mark
11070 them with {{{samp(@)}}} as in {{{samp(@<b>bold text@</b>)}}}.  Note
11071 that this really works only for simple tags.  For more extensive HTML
11072 that should be copied verbatim to the exported file use either ~#+HTML~:
11074 #+cindex: #+HTML
11075 #+cindex: #+BEGIN_HTML
11076 #+begin_example
11077    ,#+HTML: Literal HTML code for export
11078 #+end_example
11080 {{{noindent}}} or an HTML block:
11081 #+cindex: #+BEGIN_HTML
11083 #+begin_example
11084    #+BEGIN_HTML
11085    All lines between these markers are exported literally
11086    #+END_HTML
11087 #+end_example
11089 *** Links in HTML export
11090     :PROPERTIES:
11091     :DESCRIPTION: How links will be interpreted and formatted
11092     :END:
11093 #+cindex: links, in HTML export
11094 #+cindex: internal links, in HTML export
11095 #+cindex: external links, in HTML export
11097 Internal links (see [[Internal links]]) will continue to work in HTML.
11098 This includes automatic links created by radio targets (see [[Radio
11099 targets]]).  Links to external files will still work if the target file
11100 is on the same /relative/ path as the published Org file.  Links to
11101 other {{{file(.org)}}} files will be translated into HTML links under
11102 the assumption that a HTML version also exists of the linked file, at
11103 the same relative path.  ~id:~ links can then be used to jump
11104 to specific entries across files.  For information related to linking
11105 files while publishing them to a publishing directory see [[Publishing
11106 links]].
11108 If you want to specify attributes for links, you can do so using a
11109 special ~#+ATTR_HTML~ line to define attributes that will be added to
11110 the ~<a>~ or ~<img>~ tags.  Here is an example that sets ~title~ and
11111 ~style~ attributes for a link:
11113 #+cindex: #+ATTR_HTML
11114 #+begin_example
11115    ,#+ATTR_HTML: title="The Org mode homepage" style="color:red;"
11116    ,[[http://orgmode.org]]
11117 #+end_example
11119 *** Tables in HTML export
11120     :PROPERTIES:
11121     :DESCRIPTION: How to modify the formatting of tables
11122     :END:
11123 #+cindex: tables, in HTML
11124 #+vindex: org-export-html-table-tag
11126 Org mode tables are exported to HTML using the table tag defined in
11127 ~org-export-html-table-tag~.  The default setting makes tables without
11128 cell borders and frame.  If you would like to change this for
11129 individual tables, place something like the following before the
11130 table:
11132 #+cindex: #+CAPTION
11133 #+cindex: #+ATTR_HTML
11134 #+begin_example
11135    ,#+CAPTION: This is a table with lines around and between cells
11136    ,#+ATTR_HTML: border="2" rules="all" frame="border"
11137 #+end_example
11139 *** Images in HTML export
11140     :PROPERTIES:
11141     :DESCRIPTION: How to insert figures into HTML output
11142     :END:
11143 #+cindex: images, inline in HTML
11144 #+cindex: inlining images in HTML
11145 #+vindex: org-export-html-inline-images
11147 HTML export can inline images given as links in the Org file, and it
11148 can make an image the clickable part of a link.  By default, images are
11149 inlined if a link does not have a description.[fn:120] So
11150 ~[[file:myimg.jpg]]~ will be inlined, while ~[[file:myimg.jpg][the
11151 image]]~ will just produce a link {{{samp(the image)}}} that points to
11152 the image.  If the description part itself is a ~file:~ link or
11153 a ~http:~ URL pointing to an image, this image will be inlined and
11154 activated so that clicking on the image will activate the link.  For
11155 example, to include a thumbnail that will link to a high resolution
11156 version of the image, you could use:
11158 #+begin_example
11159    [[file:highres.jpg][file:thumb.jpg]]
11160 #+end_example
11162 If you need to add attributes to an inlined image, use a ~#+ATTR_HTML~.
11163 In the example below we specify the ~alt~ and ~title~ attributes to
11164 support text viewers and accessibility, and align it to the right.
11166 #+cindex: #+CAPTION
11167 #+cindex: #+ATTR_HTML
11168 #+begin_example
11169    ,#+CAPTION: A black cat stalking a spider
11170    ,#+ATTR_HTML: alt="cat/spider image" title="Action!" align="right"
11171    [[./img/a.jpg]]
11172 #+end_example
11174 {{{noindent}}} You could use ~http~ addresses just as well.
11176 *** Math formatting in HTML export
11177     :PROPERTIES:
11178     :DESCRIPTION: Beautiful math also on the web
11179     :END:
11180 #+cindex: MathJax
11181 #+cindex: dvipng
11183 LaTeX math snippets (see [[LaTeX fragments]]) can be displayed in two
11184 different ways on HTML pages.  The default is to use the [[http://www.mathjax.org][MathJax system]]
11185 which should work out of the box with Org mode installation because
11186 ~http://orgmode.org~ serves {{{file(MathJax)}}} for Org mode users for
11187 small applications and for testing purposes.[fn:121] To configure
11188 {{{file(MathJax)}}}, use the variable
11189 ~org-export-html-mathjax-options~ or insert something like the
11190 following into the buffer:
11192 #+begin_example
11193    ,#+MATHJAX: align:"left" mathml:t path:"/MathJax/MathJax.js"
11194 #+end_example
11196 {{{noindent}}} See the docstring of the variable
11197 ~org-export-html-mathjax-options~ for the meaning of the parameters in
11198 this line.
11200 If you prefer, you can also request that LaTeX fragments are
11201 processed into small images that will be inserted into the browser
11202 page.  Before the availability of MathJax, this was the default method
11203 for Org files.  This method requires that the {{{file(dvipng)}}}
11204 program is available on your system.  You can still get this processing
11205 with the following option:
11207 #+begin_example
11208    ,#+OPTIONS: LaTeX:dvipng
11209 #+end_example
11211 *** Text areas in HTML export
11212     :PROPERTIES:
11213     :DESCRIPTION: An alternate way to show an example
11214     :END:
11215 #+cindex: text areas, in HTML
11217 An alternative way to publish literal code examples in HTML is to use
11218 text areas, where the example can even be edited before pasting it
11219 into an application.  It is triggered by a ~-t~ switch at an ~example~
11220 or ~src~ block.  Using this switch disables any options for syntax and
11221 label highlighting, and line numbering, which may be present.  You may
11222 also use ~-h~ and ~-w~ switches to specify the height and width of the
11223 text area, which default to the number of lines in the example, and
11224 80, respectively.  For example
11226 #+begin_example
11227    ,#+BEGIN_EXAMPLE -t -w 40
11228      (defun org-xor (a b)
11229         "Exclusive or."
11230         (if a (not b) b))
11231    ,#+END_EXAMPLE
11232 #+end_example
11234 *** CSS support
11235     :PROPERTIES:
11236     :DESCRIPTION: Changing the appearance of the output
11237     :END:
11238 #+cindex: CSS, for HTML export
11239 #+cindex: HTML export, CSS
11240 #+vindex: org-export-html-todo-kwd-class-prefix
11241 #+vindex: org-export-html-tag-class-prefix
11243 You can also give style information for the exported file.  The HTML
11244 exporter assigns the following special CSS classes to appropriate
11245 parts of the document---your style specifications may change these, in
11246 addition to any of the standard classes like for headlines, tables,
11247 etc.[fn:122]
11249 #+attr_texinfo: :table-type table :indic @code
11250 - p.author ::           author information, including email
11251 - p.date ::             publishing date
11252 - p.creator ::           creator info, about org mode version
11253 - .title ::             document title
11254 - .todo ::              TODO keywords, all not-done states
11255 - .done ::              the DONE keywords, all states that count as done
11256 - .WAITING ::           each TODO keyword also uses a class named after itself
11257 - .timestamp ::         timestamp
11258 - .timestamp-kwd ::     keyword associated with a timestamp, like SCHEDULED
11259 - .timestamp-wrapper ::  span around keyword plus timestamp
11260 - .tag ::               tag in a headline
11261 - ._HOME ::             each tag uses itself as a class, "@" replaced by "_"
11262 - .target ::            target for links
11263 - .linenr ::            the line number in a code example
11264 - .code-highlighted ::  for highlighting referenced code lines
11265 - div.outline-N ::      div for outline level N (headline plus text))
11266 - div.outline-text-N :: extra div for text at outline level N
11267 - .section-number-N ::  section number in headlines, different for each level
11268 - div.figure ::         how to format an inlined image
11269 - pre.src ::            formatted source code
11270 - pre.example ::         normal example
11271 - p.verse ::            verse paragraph
11272 - div.footnotes ::      footnote section headline
11273 - p.footnote ::         footnote definition paragraph, containing a footnote
11274 - .footref ::           a footnote reference number (always a <sup>)
11275 - .footnum ::           footnote number in footnote definition (always <sup>)
11278 #+vindex: org-export-html-style-default
11279 #+vindex: org-export-html-style-include-default
11280 #+vindex: org-export-html-style
11281 #+vindex: org-export-html-extra
11282 #+vindex: org-export-html-style-default
11284 Each exported file contains a compact default style that defines these
11285 classes in a basic way.[fn:123]  You may overwrite these
11286 settings, or add to them by using the variables ~org-export-html-style~
11287 (for Org-wide settings) and ~org-export-html-style-extra~ (for more
11288 fine-grained settings, like file-local settings).  To set the latter variable
11289 individually for each file, you can use a ~#+STYLE:~ line:
11291 #+cindex: #+STYLE
11292 #+begin_example
11293    ,#+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
11294 #+end_example
11296 {{{noindent}}} For longer style definitions, you can use several such
11297 lines.  You could also directly write a ~<style>~ ~</style>~ section in
11298 this way, without referring to an external file.
11300 In order to add styles to a subtree, use the ~:HTML_CONTAINER_CLASS:~
11301 property to assign a class to the tree.  In order to specify CSS styles
11302 for a particular headline, you can use the id specified in a
11303 ~:CUSTOM_ID:~ property.
11305 #  FIXME: More about header and footer styles
11306 #  FIXME: Talk about links and targets.
11308 *** JavaScript support
11309     :PROPERTIES:
11310     :DESCRIPTION: Info and folding in a web browser
11311     :END:
11312 #+cindex: Rose, Sebastian
11314 Sebastian Rose has written a JavaScript program especially designed to
11315 enhance the web viewing experience of HTML files created with Org.  This
11316 program allows you to view large files in two different ways.  The first one
11317 is an /Info/-like mode where each section is displayed separately and
11318 navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}} keys (and some other keys
11319 as well, press {{{kbd(?)}}} for an overview of the available keys).  The second
11320 view type is a /folding/ view much like Org provides inside Emacs.  The
11321 script is available at [[http://orgmode.org/org-info.js]] and you can find
11322 the documentation for it at [[http://orgmode.org/worg/code/org-info-js/]].
11323 We host the script at our site, but if you use it a lot, you might
11324 not want to be dependent on ~orgmode.org~ and prefer to install a local
11325 copy on your own web server.
11327 To use the script, you need to make sure that the
11328 {{{file(org-jsinfo.el)}}} module gets loaded.  It should be loaded by
11329 default, but you can try {{{ksksksk(M-x customize-variable,RET,org-modules,RET)}}} 
11330 to convince yourself that this is indeed the case.  All it then takes to make use of the program
11331 is adding a single line to the Org file:
11333 #+cindex: #+INFOJS_OPT
11334 #+begin_example
11335    ,#+INFOJS_OPT: view:info toc:nil
11336 #+end_example
11338 {{{noindent}}} If this line is found, the HTML header will
11339 automatically contain the code needed to invoke the script.  Using the
11340 line above, you can set the following viewing options:
11342 #+attr_texinfo: :table-type table :indic @code
11343 - path: ::   
11345   The path to the script.  The default is to grab the script from
11346   [[http://orgmode.org/org-info.js]], but you might want to have
11347   a local copy and use a path like {{{samp(../scripts/org-info.js)}}}.
11349 - view: ::   
11351   Initial view when the website is first shown.  Possible values are:
11352   
11353   - info ::     Info-like interface with one section per page.
11354   - overview :: Folding interface, initially showing only top-level.
11355   - content ::  Folding interface, starting with all headlines visible.
11356   - showall ::  Folding interface, all headlines and text visible.
11358 - sdepth: :: 
11360   Maximum headline level that will still become an independent section
11361   for info and folding modes.  The default is taken from
11362   ~org-export-headline-levels~ (= the ~H~ switch in ~#+OPTIONS~).  If
11363   this is smaller than in ~org-export-headline-levels~, each
11364   info/folding section can still contain child headlines.
11366 - toc: ::    
11368   Should the table of contents /initially/ be visible? Even when ~nil~,
11369   you can always get to the "toc" with {{{kbd(i)}}}.
11371 - tdepth: :: 
11373   The depth of the table of contents.  The defaults are taken from the
11374   variables ~org-export-headline-levels~ and ~org-export-with-toc~.
11376 - ftoc: ::   
11378   Does the CSS of the page specify a fixed position for the "toc"? If
11379   yes, the toc will never be displayed as a section.
11381 - ltoc: ::   
11383   Should there be short contents (children) in each section? Make this
11384   ~above~ if the section should be above initial text.
11386 - mouse: ::  
11388   Headings are highlighted when the mouse is over them.  Should be
11389   {{{samp(underline)}}} (default) or a background color like
11390   {{{samp(#cccccc)}}}.
11392 - buttons: :: 
11394   Should view-toggle buttons be everywhere? When ~nil~ (the default),
11395   only one such button will be present.
11398 #+vindex: org-infojs-options
11399 #+vindex: org-export-html-use-infojs
11401 {{{noindent}}} You can choose default values for these options by
11402 customizing the variable ~org-infojs-options~.  If you always want to
11403 apply the script to your pages, configure the variable
11404 ~org-export-html-use-infojs~.
11406 ** LaTeX and PDF export
11407    :PROPERTIES:
11408    :DESCRIPTION: Exporting to LaTeX and processing to PDF
11409    :END:
11410 #+cindex: @LaTeX{} export
11411 #+cindex: PDF export
11412 #+cindex: Guerry, Bastien
11414 Org mode contains a LaTeX exporter written by Bastien Guerry.  With
11415 further processing, this backend is also used to produce PDF
11416 output.[fn:124] Since the LaTeX output uses {{{file(hyperref)}}} to
11417 implement links and cross references, the PDF output file will be
11418 fully linked.  Beware of the fact that your ~org~ file has to be
11419 properly structured in order to be correctly exported: respect the
11420 hierarchy of sections.
11422 *** LaTeX/PDF export commands
11423     :PROPERTIES:
11424     :DESCRIPTION: Invoking export to LaTeX/PDF
11425     :END:
11426 #+cindex: region, active
11427 #+cindex: active region
11428 #+cindex: transient-mark-mode
11430 #+attr_texinfo: :table-type table :indic @asis
11431 - {{{kbd(C-c C-e l)}}}, ~org-export-as-latex~ ::
11432   #+kindex: C-c C-e l
11433   #+cindex: property EXPORT_FILE_NAME
11435   Export as a LaTeX file.  For an Org file {{{file(myfile.org)}}}, the
11436   LaTeX file will be {{{file(myfile.tex)}}}.  The file will be
11437   overwritten without warning.  If there is an active region, only the
11438   active region will be exported.[fn:125] If the selected region is a
11439   single tree, the tree head will become the document title.[fn:126] If
11440   the tree head entry has or inherits an ~EXPORT_FILE_NAME~ property,
11441   that name will be used for the export.
11443 - {{{kbd(C-c C-e L)}}}, ~org-export-as-latex-to-buffer~ ::
11444   #+kindex: C-c C-e L
11446   Export to a temporary buffer.  Do not create a file.
11448 - {{{kbd(C-c C-e v l/L)}}} ::
11450   Export only the visible part of the document.
11452 - {{{kbd(M-x org-export-region-as-latex)}}} ::
11454   Convert the region to LaTeX under the assumption that it was in Org
11455   mode syntax before.  This is a global command that can be invoked in
11456   any buffer.
11458 - {{{kbd(M-x org-replace-region-by-latex)}}} ::
11460   Replace the active region (assumed to be in Org mode syntax) by
11461   LaTeX code.
11463 - {{{kbd(C-c C-e p)}}}, ~org-export-as-pdf~ ::
11464   #+kindex: C-c C-e p
11466   Export as LaTeX and then process to PDF.
11468 - {{{kbd(C-c C-e d)}}}, ~org-export-as-pdf-and-open~ ::
11469   #+kindex: C-c C-e d
11471   Export as LaTeX and then process to PDF, then open the resulting
11472   PDF file.
11475 #+cindex: headline levels, for exporting
11476 #+vindex: org-latex-low-levels
11478 In the exported version, the first 3 outline levels will become
11479 headlines, defining a general document structure.  Additional levels
11480 will be exported as description lists.  The exporter can ignore them or
11481 convert them to a custom string depending on ~org-latex-low-levels~.
11483 If you want that transition to occur at a different level, specify it
11484 with a numeric prefix argument, e.g.:
11486 #+begin_example
11487    C-2 C-c C-e l
11488 #+end_example
11490 {{{noindent}}} The example setting creates two levels of headings and
11491 exports the rest as list items.
11493 *** Header and sectioning
11494     :PROPERTIES:
11495     :DESCRIPTION: Setting up the export file structure
11496     :TITLE:    Header and sectioning structure
11497     :END:
11498 #+cindex: @LaTeX{} class
11499 #+cindex: @LaTeX{} sectioning structure
11500 #+cindex: @LaTeX{} header
11501 #+cindex: header, for @LaTeX{} files
11502 #+cindex: sectioning structure, for @LaTeX{} export
11504 By default, the LaTeX output uses the class ~article~.
11506 #+vindex: org-export-latex-default-class
11507 #+vindex: org-export-latex-classes
11508 #+vindex: org-export-latex-default-packages-alist
11509 #+vindex: org-export-latex-packages-alist
11510 #+cindex: #+LaTeX_HEADER
11511 #+cindex: #+LaTeX_CLASS
11512 #+cindex: #+LaTeX_CLASS_OPTIONS
11513 #+cindex: property, LaTeX_CLASS
11514 #+cindex: property, LaTeX_CLASS_OPTIONS
11516 You can change this globally by setting a different value for
11517 ~org-export-latex-default-class~ or locally by adding an option like
11518 ~#+LaTeX_CLASS: myclass~ in your file, or with a ~:LaTeX_CLASS:~
11519 property that applies when exporting a region containing only this
11520 (sub)tree.  The class must be listed in ~org-export-latex-classes~.
11521 This variable defines a header template for each class, and allows you
11522 to define the sectioning structure for each class.[fn:127] You can
11523 also define your own classes there.  ~#+LaTeX_CLASS_OPTIONS~ or a
11524 ~:LaTeX_CLASS_OPTIONS:~ property can specify the options for the
11525 ~\documentclass~ macro.  The options to documentclass have to be
11526 provided, as expected by LaTeX, within square brackets.  You can
11527 also use ~#+LaTeX_HEADER: \usepackage{xyz}~ to add lines to the
11528 header.  See the docstring of ~org-export-latex-classes~ for more
11529 information.  An example is shown below.
11531 #+begin_example
11532    ,#+LaTeX_CLASS: article
11533    ,#+LaTeX_CLASS_OPTIONS: [a4paper]
11534    ,#+LaTeX_HEADER: \usepackage{xyz}
11536    ,* Headline 1
11537      some text
11538 #+end_example
11540 *** Quoting LaTeX code
11541     :PROPERTIES:
11542     :DESCRIPTION: Incorporating literal LaTeX code
11543     :END:
11545 Embedded LaTeX as described in [[Embedded LaTeX]], will be correctly
11546 inserted into the LaTeX file.  This includes simple macros like
11547 ~\ref{LABEL}~ to create a cross reference to a figure.  Furthermore,
11548 you can add special code that should only be present in LaTeX export
11549 with the following constructs:
11551 #+cindex: #+LaTeX
11552 #+cindex: #+BEGIN_LaTeX
11553 #+begin_example
11554    ,#+LaTeX: Literal LaTeX code for export
11555 #+end_example
11557 {{{noindent}}} or
11559 #+cindex: #+BEGIN_LaTeX
11561 #+begin_example
11562    ,#+BEGIN_LaTeX
11563    All lines between these markers are exported literally
11564    ,#+END_LaTeX
11565 #+end_example
11567 *** Tables in LaTeX export
11568     :PROPERTIES:
11569     :DESCRIPTION: Options for exporting tables to LaTeX
11570     :END:
11571 #+cindex: tables, in @LaTeX{} export
11573 For LaTeX export of a table, you can specify a label, a caption and
11574 placement options (see [[Images and tables]]).  You can also use the
11575 ~ATTR_LaTeX~ line to request a ~longtable~ environment for the
11576 table, so that it may span several pages, or to change the default table
11577 environment from ~table~ to ~table*~ or to change the default inner
11578 tabular environment to ~tabularx~ or ~tabulary~.  Finally, you can
11579 set the alignment string, and (with ~tabularx~ or ~tabulary~) the
11580 width:
11582 #+cindex: #+CAPTION
11583 #+cindex: #+LABEL
11584 #+cindex: #+ATTR_LaTeX
11585 #+begin_example
11586    ,#+CAPTION: A long table
11587    ,#+LABEL: tbl:long
11588    ,#+ATTR_LaTeX: longtable align=l|lp@{3cm@}r|l
11589    | ..... | ..... |
11590    | ..... | ..... |
11591 #+end_example
11593 or to specify a multicolumn table with ~tabulary~:
11595 #+cindex: #+CAPTION
11596 #+cindex: #+LABEL
11597 #+cindex: #+ATTR_LaTeX
11598 #+begin_example
11599    ,#+CAPTION: A wide table with tabulary
11600    ,#+LABEL: tbl:wide
11601    ,#+ATTR_LaTeX: table* tabulary width=\textwidth
11602    | ..... | ..... |
11603    | ..... | ..... |
11604 #+end_example
11606 *** Images in LaTeX export
11607     :PROPERTIES:
11608     :DESCRIPTION: How to insert figures into LaTeX output
11609     :END:
11610 #+cindex: images, inline in LaTeX
11611 #+cindex: inlining images in LaTeX
11613 Images that are linked to without a description part in the link, like
11614 ~[[file:img.jpg]]~ or ~[[./img.jpg]]~ will be inserted into the PDF
11615 output file resulting from LaTeX processing.  Org will use an
11616 ~\includegraphics~ macro to insert the image.  If you have specified
11617 a caption and/or a label as described in [[Images and tables]], the
11618 figure will be wrapped into a ~figure~ environment and thus become
11619 a floating element.  You can use an ~#+ATTR_LaTeX:~ line to specify
11620 various other options.  You can ask org to export an image as a float
11621 without specifying a label or a caption by using the keyword ~float~
11622 in this line.  Various optional arguments to the ~\includegraphics~
11623 macro can also be specified in this fashion.  To modify the placement
11624 option of the floating environment, add something like
11625 {{{samp(placement=[h!])}}} to the attributes.  It is to be noted this
11626 option can be used with tables as well.[fn:128]
11628 If you would like to let text flow around the image, add the word
11629 {{{samp(wrap)}}} to the ~#+ATTR_LaTeX:~ line, which will make the
11630 figure occupy the left half of the page.  To fine-tune, the ~placement~
11631 field will be the set of additional arguments needed by the
11632 ~wrapfigure~ environment.  Note that if you change the size of the
11633 image, you need to use compatible settings for ~\includegraphics~ and
11634 ~wrapfigure~.
11636 #+cindex: #+CAPTION
11637 #+cindex: #+LABEL
11638 #+cindex: #+ATTR_LaTeX
11639 #+begin_example
11640    ,#+CAPTION:    The black-body emission of the disk around HR 4049
11641    ,#+LABEL:      fig:SED-HR4049
11642    ,#+ATTR_LaTeX: width=5cm,angle=90
11643    [[./img/sed-hr4049.pdf]]
11645    ,#+ATTR_LaTeX: width=0.38\textwidth wrap placement=@{r@}@{0.4\textwidth@}
11646    [[./img/hst.png]]
11647 #+end_example
11649 If you wish to include an image which spans multiple columns in a page, you
11650 can use the keyword ~multicolumn~ in the ~#+ATTR_LaTeX~ line.  This
11651 will export the image wrapped in a ~figure*~ environment.
11653 If you need references to a label created in this way, write
11654 ~\ref{fig:SED-HR4049}~ just like in LaTeX.
11656 *** Beamer class export
11657     :PROPERTIES:
11658     :DESCRIPTION: Turning the file into a presentation
11659     :END:
11661 The LaTeX class {{{file(beamer)}}} allows production of high
11662 quality presentations using LaTeX and pdf processing.  Org mode has
11663 special support for turning an Org mode file or tree into a
11664 {{{file(beamer)}}} presentation.
11666 When the LaTeX class for the current buffer (as set with ~#+LaTeX_CLASS:
11667 beamer~) or subtree (set with a ~LaTeX_CLASS~ property) is
11668 ~beamer~, a special export mode will turn the file or tree into a beamer
11669 presentation.  Any tree with not-too-deep level nesting should in principle be
11670 exportable as a beamer presentation.  By default, the top-level entries (or
11671 the first level below the selected subtree heading) will be turned into
11672 frames, and the outline structure below this level will become itemize lists.
11673 You can also configure the variable ~org-beamer-frame-level~ to a
11674 different level---then the hierarchy above frames will produce the sectioning
11675 structure of the presentation.
11677 A template for useful in-buffer settings or properties can be inserted
11678 into the buffer with 
11679 {{{kbd(M-x org-insert-beamer-options-template)}}}.  Among other things, this will
11680 install a column view format which is very handy for editing special
11681 properties used by beamer.
11683 You can influence the structure of the presentation using the following
11684 properties:
11686 #+attr_texinfo: :table-type table :indic @asis
11687 - ~BEAMER_env~ ::
11689   The environment that should be used to format this entry.  Valid
11690   environments are defined in the constant
11691   ~org-beamer-environments-default~, and you can define more in
11692   ~org-beamer-environments-extra~.  If this property is set, the entry
11693   will also get a ~:B_environment:~ tag to make this visible.  This tag
11694   has no semantic meaning, it is only a visual aid.
11696 - ~BEAMER_envargs~ ::
11698   The beamer-special arguments that should be used for the environment,
11699   like ~[t]~ or ~[<+->]~ of ~<2-3>~.  If the ~BEAMER_col~ property is
11700   also set, something like ~C[t]~ can be added here as well to set an
11701   options argument for the implied ~columns~ environment.  ~c[t]~ or
11702   ~c<2->~ will set an options for the implied ~column~ environment.
11704 - ~BEAMER_col~ ::
11706   The width of a column that should start with this entry.  If this
11707   property is set, the entry will also get a ~:BMCOL:~ property to make
11708   this visible.  Also this tag is only a visual aid.  When this is a plain
11709   number, it will be interpreted as a fraction of ~\textwidth~.
11710   Otherwise it will be assumed that you have specified the units, like
11711   {{{samp(3cm)}}}.  The first such property in a frame will start a
11712   ~columns~ environment to surround the columns.  This environment is
11713   closed when an entry has a ~BEAMER_col~ property with value 0 or 1, or
11714   automatically at the end of the frame.
11716 - ~BEAMER_extra~ ::
11718   Additional commands that should be inserted after the environment has
11719   been opened.  For example, when creating a frame, this can be used to
11720   specify transitions.
11723 Frames will automatically receive a ~fragile~ option if they contain
11724 source code that uses the verbatim environment.  Special {{{file(beamer)}}}
11725 specific code can be inserted using ~#+BEAMER:~ and
11726 ~#+BEGIN_BEAMER~ ...  ~#+END_BEAMER~ constructs, similar to other export
11727 backends, but with the difference that ~#+LaTeX:~ stuff will be included
11728 in the presentation as well.
11730 Outline nodes with ~BEAMER_env~ property value {{{samp(note)}}} or
11731 {{{samp(noteNH)}}} will be formatted as beamer notes, i,e, they will be wrapped
11732 into ~\note{...}~.  The former will include the heading as part of the
11733 note text, the latter will ignore the heading of that node.  To simplify note
11734 generation, it is actually enough to mark the note with a /tag/ (either
11735 ~:B_note:~ or ~:B_noteNH:~) instead of creating the
11736 ~BEAMER_env~ property.
11738 You can turn on a special minor mode ~org-beamer-mode~ for editing
11739 support with the following line:
11741 #+begin_example
11742    ,#+STARTUP: beamer
11743 #+end_example
11745 #+attr_texinfo: :table-type table :indic @asis
11746 - {{{kbd(C-c C-b)}}}, ~org-beamer-select-environment~ ::
11747   #+kindex: C-c C-b
11749   In ~org-beamer-mode~, this key offers fast selection of a beamer
11750   environment or the ~BEAMER_col~ property.
11753 Column view provides a great way to set the environment of a node and
11754 other important parameters.  Make sure you are using a COLUMN format
11755 that is geared toward this special purpose.  The command 
11756 {{{kbd(M-x org-insert-beamer-options-template)}}} defines such a format.
11758 Here is a simple example Org document that is intended for beamer export.
11760 #+begin_example
11761    ,#+LaTeX_CLASS: beamer
11762    ,#+TITLE: Example Presentation
11763    ,#+AUTHOR: Carsten Dominik
11764    ,#+LaTeX_CLASS_OPTIONS: [presentation]
11765    ,#+BEAMER_FRAME_LEVEL: 2
11766    ,#+BEAMER_HEADER_EXTRA: \usetheme@{Madrid@}\usecolortheme@{default@}
11767    ,#+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex)
11769    ,* This is the first structural section
11771    ,** Frame 1 \\ with a subtitle
11772    ,*** Thanks to Eric Fraga                                      :BMCOL:B_block:
11773        :PROPERTIES:
11774        :BEAMER_env: block
11775        :BEAMER_envargs: C[t]
11776        :BEAMER_col: 0.5
11777        :END:
11778        for the first viable beamer setup in Org
11779    ,*** Thanks to everyone else                                   :BMCOL:B_block:
11780        :PROPERTIES:
11781        :BEAMER_col: 0.5
11782        :BEAMER_env: block
11783        :BEAMER_envargs: <2->
11784        :END:
11785        for contributing to the discussion
11786    ,**** This will be formatted as a beamer note                  :B_note:
11787    ,** Frame 2 \\ where we will not use columns
11788    ,*** Request                                                   :B_block:
11789        Please test this stuff!
11790        :PROPERTIES:
11791        :BEAMER_env: block
11792        :END:
11793 #+end_example
11795 For more information, see the documentation on Worg.
11797 ** DocBook export
11798    :PROPERTIES:
11799    :DESCRIPTION: Exporting to DocBook
11800    :END:
11801 #+cindex: DocBook export
11802 #+cindex: PDF export
11803 #+cindex: Cui, Baoqiu
11805 Org contains a DocBook exporter written by Baoqiu Cui.  Once an Org file is
11806 exported to DocBook format, it can be further processed to produce other
11807 formats, including PDF, HTML, man pages, etc., using many available DocBook
11808 tools and stylesheets.
11810 Currently DocBook exporter only supports DocBook V5.0.
11812 *** DocBook export commands
11813     :PROPERTIES:
11814     :DESCRIPTION: How to invoke DocBook export
11815     :END:
11816 #+cindex: region, active
11817 #+cindex: active region
11818 #+cindex: transient-mark-mode
11820 #+attr_texinfo: :table-type table :indic @asis
11821 - {{{kbd(C-c C-e D)}}}, ~org-export-as-docbook~ ::
11822   #+kindex: C-c C-e D
11823   #+cindex: property EXPORT_FILE_NAME
11825   Export as a DocBook file.  For an Org file, {{{file(myfile.org)}}}, the
11826   DocBook XML file will be {{{file(myfile.xml)}}}.  The file will be
11827   overwritten without warning.  If there is an active region, only the
11828   region will be exported.[fn:129] If the selected region is a single
11829   tree, the tree head will become the document title.[fn:130] If the
11830   tree head entry has, or inherits, an ~EXPORT_FILE_NAME~ property, that
11831   name will be used for the export.
11833 - {{{kbd(C-c C-e V)}}}, ~org-export-as-docbook-pdf-and-open~ ::
11834   #+kindex: C-c C-e V
11836   Export as a DocBook file, process to PDF, then open the resulting PDF
11837   file.
11839   #+vindex: org-export-docbook-xslt-proc-command
11840   #+vindex: org-export-docbook-xsl-fo-proc-command
11842   Note that, in order to produce PDF output based on an exported DocBook
11843   file, you need to have XSLT processor and XSL-FO processor software
11844   installed on your system.  Check variables
11845   ~org-export-docbook-xslt-proc-command~ and
11846   ~org-export-docbook-xsl-fo-proc-command~.
11848   #+vindex: org-export-docbook-xslt-stylesheet
11850   The stylesheet argument ~%s~ in variable
11851   ~org-export-docbook-xslt-proc-command~ is replaced by the value of
11852   variable ~org-export-docbook-xslt-stylesheet~, which needs to be set by
11853   the user.  You can also overrule this global setting on a per-file basis by
11854   adding an in-buffer setting ~#+XSLT:~ to the Org file.
11856 - {{{kbd(C-c C-e v D)}}} ::
11857   #+kindex: C-c C-e v D
11859   Export only the visible part of the document.
11861 *** Quoting DocBook code
11862     :PROPERTIES:
11863     :DESCRIPTION: Incorporating DocBook code in Org files
11864     :END:
11865 You can quote DocBook code in Org files and copy it verbatim into exported
11866 DocBook file with the following constructs:
11868 #+cindex: #+DOCBOOK
11869 #+cindex: #+BEGIN_DOCBOOK
11870 #+begin_example
11871    ,#+DOCBOOK: Literal DocBook code for export
11872 #+end_example
11874 {{{noindent}}} or
11875 #+cindex: #+BEGIN_DOCBOOK
11877 #+begin_example
11878    ,#+BEGIN_DOCBOOK
11879    All lines between these markers are exported by DocBook exporter
11880    literally.
11881    ,#+END_DOCBOOK
11882 #+end_example
11884 For example, you can use the following lines to include a DocBook warning
11885 admonition.  As to what this warning says, you should pay attention to the
11886 document context when quoting DocBook code in Org files.  You may make
11887 exported DocBook XML files invalid by not quoting DocBook code correctly.
11889 #+begin_example
11890    ,#+BEGIN_DOCBOOK
11891    <warning>
11892      <para>You should know what you are doing when quoting DocBook XML code
11893      in your Org file.  Invalid DocBook XML may be generated by
11894      DocBook exporter if you are not careful!</para>
11895    </warning>
11896    ,#+END_DOCBOOK
11897 #+end_example
11899 *** Recursive sections
11900     :PROPERTIES:
11901     :DESCRIPTION: Recursive sections in DocBook
11902     :END:
11903 #+cindex: DocBook recursive sections
11905 DocBook exporter exports Org files as articles using the ~article~
11906 element in DocBook.  Recursive sections, i.e., ~section~ elements, are
11907 used in exported articles.  Top level headlines in Org files are
11908 exported as top level sections, and lower level headlines are exported
11909 as nested sections.  The entire structure of Org files will be exported
11910 completely, no matter how many nested levels of headlines there are.
11912 Using recursive sections makes it easy to port and reuse exported
11913 DocBook code in other DocBook document types like ~book~ or ~set~.
11915 *** Tables in DocBook export
11916     :PROPERTIES:
11917     :DESCRIPTION: Tables are exported as HTML tables
11918     :END:
11919 #+cindex: tables, in DocBook export
11921 Tables in Org files are exported as HTML tables, which have been
11922 supported since DocBook V4.3.
11924 If a table does not have a caption, an informal table is generated
11925 using the ~informaltable~ element; otherwise, a formal table will be
11926 generated using the ~table~ element.
11928 *** Images in DocBook export
11929     :PROPERTIES:
11930     :DESCRIPTION: How to insert figures into DocBook output
11931     :END:
11932 #+cindex: images, inline in DocBook
11933 #+cindex: inlining images in DocBook
11935 Images that are linked to without a description part in the link, like
11936 ~[[file:img.jpg]]~ or ~[[./img.jpg]]~, will be exported to
11937 DocBook using ~mediaobject~ elements.  Each ~mediaobject~ element
11938 contains an ~imageobject~ that wraps an ~imagedata~ element.  If you
11939 have specified a caption for an image as described in [[Images and
11940 tables]], a ~caption~ element will be added in ~mediaobject~.  If a label
11941 is also specified, it will be exported as an ~xml:id~ attribute of the
11942 ~mediaobject~ element.
11944 #+vindex: org-export-docbook-default-image-attributes
11946 Image attributes supported by the ~imagedata~ element, like ~align~ or
11947 ~width~, can be specified in two ways: you can either customize
11948 variable ~org-export-docbook-default-image-attributes~ or use the
11949 ~#+ATTR_DOCBOOK:~ line.  Attributes specified in variable
11950 ~org-export-docbook-default-image-attributes~ are applied to all
11951 inline images in the Org file to be exported (unless they are
11952 overridden by image attributes specified in ~#+ATTR_DOCBOOK:~ lines).
11954 The ~#+ATTR_DOCBOOK:~ line can be used to specify additional image
11955 attributes or override default image attributes for individual images.
11956 If the same attribute appears in both the ~#+ATTR_DOCBOOK:~ line and
11957 variable ~org-export-docbook-default-image-attributes~, the former
11958 takes precedence.  Here is an example about how image attributes can be
11959 set:
11961 #+cindex: #+CAPTION
11962 #+cindex: #+LABEL
11963 #+cindex: #+ATTR_DOCBOOK
11964 #+begin_example
11965    ,#+CAPTION:    The logo of Org mode
11966    ,#+LABEL:      unicorn-svg
11967    ,#+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"
11968    [[./img/org-mode-unicorn.svg]]
11969 #+end_example
11971 #+vindex: org-export-docbook-inline-image-extensions
11973 By default, DocBook exporter recognizes the following image file
11974 types: {{{file(jpeg)}}}, {{{file(jpg)}}}, {{{file(png)}}},
11975 {{{file(gif)}}}, and {{{file(svg)}}}.  You can customize variable
11976 ~org-export-docbook-inline-image-extensions~ to add more types to this
11977 list as long as DocBook supports them.
11979 *** Special characters
11980     :PROPERTIES:
11981     :DESCRIPTION: How to handle special characters
11982     :TITLE:    Special characters in DocBook export
11983     :END:
11984 #+vindex: org-export-docbook-doctype
11985 #+vindex: org-entities
11987 Special characters that are written in TeX-like syntax, such as
11988 ~\alpha~, ~\Gamma~, and ~\Zeta~, are supported by DocBook exporter.
11989 These characters are rewritten to XML entities, like ~&alpha;~,
11990 ~&Gamma;~, and ~&Zeta;~, based on the list saved in variable
11991 ~org-entities~.  As long as the generated DocBook file includes the
11992 corresponding entities, these special characters are recognized.
11994 You can customize variable ~org-export-docbook-doctype~ to include the
11995 entities you need.  For example, you can set variable
11996 ~org-export-docbook-doctype~ to the following value to recognize all
11997 special characters included in XHTML entities:
11999 #+begin_example
12000    "<!DOCTYPE article [
12001    <!ENTITY % xhtml1-symbol PUBLIC
12002    \"-//W3C//ENTITIES Symbol for HTML//EN//XML\"
12003    \"http://www.w3.org/2003/entities/2007/xhtml1-symbol.ent\"
12004    >
12005    %xhtml1-symbol;
12006    ]>
12007    "
12008 #+end_example
12010 ** OpenDocument Text export
12011    :PROPERTIES:
12012    :DESCRIPTION: Exporting to OpenDocument Text
12013    :END:
12014 #+cindex: K, Jambunathan
12015 #+cindex: ODT
12016 #+cindex: OpenDocument
12017 #+cindex: export, OpenDocument
12018 #+cindex: LibreOffice
12019 #+cindex: org-odt.el
12020 #+cindex: org-modules
12022 Org Mode supports export to OpenDocument Text (ODT) format using the
12023 {{{file(org-odt.el)}}} module.[fn:131] Documents created by this
12024 exporter use the {{{cite(OpenDocument-v1.2 specification)}}} and
12025 are compatible with LibreOffice 3.4.[fn:132]
12027 *** Pre-requisites for ODT export
12028     :PROPERTIES:
12029     :DESCRIPTION: What packages ODT exporter relies on
12030     :END:
12031 #+cindex: zip
12033 The ODT exporter relies on the {{{file(zip)}}} program to create the
12034 final output.  Check the availability of this program before proceeding
12035 further.
12037 *** ODT export commands
12038     :PROPERTIES:
12039     :DESCRIPTION: How to invoke ODT export
12040     :ALT_TITLE: Exporting to ODT
12041     :END:
12042 <<x-export-to-odt>>
12044 #+cindex: region, active
12045 #+cindex: active region
12046 #+cindex: transient-mark-mode
12048 #+attr_texinfo: :table-type table :indic @asis
12049 - {{{kbd(C-c C-e o)}}}, ~org-export-as-odt~ ::
12050   #+kindex: C-c C-e o
12051   #+cindex: property EXPORT_FILE_NAME
12053   Export as OpenDocument Text file.
12055   #+vindex: org-export-odt-preferred-output-format
12057   If ~org-export-odt-preferred-output-format~ is specified,
12058   automatically convert the exported file to that format.  See
12059   [[Automatically exporting to other formats]].
12061   For an Org file {{{file(myfile.org)}}}, the ODT file will be
12062   {{{file(myfile.odt)}}}.  The file will be overwritten without warning.
12063   If there is an active region, only the region will be
12064   exported.[fn:133] If the selected region is a single tree, the tree
12065   head will become the document title.[fn:134] If the tree head entry
12066   has, or inherits, an ~EXPORT_FILE_NAME~ property, that name will be
12067   used for the export.
12069 - {{{kbd(C-c C-e O)}}}, ~org-export-as-odt-and-open~ ::
12070   #+kindex: C-c C-e O
12072   Export as an OpenDocument Text file and open the resulting file.
12074   #+vindex: org-export-odt-preferred-output-format
12076   If ~org-export-odt-preferred-output-format~ is specified, open the
12077   converted file instead.  See [[x-export-to-other-formats][Automatically exporting to other formats]].
12079 *** Extending ODT export
12080     :PROPERTIES:
12081     :DESCRIPTION: How to produce ~doc~, ~pdf~ files
12082     :END:
12084 The ODT exporter can interface with a variety of document converters
12085 and supports popular converters out of the box.  As a result, you can
12086 use it to export to formats like {{{samp(doc)}}} or convert a document
12087 from one format (say {{{samp(csv)}}}) to another format (say
12088 {{{samp(ods)}}} or {{{samp(xls)}}}).
12090 #+cindex: @file{unoconv}
12091 #+cindex: LibreOffice
12093 If you have a working installation of LibreOffice, a document
12094 converter is pre-configured for you and you can use it right away.  If
12095 you would like to use {{{file(unoconv)}}} as your preferred converter,
12096 customize the variable ~org-export-odt-convert-process~ to point to
12097 ~unoconv~.  You can also use your own favorite converter or tweak the
12098 default settings of the {{{file(LibreOffice)}}} and
12099 {{{samp(unoconv)}}} converters.  See [[Configuring a document converter]].
12101 **** Automatically exporting to other formats
12102      :PROPERTIES:
12103      :DESCRIPTION: Automatic conversion to doc, docx, etc.
12104      :END:
12105 <<x-export-to-other-formats>>
12107 #+vindex: org-export-odt-preferred-output-format
12109 Very often, you will find yourself exporting to ODT format, only to
12110 immediately save the exported document to other formats like
12111 {{{samp(doc)}}}, {{{samp(docx)}}}, {{{samp(rtf)}}}, {{{samp(pdf)}}}
12112 etc.  In such cases, you can specify your preferred output format by
12113 customizing the variable ~org-export-odt-preferred-output-format~.
12114 This way, the export commands (see [[x-export-to-odt][Exporting to ODT]])
12115 can be extended to export to a format that is of immediate interest to
12116 you.
12118 **** Converting between document formats
12119      :PROPERTIES:
12120      :DESCRIPTION: Interacting with configured converters
12121      :END:
12122 # <<x-convert-to-other-formats>>
12124 There are many document converters in the wild that support
12125 conversion to and from various file formats, including, but not
12126 limited to the ODT format.  LibreOffice converter, mentioned above, is
12127 one such converter.  Once a converter is configured, you can interact
12128 with it using the following command.
12130 #+attr_texinfo: :table-type table :indic @asis
12131 - {{{kbd(M-x org-export-odt-convert)}}} ::
12132   #+vindex: org-export-odt-convert
12134   Convert an existing document from one format to another.  With a prefix
12135   argument, also open the newly produced file.
12137 *** Applying custom styles
12138     :PROPERTIES:
12139     :DESCRIPTION: How to apply custom styles to the output
12140     :END:
12141 #+cindex: styles, custom
12142 #+cindex: template, custom
12144 The ODT exporter ships with a set of OpenDocument styles 
12145 (see [[Working with OpenDocument style files]]) that ensure a well-formatted output.
12146 These factory styles, however, may not cater to your specific tastes.
12147 To customize the output, you can either modify the above styles files
12148 directly, or generate the required styles using an application like
12149 LibreOffice.  The latter method is suitable for expert and non-expert
12150 users alike, and is described here.
12152 Custom styles can be applied in three easy steps:
12154 1. Create a sample {{{file(example.org)}}} file with the below
12155    settings and export it to ODT format.
12157    #+begin_example
12158       ,#+OPTIONS: H:10 num:t
12159    #+end_example
12161 2. Open the above {{{file(example.odt)}}} using LibreOffice.  Use the
12162    {{{file(Stylist)}}} to locate the target styles---these typically
12163    have the {{{samp(Org)}}} prefix---and modify those to your taste.
12164    Save the modified file either as an OpenDocument Text
12165    ({{{file(.odt)}}}) or OpenDocument Template ({{{file(.ott)}}})
12166    file.
12168 3. Customize the variable ~org-export-odt-styles-file~ and point it to
12169    the newly created file.  For additional configuration options see
12170    [[x-overriding-factory-styles][Overriding factory styles]].
12172    #+cindex: #+ODT_STYLES_FILE
12173    #+vindex: org-export-odt-styles-file
12175    If you would like to choose a style on a per-file basis, you can use
12176    the ~#+ODT_STYLES_FILE~ option.  A typical setting will look like
12177    one of these two examples:
12179    #+begin_example
12180       ,#+ODT_STYLES_FILE: "/path/to/example.ott"
12181    #+end_example
12183    or
12185    #+begin_example
12186       ,#+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
12187    #+end_example
12189 Although you can use third-party styles and templates for customizing
12190 your output, this will produce the desired output only if the template
12191 provides all style names that the {{{samp(ODT)}}} exporter relies
12192 upon.  Unless this condition is met, the output is going to be less
12193 than satisfactory.  It is highly recommended that you only work with
12194 templates that are directly derived from the factory settings.
12196 *** Links in ODT export
12197     :PROPERTIES:
12198     :DESCRIPTION: How links will be interpreted and formatted
12199     :END:
12200 #+cindex: tables, in DocBook export
12202 ODT exporter creates native cross-references for internal links.  It
12203 creates Internet-style links for all other links.
12205 A link with no description and destined to a regular (un-itemized)
12206 outline heading is replaced with a cross-reference and section number
12207 of the heading.
12209 A ~\ref{label}~-style reference to an image, table etc.  is replaced
12210 with a cross-reference and sequence number of the labeled entity.  See
12211 [[Labels and captions in ODT export]].
12213 *** Tables in ODT export
12214     :PROPERTIES:
12215     :DESCRIPTION: How tables are exported
12216     :END:
12218 #+cindex: tables, in DocBook export
12220 Export of native Org mode tables (see [[Tables]]) and simple
12221 {{{file(table.el)}}} tables is supported.  However, export of complex
12222 {{{file(table.el)}}} tables---tables that have column or row
12223 spans---is not supported.  Such tables are stripped from the exported
12224 document.
12226 By default, a table is exported with top and bottom frames and with
12227 rules separating row and column groups (see [[Column groups]]).
12228 Furthermore, all tables are typeset to occupy the same width.  If the
12229 table specifies alignment and relative width for its columns (see
12230 [[Column width and alignment]]) then these are honored on export.[fn:135]
12232 #+cindex: #+ATTR_ODT
12234 You can control the width of the table by specifying ~:rel-width~
12235 property using an ~#+ATTR_ODT~ line.
12237 For example, consider the following table which makes use of all the
12238 rules mentioned above.
12240 #+begin_example
12241    #+ATTR_ODT: :rel-width 50
12242    | Area/Month    |   Jan |   Feb |   Mar |   Sum |
12243    |---------------+-------+-------+-------+-------|
12244    | /             |     < |       |       |     < |
12245    | <l13>         |  <r5> |  <r5> |  <r5> |  <r6> |
12246    | North America |     1 |    21 |   926 |   948 |
12247    | Middle East   |     6 |    75 |   844 |   925 |
12248    | Asia Pacific  |     9 |    27 |   790 |   826 |
12249    |---------------+-------+-------+-------+-------|
12250    | Sum           |    16 |   123 |  2560 |  2699 |
12251 #+end_example
12253 On export, the table will occupy 50% of text area.  The columns will be
12254 sized (roughly) in the ratio of 13:5:5:5:6.  The first column will be
12255 left-aligned and rest of the columns will be right-aligned.  There will
12256 be vertical rules after separating the header and last columns from
12257 other columns.  There will be horizontal rules separating the header
12258 and last rows from other rows.
12260 If you are not satisfied with the above formatting options, you can
12261 create custom table styles and associate them with a table using the
12262 ~#+ATTR_ODT~ line.  See [[Customizing tables in ODT export]].
12264 *** Images in ODT export
12265     :PROPERTIES:
12266     :DESCRIPTION: How to insert images
12267     :END:
12268 #+cindex: images, embedding in ODT
12269 #+cindex: embedding images in ODT
12271 You can embed images within the exported document by providing a link to the
12272 desired image file with no link description.  For example, to embed
12273 {{{samp(img.png)}}} do either of the following:
12275 #+begin_example
12276    [[file:img.png]]
12277 #+end_example
12279 #+begin_example
12280    [[./img.png]]
12281 #+end_example
12283 You can create clickable images by providing a link whose description
12284 is a link to an image file.  For example, to embed an image
12285 {{{file(org-mode-unicorn.png)}}}, which when clicked jumps to
12286 [[http://Orgmode.org]] website, do the following:
12288 #+begin_example
12289    [[http://orgmode.org][./org-mode-unicorn.png]]
12290 #+end_example
12292 #+cindex: #+ATTR_ODT
12294 You can control the size and scale of the embedded images using the
12295 ~#+ATTR_ODT~ attribute.
12297 #+cindex: identify, ImageMagick
12298 #+vindex: org-export-odt-pixels-per-inch
12300 The exporter specifies the desired size of the image in the final
12301 document in units of centimeters.  In order to scale the embedded
12302 images, the exporter queries for pixel dimensions of the images using
12303 either ImageMagick's {{{file(identify)}}} program, or Emacs'
12304 `create-image' and `image-size' APIs.[fn:136] The pixel dimensions are
12305 subsequently converted to centimeters using
12306 ~org-export-odt-pixels-per-inch~.  The default value of this variable
12307 is set to ~display-pixels-per-inch~.  You can tweak this variable to
12308 achieve the best results.
12310 The examples below illustrate the various possibilities.
12312 #+attr_texinfo: :table-type table :indic @asis
12313 - Explicitly size the image ::
12315   To embed {{{file(img.png)}}} as a 10 cm x 10 cm image, do the
12316   following:
12318   #+begin_example
12319      #+ATTR_ODT: :width 10 :height 10
12320      [[./img.png]]
12321   #+end_example
12323 - Scale the image ::
12325   To embed {{{file(img.png)}}} at half its size, do the following:
12327   #+begin_example
12328      #+ATTR_ODT: :scale 0.5
12329      [[./img.png]]
12330   #+end_example
12332 - Scale the image to a specific width ::
12334   To embed {{{file(img.png)}}} with a width of 10 cm while retaining the
12335   original height:width ratio, do the following:
12337   #+begin_example
12338      #+ATTR_ODT: :width 10
12339      [[./img.png]]
12340   #+end_example
12342 - Scale the image to a specific height ::
12344   To embed {{{file(img.png)}}} with a height of 10 cm while retaining
12345   the original height:width ratio, do the following:
12347   #+begin_example
12348      #+ATTR_ODT: :height 10
12349      [[./img.png]]
12350   #+end_example
12352 #+cindex: #+ATTR_ODT
12354 You can control the manner in which an image is anchored by setting
12355 the ~:anchor~ property of it's ~#+ATTR_ODT~ line.  You can specify one
12356 of the the following three values for the ~:anchor~ property -
12357 {{{samp("as-char")}}}, {{{samp("paragraph")}}} and {{{samp("page")}}}.
12359 To create an image that is anchored to a page, do the following:
12361 #+begin_example
12362    #+ATTR_ODT: :anchor "page"
12363    [[./img.png]]
12364 #+end_example
12366 *** Math formatting in ODT export
12367     :PROPERTIES:
12368     :DESCRIPTION: How LaTeX fragments are formatted
12369     :END:
12371 The ODT exporter has special support for handling math.
12373 **** Working with LaTeX math snippets
12374      :PROPERTIES:
12375      :DESCRIPTION: How to embed LaTeX math fragments
12376      :END:
12378 LaTeX math snippets (see [[LaTeX fragments]]) can be embedded in the ODT
12379 document in one of the following ways:
12381 #+cindex: MathML
12382 #+attr_texinfo: :table-type table :indic @asis
12383 - MathML ::
12385   This option is activated on a per-file basis with the following option:
12387   #+begin_example
12388      ,#+OPTIONS: LaTeX:t
12389   #+end_example
12391   With this option, LaTeX fragments are first converted into MathML
12392   fragments using an external LaTeX-to-MathML converter program.  The
12393   resulting MathML fragments are then embedded as an OpenDocument Formula in
12394   the exported document.
12396   #+vindex: org-latex-to-mathml-convert-command
12397   #+vindex: org-latex-to-mathml-jar-file
12399   You can specify the LaTeX-to-MathML converter by customizing the variables
12400   ~org-latex-to-mathml-convert-command~ and
12401   ~org-latex-to-mathml-jar-file~.
12403   If you prefer to use {{{file(MathToWeb)}}} as your converter, you can
12404   configure the above variables as shown below.[fn:137]
12406   #+header: :eval no
12407   #+header: :exports code
12408   #+begin_src emacs-lisp
12409   (setq org-latex-to-mathml-convert-command
12410         "java -jar %j -unicode -force -df %o %I"
12411         org-latex-to-mathml-jar-file
12412         "/path/to/mathtoweb.jar")
12413   #+end_src
12415   You can use the following commands to quickly verify the reliability of
12416   the LaTeX-to-MathML converter.
12418   - {{{kbd(M-x org-export-as-odf)}}} ::
12420     Convert a LaTeX math snippet to an OpenDocument formula
12421     ({{{file(.odf)}}}) file.
12423   - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
12425     Convert a LaTeX math snippet to an OpenDocument formula
12426     ({{{file(.odf)}}}) file and open the formula file with the
12427     system-registered application.
12429 - PNG images ::
12430   #+cindex: dvipng
12432   This option is activated on a per-file basis with
12434   #+begin_example
12435      ,#+OPTIONS: LaTeX:dvipng
12436   #+end_example
12438   With this option, LaTeX fragments are processed into PNG images and
12439   the resulting images are embedded in the exported document.  This
12440   method requires that the {{{file(dvipng)}}} program be available on
12441   your system.
12443 **** Working with MathML or OpenDocument formula files
12444      :PROPERTIES:
12445      :DESCRIPTION: How to embed equations in native format
12446      :END:
12448 For various reasons, you may find embedding LaTeX math snippets in
12449 an ODT document less than reliable.  In that case, you can embed a math
12450 equation by linking to its MathML ({{{file(.mml)}}}) source or its
12451 OpenDocument formula ({{{file(.odf)}}}) file as shown below:
12453 #+begin_example
12454    [[./equation.mml]]
12455 #+end_example
12459 #+begin_example
12460    [[./equation.odf]]
12461 #+end_example
12463 *** Labels and captions in ODT export
12464     :PROPERTIES:
12465     :DESCRIPTION: How captions are rendered
12466     :END:
12468 You can label and caption various category of objects---an inline
12469 image, a table, a LaTeX fragment or a Math formula---using
12470 ~#+LABEL~ and ~#+CAPTION~ lines.  See [[Images and tables]].  ODT exporter
12471 enumerates each labeled or captioned object of a given category
12472 separately.  As a result, each such object is assigned a sequence
12473 number based on order of its appearance in the Org file.
12475 In the exported document, a user-provided caption is augmented with
12476 the category and sequence number.  Consider the following inline image
12477 in an Org file:
12479 #+begin_example
12480    ,#+CAPTION: Bell curve
12481    ,#+LABEL:   fig:SED-HR4049
12482    [[./img/a.png]]
12483 #+end_example
12485 It could be rendered as shown below in the exported document.
12487 #+begin_example
12488    Figure 2: Bell curve
12489 #+end_example
12491 #+vindex: org-export-odt-category-strings
12493 You can modify the category component of the caption by customizing
12494 the variable ~org-export-odt-category-strings~.  For example, to tag
12495 all embedded images with the string {{{samp(Illustration)}}} (instead
12496 of the default {{{samp(Figure)}}}) use the following setting.
12498 #+header: :eval no
12499 #+header: :exports code
12500 #+begin_src emacs-lisp
12501 (setq org-export-odt-category-strings
12502       '(("en" "Table" "Illustration" "Equation" "Equation")))
12503 #+end_src
12505 With this, previous image will be captioned as below in the exported
12506 document.
12508 #+begin_example
12509    Illustration 2: Bell curve
12510 #+end_example
12512 *** Literal examples in ODT export
12513     :PROPERTIES:
12514     :DESCRIPTION: How source and example blocks are formatted
12515     :END:
12517 Export of literal examples (see [[Literal examples]]) with full
12518 fontification is supported.  Internally, the exporter relies on
12519 {{{file(htmlfontify.el)}}} to generate all style definitions needed
12520 for a fancy listing.[fn:138] The auto-generated styles have
12521 {{{samp(OrgSrc)}}} as prefix and inherit their color from the faces
12522 used by Emacs ~font-lock~ library for the source language.
12524 #+vindex: org-export-odt-fontify-srcblocks
12526 If you prefer to use your own custom styles for fontification, you can
12527 do so by customizing the variable
12528 ~org-export-odt-create-custom-styles-for-srcblocks~.
12530 #+vindex: org-export-odt-create-custom-styles-for-srcblocks
12532 You can turn off fontification of literal examples by customizing the
12533 variable ~org-export-odt-fontify-srcblocks~.
12535 *** Advanced topics in ODT export
12536     :PROPERTIES:
12537     :DESCRIPTION: Read this if you are a power user
12538     :END:
12540 If you rely heavily on ODT export, you may want to exploit the full
12541 set of features that the exporter offers.  This section describes
12542 features that would be of interest to power users.
12544 **** Configuring a document converter
12545      :PROPERTIES:
12546      :DESCRIPTION: How to register a document converter
12547      :END:
12548 #+cindex: convert
12549 #+cindex: doc, docx, rtf
12550 #+cindex: converter
12552 The ODT exporter can work with popular converters with little or no
12553 extra configuration from your side.  See [[Extending ODT export]].  If you
12554 are using a converter that is not supported by default or if you would
12555 like to tweak the default converter settings, proceed as below.
12557 #+attr_texinfo: :table-type table :indic @asis
12558 - Register the converter ::
12560   #+vindex: org-export-odt-convert-processes
12562   Name your converter and add it to the list of known converters by
12563   customizing the variable ~org-export-odt-convert-processes~.  Also
12564   specify how the converter can be invoked via command-line to effect
12565   the conversion.
12567 - Configure its capabilities ::
12569   #+vindex: org-export-odt-convert-capabilities
12570   # <<x-odt-converter-capabilities>>
12572   Specify the set of formats the converter can handle by customizing the
12573   variable ~org-export-odt-convert-capabilities~.  Use the default value
12574   for this variable as a guide for configuring your converter.  As suggested by
12575   the default setting, you can specify the full set of formats supported by the
12576   converter and not limit yourself to specifying formats that are related to
12577   just the OpenDocument Text format.
12579 - Choose the converter ::
12581   #+vindex: org-export-odt-convert-process
12583   Select the newly added converter as the preferred one by customizing the
12584   variable ~org-export-odt-convert-process~.
12586 **** Working with OpenDocument style files
12587      :PROPERTIES:
12588      :DESCRIPTION: Explore the internals
12589      :END:
12590 #+cindex: styles, custom
12591 #+cindex: template, custom
12593 This section explores the internals of the ODT exporter and the means
12594 by which it produces styled documents.  Read this section if you are
12595 interested in exploring the automatic and custom OpenDocument styles
12596 used by the exporter.
12598 # <<x-factory-styles>>
12600 The ODT exporter relies on two files for generating its output.
12601 These files are bundled with the distribution under the directory pointed to
12602 by the variable ~org-odt-styles-dir~.  The two files are:
12604 #+attr_texinfo: :table-type table :indic @asis
12605 - {{{file(OrgOdtStyles.xml)}}} ::
12606   <<x-orgodtstyles-xml>>
12608   This file contributes to the {{{file(styles.xml)}}} file of the final
12609   {{{samp(ODT)}}} document.  This file is modified to control outline
12610   numbering based on user settings, and To add styles generated by
12611   {{{file(htmlfontify.el)}}} for fontification of code blocks.
12613 - {{{file(OrgOdtContentTemplate.xml)}}} ::
12614   <<x-orgodtcontenttemplate-xml>>
12616   This file contributes to the {{{file(content.xml)}}} file of the final
12617   {{{samp(ODT)}}} document.  The contents of the Org outline are inserted
12618   between the ~<office:text>~ and ~</office:text>~
12619   elements of this file.
12621   In addition to serving as a template file for the final
12622   {{{file(content.xml)}}}, the file also contains automatic styles for
12623   formatting of tables which are referenced by the exporter, and
12624   ~<text:sequence-decl>~ ...  ~</text:sequence-decl>~
12625   elements that control how various entities---tables, images,
12626   equations, etc.---are numbered.
12629 <<x-overriding-factory-styles>>
12631 The following two variables control the location from which the ODT
12632 exporter picks up the custom styles and content template files.  You
12633 can customize these variables to override the factory styles used by
12634 the exporter.
12636 #+attr_texinfo: :table-type table :indic @asis
12637 - ~org-export-odt-styles-file~ ::
12638   <<x-org-export-odt-styles-file>>
12640   Use this variable to specify the {{{file(styles.xml)}}} that will be
12641   used in the final output.  You can specify one of the following values:
12643   - A {{{file(styles.xml)}}} file ::
12645     Use this file instead of the default {{{file(styles.xml)}}}
12647   - A {{{file(.odt)}}} or {{{file(.ott)}}} file ::
12649     Use the {{{file(styles.xml)}}} contained in the specified OpenDocument
12650     Text or Template file.
12652   - A {{{file(.odt)}}} or {{{file(.ott)}}} file and a subset of files contained within them ::
12654     Use the {{{file(styles.xml)}}} contained in the specified OpenDocument
12655     Text or Template file.  Additionally extract the specified member files
12656     and embed those within the final {{{samp(ODT)}}} document.
12658     Use this option if the {{{file(styles.xml)}}} file references
12659     additional files like header and footer images.
12661   - ~nil~ ::
12663     Use the default {{{file(styles.xml)}}}
12665 - ~org-export-odt-content-template-file~ ::
12666   <<x-org-export-odt-content-template-file>>
12668   Use this variable to specify the blank {{{file(content.xml)}}} that
12669   will be used in the final output.
12671 **** Creating one-off styles
12672      :PROPERTIES:
12673      :DESCRIPTION: How to produce custom highlighting, etc.
12674      :END:
12676 There are times when you would want one-off formatting in the exported
12677 document.  You can achieve this by embedding raw OpenDocument XML in
12678 the Org file.  The use of this feature is better illustrated with
12679 couple of examples.
12681 #+attr_texinfo: :table-type table :indic @asis
12682 - Embedding ODT tags as part of regular text ::
12684   You can include simple OpenDocument tags by prefixing them with
12685   {{{samp(@)}}}.  For example, to highlight a region of text do the
12686   following:
12688   #+begin_example
12689      @<text:span text:style-name="Highlight">This is a
12690      highlighted text@</text:span>.  But this is a
12691      regular text.
12692   #+end_example
12694   *Hint:* To see the above example in action, edit your
12695   {{{file(styles.xml)}}} (see [[x-orgodtstyles-xml][Factory styles]]) and
12696   add a custom {{{samp(Highlight)}}} style as shown below.
12698   #+begin_example
12699      <style:style style:name="Highlight" style:family="text">
12700        <style:text-properties fo:background-color="#ff0000"/>
12701      </style:style>
12702   #+end_example
12704 - Embedding a one-line OpenDocument XML ::
12706   You can add a simple OpenDocument one-liner using the ~#+ODT:~
12707   directive.  For example, to force a page break do the following:
12709   #+begin_example
12710      #+ODT: <text:p text:style-name="PageBreak"/>
12711   #+end_example
12713   *Hint:* To see the above example in action, edit your
12714   {{{file(styles.xml)}}} (see [[x-orgodtstyles-xml][Factory styles]]) and
12715   add a custom {{{samp(PageBreak)}}} style as shown below.
12717   #+begin_example
12718      <style:style style:name="PageBreak" style:family="paragraph"
12719                   style:parent-style-name="Text_20_body">
12720        <style:paragraph-properties fo:break-before="page"/>
12721      </style:style>
12722   #+end_example
12724 - Embedding a block of OpenDocument XML ::
12726   You can add a large block of OpenDocument XML using the
12727   ~#+BEGIN_ODT~ ...  ~#+END_ODT~ construct.
12729   For example, to create a one-off paragraph that uses bold text, do the
12730   following:
12732   #+begin_example
12733      #+BEGIN_ODT
12734      <text:p text:style-name="Text_20_body_20_bold">
12735      This paragraph is specially formatted and uses bold text.
12736      </text:p>
12737      #+END_ODT
12738   #+end_example
12740 **** Customizing tables in ODT export
12741      :PROPERTIES:
12742      :DESCRIPTION: How to define and use table templates
12743      :END:
12744 #+cindex: tables, in ODT export
12745 #+cindex: #+ATTR_ODT
12747 You can override the default formatting of the table by specifying a
12748 custom table style with the ~#+ATTR_ODT~ line.  For a discussion on
12749 default formatting of tables see [[Tables in ODT export]].
12751 This feature closely mimics the way table templates are defined in the
12752 OpenDocument-v1.2 specification.[fn:139]
12754 To have a quick preview of this feature, install the following setting and
12755 export the example table.
12757 #+header: :eval no
12758 #+header: :exports code
12759 #+begin_src emacs-lisp
12760   (setq org-export-odt-table-styles
12761         (append org-export-odt-table-styles
12762                 '(("TableWithHeaderRowAndColumn" "Custom"
12763                    ((use-first-row-styles . t)
12764                     (use-first-column-styles . t)))
12765                   ("TableWithFirstRowandLastRow" "Custom"
12766                    ((use-first-row-styles . t)
12767                     (use-last-row-styles . t))))))
12768 #+end_src
12770 #+begin_example
12771    ,#+ATTR_ODT: :style "TableWithHeaderRowAndColumn"
12772    | Name  | Phone | Age |
12773    | Peter |  1234 |  17 |
12774    | Anna  |  4321 |  25 |
12775 #+end_example
12777 In the above example, you used a template named {{{samp(Custom)}}} and
12778 installed two table styles with the names
12779 {{{samp(TableWithHeaderRowAndColumn)}}} and
12780 {{{samp(TableWithFirstRowandLastRow)}}}.  (*Important:* The
12781 OpenDocument styles needed for producing the above template have been
12782 pre-defined for you.  These styles are available under the section
12783 marked {{{samp(Custom Table Template)}}} in
12784 {{{file(OrgOdtContentTemplate.xml)}}} (see
12785 [[x-orgodtcontenttemplate-xml][Factory styles]]).  If you need additional
12786 templates you have to define these styles yourself.
12789 To use this feature proceed as follows:
12791 #+attr_texinfo: :table-type table :indic @asis
12792 - Create a table template[fn:140] ::
12794   A table template is nothing but a set of {{{samp(table-cell)}}} and
12795   {{{samp(paragraph)}}} styles for each of the following table cell
12796   categories:
12798     - Body
12799     - First column
12800     - Last column
12801     - First row
12802     - Last row
12803     - Even row
12804     - Odd row
12805     - Even column
12806     - Odd Column
12808   The names for the above styles must be chosen based on the name of the
12809   table template using a well-defined convention.
12811   The naming convention is better illustrated with an example.  For a
12812   table template with the name {{{samp(Custom)}}}, the needed style
12813   names are listed in the following table.
12815   | Table cell type | ~table-cell~ style                     | ~paragraph~ style                           |
12816   |-----------------+----------------------------------------+---------------------------------------------|
12817   | Body            | {{{samp(CustomTableCell)}}}            | {{{samp(CustomTableParagraph)}}}            |
12818   | First column    | {{{samp(CustomFirstColumnTableCell)}}} | {{{samp(CustomFirstColumnTableParagraph)}}} |
12819   | Last column     | {{{samp(CustomLastColumnTableCell)}}}  | {{{samp(CustomLastColumnTableParagraph)}}}  |
12820   | First row       | {{{samp(CustomFirstRowTableCell)}}}    | {{{samp(CustomFirstRowTableParagraph)}}}    |
12821   | Last row        | {{{samp(CustomLastRowTableCell)}}}     | {{{samp(CustomLastRowTableParagraph)}}}     |
12822   | Even row        | {{{samp(CustomEvenRowTableCell)}}}     | {{{samp(CustomEvenRowTableParagraph)}}}     |
12823   | Odd row         | {{{samp(CustomOddRowTableCell)}}}      | {{{samp(CustomOddRowTableParagraph)}}}      |
12824   | Even column     | {{{samp(CustomEvenColumnTableCell)}}}  | {{{samp(CustomEvenColumnTableParagraph)}}}  |
12825   | Odd column      | {{{samp(CustomOddColumnTableCell)}}}   | {{{samp(CustomOddColumnTableParagraph)}}}   |
12828   To create a table template with the name {{{samp(Custom)}}}, define
12829   the above styles in the ~<office:automatic-styles>~ ...
12830   ~</office:automatic-styles>~ element of the content template file (see
12831   [[x-orgodtcontenttemplate-xml][Factory styles]]).
12833 - Define a table style[fn:141] ::
12835   #+vindex: org-export-odt-table-styles
12837   To define a table style, create an entry for the style in the variable
12838   ~org-export-odt-table-styles~ and specify the following:
12840     - the name of the table template created in step (1)
12841     - the set of cell styles in that template that are to be activated
12844   For example, the entry below defines two different table styles
12845   {{{samp(TableWithHeaderRowAndColumn)}}} and
12846   {{{samp(TableWithFirstRowandLastRow)}}} based on the same template
12847   {{{samp(Custom)}}}.  The styles achieve their intended effect by
12848   selectively activating the individual cell styles in that template.
12850   #+header: :eval no
12851   #+header: :exports code
12852   #+begin_src emacs-lisp
12853   (setq org-export-odt-table-styles
12854         (append org-export-odt-table-styles
12855                 '(("TableWithHeaderRowAndColumn" "Custom"
12856                    ((use-first-row-styles . t)
12857                     (use-first-column-styles . t)))
12858                   ("TableWithFirstRowandLastRow" "Custom"
12859                    ((use-first-row-styles . t)
12860                     (use-last-row-styles . t))))))
12861   #+end_src
12863 - Associate a table with the table style ::
12865   To do this, specify the table style created in step (2) as part of
12866   the ~ATTR_ODT~ line as shown below.
12868   #+begin_example
12869      ,#+ATTR_ODT: :style "TableWithHeaderRowAndColumn"
12870      | Name  | Phone | Age |
12871      | Peter |  1234 |  17 |
12872      | Anna  |  4321 |  25 |
12873   #+end_example
12875 **** Validating OpenDocument XML
12876      :PROPERTIES:
12877      :DESCRIPTION: How to debug corrupt OpenDocument files
12878      :END:
12880 Occasionally, you will discover that the document created by the ODT
12881 exporter cannot be opened by your favorite application.  One of the
12882 common reasons for this is that the {{{file(.odt)}}} file is corrupt.
12883 In such cases, you may want to validate the document against the
12884 OpenDocument RELAX NG Compact Syntax (RNC) schema.
12886 For de-compressing the {{{file(.odt)}}} file[fn:142]:
12887 [[info:emacs#File Archives]].  For general help with validation (and
12888 schema-sensitive editing) of XML files: [[info:nxml-mode#Introduction]].
12889 #+vindex: org-export-odt-schema-dir
12891 If you have ready access to OpenDocument {{{file(.rnc)}}} files and
12892 the needed schema-locating rules in a single folder, you can customize
12893 the variable ~org-export-odt-schema-dir~ to point to that directory.
12894 The ODT exporter will take care of updating the
12895 ~rng-schema-locating-files~ for you.
12897 ** TaskJuggler export
12898    :PROPERTIES:
12899    :DESCRIPTION: Exporting to TaskJuggler
12900    :END:
12901 #+cindex: TaskJuggler export
12902 #+cindex: Project management
12904 [[http://www.taskjuggler.org/][TaskJuggler]] is a project management tool.  It provides an optimizing
12905 scheduler that computes your project time lines and resource
12906 assignments based on the project outline and the constraints that you
12907 have provided.
12909 The TaskJuggler exporter is a bit different from other exporters, such
12910 as the ~HTML~ and LaTeX exporters for example, in that it does not
12911 export all the nodes of a document or strictly follow the order of the
12912 nodes in the document.
12914 Instead the TaskJuggler exporter looks for a tree that defines the
12915 tasks and optionally trees that define the resources and reports for
12916 this project.  It then creates a TaskJuggler file based on these trees
12917 and the attributes defined in all the nodes.
12919 *** TaskJuggler export commands
12920     :PROPERTIES:
12921     :DESCRIPTION: Key bindings for TaskJuggler export
12922     :END:
12924 #+attr_texinfo: :table-type table :indic @asis
12925 - {{{kbd(C-c C-e j)}}}, ~org-export-as-taskjuggler~ ::
12926   #+kindex: C-c C-e j
12928   Export as a TaskJuggler file.
12930 - {{{kbd(C-c C-e J)}}}, ~org-export-as-taskjuggler-and-open~ ::
12931   #+kindex: C-c C-e J
12933   Export as a TaskJuggler file and then open the file with TaskJugglerUI
12934   (only for TaskJugglerUI 2.x).
12936 *** Tasks
12937     :PROPERTIES:
12938     :DESCRIPTION: Marking tasks for TaskJuggler export
12939     :END:
12940 #+vindex: org-export-taskjuggler-project-tag
12942 Create your tasks as you usually do with Org mode.  Assign efforts to
12943 each task using properties (it is easiest to do this in the column
12944 view).  You should end up with something similar to the example by
12945 Peter Jones in
12946 [[http://www.contextualdevelopment.com/static/artifacts/articles/2008/project-planning/project-planning.org]].
12947 Now mark the top node of your tasks with a tag named
12948 ~:taskjuggler_project:~ (or whatever you customized
12949 ~org-export-taskjuggler-project-tag~ to).  You are now ready to export
12950 the project plan with {{{kbd(C-c C-e J)}}} which will export the
12951 project plan and open a gantt chart in TaskJugglerUI.
12953 *** Resources
12954     :PROPERTIES:
12955     :DESCRIPTION: Define TaskJuggler resources
12956     :END:
12957 #+vindex: org-export-taskjuggler-resource-tag
12959 Next you can define resources and assign those to work on specific
12960 tasks.  You can group your resources hierarchically.  Tag the top node
12961 of the resources with ~:taskjuggler_resource:~ (or whatever you
12962 customized ~org-export-taskjuggler-resource-tag~ to).  You can
12963 optionally assign an identifier (named {{{samp(resource_id)}}}) to the
12964 resources (using the standard Org properties commands, see [[Property
12965 syntax]]) or you can let the exporter generate identifiers automatically
12966 (the exporter picks the first word of the headline as the identifier
12967 as long as it is unique---see the documentation of
12968 ~org-taskjuggler-get-unique-id~).  Using that identifier you can then
12969 allocate resources to tasks.  This is again done with the
12970 {{{samp(allocate)}}} property on the tasks.  Do this in column view or
12971 when on the task type 
12972 {{{ksksksk(C-c C-x p allocate,RET,<resource_id>,RET)}}}.
12974 Once the allocations are done you can again export to TaskJuggler and
12975 check in the Resource Allocation Graph which person is working on what
12976 task at what time.
12978 *** Export of properties
12979     :PROPERTIES:
12980     :DESCRIPTION: Which properties will be exported?
12981     :END:
12983 The exporter also takes TODO state information into consideration,
12984 i.e., if a task is marked as done it will have the corresponding
12985 attribute in TaskJuggler ({{{samp(complete 100)}}}).  Scheduling
12986 information is also taken into account to set start/end dates for
12987 tasks.
12989 The exporter will also export any property on a task resource or
12990 resource node which is known to TaskJuggler, such as
12991 {{{samp(limits)}}}, {{{samp(vacation)}}}, {{{samp(shift)}}},
12992 {{{samp(booking)}}}, {{{samp(efficiency)}}}, {{{samp(journalentry)}}},
12993 {{{samp(rate)}}} for resources or {{{samp(account)}}},
12994 {{{samp(start)}}}, {{{samp(note)}}}, {{{samp(duration)}}},
12995 {{{samp(end)}}}, {{{samp(journalentry)}}}, {{{samp(milestone)}}},
12996 {{{samp(reference)}}}, {{{samp(responsible)}}},
12997 {{{samp(scheduling)}}}, etc for tasks.
12999 *** Dependencies
13000     :PROPERTIES:
13001     :DESCRIPTION: How the exporter handles dependencies
13002     :END:
13004 The exporter will handle dependencies that are defined in the tasks
13005 either with the {{{samp(ORDERED)}}} attribute (see [[TODO dependencies]]),
13006 with the {{{samp(BLOCKER)}}} attribute (see {{{file(org-depend.el)}}})
13007 or alternatively with a {{{samp(depends)}}} attribute.  Both the
13008 {{{samp(BLOCKER)}}} and the {{{samp(depends)}}} attribute can be
13009 either {{{samp(previous-sibling)}}} or a reference to an identifier
13010 (named {{{samp(task_id)}}}) which is defined for another task in the
13011 project.  {{{samp(BLOCKER)}}} and the {{{samp(depends)}}} attribute can
13012 define multiple dependencies separated by either space or comma.  You
13013 can also specify optional attributes on the dependency by simply
13014 appending it.  The following examples should illustrate this:
13016 #+begin_example
13017    ,* Preparation
13018    ,  :PROPERTIES:
13019    ,  :task_id:  preparation
13020    ,  :ORDERED:  t
13021    ,  :END:
13022    ,* Training material
13023    ,  :PROPERTIES:
13024    ,  :task_id:  training_material
13025    ,  :ORDERED:  t
13026    ,  :END:
13027    ,** Markup Guidelines
13028    ,   :PROPERTIES:
13029    ,   :Effort:   2d
13030    ,   :END:
13031    ,** Workflow Guidelines
13032    ,   :PROPERTIES:
13033    ,   :Effort:   2d
13034    ,   :END:
13035    ,* Presentation
13036    ,  :PROPERTIES:
13037    ,  :Effort:   2d
13038    ,  :BLOCKER:  training_material { gapduration 1d } preparation
13039    ,  :END:
13040 #+end_example
13042 *** Reports
13043     :PROPERTIES:
13044     :DESCRIPTION: Gantt charts, etc.
13045     :END:
13046 #+vindex: org-export-taskjuggler-default-reports
13048 TaskJuggler can produce many kinds of reports (e.g., gantt chart,
13049 resource allocation, etc).  The user defines what kind of reports
13050 should be generated for a project in the TaskJuggler file.  By default,
13051 the exporter will automatically insert some pre-set reports in the
13052 file.  These defaults are defined in
13053 ~org-export-taskjuggler-default-reports~.  They can be modified using
13054 customize along with a number of other options.  For a more complete
13055 list, see 
13056 {{{ksksksk(M-x customize-group,RET,org-export-taskjuggler,RET)}}}.
13058 Alternately, the user can tag a tree with
13059 ~org-export-taskjuggler-report-tag~, and define reports in sub-nodes,
13060 similarly to what is done with tasks or resources.  The properties used
13061 for report generation are defined in
13062 ~org-export-taskjuggler-valid-report-attributes~.  In addition, a
13063 special property named {{{samp(report-kind)}}} is used to define the
13064 kind of report one wants to generate (by default, a
13065 {{{samp(taskreport)}}}).
13067 For more information and examples see the Org-taskjuggler tutorial at
13068 [[http://orgmode.org/worg/org-tutorials/org-taskjuggler.html]].
13070 ** Freemind export
13071    :PROPERTIES:
13072    :DESCRIPTION: Exporting to Freemind mind maps
13073    :END:
13074 #+cindex: Freemind export
13075 #+cindex: mind map
13077 The Freemind exporter was written by Lennart Borgman.
13079 #+attr_texinfo: :table-type table :indic @asis
13080 - {{{kbd(C-c C-e m)}}}, ~org-export-as-freemind~ ::
13081   #+kindex: C-c C-e m
13083   Export as a Freemind mind map.  For an Org file {{{file(myfile.org)}}},
13084   the Freemind file will be {{{file(myfile.mm)}}}.
13086 ** XOXO export
13087    :PROPERTIES:
13088    :DESCRIPTION: Exporting to XOXO
13089    :END:
13090 #+cindex: XOXO export
13092 Org mode contains an exporter that produces XOXO-style output.
13093 Currently, this exporter only handles the general outline structure
13094 and does not interpret any additional Org mode features.
13096 #+attr_texinfo: :table-type table :indic @asis
13097 - {{{kbd(C-c C-e x)}}}, ~org-export-as-xoxo~ ::
13098   #+kindex: C-c C-e x
13100   Export as an XOXO file.  For an Org file {{{file(myfile.org)}}}, the
13101   XOXO file will be {{{file(myfile.html)}}}.
13103 - {{{kbd(C-c C-e v x)}}} ::
13104   #+kindex: C-c C-e v x
13106   Export only the visible part of the document.
13108 ** iCalendar export
13109    :PROPERTIES:
13110    :DESCRIPTION: Exporting to iCalendar format
13111    :END:
13112 #+cindex: iCalendar export
13114 #+vindex: org-icalendar-include-todo
13115 #+vindex: org-icalendar-use-deadline
13116 #+vindex: org-icalendar-use-scheduled
13117 #+vindex: org-icalendar-categories
13118 #+vindex: org-icalendar-alarm-time
13120 Some people use Org mode for keeping track of projects, but still
13121 prefer a standard calendar application for anniversaries and
13122 appointments.  In this case it can be useful to show deadlines and
13123 other time-stamped items in Org files in the calendar application.  Org
13124 mode can export calendar information in the standard iCalendar format.
13125 If you also want to have TODO entries included in the export,
13126 configure the variable ~org-icalendar-include-todo~.  Plain timestamps
13127 are exported as VEVENT, and TODO items as VTODO.  It will also create
13128 events from deadlines that are in non-TODO items.  Deadlines and
13129 scheduling dates in TODO items will be used to set the start and due
13130 dates for the TODO entry.[fn:143] As categories, it will use the tags
13131 locally defined in the heading, and the file/tree category.[fn:144]
13132 See the variable ~org-icalendar-alarm-time~ for a way to assign alarms
13133 to entries with a time.
13135 #+vindex: org-icalendar-store-UID
13136 #+cindex: property, ID
13138 The iCalendar standard requires each entry to have a globally unique
13139 identifier (UID).  Org creates these identifiers during export.  If you
13140 set the variable ~org-icalendar-store-UID~, the UID will be stored in
13141 the ~:ID:~ property of the entry and re-used next time you report this
13142 entry.  Since a single entry can give rise to multiple iCalendar
13143 entries (as a timestamp, a deadline, a scheduled item, and as a TODO
13144 item), Org adds prefixes to the UID, depending on what triggered the
13145 inclusion of the entry.  In this way the UID remains unique, but a
13146 synchronization program can still figure out from which entry all the
13147 different instances originate.
13149 #+attr_texinfo: :table-type table :indic @asis
13150 - {{{kbd(C-c C-e i)}}}, ~org-export-icalendar-this-file~ ::
13151   #+kindex: C-c C-e i
13153   Create iCalendar entries for the current file and store them in the
13154   same directory, using a file extension {{{file(.ics)}}}.
13156 - {{{kbd(C-c C-e I)}}}, ~ org-export-icalendar-all-agenda-files~ ::
13157   #+kindex: C-c C-e I
13158   #+vindex: org-agenda-files
13160   Like {{{kbd(C-c C-e i)}}}, but do this for all files in
13161   ~org-agenda-files~.  For each of these files, a separate iCalendar file
13162   will be written.
13164 - {{{kbd(C-c C-e c)}}}, ~org-export-icalendar-combine-agenda-files~ ::
13165   #+kindex: C-c C-e c
13166   #+vindex: org-combined-agenda-icalendar-file
13168   Create a single large iCalendar file from all files in
13169   ~org-agenda-files~ and write it to the file given by
13170   ~org-combined-agenda-icalendar-file~.
13173 #+vindex: org-use-property-inheritance
13174 #+vindex: org-icalendar-include-body
13175 #+cindex: property, SUMMARY
13176 #+cindex: property, DESCRIPTION
13177 #+cindex: property, LOCATION
13179 The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
13180 the selected entries have them.[fn:145] If not, the summary will be
13181 derived from the headline, and the description from the body (limited
13182 to ~org-icalendar-include-body~ characters).
13184 How this calendar is best read and updated, depends on the application
13185 you are using.  The FAQ covers this issue.
13187 * Publishing
13188   :PROPERTIES:
13189   :DESCRIPTION: Create a web site of linked Org files
13190   :END:
13191 #+cindex: publishing
13192 #+cindex: O'Toole, David
13194 Org includes a publishing management system that allows you to
13195 configure automatic HTML conversion of /projects/ composed of
13196 interlinked org files.  You can also configure Org to automatically
13197 upload your exported HTML pages and related attachments, such as
13198 images and source code files, to a web server.
13200 You can also use Org to convert files into PDF, or even combine HTML
13201 and PDF conversion so that files are available in both formats on the
13202 server.
13204 Publishing has been contributed to Org by David O'Toole.
13206 ** Configuration
13207    :PROPERTIES:
13208    :DESCRIPTION: Defining projects
13209    :END:
13210 Publishing needs significant configuration to specify files,
13211 destination and many other properties of a project.
13213 *** Project alist
13214     :PROPERTIES:
13215     :DESCRIPTION: The central configuration variable
13216     :TITLE:    The variable ~org-publish-project-alist~
13217     :END:
13218 #+cindex: org-publish-project-alist
13219 #+cindex: projects, for publishing
13220 #+vindex: org-publish-project-alist
13222 Publishing is configured almost entirely through setting the value of
13223 one variable, called ~org-publish-project-alist~.  Each element of the
13224 list configures one project, and may be in one of the two following
13225 forms:
13227 #+header: :eval no
13228 #+header: :exports code
13229 #+begin_src emacs-lisp
13230    ("project-name" :property value :property value ...)
13231 #+end_src
13233 i.e., a well-formed property list with alternating keys and values,
13236 #+header: :eval no
13237 #+header: :exports code
13238 #+begin_src emacs-lisp
13239    ("project-name" :components ("project-name" "project-name" ...))
13240 #+end_src
13242 In both cases, projects are configured by specifying property values.
13243 A project defines the set of files that will be published, as well as
13244 the publishing configuration to use when publishing those files.  When
13245 a project takes the second form listed above, the individual members
13246 of the ~:components~ property are taken to be sub-projects, which
13247 group together files requiring different publishing options.  When you
13248 publish such a "meta-project," all the components will also be
13249 published, in the sequence given.
13251 *** Sources and destinations
13252     :PROPERTIES:
13253     :DESCRIPTION: From here to there
13254     :TITLE:    Sources and destinations for files
13255     :END:
13256 #+cindex: directories, for publishing
13258 Most properties are optional, but some should always be set.  In
13259 particular, Org needs to know where to look for source files, and
13260 where to put published files.
13262 #+attr_texinfo: :table-type table :indic @asis
13263 - ~:base-directory~ ::
13265   Directory containing publishing source files
13267 - ~:publishing-directory~ ::
13269   Directory where output files will be published.  You can directly
13270   publish to a webserver using a file name syntax appropriate for the
13271   Emacs {{{file(tramp)}}} package.  Or you can publish to a local
13272   directory and use external tools to upload your website 
13273   (see [[Uploading files]]).
13275 - ~:preparation-function~ ::
13277   Function or list of functions to be called before starting the
13278   publishing process, for example, to run ~make~ for updating files to
13279   be published.  The project property list is scoped into this call as
13280   the variable ~project-plist~.
13282 - ~:completion-function~ ::
13284   Function or list of functions called after finishing the publishing
13285   process, for example, to change permissions of the resulting files.
13286   The project property list is scoped into this call as the variable
13287   ~project-plist~.
13289 *** Selecting files
13290     :PROPERTIES:
13291     :DESCRIPTION: What files are part of the project?
13292     :END:
13293 #+cindex: files, selecting for publishing
13295 By default, all files with extension {{{file(.org)}}} in the base directory
13296 are considered part of the project.  This can be modified by setting the
13297 following properties:
13299 #+attr_texinfo: :table-type table :indic @asis
13300 - ~:base-extension~ ::
13302   Extension (without the dot!) of source files.  This actually is a
13303   regular expression.  Set this to the symbol ~any~ if you want to get
13304   all files in ~:base-directory~, even without extension.
13306 - ~:exclude~ ::
13308   Regular expression to match file names that should not be published,
13309   even though they have been selected on the basis of their extension.
13311 - ~:include~ ::
13313   List of files to be included regardless of ~:base-extension~ and
13314   ~:exclude~.
13316 - ~:recursive~ ::
13318   Non-nil means, check base-directory recursively for files to publish.
13320 *** Publishing action
13321     :PROPERTIES:
13322     :DESCRIPTION: Setting the function doing the publishing
13323     :END:
13324 #+cindex: action, for publishing
13326 Publishing means that a file is copied to the destination directory and
13327 possibly transformed in the process.  The default transformation is to export
13328 Org files as HTML files, and this is done by the function
13329 ~org-publish-org-to-html~ which calls the HTML exporter (see [[HTML
13330 export]]).  But you also can publish your content as PDF files using
13331 ~org-publish-org-to-pdf~, or as ~ascii~, ~latin1~ or
13332 ~utf8~ encoded files using the corresponding functions.  If you want to
13333 publish the Org file itself, but with /archived/, /commented/, and
13334 /tag-excluded/ trees removed, use ~org-publish-org-to-org~ and set the
13335 parameters ~:plain-source~ and/or ~:htmlized-source~.  This will
13336 produce {{{file(file.org)}}} and {{{file(file.org.html)}}} in the publishing
13337 directory.[fn:146]  Other files like images only need to be copied to the
13338 publishing destination; for this you may use ~org-publish-attachment~.
13339 For non-Org files, you always need to specify the publishing function:
13341 #+attr_texinfo: :table-type table :indic @asis
13342 - ~:publishing-function~ ::
13344   Function executing the publication of a file.  This may also be a list
13345   of functions, which will all be called in turn.
13347 - ~:plain-source~ ::
13349   Non-nil means, publish plain source.
13351 - ~:htmlized-source~ ::
13353   Non-nil means, publish htmlized source.
13356 The function must accept three arguments: a property list containing
13357 at least a ~:publishing-directory~ property, the name of the file to
13358 be published, and the path to the publishing directory of the output
13359 file.  It should take the specified file, make the necessary
13360 transformation (if any) and place the result into the destination
13361 folder.
13363 *** Publishing options
13364     :PROPERTIES:
13365     :DESCRIPTION: Tweaking HTML/LaTeX export
13366     :END:
13367 #+cindex: options, for publishing
13369 The property list can be used to set many export options for the HTML
13370 and LaTeX exporters.  In most cases, these properties correspond to user
13371 variables in Org.  The table below lists these properties along
13372 with the variable they belong to.  See the documentation string for the
13373 respective variable for details.
13375 #+vindex: org-export-html-link-up
13376 #+vindex: org-export-html-link-home
13377 #+vindex: org-export-default-language
13378 #+vindex: org-display-custom-times
13379 #+vindex: org-export-headline-levels
13380 #+vindex: org-export-with-section-numbers
13381 #+vindex: org-export-section-number-format
13382 #+vindex: org-export-with-toc
13383 #+vindex: org-export-preserve-breaks
13384 #+vindex: org-export-with-archived-trees
13385 #+vindex: org-export-with-emphasize
13386 #+vindex: org-export-with-sub-superscripts
13387 #+vindex: org-export-with-special-strings
13388 #+vindex: org-export-with-footnotes
13389 #+vindex: org-export-with-drawers
13390 #+vindex: org-export-with-tags
13391 #+vindex: org-export-with-todo-keywords
13392 #+vindex: org-export-with-tasks
13393 #+vindex: org-export-with-done-tasks
13394 #+vindex: org-export-with-priority
13395 #+vindex: org-export-with-TeX-macros
13396 #+vindex: org-export-with-LaTeX-fragments
13397 #+vindex: org-export-skip-text-before-1st-heading
13398 #+vindex: org-export-with-fixed-width
13399 #+vindex: org-export-with-timestamps
13400 #+vindex: org-export-author-info
13401 #+vindex: org-export-email-info
13402 #+vindex: org-export-creator-info
13403 #+vindex: org-export-time-stamp-file
13404 #+vindex: org-export-with-tables
13405 #+vindex: org-export-highlight-first-table-line
13406 #+vindex: org-export-html-style-include-default
13407 #+vindex: org-export-html-style-include-scripts
13408 #+vindex: org-export-html-style
13409 #+vindex: org-export-html-style-extra
13410 #+vindex: org-export-html-link-org-files-as-html
13411 #+vindex: org-export-html-inline-images
13412 #+vindex: org-export-html-extension
13413 #+vindex: org-export-html-table-tag
13414 #+vindex: org-export-html-expand
13415 #+vindex: org-export-html-with-timestamp
13416 #+vindex: org-export-publishing-directory
13417 #+vindex: org-export-html-preamble
13418 #+vindex: org-export-html-postamble
13419 #+vindex: user-full-name
13420 #+vindex: user-mail-address
13421 #+vindex: org-export-select-tags
13422 #+vindex: org-export-exclude-tags
13424 #+attr_texinfo: :table-type table :indic @asis
13425 - ~:link-up~ :: ~org-export-html-link-up~
13426 - ~:link-home~ :: ~org-export-html-link-home~
13427 - ~:language~ :: ~org-export-default-language~
13428 - ~:customtime~ :: ~org-display-custom-times~
13429 - ~:headline-levels~ :: ~org-export-headline-levels~
13430 - ~:section-numbers~ :: ~org-export-with-section-numbers~
13431 - ~:section-number-format~ :: ~org-export-section-number-format~
13432 - ~:table-of-contents~ :: ~org-export-with-toc~
13433 - ~:preserve-breaks~ :: ~org-export-preserve-breaks~
13434 - ~:archived-trees~ :: ~org-export-with-archived-trees~
13435 - ~:emphasize~ :: ~org-export-with-emphasize~
13436 - ~:sub-superscript~ :: ~org-export-with-sub-superscripts~
13437 - ~:special-strings~ :: ~org-export-with-special-strings~
13438 - ~:footnotes~ :: ~org-export-with-footnotes~
13439 - ~:drawers~ :: ~org-export-with-drawers~
13440 - ~:tags~ :: ~org-export-with-tags~
13441 - ~:todo-keywords~ :: ~org-export-with-todo-keywords~
13442 - ~:tasks~ :: ~org-export-with-tasks~
13443 - ~:priority~ :: ~org-export-with-priority~
13444 - ~:TeX-macros~ :: ~org-export-with-TeX-macros~
13445 - ~:LaTeX-fragments~ :: ~org-export-with-LaTeX-fragments~
13446 - ~:latex-listings~ :: ~org-export-latex-listings~
13447 - ~:skip-before-1st-heading~ :: ~org-export-skip-text-before-1st-heading~
13448 - ~:fixed-width~ :: ~org-export-with-fixed-width~
13449 - ~:timestamps~ :: ~org-export-with-timestamps~
13450 - ~:author~ :: ~user-full-name~
13451 - ~:email~ :: ~user-mail-address~ : ~addr;addr;..~
13452 - ~:author-info~ :: ~org-export-author-info~
13453 - ~:email-info~ :: ~org-export-email-info~
13454 - ~:creator-info~ :: ~org-export-creator-info~
13455 - ~:tables~ :: ~org-export-with-tables~
13456 - ~:table-auto-headline~ :: ~org-export-highlight-first-table-line~
13457 - ~:style-include-default~ :: ~org-export-html-style-include-default~
13458 - ~:style-include-scripts~ :: ~org-export-html-style-include-scripts~
13459 - ~:style~ :: ~org-export-html-style~
13460 - ~:style-extra~ :: ~org-export-html-style-extra~
13461 - ~:convert-org-links~ :: ~org-export-html-link-org-files-as-html~
13462 - ~:inline-images~ :: ~org-export-html-inline-images~
13463 - ~:html-extension~ :: ~org-export-html-extension~
13464 - ~:html-preamble~ :: ~org-export-html-preamble~
13465 - ~:html-postamble~ :: ~org-export-html-postamble~
13466 - ~:xml-declaration~ :: ~org-export-html-xml-declaration~
13467 - ~:html-table-tag~ :: ~org-export-html-table-tag~
13468 - ~:expand-quoted-html~ :: ~org-export-html-expand~
13469 - ~:timestamp~ :: ~org-export-html-with-timestamp~
13470 - ~:publishing-directory~ :: ~org-export-publishing-directory~
13471 - ~:select-tags~ :: ~org-export-select-tags~
13472 - ~:exclude-tags~ :: ~org-export-exclude-tags~
13473 - ~:latex-image-options~ :: ~org-export-latex-image-default-option~
13476 Most of the ~org-export-with-*~ variables have the same effect in both
13477 HTML and LaTeX exporters, except for ~:TeX-macros~ and
13478 ~:LaTeX-fragments~ options, respectively ~nil~ and ~t~ in the LaTeX
13479 export.  See ~org-export-plist-vars~ to check this list of options.
13481 #+vindex: org-publish-project-alist
13483 When a property is given a value in ~org-publish-project-alist~, its
13484 setting overrides the value of the corresponding user variable (if
13485 any) during publishing.  Options set within a file (see [[Export
13486 options]]), however, override everything.
13488 *** Publishing links
13489     :PROPERTIES:
13490     :DESCRIPTION: Which links keep working after publishing?
13491     :END:
13492 #+cindex: links, publishing
13494 To create a link from one Org file to another, you would use something
13495 like ~[[file:foo.org][The foo]]~ or simply ~[[file:foo.org]]~ (see
13496 [[Hyperlinks]]).  When published, this link becomes a link to
13497 {{{file(foo.html)}}}.  In this way, you can interlink the pages of your
13498 "org web" project and the links will work as expected when you publish
13499 them to HTML.  If you also publish the Org source file and want to link
13500 to that, use an ~http:~ link instead of a ~file:~ link, because
13501 ~file:~ links are converted to link to the corresponding
13502 {{{file(html)}}} file.
13504 You may also link to related files, such as images.  Provided you are
13505 careful with relative file names, and provided you have also
13506 configured Org to upload the related files, these links will work too.
13507 See [[Complex example]], for an example of this usage.
13509 Sometimes an Org file to be published may contain links that are only
13510 valid in your production environment, but not in the publishing
13511 location.  In this case, use the following property to define a
13512 function for checking link validity:
13514 #+attr_texinfo: :table-type table :indic @asis
13515 - ~:link-validation-function~ ::
13516   Function to validate links
13519 {{{noindent}}} This function must accept two arguments, the file name
13520 and a directory relative to which the file name is interpreted in the
13521 production environment.  If this function returns ~nil~, then the HTML
13522 generator will only insert a description into the HTML file, but no
13523 link.  One option for this function is ~org-publish-validate-link~
13524 which checks if the given file is part of any project in
13525 ~org-publish-project-alist~.
13527 *** Site map
13528     :PROPERTIES:
13529     :DESCRIPTION: Generating a list of all pages
13530     :TITLE:    Generating a sitemap
13531     :END:
13532 #+cindex: sitemap, of published pages
13534 The following properties may be used to control publishing of
13535 a map of files for a given project.
13537 #+attr_texinfo: :table-type table :indic @asis
13538 - ~:auto-sitemap~ ::
13540   When non-nil, publish a sitemap during ~org-publish-current-project~
13541   or ~org-publish-all~.
13543 - ~:sitemap-filename~ ::
13545   Filename for output of sitemap.  Defaults to {{{file(sitemap.org)}}} (which
13546   becomes {{{file(sitemap.html)}}}).
13548 - ~:sitemap-title~ ::
13550   Title of sitemap page.  Defaults to name of file.
13552 - ~:sitemap-function~ ::
13554   Plug-in function to use for generation of the sitemap.  Defaults to
13555   ~org-publish-org-sitemap~, which generates a plain list of links to
13556   all files in the project.
13558 - ~:sitemap-sort-folders~ ::
13560   Where folders should appear in the sitemap.  Set this to ~first~
13561   (default) or ~last~ to display folders first or last, respectively.
13562   Any other value will mix files and folders.
13564 - ~:sitemap-sort-files~ ::
13566   How the files are sorted in the site map.  Set this to ~alphabetically~
13567   (default), ~chronologically~ or ~anti-chronologically~.
13568   ~chronologically~ sorts the files with older date first while
13569   ~anti-chronologically~ sorts the files with newer date first.
13570   ~alphabetically~ sorts the files alphabetically.  The date of a file is
13571   retrieved with ~org-publish-find-date~.
13573 - ~:sitemap-ignore-case~ ::
13575   Should sorting be case-sensitive?  Default ~nil~.
13577 - ~:sitemap-file-entry-format~ ::
13579   With this option one can tell how a sitemap's entry is formatted in
13580   the sitemap.  This is a format string with some escape sequences: ~%t~
13581   stands for the title of the file, ~%a~ stands for the author of the
13582   file and ~%d~ stands for the date of the file.  The date is retrieved
13583   with the ~org-publish-find-date~ function and formatted with
13584   ~org-publish-sitemap-date-format~.  Default ~%t~.
13586 - ~:sitemap-date-format~ ::
13588   Format string for the ~format-time-string~ function that tells how a
13589   sitemap entry's date is to be formatted.  This property bypasses
13590   ~org-publish-sitemap-date-format~ which defaults to ~%Y-%m-%d~.
13592 - ~:sitemap-sans-extension~ ::
13594   When non-nil, remove filenames' extensions from the generated sitemap.
13595   Useful to have cool URIs (see [[http://www.w3.org/Provider/Style/URI]]).
13596   Defaults to ~nil~.
13598 *** Generating an index
13599     :PROPERTIES:
13600     :DESCRIPTION: An index that reaches across pages
13601     :END:
13602 #+cindex: index, in a publishing project
13604 Org mode can generate an index across the files of a publishing project.
13606 #+attr_texinfo: :table-type table :indic @asis
13607 - ~:makeindex~ ::
13609   When non-nil, generate in index in the file {{{file(theindex.org)}}}
13610   and publish it as {{{file(theindex.html)}}}.
13613 The file will be created when first publishing a project with the
13614 ~:makeindex~ set.  The file only contains a statement
13615 {{{samp(#+INCLUDE: "theindex.inc")}}}.  You can then build around this
13616 include statement by adding a title, style information, etc.
13618 ** Uploading files
13619    :PROPERTIES:
13620    :DESCRIPTION: How to get files up on the server
13621    :END:
13622 #+cindex: rsync
13623 #+cindex: unison
13625 For those people already utilizing third party sync tools such as
13626 {{{command(rsync)}}} or {{{command(unison)}}}, it might be preferable
13627 not to use the built in remote publishing facilities of Org mode
13628 which rely heavily on Tramp.  Tramp, while very useful and powerful,
13629 tends not to be so efficient for multiple file transfer and has been
13630 known to cause problems under heavy usage.
13632 Specialized synchronization utilities offer several advantages.  In
13633 addition to timestamp comparison, they also do content and
13634 permissions/attribute checks.  For this reason you might prefer to
13635 publish your web to a local directory (possibly even in place with
13636 your Org files) and then use {{{file(unison)}}} or {{{file(rsync)}}}
13637 to do the synchronization with the remote host.
13639 Since Unison (for example) can be configured as to which files to
13640 transfer to a certain remote destination, it can greatly simplify the
13641 project publishing definition.  Simply keep all files in the correct
13642 location, process your Org files with ~org-publish~ and let the
13643 synchronization tool do the rest.  You do not need, in this scenario,
13644 to include attachments such as {{{file(jpg)}}}, {{{file(css)}}} or
13645 {{{file(gif)}}} files in the project definition since the 3rd party
13646 tool syncs them.
13648 Publishing to a local directory is also much faster than to a remote
13649 one, so that you can afford more easily to republish entire projects.
13650 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
13651 main benefit of re-including any changed external files such as source
13652 example files you might include with ~#+INCLUDE:~.  The timestamp
13653 mechanism in Org is not smart enough to detect if included files have
13654 been modified.
13656 ** Sample configuration
13657    :PROPERTIES:
13658    :DESCRIPTION: Example projects
13659    :END:
13660 Below we provide two example configurations.  The first one is a simple
13661 project publishing only a set of Org files.  The second example is
13662 more complex, with a multi-component project.
13664 *** Simple example
13665     :PROPERTIES:
13666     :DESCRIPTION: One-component publishing
13667     :TITLE:    Example: simple publishing configuration
13668     :END:
13669 This example publishes a set of Org files to the {{{file(public_html)}}}
13670 directory on the local machine.
13672 #+header: :eval no
13673 #+header: :exports code
13674 #+begin_src emacs-lisp
13675 (setq org-publish-project-alist
13676       '(("org"
13677          :base-directory "~/org/"
13678          :publishing-directory "~/public_html"
13679          :section-numbers nil
13680          :table-of-contents nil
13681          :style "<link rel=\"stylesheet\"
13682                 href=\"../other/mystyle.css\"
13683                 type=\"text/css\"/>")))
13684 #+end_src
13686 *** Complex example
13687     :PROPERTIES:
13688     :DESCRIPTION: A multi-component publishing example
13689     :TITLE:    Example: complex publishing configuration
13690     :END:
13691 This more complicated example publishes an entire website, including
13692 Org files converted to HTML, image files, Emacs Lisp source code, and
13693 style sheets.  The publishing directory is remote and private files are
13694 excluded.
13696 To ensure that links are preserved, care should be taken to replicate
13697 your directory structure on the web server, and to use relative file
13698 paths.  For example, if your Org files are kept in {{{file(~/org)}}}
13699 and your publishable images in {{{file(~/images)}}}, you would link to
13700 an image with
13702 #+begin_example
13703    file:../images/myimage.png
13704 #+end_example
13706 On the web server, the relative path to the image should be the
13707 same.  You can accomplish this by setting up an "images" folder in the
13708 right place on the web server, and publishing images to it.
13710 #+header: :eval no
13711 #+header: :exports code
13712 #+begin_src emacs-lisp
13713 (setq org-publish-project-alist
13714       '(("orgfiles"
13715           :base-directory "~/org/"
13716           :base-extension "org"
13717           :publishing-directory "/ssh:user@@host:~/html/notebook/"
13718           :publishing-function org-publish-org-to-html
13719           :exclude "PrivatePage.org"   ;; regexp
13720           :headline-levels 3
13721           :section-numbers nil
13722           :table-of-contents nil
13723           :style "<link rel=\"stylesheet\"
13724                   href=\"../other/mystyle.css\" type=\"text/css\"/>"
13725           :html-preamble t)
13727          ("images"
13728           :base-directory "~/images/"
13729           :base-extension "jpg\\|gif\\|png"
13730           :publishing-directory "/ssh:user@@host:~/html/images/"
13731           :publishing-function org-publish-attachment)
13733          ("other"
13734           :base-directory "~/other/"
13735           :base-extension "css\\|el"
13736           :publishing-directory "/ssh:user@@host:~/html/other/"
13737           :publishing-function org-publish-attachment)
13738          ("website" :components ("orgfiles" "images" "other"))))
13739 #+end_src
13741 ** Triggering publication
13742    :PROPERTIES:
13743    :DESCRIPTION: Publication commands
13744    :END:
13745 Once properly configured, Org can publish with the following commands:
13747 #+attr_texinfo: :table-type table :indic @asis
13748 - {{{kbd(C-c C-e X)}}}, ~org-publish~ ::
13749   #+kindex: C-c C-e X
13750   
13751   Prompt for a specific project and publish all files that belong to it.
13753 - {{{kbd(C-c C-e P)}}}, ~org-publish-current-project~ ::
13754   #+kindex: C-c C-e P
13756   Publish the project containing the current file.
13758 - {{{kbd(C-c C-e F)}}}, ~org-publish-current-file~ ::
13759   #+kindex: C-c C-e F
13761   Publish only the current file.
13763 - {{{kbd(C-c C-e E)}}}, ~org-publish-all~ ::
13764   #+kindex: C-c C-e E
13766   Publish every project.
13769 #+vindex: org-publish-use-timestamps-flag
13771 Org uses timestamps to track when a file has changed.  The above
13772 functions normally only publish changed files.  You can override this
13773 and force publishing of all files by giving a prefix argument to any
13774 of the commands above, or by customizing the variable
13775 ~org-publish-use-timestamps-flag~.  This may be necessary in particular
13776 if files include other files via ~#+SETUPFILE:~ or ~#+INCLUDE:~.
13778 * Working with source code
13779   :PROPERTIES:
13780   :DESCRIPTION: Export, evaluate, and tangle code blocks
13781   :ALT_TITLE: Working With Source Code
13782   :END:
13783 #+cindex: Schulte, Eric
13784 #+cindex: Davison, Dan
13785 #+cindex: source code, working with
13787 Source code can be included in Org mode documents using a
13788 {{{samp(src)}}} block, e.g.:
13790 #+begin_example
13791    #+BEGIN_SRC emacs-lisp
13792      (defun org-xor (a b)
13793         "Exclusive or."
13794         (if a (not b) b))
13795    #+END_SRC
13796 #+end_example
13798 Org mode provides a number of features for working with live source
13799 code, including editing of code blocks in their native major-mode,
13800 evaluation of code blocks, converting code blocks into source files
13801 (known as "tangling" in literate programming), and exporting code
13802 blocks and their results in several formats.  This functionality was
13803 contributed by Eric Schulte and Dan Davison, and was originally named
13804 Org-babel.
13806 The following sections describe Org mode's code block handling facilities.
13808 ** Structure of code blocks
13809    :PROPERTIES:
13810    :DESCRIPTION: Code block syntax described
13811    :END:
13812 #+cindex: code block, structure
13813 #+cindex: source code, block structure
13814 #+cindex: #+NAME
13815 #+cindex: #+BEGIN_SRC
13817 Live code blocks can be specified with a {{{samp(src)}}} block or
13818 inline.[fn:147] The structure of a {{{samp(src)}}} block is shown in
13819 the following example:
13821 #+begin_example
13822    ,#+NAME: <name>
13823    ,#+BEGIN_SRC <language> <switches> <header arguments>
13824      <body>
13825    ,#+END_SRC
13826 #+end_example
13828 The ~#+NAME:~ line is optional, and can be used to name the code
13829 block.  Live code blocks require that a language be specified on the
13830 ~#+BEGIN_SRC~ line.  Switches and header arguments are optional.
13831 #+cindex: source code, inline
13833 Live code blocks can also be specified inline using the following
13834 syntax:
13836 #+begin_example
13837    src_<language>{<body>}
13838 #+end_example
13842 #+begin_example
13843    src_<language>[<header arguments>]{<body>}
13844 #+end_example
13846 #+attr_texinfo: :table-type table :indic @asis
13847 - ~<#+NAME: name>~ ::
13848   #+cindex: #+NAME
13850   This line associates a name with the code block.  This is similar to
13851   the ~#+TBLNAME: NAME~ lines that can be used to name tables in Org
13852   mode files.  Referencing the name of a code block makes it possible to
13853   evaluate the block from other places in the file, from other files, or
13854   from Org mode table formulas (see [[The spreadsheet]]).  Names are assumed
13855   to be unique and the behavior of Org mode when two or more blocks
13856   share the same name is undefined.
13858 - ~<language>~ ::
13859   #+cindex: source code, language
13861   The language of the code in the block (see [[Languages]]).
13863 - ~<switches>~ ::
13864   #+cindex: source code, switches
13866   Optional switches control code block export (see the discussion of
13867   switches in [[Literal examples]]).
13869 - ~<header arguments>~ ::
13870   #+cindex: source code, header arguments
13872   Optional header arguments control many aspects of evaluation, export
13873   and tangling of code blocks (see [[Header arguments]]).  Header arguments
13874   can also be set on a per-buffer or per-subtree basis using properties.
13876 - ~<body>~ ::
13878   Source code in the specified language.
13880 ** Editing source code
13881    :PROPERTIES:
13882    :DESCRIPTION: Language major-mode editing
13883    :END:
13884 #+cindex: code block, editing
13885 #+cindex: source code, editing
13886 #+kindex: C-c '
13888 Use {{{kbd(C-c ')}}} to edit the current code block.  This brings up a
13889 language major-mode edit buffer containing the body of the code block.
13890 Saving this buffer will write the new contents back to the Org buffer.
13891 Use {{{kbd(C-c ')}}} again to exit.
13893 The ~org-src-mode~ minor mode will be active in the edit buffer.  The
13894 following variables can be used to configure the behavior of the edit
13895 buffer.  See also the customization group ~org-edit-structure~ for
13896 further configuration options.
13898 #+attr_texinfo: :table-type table :indic @asis
13899 - ~org-src-lang-modes~ ::
13901   If an Emacs major-mode named ~<lang>-mode~ exists, where
13902   ~<lang>~ is the language named in the header line of the code block,
13903   then the edit buffer will be placed in that major-mode.  This variable
13904   can be used to map arbitrary language names to existing major modes.
13906 - ~org-src-window-setup~ ::
13908   Controls the way Emacs windows are rearranged when the edit buffer is
13909   created.
13911 - ~org-src-preserve-indentation~ ::
13913   This variable is especially useful for tangling languages such as
13914   Python, in which whitespace indentation in the output is meaningful.
13916 - ~org-src-ask-before-returning-to-edit-buffer~ ::
13918   By default, Org will ask before returning to an open edit buffer.  Set this
13919   variable to nil to switch without asking.
13922 To turn on native code fontification in the Org mode buffer, configure
13923 the variable ~org-src-fontify-natively~.
13925 ** Exporting code blocks
13926    :PROPERTIES:
13927    :DESCRIPTION: Export contents and/or results
13928    :END:
13929 #+cindex: code block, exporting
13930 #+cindex: source code, exporting
13932 It is possible to export the /code/ of code blocks, the /results/ of
13933 code block evaluation, /both/ the code and the results of code block
13934 evaluation, or /none/.  For most languages, the default exports code.
13935 However, for some languages (e.g., ~ditaa~) the default exports the
13936 results of code block evaluation.  For information on exporting code
13937 block bodies, see [[Literal examples]].
13939 The ~:exports~ header argument can be used to specify export
13940 behavior with the following arguments:
13942 #+attr_texinfo: :table-type table :indic @asis
13943 - ~:exports code~ ::
13945   The default in most languages.  The body of the code block is exported, as
13946   described in [[Literal examples]].
13948 - ~:exports results~ ::
13950   The code block will be evaluated and the results will be placed in the
13951   Org mode buffer for export, either updating previous results of the
13952   code block located anywhere in the buffer or, if no previous results
13953   exist, placing the results immediately after the code block.  The body
13954   of the code block will not be exported.
13956 - ~:exports both~ ::
13958   Both the code block and its results will be exported.
13960 - ~:exports none~ ::
13962   Neither the code block nor its results will be exported.
13965 It is possible to inhibit the evaluation of code blocks during export.
13966 Setting the ~org-export-babel-evaluate~ variable to ~nil~ will ensure
13967 that no code blocks are evaluated as part of the export process.  This
13968 can be useful in situations where potentially untrusted Org mode files
13969 are exported in an automated fashion, for example when Org mode is
13970 used as the markup language for a wiki.
13972 ** Extracting source code
13973    :PROPERTIES:
13974    :DESCRIPTION: Create pure source code files
13975    :END:
13976 #+cindex: tangling
13977 #+cindex: source code, extracting
13978 #+cindex: code block, extracting source code
13980 Creating pure source code files by extracting code from source blocks
13981 is referred to as "tangling"---a term adopted from the literate
13982 programming community.  During tangling of code blocks their bodies are
13983 expanded using ~org-babel-expand-src-block~ which can expand both
13984 variable and ``noweb'' style references (see [[Noweb reference syntax]]).
13986 *** Header arguments for tangling
13987 #+attr_texinfo: :table-type table :indic @asis
13988 - ~:tangle no~ ::
13990   The default.  The code block is not included in the tangled output.
13992 - ~:tangle yes~ ::
13994   Include the code block in the tangled output.  The output file name is
13995   the name of the org file with the extension {{{samp(.org)}}} replaced
13996   by the extension for the block language.
13998 - ~:tangle filename~ ::
14000   Include the code block in the tangled output to file {{{samp(filename)}}}.
14002 *** Functions for tangling
14003 #+attr_texinfo: :table-type table :indic @asis
14004 - ~org-babel-tangle~ ::
14005   #+kindex: C-c C-v t
14007   Tangle the current file.  Bound to {{{kbd(C-c C-v t)}}}.
14009   With a prefix argument only tangle the current code block.
14011 - ~org-babel-tangle-file~ ::
14012   #+kindex: C-c C-v f
14014   Choose a file to tangle.  Bound to {{{kbd(C-c C-v f)}}}.
14016 *** Hooks for tangling
14017 #+attr_texinfo: :table-type table :indic @asis
14018 - ~org-babel-post-tangle-hook~ ::
14020   This hook is run from within code files tangled by ~org-babel-tangle~.
14021   Example applications could include post-processing, compilation, or
14022   evaluation of tangled code files.
14024 ** Evaluating code blocks
14025    :PROPERTIES:
14026    :DESCRIPTION: Place results in the Org buffer
14027    :END:
14028 #+cindex: code block, evaluating
14029 #+cindex: source code, evaluating
14030 #+cindex: #+RESULTS
14032 Code blocks can be evaluated and the results of evaluation optionally
14033 placed in the Org mode buffer.[fn:148] The results of evaluation are
14034 placed following a line that begins by default with ~#+RESULTS~ and
14035 optionally a cache identifier and/or the name of the evaluated code
14036 block.  The default value of ~#+RESULTS~ can be changed with the
14037 customizable variable ~org-babel-results-keyword~.
14039 By default, the evaluation facility is only enabled for Lisp code
14040 blocks specified as ~emacs-lisp~.  However, source code blocks in many
14041 languages can be evaluated within Org mode (see [[Languages]] for a list
14042 of supported languages and [[Structure of code blocks]] for information on
14043 the syntax used to define a code block).
14045 #+kindex: C-c C-c
14046 #+kindex: C-c C-v e
14048 There are a number of ways to evaluate code blocks.  The simplest is to
14049 press {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-v e)}}} with the point on a
14050 code block.[fn:149] This will call the ~org-babel-execute-src-block~
14051 function to evaluate the block and insert its results into the Org
14052 mode buffer.
14054 #+cindex: #+CALL
14056 It is also possible to evaluate named code blocks from anywhere in an
14057 Org mode buffer or an Org mode table.  Live code blocks located in the
14058 current Org mode buffer or in the ``Library of Babel'' (see [[Library of
14059 Babel]]) can be executed.  Named code blocks can be executed with a
14060 separate ~#+CALL:~ line or inline within a block of text.
14062 The syntax of the ~#+CALL:~ line is:
14064 #+begin_example
14065    ,#+CALL: <name>(<arguments>)
14066    ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
14067 #+end_example
14069 The syntax for inline evaluation of named code blocks is:
14071 #+begin_example
14072    ... call_<name>(<arguments>) ...
14073    ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
14074 #+end_example
14076 #+attr_texinfo: :table-type table :indic @asis
14077 - ~<name>~ ::
14079   The name of the code block to be evaluated (see [[Structure of code
14080   blocks]]).
14082 - ~<arguments>~ ::
14084   Arguments specified in this section will be passed to the code block.
14085   These arguments use standard function call syntax, rather than header
14086   argument syntax.  For example, a ~#+CALL:~ line that passes the number
14087   four to a code block named ~double~, which declares the header
14088   argument ~:var n=2~, would be written as ~#+CALL: double(n=4)~.
14090 - ~<inside header arguments>~ ::
14092   Inside header arguments are passed through and applied to the named
14093   code block.  These arguments use header argument syntax rather than
14094   standard function call syntax.  Inside header arguments affect how the
14095   code block is evaluated.  For example, ~[:results output]~ will collect
14096   the results of everything printed to ~STDOUT~ during execution of the
14097   code block.
14099 - ~<end header arguments>~ ::
14101   End header arguments are applied to the calling instance and do not
14102   affect evaluation of the named code block.  They affect how the results
14103   are incorporated into the Org mode buffer and how the call line is
14104   exported.  For example, ~:results html~ will insert the results of the
14105   call line evaluation in the Org buffer, wrapped in a ~BEGIN_HTML:~
14106   block.
14109 For more examples of passing header arguments to ~#+CALL:~ lines see
14110 [[Header arguments in function calls]].
14112 ** Library of Babel
14113    :PROPERTIES:
14114    :DESCRIPTION: Use and contribute to a source code library
14115    :END:
14116 #+cindex: babel, library of
14117 #+cindex: source code, library
14118 #+cindex: code block, library
14120 The ``Library of Babel'' consists of code blocks that can be called
14121 from any Org mode file.  Code blocks defined in the ``Library of
14122 Babel'' can be called remotely as if they were in the current Org mode
14123 buffer (see [[Evaluating code blocks]] for information on the syntax of
14124 remote code block evaluation).
14127 The central repository of code blocks in the ``Library of Babel'' is
14128 housed in an Org mode file located in the {{{samp(contrib)}}}
14129 directory of Org mode.
14131 Users can add code blocks they believe to be generally useful to their
14132 ``Library of Babel.'' The code blocks can be stored in any Org mode
14133 file and then loaded into the library with ~org-babel-lob-ingest~.
14135 #+kindex: C-c C-v i
14137 Code blocks located in any Org mode file can be loaded into the
14138 ``Library of Babel'' with the ~org-babel-lob-ingest~ function, bound
14139 to {{{kbd(C-c C-v i)}}}.
14141 ** Languages
14142    :PROPERTIES:
14143    :DESCRIPTION: Supported code block languages
14144    :END:
14145 #+cindex: babel, languages
14146 #+cindex: source code, languages
14147 #+cindex: code block, languages
14149 Code blocks in the following languages are supported.
14151 #+attr_texinfo: :columns 0.24 0.24 0.04 0.24 0.24
14152 | Language   | Identifier   |   | Language       | Identifier   |
14153 |------------+--------------+---+----------------+--------------|
14154 | Asymptote  | asymptote    |   | Awk            | awk          |
14155 | Emacs Calc | calc         |   | C              | C            |
14156 | C++        | C++          |   | Clojure        | clojure      |
14157 | CSS        | css          |   | ditaa          | ditaa        |
14158 | Graphviz   | dot          |   | Emacs Lisp     | emacs-lisp   |
14159 | gnuplot    | gnuplot      |   | Haskell        | haskell      |
14160 | Java       | java         |   |                |              |
14161 | Javascript | js           |   | LaTeX          | latex        |
14162 | Ledger     | ledger       |   | Lisp           | lisp         |
14163 | Lilypond   | lilypond     |   | MATLAB         | matlab       |
14164 | Mscgen     | mscgen       |   | Objective Caml | ocaml        |
14165 | Octave     | octave       |   | Org mode       | org          |
14166 | Oz         | oz           |   | Perl           | perl         |
14167 | Plantuml   | plantuml     |   | Python         | python       |
14168 | R          | R            |   | Ruby           | ruby         |
14169 | Sass       | sass         |   | Scheme         | scheme       |
14170 | GNU Screen | screen       |   | shell          | sh           |
14171 | SQL        | sql          |   | SQLite         | sqlite       |
14174 Language-specific documentation is available for some languages.  If
14175 available, it can be found at
14176 [[http://orgmode.org/worg/org-contrib/babel/languages.html]].
14178 The variable ~org-babel-load-languages~ controls which languages are
14179 enabled for evaluation (by default only ~emacs-lisp~ is enabled).  This
14180 variable can be set using the customization interface or by adding
14181 code like the following example, disables ~emacs-lisp~ evaluation and
14182 enables evaluation of ~R~ code blocks, to your emacs configuration:
14184 #+header: :eval no
14185 #+header: :exports code
14186 #+begin_src emacs-lisp
14187 (org-babel-do-load-languages
14188  'org-babel-load-languages
14189  '((emacs-lisp . nil)
14190    (R . t)))
14191 #+end_src
14193 It is also possible to enable support for a language by loading the
14194 related elisp file with ~require~.
14196 {{{noindent}}} The following example adds support for evaluating
14197 ~clojure~ code blocks:
14199 #+header: :eval no
14200 #+header: :exports code
14201 #+begin_src emacs-lisp
14202 (require 'ob-clojure)
14203 #+end_src
14205 ** Header arguments
14206    :PROPERTIES:
14207    :DESCRIPTION: Configure code block functionality
14208    :END:
14209 #+cindex: code block, header arguments
14210 #+cindex: source code, block header arguments
14212 Code block functionality can be configured with header arguments.  This
14213 section provides an overview of the use of header arguments, and then
14214 describes each header argument in detail.
14216 *** Using header arguments
14217     :PROPERTIES:
14218     :DESCRIPTION: Different ways to set header arguments
14219     :END:
14221 The values of header arguments can be set in six different ways, each
14222 more specific (and having higher priority) than the last.
14224 **** System-wide header arguments
14225      :PROPERTIES:
14226      :DESCRIPTION: Set global default values
14227      :END:
14228 #+vindex: org-babel-default-header-args
14230 System-wide values of header arguments can be specified by customizing
14231 the ~org-babel-default-header-args~ variable:
14233 #+begin_example
14234    :session    => "none"
14235    :results    => "replace"
14236    :exports    => "code"
14237    :cache      => "no"
14238    :noweb      => "no"
14239 #+end_example
14241 # #+begin_example
14242 #   org-babel-default-header-args is a variable defined in `org-babel.el'.
14243 #   Its value is
14244 #   ((:session . "none")
14245 #    (:results . "replace")
14246 #    (:exports . "code")
14247 #    (:cache . "no")
14248 #    (:noweb . "no"))
14251 #   Documentation:
14252 #   Default arguments to use when evaluating a code block.
14253 # #+end_example
14255 For example, the following code could be used to set the default
14256 value of ~:noweb~ header arguments to ~yes~.  This would have the
14257 effect of expanding ~:noweb~ references by default when evaluating
14258 source code blocks.
14260 #+header: :eval no
14261 #+header: :exports code
14262 #+begin_src emacs-lisp
14263   (setq org-babel-default-header-args
14264         (cons '(:noweb . "yes")
14265               (assq-delete-all :noweb org-babel-default-header-args)))
14266 #+end_src
14268 **** Language-specific header arguments
14269      :PROPERTIES:
14270      :DESCRIPTION: Set default values by language
14271      :END:
14273 Each language can define its own set of default header arguments.  See
14274 the language-specific documentation available online at
14275 [[http://orgmode.org/worg/org-contrib/babel]].
14277 **** Buffer-wide header arguments
14278      :PROPERTIES:
14279      :DESCRIPTION: Set default values for a specific buffer
14280      :END:
14282 Buffer-wide header arguments may be specified as properties through
14283 the use of ~#+PROPERTY:~ lines placed anywhere in an Org mode file
14284 (see [[Property syntax]]).
14286 For example the following would set ~session~ to ~*R*~, and ~results~
14287 to ~silent~ for every code block in the buffer, ensuring that all
14288 execution took place in the same session, and no results would be
14289 inserted into the buffer.
14291 #+begin_example
14292    ,#+PROPERTY: session *R*
14293    ,#+PROPERTY: results silent
14294 #+end_example
14296 **** Header arguments in Org mode properties
14297      :PROPERTIES:
14298      :DESCRIPTION: Set default values for a buffer or heading
14299      :END:
14301 Header arguments are also read from Org mode properties (see [[Property
14302 syntax]]), which can be set on a buffer-wide or per-heading basis.  An
14303 example of setting a header argument for all code blocks in a buffer
14304 is as follows:
14306 #+begin_example
14307    ,#+PROPERTY: tangle yes
14308 #+end_example
14310 #+vindex: org-use-property-inheritance
14312 When properties are used to set default header arguments, they are
14313 looked up with inheritance, regardless of the value of
14314 ~org-use-property-inheritance~.  In the following example the value of
14315 the ~:cache~ header argument will default to ~yes~ in all code blocks
14316 in the subtree rooted at the following heading:
14318 #+begin_example
14319    ,* outline header
14320    ,:PROPERTIES:
14321    ,:cache:    yes
14322    ,:END:
14323 #+end_example
14325 #+kindex: C-c C-x p
14326 #+vindex: org-babel-default-header-args
14328 Properties defined in this way override the properties set in
14329 ~org-babel-default-header-args~.  It is convenient to use the
14330 ~org-set-property~ function bound to {{{kbd(C-c C-x p)}}} to set
14331 properties in Org mode documents.
14333 **** Code block specific header arguments
14334      :PROPERTIES:
14335      :DESCRIPTION: The most common way to set values
14336      :END:
14338 The most common way to assign values to header arguments is at the
14339 code block level.  This can be done by listing a sequence of header
14340 arguments and their values as part of the ~#+BEGIN_SRC~ line.
14341 Properties set in this way override both the values of
14342 ~org-babel-default-header-args~ and header arguments specified as
14343 properties.  In the following example, the ~:results~ header argument
14344 is set to ~silent~, meaning the results of execution will not be
14345 inserted in the buffer, and the ~:exports~ header argument is set to
14346 ~code~, meaning only the body of the code block will be preserved on
14347 export to HTML or LaTeX.
14349 #+begin_example
14350    #+NAME: factorial
14351    #+BEGIN_SRC haskell :results silent :exports code :var n=0
14352    fac 0 = 1
14353    fac n = n * fac (n-1)
14354    #+END_SRC
14355 #+end_example
14357 Similarly, it is possible to set header arguments for inline code blocks:
14359 #+begin_example
14360    src_haskell[:exports both]@{fac 5@}
14361 #+end_example
14363 Code block header arguments can span multiple lines using ~#+HEADER:~
14364 or ~#+HEADERS:~ lines preceding a code block or nested between the
14365 ~#+NAME:~ line and the ~#+BEGIN_SRC~ line of a named code block.
14367 #+cindex: #+HEADER:
14368 #+cindex: #+HEADERS:
14370 This is an example of multi-line header arguments on an un-named code
14371 block:
14373 #+begin_example
14374    ,#+HEADERS: :var data1=1
14375    ,#+BEGIN_SRC emacs-lisp :var data2=2
14376       (message "data1:%S, data2:%S" data1 data2)
14377    ,#+END_SRC
14379    ,#+RESULTS:
14380    : data1:1, data2:2
14381 #+end_example
14383 This is an example of multi-line header arguments on a named code block:
14385 #+begin_example
14386    ,#+NAME: named-block
14387    ,#+HEADER: :var data=2
14388    ,#+BEGIN_SRC emacs-lisp
14389      (message "data:%S" data)
14390    ,#+END_SRC
14392    ,#+RESULTS: named-block
14393     : data:2
14394 #+end_example
14396 **** Header arguments in function calls
14397      :PROPERTIES:
14398      :DESCRIPTION: The most specific level
14399      :END:
14401 At the most specific level, header arguments for ``Library of Babel''
14402 or ~#+CALL:~ lines can be set as shown in the two examples below.  For
14403 more information on the structure of ~#+CALL:~ lines see [[Evaluating
14404 code blocks]].
14406 The following example will apply the ~:exports results~ header
14407 argument to the evaluation of the ~#+CALL:~ line:
14409 #+begin_example
14410    ,#+CALL: factorial(n=5) :exports results
14411 #+end_example
14413 The following example will apply the ~:session special~ header
14414 argument to the evaluation of the ~factorial~ code block:
14416 #+begin_example
14417    ,#+CALL: factorial[:session special](n=5)
14418 #+end_example
14420 *** Specific header arguments
14421     :PROPERTIES:
14422     :DESCRIPTION: List of header arguments
14423     :END:
14424 Header arguments consist of an initial colon followed by the name of
14425 the argument in lowercase letters.  Additional header arguments are
14426 defined on a language-specific basis, see [[Languages]].
14428 The following header arguments are defined:
14430 **** var
14431      :PROPERTIES:
14432      :DESCRIPTION: Pass arguments to code blocks
14433      :END:
14434 The ~:var~ header argument is used to pass arguments to code blocks.
14435 The specifics of how arguments are included in a code block vary by
14436 language; these are addressed in the language-specific documentation.
14437 However, the syntax used to specify arguments is the same across all
14438 languages.  In every case, variables require a default value when they
14439 are declared.
14441 The values passed to arguments can either be literal values,
14442 references, or Emacs Lisp code (see [[Emacs Lisp evaluation of
14443 variables]]).  References include anything in the Org mode file that
14444 takes a ~#+NAME:~, ~#+TBLNAME:~, or ~#+RESULTS:~ line.  This includes
14445 tables, lists, ~#+BEGIN_EXAMPLE~ blocks, other code blocks, and the
14446 results of other code blocks.
14448 Argument values can be indexed in a manner similar to arrays (see
14449 [[Indexable variable values]]).
14451 The following syntax is used to pass arguments to code blocks using the
14452 ~:var~ header argument:
14454 #+begin_example
14455    :var name=assign
14456 #+end_example
14458 The argument, ~assign~, can either be a literal value, such as a
14459 string {{{samp("string")}}} or a number {{{samp(9)}}}, or a reference
14460 to a table, a list, a literal example, another code block (with or
14461 without arguments), or the results of evaluating another code block.
14463 Here are examples of passing values by reference:
14465 #+attr_texinfo: :table-type table :indic @asis
14466 - a table named with either ~#+NAME:~ or ~#+TBLNAME:~ ::
14468   #+begin_example
14469      #+TBLNAME: example-table
14470      | 1 |
14471      | 2 |
14472      | 3 |
14473      | 4 |
14475      #+NAME: table-length
14476      #+BEGIN_SRC emacs-lisp :var table=example-table
14477      (length table)
14478      #+END_SRC
14480      #+RESULTS: table-length
14481      : 4
14482   #+end_example
14484 - a simple list named with ~#+NAME:~ :: 
14486   #+begin_example
14487      #+NAME: example-list
14488        - simple
14489          - not
14490          - nested
14491        - list
14493      #+BEGIN_SRC emacs-lisp :var x=example-list
14494        (print x)
14495      #+END_SRC
14497      #+RESULTS:
14498      | simple | list |
14499   #+end_example
14501   Note that nesting is not carried through to the source code block.
14503 - a named code block without arguments, optionally followed by parentheses ::
14505   #+begin_example
14506      #+BEGIN_SRC emacs-lisp :var length=table-length()
14507      (* 2 length)
14508      #+END_SRC
14510      #+RESULTS:
14511      : 8
14512   #+end_example
14514 - a named code block with arguments ::
14516   #+begin_example
14517      #+NAME: double
14518      #+BEGIN_SRC emacs-lisp :var input=8
14519      (* 2 input)
14520      #+END_SRC
14522      #+RESULTS: double
14523      : 16
14525      #+NAME: squared
14526      #+BEGIN_SRC emacs-lisp :var input=double(input=1)
14527      (* input input)
14528      #+END_SRC
14530      #+RESULTS: squared
14531      : 4
14532   #+end_example
14534 - a literal example block ::
14536   #+begin_example
14537      ,#+NAME: literal-example
14538      ,#+BEGIN_EXAMPLE
14539      A literal example
14540      on two lines
14541      ,#+END_EXAMPLE
14543      ,#+NAME: read-literal-example
14544      ,#+BEGIN_SRC emacs-lisp :var x=literal-example
14545        (concatenate 'string x " for you.")
14546      ,#+END_SRC
14548      ,#+RESULTS: read-literal-example
14549       : A literal example
14550       : on two lines for you.
14551   #+end_example
14553 # ***** Alternate argument syntax
14554 <<Alternate argument syntax>>
14556 It is also possible to specify arguments in a potentially more natural
14557 way using the ~#+NAME:~ line of a code block.  As in the following
14558 example, arguments can be packed inside of parentheses, separated by
14559 commas, following the source name.
14561 #+begin_example
14562    ,#+NAME: double(input=0, x=2)
14563    ,#+BEGIN_SRC emacs-lisp
14564     (* 2 (+ input x))
14565    ,#+END_SRC
14566 #+end_example
14568 # ***** Indexable variable values
14569 <<Indexable variable values>>
14571 It is possible to reference portions of variable values by
14572 /indexing/ into the variables.  Indexes are 0 based with negative
14573 values counting back from the end.  If an index is separated by commas
14574 then each subsequent section will index into the next deepest nesting
14575 or dimension of the value.  Note that this indexing occurs /before/
14576 other table related header arguments like ~:hlines~, ~:colnames~, and
14577 ~:rownames~ are applied.  The following example assigns the last cell
14578 of the first row the table ~example-table~ to the variable ~data~:
14580 #+begin_example
14581    ,#+NAME: example-table
14582    | 1 | a |
14583    | 2 | b |
14584    | 3 | c |
14585    | 4 | d |
14587    ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
14588      data
14589    ,#+END_SRC
14591    ,#+RESULTS:
14592    : a
14593 #+end_example
14595 Ranges of variable values can be referenced using two integers
14596 separated by a ~:~, in which case the entire inclusive range is
14597 referenced.  The following example assigns the middle three rows of
14598 ~example-table~ to ~data~.
14600 #+begin_example
14601    #+NAME: example-table
14602    | 1 | a |
14603    | 2 | b |
14604    | 3 | c |
14605    | 4 | d |
14606    | 5 | 3 |
14608    #+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
14609      data
14610    #+END_SRC
14612    #+RESULTS:
14613    | 2 | b |
14614    | 3 | c |
14615    | 4 | d |
14616 #+end_example
14618 Additionally, an empty index, or the single character ~*~, are both
14619 interpreted to mean the entire range and as such are equivalent to
14620 ~0:-1~, as shown in the following example in which the entire first
14621 column is referenced:
14623 #+begin_example
14624    #+NAME: example-table
14625    | 1 | a |
14626    | 2 | b |
14627    | 3 | c |
14628    | 4 | d |
14630    #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
14631      data
14632    #+END_SRC
14634    #+RESULTS:
14635    | 1 | 2 | 3 | 4 |
14636 #+end_example
14638 It is possible to index into the results of code blocks as well as
14639 tables.  Any number of dimensions can be indexed.  Dimensions are
14640 separated from one another by commas, as shown in the following
14641 example:
14643 #+begin_example
14644    #+NAME: 3D
14645    #+BEGIN_SRC emacs-lisp
14646      '(((1  2  3)  (4  5  6)  (7  8  9))
14647        ((10 11 12) (13 14 15) (16 17 18))
14648        ((19 20 21) (22 23 24) (25 26 27)))
14649    #+END_SRC
14651    #+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
14652      data
14653    #+END_SRC
14655    #+RESULTS:
14656    | 11 | 14 | 17 |
14657 #+end_example
14659 # ***** Emacs Lisp evaluation of variables
14660 <<Emacs Lisp evaluation of variables>>
14662 Emacs lisp code can be used to initialize variable values.  When a
14663 variable value starts with ~(~, ~[~, ~'~ or ~`~ it will be evaluated
14664 as Emacs Lisp and the result of the evaluation will be assigned as the
14665 variable value.  The following example demonstrates use of this
14666 evaluation to reliably pass the file-name of the Org mode buffer to a
14667 code block:[fn:150]
14669 #+begin_example
14670    #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
14671      wc -w $filename
14672    #+END_SRC
14673 #+end_example
14675 Note that values read from tables and lists will not be evaluated as
14676 Emacs Lisp, as shown in the following example, which contains a Lisp
14677 list as the sole table element:
14679 #+begin_example
14680    #+NAME: table
14681    | (a b c) |
14683    #+HEADERS: :var data=table[0,0]
14684    #+BEGIN_SRC perl
14685      $data
14686    #+END_SRC
14688    #+RESULTS:
14689    : (a b c)
14690 #+end_example
14692 **** results
14693      :PROPERTIES:
14694      :DESCRIPTION: Specify the type of results and how they will be collected and handled
14695      :END:
14696 There are three classes of ~:results~ header argument.  Only one option
14697 per class may be supplied per code block.
14699 #+attr_texinfo: :table-type table :indic @asis
14700 - Collection ::
14702   These header arguments specify how the results should be collected
14703   from the code block.
14705 - Type ::
14707   These header arguments specify what type of result the code block will
14708   return---which has implications for how they will be inserted into the
14709   Org mode buffer.
14711 - Handling ::
14713   These header arguments specify how the results of evaluating the code
14714   block should be handled.
14716 # ***** Collection
14717 <<Collection>>
14719 The following ~:results~ options are mutually exclusive, and specify
14720 how the results should be collected from the code block.
14722 #+attr_texinfo: :table-type table :indic @asis
14723 - ~value~ ::
14725   This is the default.  The result is the value of the last statement in
14726   the code block.  This header argument places the evaluation in
14727   functional mode.  Note that in some languages, e.g., Python, use of
14728   this result type requires that a ~return~ statement be included in the
14729   body of the source code block.
14731 - ~output~ ::
14733   The result is the collection of everything printed to STDOUT during
14734   the execution of the code block.  This header argument places the
14735   evaluation in scripting mode.
14737 # ***** Type
14738 <<Type>>
14740 The following ~:results~ options are mutually exclusive and specify
14741 what type of results the code block will return.  By default, results
14742 are inserted as either a table or scalar depending on their value.
14744 #+attr_texinfo: :table-type table :indic @asis
14745 - ~table~, ~vector~ ::
14747   The results should be interpreted as an Org mode table.  If a single
14748   value is returned, it will be converted into a table with one row and
14749   one column.  E.g., ~:results value table~.
14751 - ~scalar~, ~verbatim~ ::
14753   The results should be interpreted literally---they will not be
14754   converted into a table.  The results will be inserted into the Org mode
14755   buffer as quoted text.  E.g., ~:results value verbatim~.
14757 - ~list~ ::
14759   The results should be interpreted as an Org mode list.  If a single
14760   scalar value is returned it will be converted into a list with only
14761   one element.
14763 - ~file~ ::
14765   The results will be interpreted as the path to a file, and will be
14766   inserted into the Org mode buffer as a file link.  E.g., ~:results
14767   value file~.
14769 - ~raw~ ::
14771   The results are interpreted as raw Org mode code and are inserted
14772   directly into the buffer.  If the results look like a table they will
14773   be aligned as such by Org mode.  E.g., ~:results value raw~.
14775 - ~org~ ::
14777   The results are will be enclosed in a ~BEGIN_SRC org~ block.  They are
14778   not comma-escaped by default but they will be if you hit
14779   {{{kbd(TAB)}}} in the block and/or if you export the file.  E.g.,
14780   ~:results value org~.
14782 - ~html~ ::
14784   Results are assumed to be HTML and will be enclosed in a ~BEGIN_HTML~
14785   block.  E.g., ~:results value html~.
14787 - ~latex~ ::
14789   Results assumed to be LaTeX and are enclosed in a ~BEGIN_LaTeX~
14790   block.  E.g., ~:results value latex~.
14792 - ~code~ ::
14794   Result are assumed to be parsable code and are enclosed in a code
14795   block.  E.g., ~:results value code~.
14797 - ~pp~ ::
14799   The result is converted to pretty-printed code and is enclosed in a
14800   code block.  This option currently supports Emacs Lisp, Python, and
14801   Ruby.  E.g., ~:results value pp~.
14803 - ~drawer~ ::
14805   The result is wrapped in a RESULTS drawer.  This can be useful for
14806   inserting ~raw~ or ~org~ syntax results in such a way that their
14807   extent is known and they can be automatically removed or replaced.
14809 # ***** Handling
14810 <<Handling>>
14811 The following ~:results~ options indicate what happens with the
14812 results once they are collected.
14814 #+attr_texinfo: :table-type table :indic @asis
14815 - ~replace~ ::
14817   The default value.  Any existing results will be removed, and the new
14818   results will be inserted into the Org mode buffer in their place.
14819   E.g., ~:results output replace~.
14821 - ~append~ ::
14823   If there are pre-existing results of the code block then the new
14824   results will be appended to the existing results.  Otherwise the new
14825   results will be inserted as with ~replace~.
14827 - ~prepend~ ::
14829   If there are pre-existing results of the code block then the new
14830   results will be prepended to the existing results.  Otherwise the new
14831   results will be inserted as with ~replace~.
14833 - ~silent~ ::
14835   The results will be echoed in the minibuffer but will not be inserted
14836   into the Org mode buffer.  E.g., ~:results output silent~.
14838 **** file
14839      :PROPERTIES:
14840      :DESCRIPTION: Specify a path for file output
14841      :END:
14843 The header argument ~:file~ is used to specify an external file in
14844 which to save code block results.  After code block evaluation an Org
14845 mode style ~[[file:]]~ link (see [[Link format]]) to the file will be inserted
14846 into the Org mode buffer.  Some languages including R, gnuplot, dot,
14847 and ditaa provide special handling of the ~:file~ header argument,
14848 automatically wrapping the code block body in the boilerplate code
14849 required to save output to the specified file.  This is often useful
14850 for saving graphical output of a code block to the specified file.
14852 The argument to ~:file~ should be either a string specifying the path
14853 to a file, or a list of two strings in which case the first element of
14854 the list should be the path to a file and the second a description for
14855 the link.
14857 **** file-desc
14858      :PROPERTIES:
14859      :DESCRIPTION: Specify a description for file results
14860      :END:
14862 The value of the ~:file-desc~ header argument is used to provide a
14863 description for file code block results which are inserted as Org mode
14864 links (see [[Link format]]).  If the ~:file-desc~ header argument is given
14865 with no value the link path will be placed in both the ``link'' and
14866 the ``description'' portion of the Org mode link.
14868 **** dir
14869      :PROPERTIES:
14870      :DESCRIPTION: Specify the default (possibly remote) directory for code block execution
14871      :TITLE:    ~:dir~ and remote execution
14872      :END:
14874 While the ~:file~ header argument can be used to specify the path to
14875 the output file, ~:dir~ specifies the default directory during code
14876 block execution.  If it is absent, then the directory associated with
14877 the current buffer is used.  In other words, supplying ~:dir path~
14878 temporarily has the same effect as changing the current directory with
14879 {{{kbd(M-x cd path)}}}, and then not supplying ~:dir~.  Under the
14880 surface, ~:dir~ simply sets the value of the Emacs variable
14881 ~default-directory~.
14883 When using ~:dir~, you should supply a relative path for file output
14884 (e.g., ~:file myfile.jpg~ or ~:file results/myfile.jpg~) in which
14885 case that path will be interpreted relative to the default directory.
14887 In other words, if you want your plot to go into a folder called
14888 {{{file(Work)}}} in your home directory, you could use a code block
14889 like the following example:
14891 #+begin_example
14892    #+BEGIN_SRC R :file myplot.png :dir ~/Work
14893    matplot(matrix(rnorm(100), 10), type="l")
14894    #+END_SRC
14895 #+end_example
14897 # ***** Remote execution
14898 <<Remote execution>>
14900 A directory on a remote machine can be specified using tramp file
14901 syntax, in which case the code will be evaluated on the remote
14902 machine.  An example is:
14904 #+begin_example
14905    #+BEGIN_SRC R :file plot.png :dir /dand@yakuba.princeton.edu:
14906    plot(1:10, main=system("hostname", intern=TRUE))
14907    #+END_SRC
14908 #+end_example
14910 Text results will be returned to the local Org mode buffer as usual,
14911 and file output will be created on the remote machine with relative
14912 paths interpreted relative to the remote directory.  An Org mode link
14913 to the remote file will be created.
14915 So, in the above example a plot will be created on the remote machine,
14916 and a link of the following form will be inserted in the org buffer:
14918 #+begin_example
14919    [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
14920 #+end_example
14922 Most of this functionality follows immediately from the fact that
14923 ~:dir~ sets the value of the Emacs variable ~default-directory~,
14924 thanks to tramp.  Those using XEmacs, or GNU Emacs prior to version 23
14925 may need to install tramp separately in order for these features to
14926 work correctly.
14928 # ***** Further points
14929 <<Further points>>
14930 Please be aware of these further points:
14932 - If ~:dir~ is used in conjunction with ~:session~, although it will
14933   determine the starting directory for a new session as expected, no
14934   attempt is currently made to alter the directory associated with an
14935   existing session.
14937 - ~:dir~ should typically not be used to create files during export
14938   with ~:exports results~ or ~:exports both~.  The reason is that, in
14939   order to retain portability of exported material between machines,
14940   during export links inserted into the buffer will /not/ be expanded
14941   against ~default directory~.  Therefore, if ~default-directory~ is
14942   altered using ~:dir~, it is probable that the file will be created
14943   in a location to which the link does not point.
14945 **** exports
14946      :PROPERTIES:
14947      :DESCRIPTION: Export code and/or results
14948      :END:
14949 The ~:exports~ header argument specifies what should be included in HTML
14950 or LaTeX exports of the Org mode file.
14952 #+attr_texinfo: :table-type table :indic @asis
14953 - ~code~ ::
14955   The default.  The body of code is included into the exported file.
14956   E.g., ~:exports code~.
14958 - ~results~ ::
14960   The result of evaluating the code is included in the exported file.
14961   E.g., ~:exports results~.
14963 - ~both~ ::
14965   Both the code and results are included in the exported file.  E.g.,
14966   ~:exports both~.
14968 - ~none~ ::
14970   Nothing is included in the exported file.  E.g., ~:exports none~.
14972 **** tangle
14973      :PROPERTIES:
14974      :DESCRIPTION: Toggle tangling and specify file name
14975      :END:
14977 The ~:tangle~ header argument specifies whether or not the code
14978 block should be included in tangled extraction of source code files.
14980 #+attr_texinfo: :table-type table :indic @asis
14981 - ~tangle~ ::
14983   The code block is exported to a source code file named after the full
14984   path (including the directory) and file name (w/o extension) of the
14985   Org mode file.  E.g., ~:tangle yes~.
14987 - ~no~ ::
14989   The default.  The code block is not exported to a source code file.
14990   E.g., ~:tangle no~.
14992 - other ::
14994   Any other string passed to the ~:tangle~ header argument is
14995   interpreted as a path (directory and file name relative to the
14996   directory of the Org mode file) to which the block will be exported,
14997   e.g., ~:tangle path~.
14999 **** mkdirp
15000 :PROPERTIES:
15001 :DESCRIPTION: Toggle creation of parent directories of target files during tangling
15002 :END:
15004 The ~:mkdirp~ header argument can be used to create parent directories
15005 of tangled files when missing.  This can be set to ~yes~ to enable
15006 directory creation or to ~no~ to inhibit directory creation.
15008 **** comments
15009 :PROPERTIES:
15010 :DESCRIPTION: Toggle insertion of comments in tangled code files
15011 :END:
15013 By default code blocks are tangled to source-code files without any
15014 insertion of comments beyond those which may already exist in the body
15015 of the code block.  The ~:comments~ header argument can be set as
15016 follows to control the insertion of extra comments into the tangled
15017 code file.
15019 #+attr_texinfo: :table-type table :indic @asis
15020 - ~no~ ::
15022   The default.  No extra comments are inserted during tangling.
15024 - ~link~ ::
15026   The code block is wrapped in comments which contain pointers back to
15027   the original Org file from which the code was tangled.
15029 - ~yes~ ::
15031   A synonym for ``link'' to maintain backwards compatibility.
15033 - ~org~ ::
15035   Include text from the Org mode file as a comment.
15037   The text is picked from the leading context of the tangled code and is
15038   limited by the nearest headline or source block as the case may be.
15040 - ~both~ ::
15042   Turns on both the ``link'' and ``org'' comment options.
15044 - ~noweb~ ::
15046   Turns on the ``link'' comment option, and additionally wraps expanded
15047   noweb references in the code block body in link comments.
15049 **** padline
15050 :PROPERTIES:
15051 :DESCRIPTION: Control insertion of padding lines in tangle code files
15052 :END:
15054 Control in insertion of padding lines around code block bodies in tangled
15055 code files.  The default value is ~yes~ which results in insertion of
15056 newlines before and after each tangled code block.  The following arguments
15057 are accepted:
15059 #+attr_texinfo: :table-type table :indic @asis
15060 - ~yes~ ::
15062   Insert newlines before and after each code block body in tangled code
15063   files.
15065 - ~no~ ::
15067   Do not insert any newline padding in tangled output.
15069 **** no-expand
15070 :PROPERTIES:
15071 :DESCRIPTION: Turn off variable assignment and noweb expansion during tangling
15072 :END:
15074 By default, code blocks are expanded with ~org-babel-expand-src-block~
15075 during tangling.  This has the effect of assigning values to variables
15076 specified with ~:var~ (see [[var]]), and of replacing ``noweb'' references
15077 (see [[Noweb reference syntax]]) with their targets.  The ~:no-expand~
15078 header argument can be used to turn off this behavior.
15080 **** session
15081 :PROPERTIES:
15082 :DESCRIPTION: Preserve state of code evaluation
15083 :END:
15085 The ~:session~ header argument starts a session for an interpreted
15086 language where state is preserved.
15088 By default, a session is not started.
15090 A string passed to the ~:session~ header argument will give the
15091 session a name.  This makes it possible to run concurrent sessions for
15092 each interpreted language.
15094 **** noweb
15095 :PROPERTIES:
15096 :DESCRIPTION: Toggle expansion of noweb references
15097 :END:
15099 The ~:noweb~ header argument controls expansion of ``noweb'' syntax
15100 references (see [[Noweb reference syntax]]) when the code block is
15101 evaluated, tangled, or exported.  The ~:noweb~ header argument can have
15102 one of the five values: ~no~, ~yes~, ~tangle~, ~no-export~, or
15103 ~strip-export~.
15105 #+attr_texinfo: :table-type table :indic @asis
15106 - ~no~ ::
15108   The default.  ``Noweb'' syntax references in the body of the code block
15109   will not be expanded before the code block is evaluated, tangled or
15110   exported.
15112 - ~yes~ ::
15114   ``Noweb'' syntax references in the body of the code block will be
15115   expanded before the code block is evaluated, tangled or exported.
15117 - ~tangle~ ::
15119   ``Noweb'' syntax references in the body of the code block will be
15120   expanded before the code block is tangled.  However, ``noweb'' syntax
15121   references will not be expanded when the code block is evaluated or
15122   exported.
15124 - ~no-export~ ::
15126   ``Noweb'' syntax references in the body of the code block will be
15127   expanded before the block is evaluated or tangled.  However, ``noweb''
15128   syntax references will not be expanded when the code block is
15129   exported.
15131 - ~strip-export~ ::
15133   ``Noweb'' syntax references in the body of the code block will be
15134   expanded before the block is evaluated or tangled.  However, ``noweb''
15135   syntax references will not be removed when the code block is exported.
15137 - ~eval~ ::
15139   ``Noweb'' syntax references in the body of the code block will only be
15140   expanded before the block is evaluated.
15142 # ***** Noweb prefix lines
15143 <<Noweb prefix lines>>
15145 Noweb insertions are placed behind the line prefix of the
15146 ~<<reference>>~.  Because the ~<<example>>~ noweb reference appears
15147 behind the SQL comment syntax in the following example, each line of
15148 the expanded noweb reference will be commented.
15150 This code block:
15152 #+begin_example
15153    -- <<example>>
15154 #+end_example
15157 expands to:
15159 #+begin_example
15160    -- this is the
15161    -- multi-line body of example
15162 #+end_example
15164 Note that noweb replacement text that does not contain any newlines
15165 will not be inserted behind the line prefix, so it is always possible
15166 to use inline noweb references.
15168 **** noweb-ref
15169 :PROPERTIES:
15170 :DESCRIPTION: Specify block's noweb reference resolution target
15171 :END:
15173 When expanding ``noweb'' style references the bodies of all code block
15174 with /either/ a block name matching the reference name /or/ a
15175 ~:noweb-ref~ header argument matching the reference name will be
15176 concatenated together to form the replacement text.
15178 By setting this header argument at the sub-tree or file level, simple code
15179 block concatenation may be achieved.  For example, when tangling the
15180 following Org mode file, the bodies of code blocks will be concatenated into
15181 the resulting pure code file.[fn:151]
15183 #+begin_example
15184    #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
15185      <<fullest-disk>>
15186    #+END_SRC
15187   ,* the mount point of the fullest disk
15188      :PROPERTIES:
15189      :noweb-ref: fullest-disk
15190      :END:
15192    ,** query all mounted disks
15193    #+BEGIN_SRC sh
15194      df \
15195    #+END_SRC
15197    ,** strip the header row
15198    #+BEGIN_SRC sh
15199      |sed '1d' \
15200    #+END_SRC
15202    ,** sort by the percent full
15203    #+BEGIN_SRC sh
15204      |awk '@{print $5 " " $6@}'|sort -n |tail -1 \
15205    #+END_SRC
15207    ,** extract the mount point
15208    #+BEGIN_SRC sh
15209      |awk '@{print $2@}'
15210    #+END_SRC
15211 #+end_example
15213 The ~:noweb-sep~ (see [[noweb-sep]]) header argument holds the string used
15214 to separate accumulate noweb references like those above.  By default a
15215 newline is used.
15217 **** noweb-sep
15218 :PROPERTIES:
15219 :DESCRIPTION: String used to separate noweb references
15220 :END:
15222 The ~:noweb-sep~ header argument holds the string used to separate
15223 accumulated noweb references (see [[noweb-ref]]).  By default a newline is
15224 used.
15226 **** cache
15227 :PROPERTIES:
15228 :DESCRIPTION: Avoid re-evaluating unchanged code blocks
15229 :END:
15231 The ~:cache~ header argument controls the use of in-buffer caching of
15232 the results of evaluating code blocks.  It can be used to avoid
15233 re-evaluating unchanged code blocks.  Note that the ~:cache~ header
15234 argument will not attempt to cache results when the ~:session~ header
15235 argument is used, because the results of the code block execution may
15236 be stored in the session outside of the Org mode buffer.  The ~:cache~
15237 header argument can have one of two values: ~yes~ or ~no~.
15239 #+attr_texinfo: :table-type table :indic @asis
15240 - ~no~ ::
15242   The default.  No caching takes place, and the code block will be
15243   evaluated every time it is called.
15245 - ~yes~ ::
15247   Every time the code block is run a SHA1 hash of the code and arguments
15248   passed to the block will be generated.  This hash is packed into the
15249   ~#+RESULTS:~ line and will be checked on subsequent executions of the
15250   code block.  If the code block has not changed since the last time it
15251   was evaluated, it will not be re-evaluated.
15254 Code block caches notice if the value of a variable argument
15255 to the code block has changed.  If this is the case, the cache is
15256 invalidated and the code block is re-run.  In the following example,
15257 ~caller~ will not be re-run unless the results of ~random~ have
15258 changed since it was last run.
15260 #+begin_example
15261    #+NAME: random
15262    #+BEGIN_SRC R :cache yes
15263    runif(1)
15264    #+END_SRC
15266    #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
15267    0.4659510825295
15269    #+NAME: caller
15270    #+BEGIN_SRC emacs-lisp :var x=random :cache yes
15271    x
15272    #+END_SRC
15274    #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
15275    0.254227238707244
15276 #+end_example
15278 **** sep
15279 :PROPERTIES:
15280 :DESCRIPTION: Delimiter for writing tabular results outside Org
15281 :END:
15282 #+kindex: C-c C-o
15284 The ~:sep~ header argument can be used to control the delimiter used
15285 when writing tabular results out to files external to Org mode.  This
15286 is used either when opening tabular results of a code block by calling
15287 the ~org-open-at-point~ function bound to {{{kbd(C-c C-o)}}} on the
15288 code block, or when writing code block results to an external file
15289 (see [[file]]) header argument.
15291 By default, when ~:sep~ is not specified output tables are tab
15292 delimited.
15294 **** hlines
15295 :PROPERTIES:
15296 :DESCRIPTION: Handle horizontal lines in tables
15297 :END:
15299 Tables are frequently represented with one or more horizontal lines,
15300 or hlines.  The ~:hlines~ argument to a code block accepts the values
15301 ~yes~ or ~no~, with a default value of ~no~.
15303 #+attr_texinfo: :table-type table :indic @asis
15304 - ~no~ ::
15306   Strips horizontal lines from the input table.  In most languages this
15307   is the desired effect because an ~hline~ symbol is interpreted as an
15308   unbound variable and raises an error.  Setting ~:hlines no~ or relying
15309   on the default value yields the following results.
15311   #+begin_example
15312      #+TBLNAME: many-cols
15313      | a | b | c |
15314      |---+---+---|
15315      | d | e | f |
15316      |---+---+---|
15317      | g | h | i |
15319      #+NAME: echo-table
15320      #+BEGIN_SRC python :var tab=many-cols
15321        return tab
15322      #+END_SRC
15324      #+RESULTS: echo-table
15325      | a | b | c |
15326      | d | e | f |
15327      | g | h | i |
15328   #+end_example
15330 - ~yes~ ::
15332   Leaves hlines in the table.  Setting ~:hlines yes~ has this effect.
15334   #+begin_example
15335      #+TBLNAME: many-cols
15336      | a | b | c |
15337      |---+---+---|
15338      | d | e | f |
15339      |---+---+---|
15340      | g | h | i |
15342      #+NAME: echo-table
15343      #+BEGIN_SRC python :var tab=many-cols :hlines yes
15344        return tab
15345      #+END_SRC
15347      #+RESULTS: echo-table
15348      | a | b | c |
15349      |---+---+---|
15350      | d | e | f |
15351      |---+---+---|
15352      | g | h | i |
15353   #+end_example
15355 **** colnames
15356 :PROPERTIES:
15357 :DESCRIPTION: Handle column names in tables
15358 :END:
15360 The ~:colnames~ header argument accepts the values ~yes~, ~no~, or
15361 ~nil~ for unassigned.  The default value is ~nil~.  Note that the
15362 behavior of the ~:colnames~ header argument may differ across
15363 languages.  For example Emacs Lisp code blocks ignore the ~:colnames~
15364 header argument entirely given the ease with which tables with column
15365 names may be handled directly in Emacs Lisp.
15367 #+attr_texinfo: :table-type table :indic @asis
15368 - ~nil~ ::
15370   If an input table looks like it has column names (because its second
15371   row is an hline), then the column names will be removed from the table
15372   before processing, then reapplied to the results.
15374   #+begin_example
15375      #+TBLNAME: less-cols
15376      | a |
15377      |---|
15378      | b |
15379      | c |
15381      #+NAME: echo-table-again
15382      #+BEGIN_SRC python :var tab=less-cols
15383        return [[val + '*' for val in row] for row in tab]
15384      #+END_SRC
15386      #+RESULTS: echo-table-again
15387      | a  |
15388      |----|
15389      | b* |
15390      | c* |
15391   #+end_example
15393   Please note that column names are not removed before the table is
15394   indexed using variable indexing.  See [[Indexable variable values]].
15396 - ~no~ ::
15398   No column name pre-processing takes place
15400 - ~yes~ ::
15402   Column names are removed and reapplied as with ~nil~ even if the table
15403   does not ``look like'' it has column names (i.e., the second row is
15404   not an hline).
15406 **** rownames
15407 :PROPERTIES:
15408 :DESCRIPTION: Handle row names in tables
15409 :END:
15411 The ~:rownames~ header argument can take on the values ~yes~
15412 or ~no~, with a default value of ~no~.
15414 #+attr_texinfo: :table-type table :indic @asis
15415 - ~no~ ::
15417   No row name pre-processing will take place.
15419 - ~yes~ ::
15421   The first column of the table is removed from the table before
15422   processing, and is then reapplied to the results.
15424   #+begin_example
15425      #+TBLNAME: with-rownames
15426      | one | 1 | 2 | 3 | 4 |  5 |
15427      | two | 6 | 7 | 8 | 9 | 10 |
15429      #+NAME: echo-table-once-again
15430      #+BEGIN_SRC python :var tab=with-rownames :rownames yes
15431        return [[val + 10 for val in row] for row in tab]
15432      #+END_SRC
15434      #+RESULTS: echo-table-once-again
15435      | one | 11 | 12 | 13 | 14 | 15 |
15436      | two | 16 | 17 | 18 | 19 | 20 |
15437   #+end_example
15439   Please note that row names are not removed before the table is indexed
15440   using variable indexing.  See [[Indexable variable values]].
15442 **** shebang
15443 :PROPERTIES:
15444 :DESCRIPTION: Make tangles files executable
15445 :END:
15447 Setting the ~:shebang~ header argument to a string value (e.g.,
15448 {{{samp(:shebang "#!/bin/bash")}}}) causes the string to be inserted as the
15449 first line of any tangled file holding the code block, and the file
15450 permissions of the tangled file are set to make it executable.
15452 **** eval
15453 :PROPERTIES:
15454 :DESCRIPTION: Limit evaluation of specific code blocks
15455 :END:
15457 The ~:eval~ header argument can be used to limit the evaluation of
15458 specific code blocks.  The ~:eval~ header argument can be useful for
15459 protecting against the evaluation of dangerous code blocks or to
15460 ensure that evaluation will require a query regardless of the value of
15461 the ~org-confirm-babel-evaluate~ variable.  The possible values of
15462 ~:eval~ and their effects are shown below.
15464 #+attr_texinfo: :table-type table :indic @asis
15465 - ~never~ or ~no~ ::
15467   The code block will not be evaluated under any circumstances.
15469 - ~query~ ::
15471   Evaluation of the code block will require an affirmative answer to a
15472   query.
15474 - ~never-export~ or ~no-export~ ::
15476   The code block will not be evaluated during export but may still be
15477   called interactively.
15479 - ~query-export~ ::
15481   Evaluation of the code block during export will require an affirmative
15482   answer to a query.
15485 If this header argument is not set then evaluation is determined by the value
15486 of the ~org-confirm-babel-evaluate~ variable (see [[Code evaluation
15487 security]]).
15489 **** wrap
15490 :PROPERTIES:
15491 :DESCRIPTION: Mark source block evaluation results
15492 :END:
15494 The ~:wrap~ header argument is used to mark the results of source
15495 block evaluation.  The header argument can be passed a string that will
15496 be appended to ~#+BEGIN_~ and ~#+END_~, which will then be used to
15497 wrap the results.  If no string is specified then the results will be
15498 wrapped in a ~#+BEGIN/END_RESULTS~ block.
15500 ** Results of evaluation
15501    :PROPERTIES:
15502    :DESCRIPTION: How evaluation results are handled
15503    :END:
15504 #+cindex: code block, results of evaluation
15505 #+cindex: source code, results of evaluation
15507 The way in which results are handled depends on whether a session is
15508 invoked, as well as on whether ~:results value~ or ~:results output~
15509 is used.  The following table shows the table possibilities.  For a full
15510 listing of the possible results header arguments, see [[results]].
15512 |                   | *Non-session*            | *Session*                           |
15513 |-------------------+--------------------------+-------------------------------------|
15514 | ~:results value~  | value of last expression | value of last expression            |
15515 | ~:results output~ | contents of STDOUT       | concatenation of interpreter output |
15518 Please note that with ~:results value~, the result in both ~:session~
15519 and non-session is returned to Org mode as a table (a one- or
15520 two-dimensional vector of strings or numbers) when appropriate.
15522 *** Non-session
15524 #+attr_texinfo: :table-type table :indic @asis
15525 - ~:results value~ ::
15527   This is the default.  Internally, the value is obtained by wrapping the
15528   code in a function definition in the external language, and evaluating
15529   that function.  Therefore, code should be written as if it were the
15530   body of such a function.  In particular, note that Python does not
15531   automatically return a value from a function unless a ~return~
15532   statement is present, and so a {{{samp(return)}}} statement will
15533   usually be required in Python.
15535   This is the only one of the four evaluation contexts in which the code
15536   is automatically wrapped in a function definition.
15538 - ~:results output~ ::
15540   The code is passed to the interpreter as an external process, and the
15541   contents of the standard output stream are returned as text.[fn:152]
15543 *** Session
15545 #+attr_texinfo: :table-type table :indic @asis
15546 - ~:results value~ ::
15548   The code is passed to an interpreter running as an interactive Emacs
15549   inferior process.  Only languages which provide tools for interactive
15550   evaluation of code have session support, so some language (e.g., C and
15551   ditaa) do not support the ~:session~ header argument, and in other
15552   languages (e.g., Python and Haskell) which have limitations on the
15553   code which may be entered into interactive sessions, those limitations
15554   apply to the code in code blocks using the ~:session~ header argument
15555   as well.
15557   Unless the ~:results output~ option is supplied (see below) the result
15558   returned is the result of the last evaluation performed by the
15559   interpreter.[fn:153]
15561 - ~:results output~ ::
15563   The code is passed to the interpreter running as an interactive Emacs
15564   inferior process.  The result returned is the concatenation of the
15565   sequence of (text) output from the interactive interpreter.  Notice
15566   that this is not necessarily the same as what would be sent to
15567   ~STDOUT~ if the same code were passed to a non-interactive interpreter
15568   running as an external process.  Compare the following two
15569   examples:
15571   #+begin_example
15572      #+BEGIN_SRC python :results output
15573       print "hello"
15574       2
15575       print "bye"
15576      #+END_SRC
15578      #+RESULTS:
15579      : hello
15580      : bye
15581   #+end_example
15583   In non-session mode, the `2' is not printed and does not appear.
15585   #+begin_example
15586      #+BEGIN_SRC python :results output :session
15587       print "hello"
15588       2
15589       print "bye"
15590      #+END_SRC
15592      #+RESULTS:
15593      : hello
15594      : 2
15595      : bye
15596   #+end_example
15598   But in ~:session~ mode, the interactive interpreter receives input `2'
15599   and prints out its value, `2'.  (Indeed, the other print statements are
15600   unnecessary here).
15602 ** Noweb reference syntax
15603    :PROPERTIES:
15604    :DESCRIPTION: Literate programming in Org mode
15605    :END:
15606 #+cindex: code block, noweb reference
15607 #+cindex: syntax, noweb
15608 #+cindex: source code, noweb reference
15610 The ``noweb'' (see [[http://www.cs.tufts.edu/~nr/noweb/]]) Literate
15611 Programming system allows named blocks of code to be referenced using
15612 the familiar Noweb syntax:
15614 #+begin_example
15615    <<code-block-name>>
15616 #+end_example
15618 When a code block is tangled or evaluated, whether or not ``noweb''
15619 references are expanded depends upon the value of the ~:noweb~ header
15620 argument.  If ~:noweb yes~, then a Noweb reference is expanded before
15621 evaluation.  If ~:noweb no~, the default, then the reference is not
15622 expanded before evaluation.  See the [[noweb-ref]] header argument for a
15623 more flexible way to resolve noweb references.
15625 It is possible to include the /results/ of a code block rather than
15626 the body.  This is done by appending parenthesis to the code block
15627 name, which may optionally contain arguments to the code block as
15628 shown below.
15630 #+begin_example
15631    <<code-block-name(optional arguments)>>
15632 #+end_example
15634 Note that the default value, ~:noweb no~, was chosen to ensure that
15635 correct code is not broken in a language, such as Ruby, where
15636 ~<<arg>>~ is a syntactically valid construct.  If ~<<arg>>~ is not
15637 syntactically valid in languages that you use, then please consider
15638 setting the default value.
15640 If noweb tangling is slow in large Org mode files, consider
15641 setting the ~*org-babel-use-quick-and-dirty-noweb-expansion*~ variable
15642 to true.  This will result in faster noweb reference resolution at the
15643 expense of not correctly resolving inherited values of the
15644 ~:noweb-ref~ header argument.
15646 ** Key bindings and useful functions
15647    :PROPERTIES:
15648    :DESCRIPTION: Work quickly with code blocks
15649    :END:
15650 #+cindex: code block, key bindings
15652 Many common Org mode key sequences are re-bound depending on
15653 the context.
15655 Within a code block, the following key bindings
15656 are active:
15657 #+kindex: C-c C-c
15658 #+kindex: C-c C-o
15659 #+kindex: C-up
15660 #+kindex: M-down
15662 #+attr_texinfo: :columns 0.2 0.55
15663 | Key binding           | Function                          |
15664 |-----------------------+-----------------------------------|
15665 | {{{kbd(C-c C-c)}}}    | ~org-babel-execute-src-block~     |
15666 | {{{kbd(C-c C-o)}}}    | ~org-babel-open-src-block-result~ |
15667 | {{{kbdkey(C-,up)}}}   | ~org-babel-load-in-session~       |
15668 | {{{kbdkey(M-,down)}}} | ~org-babel-pop-to-session~        |
15671 In an Org mode buffer, the following key bindings are active:
15673 #+kindex: C-c C-v p
15674 #+kindex: C-c C-v C-p
15675 #+kindex: C-c C-v n
15676 #+kindex: C-c C-v C-n
15677 #+kindex: C-c C-v e
15678 #+kindex: C-c C-v C-e
15679 #+kindex: C-c C-v o
15680 #+kindex: C-c C-v C-o
15681 #+kindex: C-c C-v v
15682 #+kindex: C-c C-v C-v
15683 #+kindex: C-c C-v u
15684 #+kindex: C-c C-v C-u
15685 #+kindex: C-c C-v g
15686 #+kindex: C-c C-v C-g
15687 #+kindex: C-c C-v r
15688 #+kindex: C-c C-v C-r
15689 #+kindex: C-c C-v b
15690 #+kindex: C-c C-v C-b
15691 #+kindex: C-c C-v s
15692 #+kindex: C-c C-v C-s
15693 #+kindex: C-c C-v d
15694 #+kindex: C-c C-v C-d
15695 #+kindex: C-c C-v t
15696 #+kindex: C-c C-v C-t
15697 #+kindex: C-c C-v f
15698 #+kindex: C-c C-v C-f
15699 #+kindex: C-c C-v c
15700 #+kindex: C-c C-v C-c
15701 #+kindex: C-c C-v j
15702 #+kindex: C-c C-v C-j
15703 #+kindex: C-c C-v l
15704 #+kindex: C-c C-v C-l
15705 #+kindex: C-c C-v i
15706 #+kindex: C-c C-v C-i
15707 #+kindex: C-c C-v I
15708 #+kindex: C-c C-v C-I
15709 #+kindex: C-c C-v z
15710 #+kindex: C-c C-v C-z
15711 #+kindex: C-c C-v a
15712 #+kindex: C-c C-v C-a
15713 #+kindex: C-c C-v h
15714 #+kindex: C-c C-v C-h
15715 #+kindex: C-c C-v x
15716 #+kindex: C-c C-v C-x
15718 #+attr_texinfo: :columns 0.4 0.6
15719 | Key binding                                    | Function                                   |
15720 |------------------------------------------------+--------------------------------------------|
15721 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~             |
15722 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~                 |
15723 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~                  |
15724 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~          |
15725 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~               |
15726 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~            |
15727 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~           |
15728 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~              |
15729 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~                 |
15730 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~                |
15731 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~                |
15732 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~                         |
15733 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~                    |
15734 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~                |
15735 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~              |
15736 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~                |
15737 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~                     |
15738 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~            |
15739 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~    |
15740 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~                      |
15741 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~              |
15742 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
15745 # When possible these keybindings were extended to work when the control key is
15746 # kept pressed, resulting in the following additional keybindings.
15748 # @multitable @columnfractions 0.25 0.75
15749 # - {{{kbd(C-c C-v C-a)}}} @tab ~org-babel-sha1-hash~
15750 # - {{{kbd(C-c C-v C-b)}}} @tab ~org-babel-execute-buffer~
15751 # - {{{kbd(C-c C-v C-f)}}} @tab ~org-babel-tangle-file~
15752 # - {{{kbd(C-c C-v C-l)}}} @tab ~org-babel-lob-ingest~
15753 # - {{{kbd(C-c C-v C-p)}}} @tab ~org-babel-expand-src-block~
15754 # - {{{kbd(C-c C-v C-s)}}} @tab ~org-babel-execute-subtree~
15755 # - {{{kbd(C-c C-v C-t)}}} @tab ~org-babel-tangle~
15756 # - {{{kbd(C-c C-v C-z)}}} @tab ~org-babel-switch-to-session~
15757 # @end multitable
15759 ** Batch execution
15760    :PROPERTIES:
15761    :DESCRIPTION: Call functions from the command line
15762    :END:
15763 #+cindex: code block, batch execution
15764 #+cindex: source code, batch execution
15766 It is possible to call functions from the command line.  This shell
15767 script calls ~org-babel-tangle~ on every one of its arguments.
15769 Be sure to adjust the paths to fit your system.
15771 #+begin_example
15772    #!/bin/sh
15773    # -*- mode: shell-script -*-
15774    #
15775    # tangle files with org-mode
15776    #
15777    DIR=`pwd`
15778    FILES=""
15780    # wrap each argument in the code required to call tangle on it
15781    for i in $@; do
15782        FILES="$FILES \"$i\""
15783    done
15785    emacs -Q --batch \
15786    --eval "(progn
15787    (add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\"))
15788    (add-to-list 'load-path (expand-file-name \"~/src/org/contrib/lisp/\" t))
15789    (require 'org)(require 'org-exp)(require 'ob)(require 'ob-tangle)
15790    (mapc (lambda (file)
15791           (find-file (expand-file-name file \"$DIR\"))
15792           (org-babel-tangle)
15793           (kill-buffer)) '($FILES)))" 2>&1 |grep tangled
15794 #+end_example
15796 * FIXME Miscellaneous
15797   :PROPERTIES:
15798   :DESCRIPTION: All the rest which did not fit elsewhere
15799   :END:
15801 ** FIXME Completion
15802    :PROPERTIES:
15803    :DESCRIPTION: M-TAB knows what you need
15804    :END:
15805 #+cindex: completion, of @TeX{} symbols
15806 #+cindex: completion, of TODO keywords
15807 #+cindex: completion, of dictionary words
15808 #+cindex: completion, of option keywords
15809 #+cindex: completion, of tags
15810 #+cindex: completion, of property keys
15811 #+cindex: completion, of link abbreviations
15812 #+cindex: @TeX{} symbol completion
15813 #+cindex: TODO keywords completion
15814 #+cindex: dictionary word completion
15815 #+cindex: option keyword completion
15816 #+cindex: tag completion
15817 #+cindex: link abbreviations, completion of
15819 Emacs would not be Emacs without completion, and Org mode uses it
15820 whenever it makes sense.  If you prefer an iswitchb- or ido-like
15821 interface for some of the completion prompts, you can specify your
15822 preference by setting at most one of the variables
15823 ~org-completion-use-iswitchb~ or ~org-completion-use-ido~.
15825 Org supports in-buffer completion.  This type of completion does not
15826 make use of the minibuffer.  You simply type a few letters into the
15827 buffer and use the {{{key(TAB)}}} key to complete text right there.
15829 #+attr_texinfo: :table-type table :indic @asis
15830 - {{{kbdkey(M-,TAB)}}} ::
15831   #+kindex: M-@key{TAB}
15833   Complete word at point.
15835   - At the beginning of a headline :: 
15837     Complete TODO keywords.
15839   - After {{{kbd(XXX)}}} :: 
15840     # Should be \
15841     Complete TeX symbols supported by the exporter.
15843   - After {{{samp(*)}}} :: 
15845     Complete headlines in the current buffer so that they can be used in
15846     search links like:
15847     
15848     #+begin_example
15849        [[*find this headline]]
15850     #+end_example
15852   - After {{{samp(:)}}} in a headline :: 
15854     Complete tags.  The list of tags is taken from the variable
15855     ~org-tag-alist~ (possibly set through the {{{samp(#+TAGS)}}} in-buffer
15856     option, see [[Setting tags]]), or it is created dynamically from all tags
15857     used in the current buffer.
15859   - After {{{samp(:)}}} and not in a headline ::
15861     Complete property keys.  The list of keys is constructed dynamically
15862     from all keys used in the current buffer.
15864   - After {{{samp([)}}} ::
15866     Complete link abbreviations (see [[Link abbreviations]]).
15868   - After {{{samp(#+)}}} ::
15870     Complete the special keywords like {{{samp(TYP_TODO)}}} or
15871     {{{samp(OPTIONS)}}} which set file-specific options for Org mode.  When
15872     the option keyword is already complete, pressing {{{kbdkey(M-,TAB)}}}
15873     again will insert example settings for this keyword.
15875   - In the line after {{{samp(#+STARTUP: )}}} ::
15877     Complete startup keywords, i.e., valid keys for this line.
15879   - Elsewhere ::
15881     Complete dictionary words using Ispell.
15883 ** Easy templates
15884    :PROPERTIES:
15885    :DESCRIPTION: Quick insertion of structural elements
15886    :END:
15887 #+cindex: template insertion
15888 #+cindex: insertion, of templates
15890 Org mode supports insertion of empty structural elements (like
15891 ~#+BEGIN_SRC~ and ~#+END_SRC~ pairs) with just a few key strokes.  This
15892 is achieved through a native template expansion mechanism.  Note that
15893 Emacs has several other template mechanisms which could be used in a
15894 similar way, for example {{{file(yasnippet)}}}.
15896 To insert a structural element, type a {{{kbd(<)}}}, followed by a
15897 template selector and {{{kbdkey(,TAB)}}}.  Completion takes effect only
15898 when the above keystrokes are typed on a line by itself.
15900 The following template selectors are currently supported:
15901 #+kindex: s
15902 #+kindex: e
15903 #+kindex: q
15904 #+kindex: v
15905 #+kindex: c
15906 #+kindex: l
15907 #+kindex: L
15908 #+kindex: h
15909 #+kindex: H
15910 #+kindex: a
15911 #+kindex: A
15912 #+kindex: i
15913 #+kindex: I
15915 #+attr_texinfo: :columns 0.2 0.7
15916 | Selector     | Template                              |
15917 |--------------+---------------------------------------|
15918 | {{{kbd(a)}}} | ~#+BEGIN_ASCII~ ...~ #+END_ASCII~     |
15919 | {{{kbd(A)}}} | ~#+ASCII:~                            |
15920 | {{{kbd(c)}}} | ~#+BEGIN_CENTER~ ... ~#+END_CENTER~   |
15921 | {{{kbd(e)}}} | ~#+BEGIN_EXAMPLE~ ... ~#+END_EXAMPLE~ |
15922 | {{{kbd(h)}}} | ~#+BEGIN_HTML~ ... ~#+END_HTML~       |
15923 | {{{kbd(H)}}} | ~#+HTML:~                             |
15924 | {{{kbd(i)}}} | ~#+INDEX:~                            |
15925 | {{{kbd(I)}}} | ~#+INCLUDE:~                          |
15926 | {{{kbd(l)}}} | ~#+BEGIN_LaTeX~ ... ~#+END_LaTeX~     |
15927 | {{{kbd(L)}}} | ~#+LaTeX:~                            |
15928 | {{{kbd(q)}}} | ~#+BEGIN_QUOTE~ ... ~#+END_QUOTE~     |
15929 | {{{kbd(s)}}} | ~#+BEGIN_SRC~ ... ~#+END_SRC~         |
15930 | {{{kbd(v)}}} | ~#+BEGIN_VERSE~ ... ~#+END_VERSE~     |
15932 For example, on an empty line, typing "<e" and then pressing TAB, will expand
15933 into a complete EXAMPLE template.
15935 You can install additional templates by customizing the variable
15936 ~org-structure-template-alist~.  See the docstring of the variable for
15937 additional details.
15939 ** Speed keys
15940    :PROPERTIES:
15941    :DESCRIPTION: Electric commands at the beginning of a headline
15942    :END:
15943 #+cindex: speed keys
15944 #+vindex: org-use-speed-commands
15945 #+vindex: org-speed-commands-user
15947 Single keys can be made to execute commands when the cursor is at the
15948 beginning of a headline, i.e., before the first star.  Configure the
15949 variable ~org-use-speed-commands~ to activate this feature.  There is a
15950 pre-defined list of commands, and you can add more such commands using
15951 the variable ~org-speed-commands-user~.  Speed keys do not only speed
15952 up navigation and other commands, but they also provide an alternative
15953 way to execute commands bound to keys that are not or not easily
15954 available on a TTY, or on a small mobile device with a limited
15955 keyboard.
15957 To see which commands are available, activate the feature and press
15958 {{{kbd(?)}}} with the cursor at the beginning of a headline.
15960 ** Code evaluation security
15961    :PROPERTIES:
15962    :DESCRIPTION: Org mode files evaluate in-line code
15963    :TITLE:    Code evaluation and security issues
15964    :END:
15966 Org provides tools to work with the code snippets, including
15967 evaluating them.
15969 Running code on your machine always comes with a security risk.  Badly
15970 written or malicious code can be executed on purpose or by accident.
15971 Org has default settings that will only evaluate source code if you
15972 give explicit permission to do so, and as a casual user of these
15973 features you should leave these precautions intact.
15975 For people who regularly work with source code, the confirmation
15976 prompts can become annoying, and you might want to turn them off.  This
15977 can be done, but you must be aware of the risks that are involved.
15979 Code evaluation can happen under the following circumstances:
15981 #+attr_texinfo: :table-type table :indic @asis
15982 - Source code blocks ::
15984   Source code blocks can be evaluated during export, or when pressing
15985   {{{kbd(C-c C-c)}}} in the block.  The most important thing to realize
15986   here is that Org mode files which contain code snippets are, in a
15987   certain sense, like executable files.  So you should accept them and
15988   load them into Emacs only from trusted sources---just like you would
15989   do with a program you install on your computer.
15991   Make sure you know what you are doing before customizing the variables
15992   that take off the default security brakes.
15994   - ~org-confirm-babel-evaluate~ ::
15996     When ~t~ (the default), the user is asked before every code block
15997     evaluation.  When ~nil~, the user is not asked.  When set to a function,
15998     it is called with two arguments (language and body of the code block)
15999     and should return ~t~ to ask and ~nil~ not to ask.
16001   For example, here is how to execute "ditaa" code (which is considered
16002   safe) without asking:
16004   #+header: :eval no
16005   #+header: :exports code
16006   #+begin_src emacs-lisp
16007   (defun my-org-confirm-babel-evaluate (lang body)
16008     (not (string= lang "ditaa")))  ; don't ask for ditaa
16009   (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
16010   #+end_src
16012 - Following ~shell~ and ~elisp~ links ::
16014   Org has two link types that can directly evaluate code (see [[External
16015   links]]).  These links can be problematic because the code to be
16016   evaluated is not visible.
16018   - ~org-confirm-shell-link-function~ ::
16019     
16020     Function to queries user about shell link execution.
16022   - ~org-confirm-elisp-link-function~ ::
16024     Function to query user for Emacs Lisp link execution.
16026 - Formulas in tables ::
16028   Formulas in tables (see [[The spreadsheet]]) are code that is evaluated
16029   either by the /calc/ interpreter, or by the /Emacs Lisp/ interpreter.
16031 ** Customization
16032    :PROPERTIES:
16033    :DESCRIPTION: Adapting Org to your taste
16034    :END:
16035 #+cindex: customization
16036 #+cindex: options, for customization
16037 #+cindex: variables, for customization
16039 There are more than 500 variables that can be used to customize Org.
16040 For the sake of compactness of the manual, I am not describing the
16041 variables here.  A structured overview of customization variables is
16042 available with {{{kbd(M-x org-customize)}}}.  Or select ~Browse Org
16043 Group~ from the ~Org->Customization~ menu.  Many settings can also be
16044 activated on a per-file basis, by putting special lines into the
16045 buffer (see [[In-buffer settings]]).
16047 ** In-buffer settings
16048    :PROPERTIES:
16049    :DESCRIPTION: Overview of the #+KEYWORDS
16050    :TITLE:    Summary of in-buffer settings
16051    :END:
16052 #+cindex: in-buffer settings
16053 #+cindex: special keywords
16055 Org mode uses special lines in the buffer to define settings on a
16056 per-file basis.  These lines start with a {{{samp(#+)}}} followed by a
16057 keyword, a colon, and then individual words defining a setting.
16058 Several setting words can be in the same line, but you can also have
16059 multiple lines for the keyword.  While these settings are described
16060 throughout the manual, here is a summary.  After changing any of those
16061 lines in the buffer, press {{{kbd(C-c C-c)}}} with the cursor still in
16062 the line to activate the changes immediately.  Otherwise they become
16063 effective only when the file is visited again in a new Emacs session.
16065 #+vindex: org-archive-location
16066 #+attr_texinfo: :table-type table :indic @asis
16067 - {{{kbd(#+ARCHIVE: %s_done)}}} ::
16069   This line sets the archive location for the agenda file.  It applies to
16070   all subsequent lines, until the next {{{samp(#+ARCHIVE)}}} line or the
16071   end of the file.  The first such line also applies to any entries
16072   before it.  The corresponding variable is ~org-archive-location~.
16074 - {{{kbd(#+CATEGORY:)}}} ::
16076   This line sets the category for the agenda file.  The category applies
16077   to all subsequent lines, until the next {{{samp(#+CATEGORY)}}} line or
16078   the end of the file.  The first such line also applies to any entries
16079   before it.
16081 - {{{kbd(#+COLUMNS: %25ITEM ...)}}} ::
16082   #+cindex: property, COLUMNS
16084   Set the default format for columns view.  This format applies when
16085   columns view is invoked in locations where no ~COLUMNS~ property
16086   applies.
16088 - {{{kbd(#+CONSTANTS: name1=value1 ...)}}} ::
16089   #+vindex: org-table-formula-constants
16090   #+vindex: org-table-formula
16092   Set file-local values for constants to be used in table formulas.  This
16093   line sets the local variable ~org-table-formula-constants-local~.  The
16094   global version of this variable is ~org-table-formula-constants~.
16096 - {{{kbd(#+FILETAGS: :tag1:tag2:tag3:)}}} ::
16098   Set tags that can be inherited by any entry in the file, including the
16099   top-level entries.
16101 - {{{kbd(#+DRAWERS: NAME1 ...)}}} ::
16102   #+vindex: org-drawers
16104   Set the file-local set of additional drawers.  The corresponding global
16105   variable is ~org-drawers~.
16107 - {{{kbd(#+LINK:  linkword replace)}}} ::
16108   #+vindex: org-link-abbrev-alist
16110   These lines (several are allowed) specify link abbreviations.  See
16111   [[Link abbreviations]].  The corresponding variable is ~org-link-abbrev-alist~.
16113 - {{{kbd(#+PRIORITIES: highest lowest default)}}} ::
16114   #+vindex: org-highest-priority
16115   #+vindex: org-lowest-priority
16116   #+vindex: org-default-priority
16118   This line sets the limits and the default for the priorities.  All
16119   three must be either letters A-Z or numbers 0-9.  The highest priority
16120   must have a lower ASCII number than the lowest priority.
16122 - {{{kbd(#+PROPERTY: Property_Name Value)}}} ::
16124   This line sets a default inheritance value for entries in the current
16125   buffer, most useful for specifying the allowed values of a property.
16127 - {{{kbd(#+SETUPFILE: file)}}} ::
16128   #+cindex: #+SETUPFILE
16130   This line defines a file that holds more in-buffer setup.  Normally
16131   this is entirely ignored.  Only when the buffer is parsed for
16132   option-setting lines (i.e., when starting Org mode for a file, when
16133   pressing {{{kbd(C-c C-c)}}} in a settings line, or when exporting),
16134   then the contents of this file are parsed as if they had been included
16135   in the buffer.  In particular, the file can be any other Org mode file
16136   with internal setup.  You can visit the file the cursor is in the line
16137   with {{{kbd(C-c ')}}}.
16139 - {{{kbd(#+STARTUP:)}}} ::
16140   #+cindex: #+STARTUP:
16142   This line sets options to be used at startup of Org mode, when an
16143   Org file is being visited.
16145   The first set of options deals with the initial visibility of the
16146   outline tree.  The corresponding variable for global default settings
16147   is ~org-startup-folded~, with a default value ~t~, which means
16148   ~overview~.
16150   #+vindex: org-startup-folded
16151   #+cindex: @code{overview}, STARTUP keyword
16152   #+cindex: @code{content}, STARTUP keyword
16153   #+cindex: @code{showall}, STARTUP keyword
16154   #+cindex: @code{showeverything}, STARTUP keyword
16156   #+attr_texinfo: :table-type table :indic @asis
16157   - ~overview~ ::         top-level headlines only
16158   - ~content~ ::         all headlines
16159   - ~showall~ ::         no folding of any entries
16160   - ~showeverything~ ::  show even drawer contents
16162   #+vindex: org-startup-indented
16163   #+cindex: @code{indent}, STARTUP keyword
16164   #+cindex: @code{noindent}, STARTUP keyword
16166   Dynamic virtual indentation is controlled by the variable
16167   ~org-startup-indented~.[fn:182]
16169   #+attr_texinfo: :table-type table :indic @asis
16170   - ~indent~ ::     start with ~org-indent-mode~ turned on
16171   - ~noindent~ ::   start with ~org-indent-mode~ turned off
16173   #+vindex: org-startup-align-all-tables
16175   Then there are options for aligning tables upon visiting a file.  This
16176   is useful in files containing narrowed table columns.  The corresponding
16177   variable is ~org-startup-align-all-tables~, with a default value
16178   ~nil~.
16180   #+cindex: @code{align}, STARTUP keyword
16181   #+cindex: @code{noalign}, STARTUP keyword
16183   #+attr_texinfo: :table-type table :indic @asis
16184   - ~align~ ::      align all tables
16185   - ~noalign~ ::    don't align tables on startup
16187   #+vindex: org-startup-with-inline-images
16189   When visiting a file, inline images can be automatically displayed.
16190   The corresponding variable is ~org-startup-with-inline-images~, with a
16191   default value ~nil~ to avoid delays when visiting a file.
16193   #+cindex: @code{inlineimages}, STARTUP keyword
16194   #+cindex: @code{noinlineimages}, STARTUP keyword
16196   #+attr_texinfo: :table-type table :indic @asis
16197   - ~inlineimages~   show inline images
16198   - ~noinlineimages~ don't show inline images on startup
16200   #+vindex: org-log-done
16201   #+vindex: org-log-note-clock-out
16202   #+vindex: org-log-repeat
16204   Logging the closing and reopening of TODO items and clock intervals
16205   can be configured using these options (see variables ~org-log-done~,
16206   ~org-log-note-clock-out~, and ~org-log-repeat~).
16208   #+cindex: @code{logdone}, STARTUP keyword
16209   #+cindex: @code{lognotedone}, STARTUP keyword
16210   #+cindex: @code{nologdone}, STARTUP keyword
16211   #+cindex: @code{lognoteclock-out}, STARTUP keyword
16212   #+cindex: @code{nolognoteclock-out}, STARTUP keyword
16213   #+cindex: @code{logrepeat}, STARTUP keyword
16214   #+cindex: @code{lognoterepeat}, STARTUP keyword
16215   #+cindex: @code{nologrepeat}, STARTUP keyword
16216   #+cindex: @code{logreschedule}, STARTUP keyword
16217   #+cindex: @code{lognotereschedule}, STARTUP keyword
16218   #+cindex: @code{nologreschedule}, STARTUP keyword
16219   #+cindex: @code{logredeadline}, STARTUP keyword
16220   #+cindex: @code{lognoteredeadline}, STARTUP keyword
16221   #+cindex: @code{nologredeadline}, STARTUP keyword
16222   #+cindex: @code{logrefile}, STARTUP keyword
16223   #+cindex: @code{lognoterefile}, STARTUP keyword
16224   #+cindex: @code{nologrefile}, STARTUP keyword
16226   #+attr_texinfo: :table-type table :indic @asis
16227   - ~logdone~ ::            record a timestamp when an item is marked DONE
16228   - ~lognotedone~ ::        record timestamp and a note when DONE
16229   - ~nologdone~ ::          don't record when items are marked DONE
16230   - ~logrepeat~ ::          record a time when reinstating a repeating item
16231   - ~lognoterepeat~ ::      record a note when reinstating a repeating item
16232   - ~nologrepeat~ ::        do not record when reinstating repeating item
16233   - ~lognoteclock-out~ ::   record a note when clocking out
16234   - ~nolognoteclock-out~ :: don't record a note when clocking out
16235   - ~logreschedule~ ::      record a timestamp when scheduling time changes
16236   - ~lognotereschedule~ ::  record a note when scheduling time changes
16237   - ~nologreschedule~ ::    do not record when a scheduling date changes
16238   - ~logredeadline~ ::      record a timestamp when deadline changes
16239   - ~lognoteredeadline~ ::  record a note when deadline changes
16240   - ~nologredeadline~ ::    do not record when a deadline date changes
16241   - ~logrefile~ ::          record a timestamp when refiling
16242   - ~lognoterefile~ ::      record a note when refiling
16243   - ~nologrefile~ ::        do not record when refiling
16245   #+vindex: org-hide-leading-stars
16246   #+vindex: org-odd-levels-only
16248   Here are the options for hiding leading stars in outline headings, and
16249   for indenting outlines.  The corresponding variables are
16250   ~org-hide-leading-stars~ and ~org-odd-levels-only~, both with a
16251   default setting ~nil~ (meaning ~showstars~ and ~oddeven~).
16253   #+cindex: @code{hidestars}, STARTUP keyword
16254   #+cindex: @code{showstars}, STARTUP keyword
16255   #+cindex: @code{odd}, STARTUP keyword
16256   #+cindex: @code{even}, STARTUP keyword
16258   #+attr_texinfo: :table-type table :indic @asis
16259   - ~hidestars~ ::  make all but one of the stars starting a headline invisible.
16260   - ~showstars~ ::  show all stars starting a headline
16261   - ~indent~ ::     virtual indentation according to outline level
16262   - ~noindent~ ::   no virtual indentation according to outline level
16263   - ~odd~ ::        allow only odd outline levels (1, 3, ...)
16264   - ~oddeven~ ::    allow all outline levels
16266   #+vindex: org-put-time-stamp-overlays
16267   #+vindex: org-time-stamp-overlay-formats
16269   To turn on custom format overlays over timestamps (variables
16270   ~org-put-time-stamp-overlays~ and ~org-time-stamp-overlay-formats~),
16271   use:
16273   #+cindex: @code{customtime}, STARTUP keyword
16274      
16275   #+attr_texinfo: :table-type table :indic @asis
16276   - ~customtime~ :: overlay custom time format
16278   #+vindex: constants-unit-system
16280   The following options influence the table spreadsheet (variable
16281   ~constants-unit-system~).
16283   #+cindex: @code{constcgs}, STARTUP keyword
16284   #+cindex: @code{constSI}, STARTUP keyword
16286   #+attr_texinfo: :table-type table :indic @asis
16287   - ~constcgs~ ::   {{{file(constants.el)}}} should use the c-g-s unit system
16288   - ~constSI~ ::    {{{file(constants.el)}}} should use the SI unit system
16289   
16290   #+vindex: org-footnote-define-inline
16291   #+vindex: org-footnote-auto-label
16292   #+vindex: org-footnote-auto-adjust
16294   To influence footnote settings, use the following keywords.  The
16295   corresponding variables are ~org-footnote-define-inline~,
16296   ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
16298   #+cindex: @code{fninline}, STARTUP keyword
16299   #+cindex: @code{nofninline}, STARTUP keyword
16300   #+cindex: @code{fnlocal}, STARTUP keyword
16301   #+cindex: @code{fnprompt}, STARTUP keyword
16302   #+cindex: @code{fnauto}, STARTUP keyword
16303   #+cindex: @code{fnconfirm}, STARTUP keyword
16304   #+cindex: @code{fnplain}, STARTUP keyword
16305   #+cindex: @code{fnadjust}, STARTUP keyword
16306   #+cindex: @code{nofnadjust}, STARTUP keyword
16308   #+attr_texinfo: :table-type table :indic @asis
16309   - ~fninline~ ::    define footnotes inline
16310   - ~fnnoinline~ ::  define footnotes in separate section
16311   - ~fnlocal~ ::     define footnotes near first reference, but not inline
16312   - ~fnprompt~ ::    prompt for footnote labels
16313   - ~fnauto~ ::      create ~[fn:1]~-like labels automatically (default)
16314   - ~fnconfirm~ ::   offer automatic label for editing or confirmation
16315   - ~fnplain~ ::     create ~[1]~-like labels automatically
16316   - ~fnadjust~ ::    automatically renumber and sort footnotes
16317   - ~nofnadjust~ ::  do not renumber and sort automatically
16319   #+cindex: org-hide-block-startup
16321   To hide blocks on startup, use these keywords.  The corresponding
16322   variable is ~org-hide-block-startup~.
16324   #+cindex: @code{hideblocks}, STARTUP keyword
16325   #+cindex: @code{nohideblocks}, STARTUP keyword
16327   #+attr_texinfo: :table-type table :indic @asis
16328   - ~hideblocks~ ::   Hide all begin/end blocks on startup
16329   - ~nohideblocks~ :: Do not hide blocks on startup
16330   
16331   #+cindex: org-pretty-entities
16333   The display of entities as UTF-8 characters is governed by the
16334   variable ~org-pretty-entities~ and the keywords
16336   #+cindex: @code{entitiespretty}, STARTUP keyword
16337   #+cindex: @code{entitiesplain}, STARTUP keyword
16339   #+attr_texinfo: :table-type table :indic @asis
16340   - ~entitiespretty~ ::  Show entities as UTF-8 characters where possible
16341   - ~entitiesplain~ ::   Leave entities plain
16343 - {{{kbd(#+TAGS:  TAG1(c1) TAG2(c2))}}} ::
16344   #+vindex: org-tag-alist
16346   These lines (several such lines are allowed) specify the valid tags in
16347   this file, and (potentially) the corresponding /fast tag selection/
16348   keys.  The corresponding variable is ~org-tag-alist~.
16350 - {{{kbd(#+TBLFM:)}}} ::
16352   This line contains the formulas for the table directly above the line.
16354 - {{{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:)}}} ::
16356   These lines provide settings for exporting files.  For more details see
16357   [[Export options]].
16359 - {{{kbd(#+TODO:)}}}, {{{kbd(#+SEQ_TODO:)}}}, {{{kbd(#+TYP_TODO:)}}} ::
16360   #+vindex: org-todo-keywords
16362   These lines set the TODO keywords and their interpretation in the
16363   current file.  The corresponding variable is ~org-todo-keywords~.
16365 ** The very busy C-c C-c key
16366    :PROPERTIES:
16367    :DESCRIPTION: When in doubt, press C-c C-c
16368    :TITLE:    The very busy C-c C-c key
16369    :END:
16370 #+kindex: C-c C-c
16371 #+cindex: C-c C-c, overview
16373 The key {{{kbd(C-c C-c)}}} has many purposes in Org, which are all
16374 mentioned scattered throughout this manual.  One specific function of
16375 this key is to add /tags/ to a headline (see [[Tags]]).  In many
16376 other circumstances it means something like "Hey Org, look
16377 here and update according to what you see here."  Here is a summary of
16378 what this means in different contexts.
16380 - If there are highlights in the buffer from the creation of a sparse
16381   tree, or from clock display, remove these highlights.
16382 - If the cursor is in one of the special ~#+KEYWORD~ lines, this
16383   triggers scanning the buffer for these lines and updating the
16384   information.
16385 - If the cursor is inside a table, realign the table.  This command
16386   works even if the automatic table editor has been turned off.
16387 - If the cursor is on a ~#+TBLFM~ line, re-apply the formulas to the
16388   entire table.
16389 - If the current buffer is a capture buffer, close the note and file
16390   it.  With a prefix argument, file it, without further interaction, to
16391   the default location.
16392 - If the cursor is on a ~<<<target>>>~, update radio targets and
16393   corresponding links in this buffer.
16394 - If the cursor is in a property line or at the start or end of a
16395   property drawer, offer property commands.
16396 - If the cursor is at a footnote reference, go to the corresponding
16397   definition, and vice versa.
16398 -  If the cursor is on a statistics cookie, update it.
16399 - If the cursor is in a plain list item with a checkbox, toggle the
16400   status of the checkbox.
16401 - If the cursor is on a numbered item in a plain list, renumber the
16402   ordered list.
16403 - If the cursor is on the ~#+BEGIN~ line of a dynamic block, the block
16404   is updated.
16405 - If the cursor is at a timestamp, fix the day name in the timestamp.
16407 ** Clean view
16408    :PROPERTIES:
16409    :DESCRIPTION: Getting rid of leading stars in the outline
16410    :TITLE:    A cleaner outline view
16411    :END:
16412 #+cindex: hiding leading stars
16413 #+cindex: dynamic indentation
16414 #+cindex: odd-levels-only outlines
16415 #+cindex: clean outline view
16417 Some people find it noisy and distracting that the Org headlines start
16418 with a potentially large number of stars, and that text below the
16419 headlines is not indented.  While this is no problem when writing a
16420 /book-like/ document where the outline headings are really section
16421 headings, in a more /list-oriented/ outline, indented structure is a
16422 lot cleaner:
16424 #+begin_example
16425    ,* Top level headline             |    * Top level headline
16426    ,** Second level                  |      * Second level
16427    ,*** 3rd level                    |        * 3rd level
16428    some text                        |          some text
16429    ,*** 3rd level                    |        * 3rd level
16430    more text                        |          more text
16431    ,* Another top level headline     |    * Another top level headline
16432 #+end_example
16434 {{{noindent}}} If you are using at least Emacs 23.2 and version 6.29
16435 of Org, this kind of view can be achieved dynamically at display time
16436 using ~org-indent-mode~.[fn:183] In this minor mode, all lines are
16437 prefixed for display with the necessary amount of space.[fn:154] Also
16438 headlines are prefixed with additional stars, so that the amount of
16439 indentation shifts by two spaces per level.[fn:155] All headline stars
16440 but the last one are made invisible using the ~org-hide~ face---see
16441 below under {{{samp(2.)}}} for more information on how this
16442 works.[fn:156] You can turn on ~org-indent-mode~ for all files by
16443 customizing the variable ~org-startup-indented~, or you can turn it on
16444 for individual files using
16446 #+begin_example
16447    ,#+STARTUP: indent
16448 #+end_example
16450 If you want a similar effect in an earlier version of Emacs and/or
16451 Org, or if you want the indentation to be hard space characters so
16452 that the plain text file looks as similar as possible to the Emacs
16453 display, Org supports you in the following way:
16455 #+attr_texinfo: :table-type table :indic @asis
16456 - Indentation of text below headlines ::
16458   You may indent text below each headline to make the left boundary line up
16459   with the headline, like
16461   #+begin_example
16462      ,*** 3rd level
16463          more text, now indented
16464   #+end_example
16466   #+vindex: org-adapt-indentation
16468   Org supports this with paragraph filling, line wrapping, and structure
16469   editing,
16470   preserving or adapting the indentation as appropriate.[fn:157]
16472 - Hiding leading stars ::
16473   #+vindex: org-hide-leading-stars
16475   You can modify the display in such a way that all leading stars become
16476   invisible.  To do this in a global way, configure the variable
16477   ~org-hide-leading-stars~ or change this on a per-file basis with
16479   #+begin_example
16480      ,#+STARTUP: hidestars
16481      ,#+STARTUP: showstars
16482   #+end_example
16484   With hidden stars, the tree becomes:
16486   #+begin_example
16487      ,* Top level headline
16488      , * Second level
16489      ,  * 3rd level
16490        ...
16491   #+end_example
16493   #+vindex: org-hide @r{(face)}
16495   {{{noindent}}} The leading stars are not truly replaced by whitespace,
16496   they are only fontified with the face ~org-hide~ that uses the
16497   background color as font color.  If you are not using either white or
16498   black background, you may have to customize this face to get the
16499   wanted effect.  Another possibility is to set this font such that the
16500   extra stars are /almost/ invisible, for example using the color
16501   ~grey90~ on a white background.
16502 - Odd levels ::
16503   #+vindex: org-odd-levels-only
16505   Things become cleaner still if you skip all the even levels and use
16506   only odd levels 1, 3, 5, ..., effectively adding two stars to go from
16507   one outline level to the next.[fn:158] In this way we get the outline
16508   view shown at the beginning of this section.  In order to make the
16509   structure editing and export commands handle this convention
16510   correctly, configure the variable ~org-odd-levels-only~, or set this
16511   on a per-file basis with one of the following lines:
16513   #+begin_example
16514      ,#+STARTUP: odd
16515      ,#+STARTUP: oddeven
16516   #+end_example
16518   You can convert an Org file from single-star-per-level to the
16519   double-star-per-level convention with {{{kbdkey(M-x
16520   org-convert-to-odd-levels , RET)}}} in that file.  The reverse
16521   operation is {{{kbd(M-x org-convert-to-oddeven-levels)}}}.
16523 ** TTY keys
16524    :PROPERTIES:
16525    :DESCRIPTION: Using Org on a tty
16526    :TITLE:    Using Org on a tty
16527    :END:
16529 Because Org contains a large number of commands, by default many of
16530 Org's core commands are bound to keys that are generally not
16531 accessible on a tty, such as the cursor keys ({{{key(left)}}},
16532 {{{key(right)}}}, {{{key(up)}}}, {{{key(down)}}}), {{{key(TAB)}}} and
16533 {{{key(RET)}}}, in particular when used together with modifiers like
16534 {{{key(Meta)}}} and/or {{{key(Shift)}}}.  To access these commands on a
16535 tty when special keys are unavailable, the following alternative
16536 bindings can be used.  The tty bindings below will likely be more
16537 cumbersome; you may find for some of the bindings below that a
16538 customized workaround suits you better.  For example, changing a
16539 timestamp is really only fun with {{{kbdkey(S-,cursor)}}} keys,
16540 whereas on a tty you would rather use {{{kbd(C-c .)}}} to re-insert
16541 the timestamp.
16543 #+attr_texinfo: :columns 0.2 0.3 0.1 0.4
16544 | Default                  | Alternative 1                | Speed key    | Alternative 2             |
16545 |--------------------------+------------------------------+--------------+---------------------------|
16546 | {{{kbdkey(S-,TAB)}}}     | {{{kbdspckey(C-u,TAB)}}}     | {{{kbd(C)}}} |                           |
16547 | {{{kbdkey(M-,left)}}}    | {{{kbd(C-c C-x l)}}}         | {{{kbd(l)}}} | {{{kbdkeys(,Esc,left)}}}  |
16548 | {{{kbdkey(M-S-,left)}}}  | {{{kbd(C-c C-x L)}}}         | {{{kbd(L)}}} |                           |
16549 | {{{kbdkey(M-,right)}}}   | {{{kbd(C-c C-x r)}}}         | {{{kbd(r)}}} | {{{kbdkeys(,Esc,right)}}} |
16550 | {{{kbdkey(M-S-,right)}}} | {{{kbd(C-c C-x R)}}}         | {{{kbd(R)}}} |                           |
16551 | {{{kbdkey(M-,up)}}}      | {{{kbd(C-c C-x u)}}}         | {{{kbd( )}}} | {{{kbdkeys(,Esc,up)}}}    |
16552 | {{{kbdkey(M-S-,up)}}}    | {{{kbd(C-c C-x U)}}}         | {{{kbd(U)}}} |                           |
16553 | {{{kbdkey(M-,down)}}}    | {{{kbd(C-c C-x d)}}}         | {{{kbd( )}}} | {{{kbdkeys(,Esc,down)}}}  |
16554 | {{{kbdkey(M-S-,down)}}}  | {{{kbd(C-c C-x D)}}}         | {{{kbd(D)}}} |                           |
16555 | {{{kbdkey(S-,RET)}}}     | {{{kbd(C-c C-x c)}}}         | {{{kbd( )}}} |                           |
16556 | {{{kbdkey(M-,RET)}}}     | {{{kbd(C-c C-x m)}}}         | {{{kbd( )}}} | {{{kbdkeys(,Esc,RET)}}}   |
16557 | {{{kbdkey(M-S-,RET)}}}   | {{{kbd(C-c C-x M)}}}         | {{{kbd( )}}} |                           |
16558 | {{{kbdkey(S-,left)}}}    | {{{kbdspckey(C-c,left)}}}    | {{{kbd( )}}} |                           |
16559 | {{{kbdkey(S-,right)}}}   | {{{kbdspckey(C-c,right)}}}   | {{{kbd( )}}} |                           |
16560 | {{{kbdkey(S-,up)}}}      | {{{kbdspckey(C-c,up)}}}      | {{{kbd( )}}} |                           |
16561 | {{{kbdkey(S-,down)}}}    | {{{kbdspckey(C-c,down)}}}    | {{{kbd( )}}} |                           |
16562 | {{{kbdkey(C-S-,left)}}}  | {{{kbdspckey(C-c C-x,left)}}}  | {{{kbd( )}}} |                           |
16563 | {{{kbdkey(C-S-,right)}}} | {{{kbdspckey(C-c C-x,right)}}} | {{{kbd( )}}} |                           |
16565 ** Interaction
16566    :PROPERTIES:
16567    :DESCRIPTION: Other Emacs packages
16568    :TITLE:    Interaction with other packages
16569    :END:
16570 #+cindex: packages, interaction with other
16571 Org lives in the world of GNU Emacs and interacts in various ways
16572 with other code out there.
16574 *** FIXME Cooperation
16575     :PROPERTIES:
16576     :DESCRIPTION: Packages Org cooperates with
16577     :TITLE:    Packages that Org cooperates with
16578     :END:
16580 #+attr_texinfo: :table-type table :indic @asis
16581 - {{{file(calc.el)}}} by Dave Gillespie ::
16582   #+cindex: @file{calc.el}
16583   #+cindex: Gillespie, Dave
16585   Org uses the Calc package for implementing spreadsheet functionality
16586   in its tables (see [[The spreadsheet]]).  Org checks for the availability
16587   of Calc by looking for the function ~calc-eval~ which will have been
16588   autoloaded during setup if Calc has been installed properly.  As of
16589   Emacs 22, Calc is part of the Emacs distribution.  Another possibility
16590   for interaction between the two packages is using Calc for embedded
16591   calculations.  See [[info:calc:Embedded Mode][GNU Emacs Calc Manual]].
16593 - {{{file(constants.el)}}} by Carsten Dominik ::
16594   #+cindex: @file{constants.el}
16595   #+cindex: Dominik, Carsten
16596   #+vindex: org-table-formula-constants
16598   In a table formula (see [[The spreadsheet]]), it is possible to use names
16599   for natural constants or units.  Instead of defining your own constants
16600   in the variable ~org-table-formula-constants~, install the
16601   {{{file(constants)}}} package which defines a large number of
16602   constants and units, and lets you use unit prefixes like {{{samp(M)}}}
16603   for {{{samp(Mega)}}}, etc.  You will need version 2.0 of this package,
16604   available at [[http://www.astro.uva.nl/~dominik/Tools]].  Org checks for
16605   the function ~constants-get~, which has to be autoloaded in your
16606   setup.  See the installation instructions in the file
16607   {{{file(constants.el)}}}.
16609 - {{{file(cdlatex.el)}}} by Carsten Dominik ::
16610   #+cindex: @file{cdlatex.el}
16611   #+cindex: Dominik, Carsten
16613   Org mode can make use of the CDLaTeX package to efficiently enter
16614   LaTeX fragments into Org files.  See [[CDLaTeX mode]].
16616 - {{{file(imenu.el)}}} by Ake Stenhoff and Lars Lindberg ::
16617   #+cindex: @file{imenu.el}
16618   #+cindex: Stenhoff, Ake
16619   #+cindex: Lindberg, Lars
16621   Imenu allows menu access to an index of items in a file.  Org mode
16622   supports Imenu---all you need to do to get the index is the following:
16624   #+begin_src emacs-lisp
16625   (add-hook 'org-mode-hook
16626             (lambda () (imenu-add-to-menubar "Imenu")))
16627   #+end_src
16629   #+vindex: org-imenu-depth
16631   By default the index is two levels deep---you can modify the depth
16632   using the option ~org-imenu-depth~.
16634 - {{{file(remember.el)}}} by John Wiegley ::
16635   #+cindex: @file{remember.el}
16636   #+cindex: Wiegley, John
16638   Org used to use this package for capture, but no longer does.
16640 - {{{file(speedbar.el)}}} by Eric M. Ludlam ::
16641   #+cindex: @file{speedbar.el}
16642   #+cindex: Ludlam, Eric M.
16644   Speedbar is a package that creates a special frame displaying files and
16645   index items in files.  Org mode supports Speedbar and allows you to
16646   drill into Org files directly from the Speedbar.  It also allows you to
16647   restrict the scope of agenda commands to a file or a subtree by using
16648   the command {{{kbd(<)}}} in the Speedbar frame.
16650 - {{{file(table.el)}}} by Takaaki Ota ::
16651   #+kindex: C-c C-c
16652   #+cindex: table editor, @file{table.el}
16653   #+cindex: @file{table.el}
16654   #+cindex: Ota, Takaaki
16656   Complex ASCII tables with automatic line wrapping, column- and row-spanning,
16657   and alignment can be created using the Emacs table package by Takaaki Ota
16658   ([[http://sourceforge.net/projects/table]], and also part of Emacs 22).
16659   Org mode will recognize these tables and export them properly.  Because of
16660   interference with other Org mode functionality, you unfortunately cannot edit
16661   these tables directly in the buffer.  Instead, you need to use the command
16662   {{{kbd(C-c ')}}} to edit them, similar to source code snippets.
16664   - {{{kbd(C-c ')}}}, ~org-edit-special~ ::
16665     #+kindex: C-c '
16667     Edit a {{{file(table.el)}}} table.  Works when the cursor is in a
16668     table.el table.
16670   - {{{kbd(C-c XXX)}}}, ~org-table-create-with-table.el~ ::
16671     #+kindex: C-c ~
16672     # Should be ~
16673     Insert a {{{file(table.el)}}} table.  If there is already a table at
16674     point, this command converts it between the {{{file(table.el)}}}
16675     format and the Org mode format.  See the documentation string of the
16676     command ~org-convert-table~ for the restrictions under which this is
16677     possible.
16679   {{{file(table.el)}}} is part of Emacs since Emacs 22.
16681 - {{{file(footnote.el)}}} by Steven L. Baur ::
16682   #+cindex: @file{footnote.el}
16683   #+cindex: Baur, Steven L.
16685   Org mode recognizes numerical footnotes as provided by this package.
16686   However, Org mode also has its own footnote support (see [[Creating footnotes]]),
16687   which makes using {{{file(footnote.el)}}} unnecessary.
16689 *** Conflicts
16690     :PROPERTIES:
16691     :DESCRIPTION: Packages that lead to conflicts
16692     :END:
16694 #+cindex: @code{shift-selection-mode}
16695 #+vindex: org-support-shift-select
16697 In Emacs 23, ~shift-selection-mode~ is on by default, meaning that
16698 cursor motions combined with the shift key should start or enlarge
16699 regions.  This conflicts with the use of {{{kbdkey(S-,cursor)}}}
16700 commands in Org to change timestamps, TODO keywords, priorities, and
16701 item bullet types if the cursor is at such a location.  By default,
16702 {{{kbdkey(S-,cursor)}}} commands outside special contexts don't do
16703 anything, but you can customize the variable
16704 ~org-support-shift-select~.  Org mode then tries to accommodate shift
16705 selection by using it outside of the special contexts where
16706 special commands apply, and by extending an existing active
16707 region even if the cursor moves across a special context.
16709 #+attr_texinfo: :table-type table :indic @asis
16710 - {{{file(CUA.el)}}} by Kim. F. Storm ::
16711   #+cindex: @file{CUA.el}
16712   #+cindex: Storm, Kim. F.
16713   #+vindex: org-replace-disputed-keys
16715   Key bindings in Org conflict with the {{{kbdkey(S-,<cursor>)}}} keys
16716   used by CUA mode (as well as ~pc-select-mode~ and ~s-region-mode~) to
16717   select and extend the region.  In fact, Emacs 23 has this built-in in
16718   the form of ~shift-selection-mode~, see previous paragraph.  If you are
16719   using Emacs 23, you probably don't want to use another package for
16720   this purpose.  However, if you prefer to leave these keys to a
16721   different package while working in Org mode, configure the variable
16722   ~org-replace-disputed-keys~.  When set, Org will move the following key
16723   bindings in Org files, and in the agenda buffer (but not during date
16724   selection).
16726   | S-UP      {{{result}}}  M-p   | S-DOWN     {{{result}}}  M-n   |
16727   | S-LEFT    {{{result}}}  M--   | S-RIGHT    {{{result}}}  M-+   |
16728   | C-S-LEFT  {{{result}}}  M-S-- | C-S-RIGHT  {{{result}}}  M-S-+ |
16730   #+vindex: org-disputed-keys
16732   Yes, these are unfortunately more difficult to remember.  If you want
16733   to have other replacement keys, look at the variable
16734   ~org-disputed-keys~.
16736 - {{{file(filladapt.el)}}} by Kyle Jones ::
16737   #+cindex: @file{filladapt.el}
16738   #+cindex: Jones, Kyle
16740   Org mode tries to do the right thing when filling paragraphs, list
16741   items and other elements.  Many users reported they had problems using
16742   both {{{file(filladapt.el)}}} and Org mode, so a safe thing to do is
16743   to disable it like this:
16745   #+begin_src emacs-lisp
16746   (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
16747   #+end_src
16749 - {{{file(yasnippet.el)}}} ::
16750   #+cindex: @file{yasnippet.el}
16752   The way Org mode binds the {{{key(TAB)}}} key (binding to ~[tab]~
16753   instead of ~"\t"~) overrules YASnippet's access to this key.  The
16754   following code fixed this problem:
16756   #+begin_src emacs-lisp
16757   (add-hook 'org-mode-hook
16758             (lambda ()
16759               (org-set-local 'yas/trigger-key [tab])
16760               (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
16761   #+end_src
16763   The latest version of yasnippet doesn't play well with Org mode.  If the
16764   above code does not fix the conflict, start by defining the following
16765   function:
16767   #+begin_src emacs-lisp
16768   (defun yas/org-very-safe-expand ()
16769          (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
16770   #+end_src
16772   Then, tell Org mode what to do with the new function:
16774   #+begin_src emacs-lisp
16775   (add-hook 'org-mode-hook
16776             (lambda ()
16777                 (make-variable-buffer-local 'yas/trigger-key)
16778                 (setq yas/trigger-key [tab])
16779                 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
16780                 (define-key yas/keymap [tab] 'yas/next-field)))
16781   #+end_src
16783 - {{{file(windmove.el)}}} by Hovav Shacham ::
16784   #+cindex: @file{windmove.el}
16785   #+cindex: Shacham, Hovav
16787   This package also uses the {{{kbd(S-<cursor>)}}} keys, so everything
16788   written in the paragraph above about CUA mode also applies here.  If
16789   you want make the windmove function active in locations where Org mode
16790   does not have special functionality on {{{kbdkey(S-,cursor)}}}, add
16791   this to your configuration:
16793   #+begin_src emacs-lisp
16794   ;; Make windmove work in org-mode:
16795   (add-hook 'org-shiftup-final-hook 'windmove-up)
16796   (add-hook 'org-shiftleft-final-hook 'windmove-left)
16797   (add-hook 'org-shiftdown-final-hook 'windmove-down)
16798   (add-hook 'org-shiftright-final-hook 'windmove-right)
16799   #+end_src
16801 - {{{file(viper.el)}}} by Michael Kifer ::
16802   #+cindex: @file{viper.el}
16803   #+cindex: Kifer, Michael
16804   #+kindex: C-c /
16806   Viper uses {{{kbd(C-c /)}}} and therefore makes this key not access the
16807   corresponding Org mode command ~org-sparse-tree~.  You need to find
16808   another key for this command, or override the key in
16809   ~viper-vi-global-user-map~ with
16811   #+begin_src emacs-lisp
16812   (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
16813   #+end_src
16815 ** org-crypt
16816    :PROPERTIES:
16817    :DESCRIPTION: Encrypting Org files
16818    :END:
16819 #+cindex: @file{+org-crypt.el}
16820 #+cindex: @code{org-decrypt-entry}
16822 Org-crypt will encrypt the text of an entry, but not the headline, or
16823 properties.  Org-crypt uses the Emacs EasyPG library to encrypt and
16824 decrypt files.
16826 Any text below a headline that has a {{{samp(:crypt:)}}} tag will
16827 automatically be encrypted when the file is saved.  If you want to use
16828 a different tag just customize the ~org-crypt-tag-matcher~ setting.
16830 To use org-crypt it is suggested that you have the following in your
16831 {{{file(.emacs)}}}:
16833 #+header: :eval no
16834 #+header: :exports code
16835 #+begin_src emacs-lisp
16836 (require 'org-crypt)
16837 (org-crypt-use-before-save-magic)
16838 (setq org-tags-exclude-from-inheritance (quote ("crypt")))
16840 (setq org-crypt-key nil)
16841   ;; GPG key to use for encryption
16842   ;; Either the Key ID or set to nil to use symmetric encryption.
16844 (setq auto-save-default nil)
16845   ;; Auto-saving does not cooperate with org-crypt.el: so you need
16846   ;; to turn it off if you plan to use org-crypt.el quite often.
16847   ;; Otherwise, you'll get an (annoying) message each time you
16848   ;; start Org.
16850   ;; To turn it off only locally, you can insert this:
16851   ;;
16852   ;; # -*- buffer-auto-save-file-name: nil; -*-
16853 #+end_src
16855 Excluding the crypt tag from inheritance prevents already encrypted text
16856 being encrypted again.
16858 * Hacking
16859   :PROPERTIES:
16860   :DESCRIPTION: How to hack your way around
16861   :APPENDIX: Appendix
16862   :END:
16863 #+cindex: hacking
16865 This appendix describes some ways a user can extend the functionality
16866 of Org.
16868 ** Hooks
16869    :PROPERTIES:
16870    :DESCRIPTION: How to reach into Org's internals
16871    :END:
16872 #+cindex: hooks
16874 Org has a large number of hook variables that can be used to add
16875 functionality.  This appendix about hacking is going to illustrate the
16876 use of some of them.  A complete list of all hooks with documentation is
16877 maintained by the Worg project and can be found at
16878 [[http://orgmode.org/worg/org-configs/org-hooks.php]].
16880 ** Add-on packages
16881    :PROPERTIES:
16882    :DESCRIPTION: Available extensions
16883    :END:
16884 #+cindex: add-on packages
16886 A large number of add-on packages have been written by various
16887 authors.  These packages are not part of Emacs, but they are
16888 distributed as contributed packages with the separate release
16889 available at the Org mode home page at [[http://orgmode.org]].  The
16890 list of contributed packages, along with documentation about each
16891 package, is maintained by the Worg project at
16892 [[http://orgmode.org/worg/org-contrib/]].
16894 ** Adding hyperlink types
16895    :PROPERTIES:
16896    :DESCRIPTION: New custom link types
16897    :END:
16898 #+cindex: hyperlinks, adding new types
16900 Org has a large number of hyperlink types built-in (see [[Hyperlinks]]).
16901 If you would like to add new link types, Org provides an interface for
16902 doing so.  Let's look at an example file, {{{file(org-man.el)}}}, that
16903 will add support for creating links like:
16905 #+begin_example
16906    [[man:printf][The printf manual]]
16907 #+end_example
16909 to show Unix manual pages inside Emacs:
16911 #+header: :eval no
16912 #+header: :exports code
16913 #+begin_src emacs-lisp
16914 ;;; org-man.el - Support for links to manpages in Org
16916 (require 'org)
16918 (org-add-link-type "man" 'org-man-open)
16919 (add-hook 'org-store-link-functions 'org-man-store-link)
16921 (defcustom org-man-command 'man
16922   "The Emacs command to be used to display a man page."
16923   :group 'org-link
16924   :type '(choice (const man) (const woman)))
16926 (defun org-man-open (path)
16927   "Visit the manpage on PATH.
16928 PATH should be a topic that can be thrown at the man command."
16929   (funcall org-man-command path))
16931 (defun org-man-store-link ()
16932   "Store a link to a manpage."
16933   (when (memq major-mode '(Man-mode woman-mode))
16934     ;; This is a man page, we do make this link
16935     (let* ((page (org-man-get-page-name))
16936            (link (concat "man:" page))
16937            (description (format "Manpage for %s" page)))
16938       (org-store-link-props
16939        :type "man"
16940        :link link
16941        :description description))))
16943 (defun org-man-get-page-name ()
16944   "Extract the page name from the buffer name."
16945   ;; This works for both `Man-mode' and `woman-mode'.
16946   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
16947       (match-string 1 (buffer-name))
16948     (error "Cannot create link to this man page")))
16950 (provide 'org-man)
16952 ;;; org-man.el ends here
16953 #+end_src
16955 {{{noindent}}} You would activate this new link type in
16956 {{{file(.emacs)}}} with:
16958 #+header: :eval no
16959 #+header: :exports code
16960 #+begin_src emacs-lisp
16961 (require 'org-man)
16962 #+end_src
16964 {{{noindent}}} Let's go through the file and see what it does.
16965 #+vindex: org-store-link-functions
16967 1. It does ~(require 'org)~ to make sure that {{{file(org.el)}}} has
16968    been loaded.
16970 2. The next line calls ~org-add-link-type~ to define a new link type
16971    with prefix {{{samp(man)}}}.  The call also contains the name of a
16972    function that will be called to follow such a link.
16974 3. The next line adds a function to ~org-store-link-functions~, in
16975    order to allow the command {{{kbd(C-c l)}}} to record a useful link
16976    in a buffer displaying a man page.
16977    
16979 The rest of the file defines the necessary variables and functions.
16980 First there is a customization variable that determines which Emacs
16981 command should be used to display man pages.  There are two options,
16982 ~man~ and ~woman~.  Then the function to follow a link is defined.  It
16983 gets the link path as an argument---in this case the link path is just
16984 a topic for the manual command.  The function calls the value of
16985 ~org-man-command~ to display the man page.
16987 Finally the function ~org-man-store-link~ is defined.  When you try to
16988 store a link with {{{kbd(C-c l)}}}, this function will be called to
16989 try to make a link.  The function must first decide if it is supposed
16990 to create the link for this buffer type; we do this by checking the
16991 value of the variable ~major-mode~.  If not, the function must exit and
16992 return the value ~nil~.  If yes, the link is created by getting the
16993 manual topic from the buffer name and prefixing it with the string
16994 {{{samp(man:)}}}.  Then it must call the command ~org-store-link-props~
16995 and set the ~:type~ and ~:link~ properties.  Optionally you can also
16996 set the ~:description~ property to provide a default for the link
16997 description when the link is later inserted into an Org buffer with
16998 {{{kbd(C-c C-l)}}}.
17000 When it makes sense for your new link type, you may also define a
17001 function ~org-PREFIX-complete-link~ that implements special (e.g.,
17002 completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
17003 Such a function should not accept any arguments, and return the full
17004 link with prefix.
17006 ** Context-sensitive commands
17007    :PROPERTIES:
17008    :DESCRIPTION: How to add functionality to such commands
17009    :END:
17010 #+cindex: context-sensitive commands, hooks
17011 #+cindex: add-ons, context-sensitive commands
17012 #+vindex: org-ctrl-c-ctrl-c-hook
17014 Org has several commands that act differently depending on context.
17015 The most important example is the {{{kbd(C-c C-c)}}} (see [[The very
17016 busy C-c C-c key]]).  Also the {{{kbd(M-cursor)}}} and
17017 {{{kbd(M-S-cursor)}}} keys have this property.
17019 Add-ons can tap into this functionality by providing a function that
17020 detects special context for that add-on and executes functionality
17021 appropriate for the context.  Here is an example from Dan Davison's
17022 {{{file(org-R.el)}}} which allows you to evaluate commands based on
17023 the {{{file(R)}}} programming language.[fn:159] For this package,
17024 special contexts are lines that start with ~#+R:~ or ~#+RR:~.
17026 #+header: :eval no
17027 #+header: :exports code
17028 #+begin_src emacs-lisp
17029 (defun org-R-apply-maybe ()
17030   "Detect if this is context for org-R and execute R commands."
17031   (if (save-excursion
17032         (beginning-of-line 1)
17033         (looking-at "#\\+RR?:"))
17034       (progn (call-interactively 'org-R-apply)
17035              t) ;; to signal that we took action
17036     nil)) ;; to signal that we did not
17038 (add-hook 'org-ctrl-c-ctrl-c-hook 'org-R-apply-maybe)
17039 #+end_src
17041 The function first checks if the cursor is in such a line.  If that is
17042 the case, ~org-R-apply~ is called and the function returns ~t~ to
17043 signal that action was taken, and {{{kbd(C-c C-c)}}} will stop looking
17044 for other contexts.  If the function finds it should do nothing
17045 locally, it returns ~nil~ so that other, similar functions can have a
17046 try.
17048 ** Tables in arbitrary syntax
17049    :PROPERTIES:
17050    :DESCRIPTION: Orgtbl for LaTeX and other programs
17051    :END:
17052 #+cindex: tables, in other modes
17053 #+cindex: lists, in other modes
17054 #+cindex: Orgtbl mode
17056 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
17057 frequent feature request has been to make it work with native tables
17058 in specific languages, for example LaTeX.  However, this is
17059 extremely hard to do in a general way, would lead to a customization
17060 nightmare, and would take away much of the simplicity of the Orgtbl
17061 mode table editor.
17063 This appendix describes a different approach.  We keep the Orgtbl mode
17064 table in its native format (the source table), and use a custom
17065 function to /translate/ the table to the correct syntax, and to
17066 /install/ it in the right location (the target table).  This puts
17067 the burden of writing conversion functions on the user, but it allows
17068 for a very flexible system.
17070 Bastien added the ability to do the same with lists, in Orgstruct
17071 mode.  You can use Org's facilities to edit and structure lists by
17072 turning ~orgstruct-mode~ on, then locally exporting such lists in
17073 another format (HTML, LaTeX or Texinfo.)
17075 *** Radio tables
17076     :PROPERTIES:
17077     :DESCRIPTION: Sending and receiving radio tables
17078     :END:
17079 #+cindex: radio tables
17081 To define the location of the target table, you first need to create
17082 two lines that are comments in the current mode, but contain magic
17083 words for Orgtbl mode to find.  Orgtbl mode will insert the translated
17084 table between these lines, replacing whatever was there before.  For
17085 example:
17087 #+begin_example
17088    /* BEGIN RECEIVE ORGTBL table_name */
17089    /* END RECEIVE ORGTBL table_name */
17090 #+end_example
17092 {{{noindent}}} Just above the source table, we put a special line that
17093 tells Orgtbl mode how to translate this table and where to install it.
17094 For example: 
17096 #+cindex: #+ORGTBL
17097 #+begin_example
17098    ,#+ORGTBL: SEND table_name translation_function arguments ...
17099 #+end_example
17101 {{{noindent}}} Here, ~table_name~ is the reference name for the table
17102 that is also used in the receiver lines.  ~translation_function~ is the
17103 Lisp function that does the translation.  Furthermore, the line can
17104 contain a list of arguments (alternating key and value) at the end.
17105 The arguments will be passed as a property list to the translation
17106 function for interpretation.  A few standard parameters are already
17107 recognized and acted upon before the translation function is called:
17109 #+attr_texinfo: :table-type table :indic @asis
17110 - ~:skip N~ ::
17112   Skip the first N lines of the table.  Hlines do count as separate lines
17113   for this parameter!
17115 - ~:skipcols (n1 n2 ...)~ ::
17117   List of columns that should be skipped.  If the table has a column with
17118   calculation marks, that column is automatically discarded as well.
17119   Please note that the translator function sees the table /after/ the
17120   removal of these columns, the function never knows that there have
17121   been additional columns.
17123 - ~:no-escape t~ ::
17125   When non-nil, do not escape special characters ~&%#_^~ when exporting
17126   the table.  The default value is nil.
17129 {{{noindent}}} The one problem remaining is how to keep the source
17130 table in the buffer without disturbing the normal workings of the
17131 file, for example during compilation of a C file or processing of a
17132 LaTeX file.  There are a number of different solutions:
17134 - The table could be placed in a block comment if that is supported by
17135   the language.  For example, in C mode you could wrap the table
17136   between {{{samp(/*)}}} and {{{samp(*/)}}} lines.
17138 - Sometimes it is possible to put the table after some kind of END
17139   statement, for example ~\bye~ in TeX and ~\end{document}~ in
17140   LaTeX.
17142 - You can just comment the table line-by-line whenever you want to
17143   process the file, and uncomment it whenever you need to edit the
17144   table.  This only sounds tedious---the command {{{kbd(M-x
17145   orgtbl-toggle-comment)}}} makes this comment-toggling very easy, in
17146   particular if you bind it to a key.
17148 *** A LaTeX example
17149     :PROPERTIES:
17150     :DESCRIPTION: Step by step, almost a tutorial
17151     :TITLE:    A LaTeX example of radio tables
17152     :END:
17153 #+cindex: @LaTeX{}, and Orgtbl mode
17155 The best way to wrap the source table in LaTeX is to use the
17156 ~comment~ environment provided by {{{file(comment.sty)}}}.  It has to
17157 be activated by placing ~\usepackage{comment}~ into the document
17158 header.  Orgtbl mode can insert a radio table skeleton with the command
17159 {{{kbd(M-x orgtbl-insert-radio-table)}}}.[fn:160] You will be prompted
17160 for a table name, let's say we use {{{samp(salesfigures)}}}.  You will
17161 then get the following template:
17163 #+cindex: #+ORGTBL, SEND
17164 #+begin_example
17165    % BEGIN RECEIVE ORGTBL salesfigures
17166    % END RECEIVE ORGTBL salesfigures
17167    \begin{comment}
17168    #+ORGTBL: SEND salesfigures orgtbl-to-latex
17169    | | |
17170    \end{comment}
17171 #+end_example
17173 #+vindex: @LaTeX{}-verbatim-environments
17175 {{{noindent}}} The ~#+ORGTBL: SEND~ line tells Orgtbl mode to use the
17176 function ~orgtbl-to-latex~ to convert the table into LaTeX and to
17177 put it into the receiver location with name ~salesfigures~.  You may
17178 now fill in the table---feel free to use the spreadsheet features:[fn:161]
17180 #+begin_example
17181    % BEGIN RECEIVE ORGTBL salesfigures
17182    % END RECEIVE ORGTBL salesfigures
17183    \begin{comment}
17184    #+ORGTBL: SEND salesfigures orgtbl-to-latex
17185    | Month | Days | Nr sold | per day |
17186    |-------+------+---------+---------|
17187    | Jan   |   23 |      55 |     2.4 |
17188    | Feb   |   21 |      16 |     0.8 |
17189    | March |   22 |     278 |    12.6 |
17190    #+TBLFM: $4=$3/$2;%.1f
17191    % $ (optional extra dollar to keep font-lock happy, see footnote)
17192    \end{comment}
17193 #+end_example
17195 {{{noindent}}} When you are done, press {{{kbd(C-c C-c)}}} in the
17196 table to get the converted table inserted between the two marker
17197 lines.
17199 Now let's assume you want to make the table header by hand, because
17200 you want to control how columns are aligned, etc.  In this case we make
17201 sure that the table translator skips the first 2 lines of the source
17202 table, and tell the command to work as a splice, i.e., to not
17203 produce header and footer commands of the target table:
17205 #+begin_example
17206    \begin{tabular}{lrrr}
17207    Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
17208    % BEGIN RECEIVE ORGTBL salesfigures
17209    % END RECEIVE ORGTBL salesfigures
17210    \end{tabular}
17211    %
17212    \begin{comment}
17213    #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
17214    | Month | Days | Nr sold | per day |
17215    |-------+------+---------+---------|
17216    | Jan   |   23 |      55 |     2.4 |
17217    | Feb   |   21 |      16 |     0.8 |
17218    | March |   22 |     278 |    12.6 |
17219    #+TBLFM: $4=$3/$2;%.1f
17220    \end{comment}
17221 #+end_example
17223 The LaTeX translator function ~orgtbl-to-latex~ is already part of
17224 Orgtbl mode.  It uses a ~tabular~ environment to typeset the table and
17225 marks horizontal lines with ~\hline~.  Furthermore, it interprets the
17226 following parameters (see also see [[Translator functions]]):
17228 #+attr_texinfo: :table-type table :indic @asis
17229 - ~:splice nil/t~ ::
17231   When set to ~t~, return only table body lines, don't wrap them into a
17232   tabular environment.  Default is ~nil~.
17234 - ~:fmt fmt~ ::
17236   A format to be used to wrap each field, it should contain ~%s~ for the
17237   original field value.  For example, to wrap each field value in
17238   dollars, you could use ~:fmt "$%s$"~.  This may also be a property list
17239   with column numbers and formats, for example ~:fmt (2 "$%s$" 4
17240   "%s\\%%")~.  A function of one argument can be used in place of the
17241   strings; the function must return a formatted string.
17243 - ~:efmt efmt~ ::
17245   Use this format to print numbers with exponentials.  The format should
17246   have ~%s~ twice for inserting mantissa and exponent, for example:
17248   #+begin_example
17249      "%s\\times10^{%s}"
17250   #+end_example
17252   The default is:
17254   #+begin_example
17255      "%s\\,(%s)"
17256   #+end_example
17258   This may also be a property list with column numbers and formats, for
17259   example:
17261   #+begin_example
17262      :efmt (2 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")
17263   #+end_example
17265   After ~efmt~ has been applied to a value, ~fmt~ will also be applied.
17266   Similar to ~fmt~, functions of two arguments can be supplied instead
17267   of strings.
17269 *** Translator functions
17270     :PROPERTIES:
17271     :DESCRIPTION: Copy and modify
17272     :END:
17273 #+cindex: HTML, and Orgtbl mode
17274 #+cindex: translator function
17276 Orgtbl mode has several translator functions built-in: ~orgtbl-to-csv~
17277 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values)
17278 ~orgtbl-to-latex~, ~orgtbl-to-html~, and ~orgtbl-to-texinfo~.  Except
17279 for ~orgtbl-to-html~, these all use a generic translator,
17280 ~orgtbl-to-generic~.[fn:162] For example, ~orgtbl-to-latex~ itself is
17281 a very short function that computes the column definitions for the
17282 ~tabular~ environment, defines a few field and line separators and
17283 then hands processing over to the generic translator.  Here is the
17284 entire code:
17286 #+header: :eval no
17287 #+header: :exports code
17288 #+begin_src emacs-lisp
17289 (defun orgtbl-to-latex (table params)
17290   "Convert the Orgtbl mode TABLE to LaTeX."
17291   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
17292                                org-table-last-alignment ""))
17293          (params2
17294           (list
17295            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
17296            :tend "\\end@{tabular@}"
17297            :lstart "" :lend " \\\\" :sep " & "
17298            :efmt "%s\\,(%s)" :hline "\\hline")))
17299     (orgtbl-to-generic table (org-combine-plists params2 params))))
17300 #+end_src
17302 As you can see, the properties passed into the function (variable
17303 ~PARAMS~) are combined with the ones newly defined in the function
17304 (variable ~PARAMS2~).  The ones passed into the function (i.e., the
17305 ones set by the {{{samp(ORGTBL SEND)}}} line) take precedence.  So if
17306 you would like to use the LaTeX translator, but wanted the line
17307 endings to be ~\\[2mm]~ instead of the default ~\\~, you could just
17308 overrule the default with:
17310 #+begin_example
17311    ,#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
17312 #+end_example
17314 For a new language, you can either write your own converter function
17315 in analogy with the LaTeX translator, or you can use the generic
17316 function directly.  For example, if you have a language where a table
17317 is started with {{{samp(!BTBL!)}}}, ended with {{{samp(!ETBL!)}}}, and
17318 where table lines are started with {{{samp(!BL!)}}}, ended with
17319 {{{samp(!EL!)}}}, and where the field separator is a TAB, you could
17320 call the generic translator like this (on a single line!):
17322 #+begin_example
17323    ,#+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
17324                                  :lstart "!BL! " :lend " !EL!" :sep "\t"
17325 #+end_example
17327 {{{noindent}}} Please check the documentation string of the function
17328 ~orgtbl-to-generic~ for a full list of parameters understood by that
17329 function, and remember that you can pass each of them into
17330 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
17331 the generic function.
17333 Of course you can also write a completely new function doing
17334 complicated things the generic translator cannot do.  A translator
17335 function takes two arguments.  The first argument is the table, a list
17336 of lines, each line either the symbol ~hline~ or a list of fields.  The
17337 second argument is the property list containing all parameters
17338 specified in the {{{samp(#+ORGTBL: SEND)}}} line.  The function must
17339 return a single string containing the formatted table.  If you write a
17340 generally useful translator, please post it to the [[mailto:emacs-orgmode@gnu.org][mailing list]] so
17341 that others can benefit from your work.
17343 *** Radio lists
17344     :PROPERTIES:
17345     :DESCRIPTION: Doing the same for lists
17346     :END:
17347 #+cindex: radio lists
17348 #+cindex: org-list-insert-radio-list
17350 Sending and receiving radio lists works exactly the same way as
17351 sending and receiving radio tables (see [[Radio tables]]).  As for radio
17352 tables, you can insert radio list templates in HTML, LaTeX and
17353 Texinfo modes by calling ~org-list-insert-radio-list~.
17355 Here are the differences with radio tables:
17357 - Orgstruct mode must be active.
17359 - Use the ~ORGLST~ keyword instead of ~ORGTBL~.
17361 - The available translation functions for radio lists don't take
17362   parameters.
17364 - {{{kbd(C-c C-c)}}} will work when pressed on the first item of the
17365   list.
17368 Here is a LaTeX example.  Let's say that you have this in your
17369 LaTeX file:
17371 #+cindex: #+ORGLST
17372 #+begin_example
17373    % BEGIN RECEIVE ORGLST to-buy
17374    % END RECEIVE ORGLST to-buy
17375    \begin{comment}
17376    #+ORGLST: SEND to-buy org-list-to-latex
17377    - a new house
17378    - a new computer
17379      + a new keyboard
17380      + a new mouse
17381    - a new life
17382    \end{comment}
17383 #+end_example
17385 Pressing `C-c C-c' on ~a new house~ will insert the converted
17386 LaTeX list between the two marker lines.
17388 ** Dynamic blocks
17389    :PROPERTIES:
17390    :DESCRIPTION: Automatically filled blocks
17391    :END:
17392 #+cindex: dynamic blocks
17394 Org documents can contain /dynamic blocks/.  These are specially marked
17395 regions that are updated by some user-written function.  A good example
17396 for such a block is the clock table inserted by the command 
17397 {{{kbd(C-c C-x C-r)}}} (see [[Clocking work time]]).
17399 Dynamic blocks are enclosed by a BEGIN-END structure that assigns a
17400 name to the block and can also specify parameters for the function
17401 producing the content of the block.
17403 #+cindex: #+BEGIN:dynamic block
17404 #+begin_example
17405    ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
17407    ,#+END:
17408 #+end_example
17410 Dynamic blocks are updated with the following commands:
17412 #+attr_texinfo: :table-type table :indic @asis
17413 - {{{kbd(C-c C-x C-u)}}}, ~org-dblock-update~ ::
17414   #+kindex: C-c C-x C-u
17416   Update dynamic block at point.
17418 - {{{kbd(C-u C-c C-x C-u)}}} ::
17419   #+kindex: C-u C-c C-x C-u
17421   Update all dynamic blocks in the current file.
17424 Updating a dynamic block means to remove all the text between ~BEGIN~
17425 and ~END~, parse the ~BEGIN~ line for parameters and then call the
17426 specific writer function for this block to insert the new content.  If
17427 you want to use the original content in the writer function, you can
17428 use the extra parameter ~:content~.
17430 For a block with name ~myblock~, the writer function is
17431 ~org-dblock-write:myblock~ with as only parameter a property list
17432 with the parameters given in the begin line.  Here is a trivial example
17433 of a block that keeps track of when the block update function was last
17434 run:
17436 #+begin_example
17437    ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
17439    ,#+END:
17440 #+end_example
17442 {{{noindent}}} The corresponding block writer function could look like
17443 this:
17445 #+header: :eval no
17446 #+header: :exports code
17447 #+begin_src emacs-lisp
17448 (defun org-dblock-write:block-update-time (params)
17449    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
17450      (insert "Last block update at: "
17451              (format-time-string fmt (current-time)))))
17452 #+end_src
17454 If you want to make sure that all dynamic blocks are always
17455 up-to-date, you could add the function ~org-update-all-dblocks~ to a
17456 hook, for example ~before-save-hook~.  ~org-update-all-dblocks~ is
17457 written in a way such that it does nothing in buffers that are not in
17458 ~org-mode~.
17460 You can narrow the current buffer to the current dynamic block (like
17461 any other block) with ~org-narrow-to-block~.
17463 ** Special agenda views
17464    :PROPERTIES:
17465    :DESCRIPTION: Customized views
17466    :END:
17467 #+cindex: agenda views, user-defined
17468 #+vindex: org-agenda-skip-function
17469 #+vindex: org-agenda-skip-function-global
17471 Org provides a special hook that can be used to narrow down the
17472 selection made by these agenda views: ~agenda~, ~todo~, ~alltodo~,
17473 ~tags~, ~tags-todo~, ~tags-tree~.  You may specify a function that is
17474 used at each match to verify if the match should indeed be part of the
17475 agenda view, and if not, how much should be skipped.  You can specify a
17476 global condition that will be applied to all agenda views, this
17477 condition would be stored in the variable
17478 ~org-agenda-skip-function-global~.  More commonly, such a definition is
17479 applied only to specific custom searches, using
17480 ~org-agenda-skip-function~.
17482 Let's say you want to produce a list of projects that contain a
17483 ~WAITING~ tag anywhere in the project tree.  Let's further assume that
17484 you have marked all tree headings that define a project with the TODO
17485 keyword PROJECT.  In this case you would run a TODO search for the
17486 keyword PROJECT, but skip the match unless there is a ~WAITING~ tag
17487 anywhere in the subtree belonging to the project line.
17489 To achieve this, you must write a function that searches the subtree for
17490 the tag.  If the tag is found, the function must return ~nil~ to
17491 indicate that this match should not be skipped.  If there is no such
17492 tag, return the location of the end of the subtree, to indicate that
17493 search should continue from there.
17495 #+header: :eval no
17496 #+header: :exports code
17497 #+begin_src emacs-lisp
17498 (defun my-skip-unless-waiting ()
17499   "Skip trees that are not waiting"
17500   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
17501     (if (re-search-forward ":waiting:" subtree-end t)
17502         nil          ; tag found, do not skip
17503       subtree-end))) ; tag not found, continue after end of subtree
17504 #+end_src
17506 Now you may use this function in an agenda custom command, for example
17507 like this:
17509 #+header: :eval no
17510 #+header: :exports code
17511 #+begin_src emacs-lisp
17512 (org-add-agenda-custom-command
17513  '("b" todo "PROJECT"
17514    ((org-agenda-skip-function 'my-skip-unless-waiting)
17515     (org-agenda-overriding-header "Projects waiting for something: "))))
17516 #+end_src
17518 #+vindex: org-agenda-overriding-header
17520 Note that this also binds ~org-agenda-overriding-header~ to get a
17521 meaningful header in the agenda view.
17523 #+vindex: org-odd-levels-only
17524 #+vindex: org-agenda-skip-function
17526 A general way to create custom searches is to base them on a search
17527 for entries with a certain level limit.  If you want to study all
17528 entries with your custom search function, simply do a search for
17529 {{{samp(LEVEL>0)}}}, and then use ~org-agenda-skip-function~ to select
17530 the entries you really want to have.[fn:163]
17532 You may also put a Lisp form into ~org-agenda-skip-function~.  In
17533 particular, you may use the functions ~org-agenda-skip-entry-if~
17534 and ~org-agenda-skip-subtree-if~ in this form, for example:
17536 #+attr_texinfo: :table-type table :indic @asis
17537 - {{{samp((org-agenda-skip-entry-if 'scheduled))}}} ::
17539   Skip current entry if it has been scheduled.
17541 - {{{samp((org-agenda-skip-entry-if 'notscheduled))}}} ::
17543   Skip current entry if it has not been scheduled.
17545 - {{{samp((org-agenda-skip-entry-if 'deadline))}}} ::
17547   Skip current entry if it has a deadline.
17549 - {{{samp((org-agenda-skip-entry-if 'scheduled 'deadline))}}} ::
17551   Skip current entry if it has a deadline, or if it is scheduled.
17553 - {{{samp((org-agenda-skip-entry-if 'todo '("TODO" "WAITING")))}}} ::
17555   Skip current entry if the TODO keyword is TODO or WAITING.
17557 - {{{samp((org-agenda-skip-entry-if 'todo 'done))}}} ::
17559   Skip current entry if the TODO keyword marks a DONE state.
17561 - {{{samp((org-agenda-skip-entry-if 'timestamp))}}} ::
17563   Skip current entry if it has any timestamp, may also be deadline or scheduled.
17564   <<x-agenda-skip-entry-regexp>>
17566 - {{{samp((org-agenda-skip-entry-if 'regexp "regular expression"))}}} ::
17567   
17568   Skip current entry if the regular expression matches in the entry.
17570 - {{{samp((org-agenda-skip-entry-if 'notregexp "regular expression"))}}} ::
17572   Skip current entry unless the regular expression matches.
17574 - {{{samp((org-agenda-skip-subtree-if 'regexp "regular expression"))}}} ::
17576   Same as above, but check and skip the entire subtree.
17579 Therefore we could also have written the search for WAITING projects
17580 like this, even without defining a special function:
17582 #+header: :eval no
17583 #+header: :exports code
17584 #+begin_src emacs-lisp
17585 (org-add-agenda-custom-command
17586  '("b" todo "PROJECT"
17587    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
17588                                 'regexp ":waiting:"))
17589     (org-agenda-overriding-header "Projects waiting for something: "))))
17590 #+end_src
17592 ** Extracting agenda information
17593    :PROPERTIES:
17594    :DESCRIPTION: Post-processing agenda information
17595    :END:
17596 #+cindex: agenda, pipe
17597 #+cindex: Scripts, for agenda processing
17598 #+vindex: org-agenda-custom-commands
17600 Org provides commands to access agenda information for the command
17601 line in Emacs batch mode.  This extracted information can be sent
17602 directly to a printer, or it can be read by a program that does
17603 further processing of the data.  The first of these commands is the
17604 function ~org-batch-agenda~, that produces an agenda view and sends it
17605 as ASCII text to STDOUT.  The command takes a single string as
17606 parameter.  If the string has length 1, it is used as a key to one of
17607 the commands you have configured in ~org-agenda-custom-commands~,
17608 basically any key you can use after {{{kbd(C-c a)}}}.  For example, to
17609 directly print the current TODO list, you could use:
17611 #+header: :eval no
17612 #+header: :exports code
17613 #+begin_src sh
17614 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
17615 #+end_src
17617 If the parameter is a string with 2 or more characters, it is used as
17618 a tags/TODO match string.  For example, to print your local shopping
17619 list (all items with the tag {{{samp(shop)}}}, but excluding the tag
17620 {{{samp(NewYork)}}}), you could use:
17622 #+header: :eval no
17623 #+header: :exports code
17624 #+begin_src sh
17625 emacs -batch -l ~/.emacs                                      \
17626       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
17627 #+end_src
17629 {{{noindent}}} You may also modify parameters on the fly like this:
17631 #+header: :eval no
17632 #+header: :exports code
17633 #+begin_src sh
17634 emacs -batch -l ~/.emacs                                      \
17635    -eval '(org-batch-agenda "a"                               \
17636             org-agenda-span (quote month)                     \
17637             org-agenda-include-diary nil                      \
17638             org-agenda-files (quote ("~/org/project.org")))'  \
17639    | lpr
17640 #+end_src
17642 {{{noindent}}} which will produce a 30-day agenda, fully restricted to
17643 the Org file {{{file(~/org/projects.org)}}}, not even including the
17644 diary.
17646 If you want to process the agenda data in more sophisticated ways, you
17647 can use the command ~org-batch-agenda-csv~ to get a comma-separated
17648 list of values for each agenda item.  Each line in the output will
17649 contain a number of fields separated by commas.  The fields in a line
17650 are:
17652 #+attr_texinfo: :table-type table :indic @code
17653 - category ::     The category of the item
17654 - head ::        The headline, without TODO keyword, TAGS and PRIORITY
17655 - type ::        The type of the agenda entry, can be:
17656   - todo ::               selected in TODO match
17657   - tagsmatch ::          selected in tags match
17658   - diary ::              imported from diary
17659   - deadline ::           a deadline
17660   - scheduled ::         scheduled
17661   - timestamp ::         appointment, selected by timestamp
17662   - closed ::            entry was closed on date
17663   - upcoming-deadline ::  warning about nearing deadline
17664   - past-scheduled ::     forwarded scheduled item
17665   - block ::              entry has date block including date
17666 - todo ::         The TODO keyword, if any
17667 - tags ::        All tags including inherited ones, separated by colons
17668 - date ::        The relevant date, like 2007-2-14
17669 - time ::        The time, like 15:00-16:50
17670 - extra ::       String with extra planning info
17671 - priority-l ::   The priority letter if any was given
17672 - priority-n ::  The computed numerical priority
17674 {{{noindent}}} Time and date will only be given if a timestamp (or
17675 deadline/scheduled) led to the selection of the item.
17677 A CSV list like this is very easy to use in a post-processing script.
17678 For example, here is a Perl program that gets the TODO list from
17679 Emacs/Org and prints all the items, preceded by a checkbox:
17681 #+header: :eval no
17682 #+header: :exports code
17683 #+begin_src perl
17684 #!/usr/bin/perl
17686 # define the Emacs command to run
17687 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
17689 # run it and capture the output
17690 $agenda = qx@{$cmd 2>/dev/null@};
17692 # loop over all lines
17693 foreach $line (split(/\n/,$agenda)) @{
17694   # get the individual values
17695   ($category,$head,$type,$todo,$tags,$date,$time,$extra,
17696    $priority_l,$priority_n) = split(/,/,$line);
17697   # process and print
17698   print "[ ] $head\n";
17700 #+end_src
17702 ** Using the property API
17703    :PROPERTIES:
17704    :DESCRIPTION: Writing programs that use entry properties
17705    :END:
17706 #+cindex: API, for properties
17707 #+cindex: properties, API
17709 Here is a description of the functions that can be used to work with
17710 properties.
17712 #+attr_texinfo: :options org-entry-properties &optional pom which
17713 #+begin_defun
17714 Get all properties of the entry at point-or-marker POM.
17715 This includes the TODO keyword, the tags, time strings for deadline,
17716 scheduled, and clocking, and any additional properties defined in the
17717 entry.  The return value is an alist.  Keys may occur multiple times
17718 if the property key was used several times.@*
17719 POM may also be nil, in which case the current entry is used.
17720 If WHICH is nil or `all', get all properties.  If WHICH is
17721 `special' or `standard', only get that subclass.
17722 #+end_defun
17724 #+vindex: org-use-property-inheritance
17725 #+findex: org-insert-property-drawer
17726 #+attr_texinfo: :options org-entry-get pom property &optional inherit
17727 #+begin_defun
17728 Get value of PROPERTY for entry at point-or-marker POM.  By default,
17729 this only looks at properties defined locally in the entry.  If INHERIT
17730 is non-nil and the entry does not have the property, then also check
17731 higher levels of the hierarchy.  If INHERIT is the symbol
17732 ~selective~, use inheritance if and only if the setting of
17733 ~org-use-property-inheritance~ selects PROPERTY for inheritance.
17734 #+end_defun
17736 #+attr_texinfo: :options org-entry-delete pom property
17737 #+begin_defun
17738 Delete the property PROPERTY from entry at point-or-marker POM.
17739 #+end_defun
17741 #+attr_texinfo: :options org-entry-put pom property value
17742 #+begin_defun
17743 Set PROPERTY to VALUE for entry at point-or-marker POM.
17744 #+end_defun
17746 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
17747 #+begin_defun
17748 Get all property keys in the current buffer.
17749 #+end_defun
17750 #+attr_texinfo: :options org-insert-property-drawer
17751 #+begin_defun
17752 Insert a property drawer for the current entry.  Also
17753 #+end_defun
17755 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
17756 #+begin_defun
17757 Set PROPERTY at point-or-marker POM to VALUES.  VALUES should be a list of
17758 strings.  They will be concatenated, with spaces as separators.
17759 #+end_defun
17761 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
17762 #+begin_defun
17763 Treat the value of the property PROPERTY as a whitespace-separated list of
17764 values and return the values as a list of strings.
17765 #+end_defun
17767 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
17768 #+begin_defun
17769 Treat the value of the property PROPERTY as a whitespace-separated list of
17770 values and make sure that VALUE is in this list.
17771 #+end_defun
17773 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
17774 #+begin_defun
17775 Treat the value of the property PROPERTY as a whitespace-separated list of
17776 values and make sure that VALUE is /not/ in this list.
17777 #+end_defun
17779 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
17780 #+begin_defun
17781 Treat the value of the property PROPERTY as a whitespace-separated list of
17782 values and check if VALUE is in this list.
17783 #+end_defun
17785 #+attr_texinfo: :options org-property-allowed-value-functions
17786 #+begin_defopt
17787 Hook for functions supplying allowed values for a specific property.
17788 The functions must take a single argument, the name of the property, and
17789 return a flat list of allowed values.  If {{{samp(:ETC)}}} is one of
17790 the values, use the values as completion help, but allow also other values
17791 to be entered.  The functions must return ~nil~ if they are not
17792 responsible for this property.
17793 #+end_defopt
17795 ** Using the mapping API
17796    :PROPERTIES:
17797    :DESCRIPTION: Mapping over all or selected entries
17798    :END:
17799 #+cindex: API, for mapping
17800 #+cindex: mapping entries, API
17802 Org has sophisticated mapping capabilities to find all entries satisfying
17803 certain criteria.  Internally, this functionality is used to produce agenda
17804 views, but there is also an API that can be used to execute arbitrary
17805 functions for each or selected entries.  The main entry point for this API
17808 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
17809 #+begin_defun
17810 Call FUNC at each headline selected by MATCH in SCOPE.
17812 FUNC is a function or a Lisp form.  The function will be called without
17813 arguments, with the cursor positioned at the beginning of the headline.
17814 The return values of all calls to the function will be collected and
17815 returned as a list.
17817 The call to FUNC will be wrapped into a save-excursion form, so FUNC
17818 does not need to preserve point.  After evaluation, the cursor will be
17819 moved to the end of the line (presumably of the headline of the
17820 processed entry) and search continues from there.  Under some
17821 circumstances, this may not produce the wanted results.  For example,
17822 if you have removed (e.g., archived) the current (sub)tree it could
17823 mean that the next entry will be skipped entirely.  In such cases, you
17824 can specify the position from where search should continue by making
17825 FUNC set the variable `org-map-continue-from' to the desired buffer
17826 position.
17828 MATCH is a tags/property/todo match as it is used in the agenda match view.
17829 Only headlines that are matched by this query will be considered during
17830 the iteration.  When MATCH is nil or t, all headlines will be
17831 visited by the iteration.
17833 SCOPE determines the scope of this command.  It can be any of:
17835 #+attr_texinfo: :table-type table :indic @code
17836 - nil ::     
17838   The current buffer, respecting the restriction, if any.
17840 - tree ::    
17842   The subtree started with the entry at point.
17844 - region ::  
17846   The entries within the active region, if any.
17848 - file ::    
17850   The current buffer, without restriction.
17852 - file-with-archives ::
17853         
17854   The current buffer, and any archives associated with it.
17856 - agenda ::  
17858   All agenda files.
17860 - agenda-with-archives ::
17861         
17862   All agenda files with any archive files associated with them.
17864 - (file1 file2 ...) ::
17865         
17866   If this is a list, all files in the list will be scanned.
17869 {{{noindent}}} The remaining args are treated as settings for the
17870 skipping facilities of the scanner.  The following items can be given
17871 here:
17873 #+vindex: org-agenda-skip-function
17874 #+attr_texinfo: :table-type table :indic @asis
17875 - ~archive~ ::   
17877   Skip trees with the archive tag.
17879 - ~comment~ ::   
17881   Skip trees with the COMMENT keyword.
17883 - function or Lisp form ::
17885   Will be used as value for ~org-agenda-skip-function~, so whenever the
17886   function returns t, FUNC will not be called for that entry and search
17887   will continue from the point where the function leaves it.
17888 #+end_defun
17890 The function given to that mapping routine can really do anything you like.
17891 It can use the property API (see [[Using the property API]]) to gather more
17892 information about the entry, or in order to change metadata in the entry.
17893 Here are a few functions that might be handy:
17895 #+attr_texinfo: :options org-todo &optional arg
17896 #+begin_defun
17897 Change the TODO state of the entry.  See the docstring of the functions for
17898 the many possible values for the argument ARG.
17899 #+end_defun
17901 #+attr_texinfo: :options org-priority &optional action
17902 #+begin_defun
17903 Change the priority of the entry.  See the docstring of this function for the
17904 possible values for ACTION.
17905 #+end_defun
17907 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
17908 #+begin_defun
17909 Toggle the tag TAG in the current entry.  Setting ONOFF to either ~on~
17910 or ~off~ will not toggle tag, but ensure that it is either on or off.
17911 #+end_defun
17913 #+attr_texinfo: :options org-promote
17914 #+begin_defun
17915 Promote the current entry.
17916 #+end_defun
17918 #+attr_texinfo: :options org-demote
17919 #+begin_defun
17920 Demote the current entry.
17921 #+end_defun
17923 The following simple example will turn all entries in the current file
17924 with a tag ~TOMORROW~ into TODO entries with the keyword ~UPCOMING~.
17925 Entries in comment trees and in archive trees will be ignored.
17927 #+header: :eval no
17928 #+header: :exports code
17929 #+begin_src emacs-lisp
17930 (org-map-entries
17931    '(org-todo "UPCOMING")
17932    "+TOMORROW" 'file 'archive 'comment)
17933 #+end_src
17935 The following example counts the number of entries with TODO keyword
17936 ~WAITING~, in all agenda files.
17938 #+header: :eval no
17939 #+header: :exports code
17940 #+begin_src emacs-lisp
17941 (length (org-map-entries t "/+WAITING" 'agenda))
17942 #+end_src
17944 * MobileOrg
17945   :PROPERTIES:
17946   :DESCRIPTION: Viewing and capture on a mobile device
17947   :APPENDIX:    Appendix
17948   :END:
17949 #+cindex: iPhone
17950 #+cindex: MobileOrg
17951 #+cindex: Moreland, Richard
17952 #+cindex: Jones, Matt
17954 MobileOrg is the name of the mobile companion app for Org mode,
17955 currently available for iOS and for Android.  MobileOrg offers
17956 offline viewing and capture support for an Org mode system rooted on a
17957 ``real'' computer.  It does also allow you to record changes to
17958 existing entries.  The [[http://mobileorg.ncogni.to/][iOS implementation]] for the iPhone/iPod
17959 Touch/iPad series of devices, was developed by Richard Moreland.
17960 Android users should check out [[http://wiki.github.com/matburt/mobileorg-android/][MobileOrg Android]] by Matt Jones.  The
17961 two implementations are not identical but offer similar features.
17963 This appendix describes the support Org has for creating agenda views
17964 in a format that can be displayed by MobileOrg, and for integrating
17965 notes captured and changes made by MobileOrg into the main system.
17967 For changing tags and TODO states in MobileOrg, you should have set up
17968 the customization variables ~org-todo-keywords~ and ~org-tags-alist~
17969 to cover all important tags and TODO keywords, even if individual
17970 files use only part of these.  MobileOrg will also offer you states and
17971 tags set up with in-buffer settings, but it will understand the
17972 logistics of TODO state /sets/ (see [[Per-file keywords]]) and /mutually
17973 exclusive/ tags (see [[Setting tags]]) only for those set in these
17974 variables.
17976 ** Setting up the staging area
17977    :PROPERTIES:
17978    :DESCRIPTION: Where to interact with the mobile device
17979    :END:
17981 MobileOrg needs to interact with Emacs through a directory on a
17982 server.  If you are using a public server, you should consider to
17983 encrypt the files that are uploaded to the server.  This can be done
17984 with Org mode 7.02 and with MobileOrg 1.5 (iPhone version), and you
17985 need an {{{file(openssl)}}} installation on your system.  To turn on
17986 encryption, set a password in MobileOrg and, on the Emacs side,
17987 configure the variable ~org-mobile-use-encryption~.[fn:164]
17989 The easiest way to create that directory is to use a free [[http://dropbox.com][Dropbox]]
17990 account.[fn:165] When MobileOrg first connects to your Dropbox, it
17991 will create a directory MobileOrg inside the Dropbox.  After the
17992 directory has been created, tell Emacs about it:
17994 #+header: :eval no
17995 #+header: :exports code
17996 #+begin_src emacs-lisp
17997 (setq org-mobile-directory "~/Dropbox/MobileOrg")
17998 #+end_src
18000 Org mode has commands to put files for MobileOrg into that
18001 directory, and to read captured notes from there.
18003 ** Pushing to MobileOrg
18004    :PROPERTIES:
18005    :DESCRIPTION: Uploading Org files and agendas
18006    :END:
18008 This operation copies all files currently listed in ~org-mobile-files~
18009 to the directory ~org-mobile-directory~.  By default this list contains
18010 all agenda files (as listed in ~org-agenda-files~), but additional
18011 files can be included by customizing ~org-mobile-files~.  File names
18012 will be staged with paths relative to ~org-directory~, so all files
18013 should be inside this directory.[fn:184]
18015 The push operation also creates a special Org file
18016 {{{file(agendas.org)}}} with all custom agenda view defined by the
18017 user.[fn:166]
18019 Finally, Org writes the file {{{file(index.org)}}}, containing links
18020 to all other files.  MobileOrg first reads this file from the server,
18021 and then downloads all agendas and Org files listed in it.  To speed up
18022 the download, MobileOrg will only read files whose checksums have
18023 changed.[fn:167]
18025 ** Pulling from MobileOrg
18026    :PROPERTIES:
18027    :DESCRIPTION: Integrating captured and flagged items
18028    :END:
18030 When MobileOrg synchronizes with the server, it not only pulls the
18031 Org files for viewing.  It also appends captured entries and pointers
18032 to flagged and changed entries to the file {{{file(mobileorg.org)}}}
18033 on the server.  Org has a /pull/ operation that integrates this
18034 information into an inbox file and operates on the pointers to flagged
18035 entries.  Here is how it works:
18037 1. Org moves all entries found in {{{file(mobileorg.org)}}} and
18038    appends them to the file pointed to by the variable
18039    ~org-mobile-inbox-for-pull~.[fn:168] Each captured entry and each
18040    editing event will be a top-level entry in the inbox file.
18042 2. After moving the entries, Org will attempt to implement the changes
18043    made in MobileOrg.  Some changes are applied directly and without
18044    user interaction.  Examples are all changes to tags, TODO state,
18045    headline and body text that can be cleanly applied.  Entries that
18046    have been flagged for further action will receive a tag
18047    ~:FLAGGED:~, so that they can be easily found again.  When there is
18048    a problem finding an entry or applying the change, the pointer
18049    entry will remain in the inbox and will be marked with an error
18050    message.  You need to later resolve these issues by hand.
18052 3. Org will then generate an agenda view with all flagged entries.  The
18053    user should then go through these entries and do whatever actions
18054    are necessary.  If a note has been stored while flagging an entry in
18055    MobileOrg, that note will be displayed in the echo area when the
18056    cursor is on the corresponding agenda line.
18058    #+attr_texinfo: :table-type table :indic @asis
18059    - {{{kbd(?)}}} ::
18060      #+kindex: ?
18062      Pressing {{{kbd(?)}}} in that special agenda will display the full
18063      flagging note in another window and also push it onto the kill ring.
18064      So you could use {{{kbd(? z C-y C-c C-c)}}} to store that flagging
18065      note as a normal note in the entry.  Pressing {{{kbd(?)}}} twice in
18066      succession will offer to remove the ~:FLAGGED:~ tag along with the
18067      recorded flagging note (which is stored in a property).  In this way
18068      you indicate that the intended processing for this flagged entry is
18069      finished.
18072 #+kindex: C-c a ?
18074 If you are not able to process all flagged entries directly, you can always
18075 return to this agenda view using {{{kbd(C-c a ?)}}}.[fn:169]
18077 * History and acknowledgments
18078   :PROPERTIES:
18079   :DESCRIPTION: How Org came into being
18080   :ALT_TITLE: History and Acknowledgments
18081   :APPENDIX:    Appendix
18082   :END:
18083 ** From Carsten
18085 Org was born in 2003, out of frustration over the user interface of
18086 the Emacs Outline mode.  I was trying to organize my notes and
18087 projects, and using Emacs seemed to be the natural way to go.  However,
18088 having to remember eleven different commands with two or three keys
18089 per command, only to hide and show parts of the outline tree, that
18090 seemed entirely unacceptable to me.  Also, when using outlines to take
18091 notes, I constantly wanted to restructure the tree, organizing it
18092 parallel to my thoughts and plans.  /Visibility cycling/ and /structure
18093 editing/ were originally implemented in the package
18094 {{{file(outline-magic.el)}}}, but quickly moved to the more general
18095 {{{file(org.el)}}}.  As this environment became comfortable for project
18096 planning, the next step was adding /TODO entries/, basic /timestamps/,
18097 and /table support/.  These areas highlighted the two main goals that
18098 Org still has today: to be a new, outline-based, plain text mode with
18099 innovative and intuitive editing features, and to incorporate project
18100 planning functionality directly into a notes file.
18102 Since the first release, literally thousands of emails to me or to the
18103 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
18104 new ideas, and sometimes patches and add-on code.  Many thanks to
18105 everyone who has helped to improve this package.  I am trying to keep
18106 here a list of the people who had significant influence in shaping one
18107 or more aspects of Org.  The list may not be complete, if I have
18108 forgotten someone, please accept my apologies and let me know.
18110 Before I get to this list, a few special mentions are in order:
18112 #+attr_texinfo: :table-type table :indic @asis
18113 - Bastien Guerry ::
18115   Bastien has written a large number of extensions to Org (most of them
18116   integrated into the core by now), including the LaTeX exporter and
18117   the plain list parser.  His support during the early days, when he
18118   basically acted as co-maintainer, was central to the success of this
18119   project.  Bastien also invented Worg, helped establishing the Web
18120   presence of Org, and sponsored hosting costs for the ~orgmode.org~
18121   website.
18123 - Eric Schulte and Dan Davison ::
18125   Eric and Dan are jointly responsible for the Org-babel system, which
18126   turns Org into a multi-language environment for evaluating code and
18127   doing literate programming and reproducible research.
18129 - John Wiegley ::
18131   John has contributed a number of great ideas and patches directly to
18132   Org, including the attachment system ({{{file(org-attach.el)}}}),
18133   integration with Apple Mail ({{{file(org-mac-message.el)}}}),
18134   hierarchical dependencies of TODO items, habit tracking
18135   ({{{file(org-habits.el)}}}), and encryption
18136   ({{{file(org-crypt.el)}}}).  Also, the capture system is really an
18137   extended copy of his great {{{file(remember.el)}}}.
18139 - Sebastian Rose ::
18141   Without Sebastian, the HTML/XHTML publishing of Org would be the
18142   pitiful work of an ignorant amateur.  Sebastian has pushed this part of
18143   Org onto a much higher level.  He also wrote {{{file(org-info.js)}}}, a
18144   Java script for displaying webpages derived from Org using an
18145   Info-like or a folding interface with single-key navigation.
18148 {{{noindent}}} See [[List of contributions][below]] for the full list of contributions! Again,
18149 please let me know what I am missing here!
18151 ** From Bastien
18153 I (Bastien) have been maintaining Org since January 2011.  This
18154 appendix would not be complete without adding a few more
18155 acknowledgements and thanks to Carsten's ones above.
18157 I am first grateful to Carsten for his trust while handing me over the
18158 maintainership of Org.  His support as been great since day one of this
18159 new adventure, and it helped a lot.
18161 When I took over maintainership, I knew I would have to make Org more
18162 collaborative than ever, as I would have to rely on people that are
18163 more knowledgeable than I am on many parts of the code.  Here is a list
18164 of the persons I could rely on, they should really be considered
18165 co-maintainers, either of the code or the community:
18167 #+attr_texinfo: :table-type table :indic @asis
18168 - Eric Schulte ::
18170   Eric is maintaining the Babel parts of Org.  His reactivity here kept
18171   me away from worrying about possible bugs here and let me focus on
18172   other parts.
18174 - Nicolas Goaziou ::
18176   Nicolas is maintaining the consistency of the deepest parts of Org.
18177   His work on {{{file(org-element.el)}}} and {{{file(org-export.el)}}}
18178   has been outstanding, and opened the doors for many new ideas and
18179   features.
18181 - Jambunathan K ::
18183   Jambunathan contributed the ODT exporter, definitly a killer feature
18184   of Org mode.  He also contributed the new HTML exporter, which is
18185   another core feature of Org.  Here too, I knew I could rely on him to
18186   fix bugs in these areas and to patiently explain the users what was
18187   the problems and solutions.
18189 - Achim Gratz ::
18191   Achim rewrote the building process of Org, turning some /ad hoc/ tools
18192   into a flexible and conceptually clean process.  He patiently coped
18193   with the many hicups that such a change can create for users.
18195 - Nick Dokos ::
18197   The Org mode mailing list would not be such a nice place without Nick,
18198   who patiently helped users so many times.  It is impossible to
18199   overestimate such a great help, and the list would not be so active
18200   without him.
18203 I received support from so many users that it is clearly impossible to be
18204 fair when shortlisting a few of them---but Org's history would not be
18205 complete if the ones above were not mentioned in this manual.
18207 ** List of contributions
18209 - Russel Adams came up with the idea for drawers.
18211 - Thomas Baumann wrote {{{file(org-bbdb.el)}}} and {{{file(org-mhe.el)}}}.
18213 - Christophe Bataillon created the great unicorn logo that we use on
18214   the Org mode website.
18216 - Alex Bochannek provided a patch for rounding timestamps.
18218 - Jan Böcker wrote {{{file(org-docview.el)}}}.
18220 - Brad Bozarth showed how to pull RSS feed data into Org mode files.
18222 - Tom Breton wrote {{{file(org-choose.el)}}}.
18224 - Charles Cave's suggestion sparked the implementation of templates
18225   for Remember, which are now templates for capture.
18227 - Pavel Chalmoviansky influenced the agenda treatment of items with
18228   specified time.
18230 - Gregory Chernov patched support for Lisp forms into table
18231   calculations and improved XEmacs compatibility, in particular by
18232   porting {{{file(nouline.el)}}} to XEmacs.
18234 - Sacha Chua suggested copying some linking code from Planner.
18236 - Baoqiu Cui contributed the DocBook exporter.
18238 - Eddward DeVilla proposed and tested checkbox statistics.  He also
18239   came up with the idea of properties, and that there should be an API
18240   for them.
18242 - Nick Dokos tracked down several nasty bugs.
18244 - Kees Dullemond used to edit projects lists directly in HTML and so
18245   inspired some of the early development, including HTML export.  He
18246   also asked for a way to narrow wide table columns.
18248 - Thomas S.  Dye contributed documentation on Worg and helped
18249   integrating the Org-Babel documentation into the manual.
18251 -  Christian Egli converted the documentation into Texinfo format,
18252    inspired the agenda, patched CSS formatting into the HTML exporter,
18253    and wrote {{{file(org-taskjuggler.el)}}}.
18255 - David Emery provided a patch for custom CSS support in exported
18256   HTML agendas.
18258 - Nic Ferrier contributed mailcap and XOXO support.
18260 - Miguel A.  Figueroa-Villanueva implemented hierarchical checkboxes.
18262 - John Foerch figured out how to make incremental search show
18263   context around a match in a hidden outline tree.
18265 - Raimar Finken wrote {{{file(org-git-line.el)}}}.
18267 - Mikael Fornius works as a mailing list moderator.
18269 - Austin Frank works as a mailing list moderator.
18271 - Eric Fraga drove the development of BEAMER export with ideas and
18272   testing.
18274 - Barry Gidden did proofreading the manual in preparation for the
18275   book publication through Network Theory Ltd.
18277 - Niels Giesen had the idea to automatically archive DONE trees.
18279 - Nicolas Goaziou rewrote much of the plain list code.
18281 - Kai Grossjohann pointed out key-binding conflicts with other packages.
18283 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
18284   a book.
18286 - Bernt Hansen has driven much of the support for auto-repeating
18287   tasks, task state change logging, and the clocktable.  His clear
18288   explanations have been critical when we started to adopt the Git
18289   version control system.
18291 -  Manuel Hermenegildo has contributed various ideas, small fixes
18292    and patches.
18294 - Phil Jackson wrote {{{file(org-irc.el)}}}.
18296 - Scott Jaderholm proposed footnotes, control over whitespace
18297   between folded entries, and column view for properties.
18299 - Matt Jones wrote /MobileOrg Android/.
18301 - Tokuya Kameshima wrote {{{file(org-wl.el)}}} and {{{file(org-mew.el)}}}.
18303 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it.  He
18304   also provided frequent feedback and some patches.
18306 - Matt Lundin has proposed last-row references for table formulas
18307   and named invisible anchors.  He has also worked a lot on the FAQ.
18309 - David Maus wrote {{{file(org-atom.el)}}}, maintains the issues
18310   file for Org, and is a prolific contributor on the mailing list with
18311   competent replies, small fixes and patches.
18313 - Jason F.  McBrayer suggested agenda export to CSV format.
18315 - Max Mikhanosha came up with the idea of refiling.
18317 - Dmitri Minaev sent a patch to set priority limits on a per-file
18318   basis.
18320 - Stefan Monnier provided a patch to keep the Emacs-Lisp compiler
18321   happy.
18323 - Richard Moreland wrote /MobileOrg/ for the iPhone.
18325 - Rick Moynihan proposed allowing multiple TODO sequences in a file
18326   and being able to quickly restrict the agenda to a subtree.
18328 - Todd Neal provided patches for links to Info files and Elisp forms.
18330 - Greg Newman refreshed the unicorn logo into its current form.
18332 - Tim O'Callaghan suggested in-file links, search options for
18333   general file links, and TAGS.
18335 - Osamu Okano wrote {{{file(orgcard2ref.pl)}}}, a Perl program to
18336   create a text version of the reference card.
18338 - Takeshi Okano translated the manual and David O'Toole's tutorial
18339   into Japanese.
18341 - Oliver Oppitz suggested multi-state TODO items.
18343 - Scott Otterson sparked the introduction of descriptive text for
18344   links, among other things.
18346 - Pete Phillips helped during the development of the TAGS feature,
18347   and provided frequent feedback.
18349 - Martin Pohlack provided the code snippet to bundle character
18350   insertion into bundles of 20 for undo.
18352 - T.V.  Raman reported bugs and suggested improvements.
18354 - Matthias Rempe (Oelde) provided ideas, Windows support, and
18355   quality control.
18357 - Paul Rivier provided the basic implementation of named footnotes.
18358   He also acted as mailing list moderator for some time.
18360 - Kevin Rogers contributed code to access VM files on remote hosts.
18362 - Frank Ruell solved the mystery of the ~keymapp nil~ bug, a
18363   conflict with {{{file(allout.el)}}}.
18365 - Jason Riedy generalized the send-receive mechanism for Orgtbl
18366   tables with extensive patches.
18368 - Philip Rooke created the Org reference card, provided lots of
18369   feedback, developed and applied standards to the Org documentation.
18371 - Christian Schlauer proposed angular brackets around links, among
18372   other things.
18374 - Paul Sexton wrote {{{file(org-ctags.el)}}}.
18376 - Tom Shannon's {{{file(organizer-mode.el)}}} inspired linking to VM/BBDB/Gnus.
18378 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
18379   literal examples, and remote highlighting for referenced code lines.
18381 - Stathis Sideris wrote the {{{file(ditaa.jar)}}} ASCII to PNG
18382   converter that is now packaged into Org's {{{file(contrib)}}}
18383   directory.
18385 - Daniel Sinder came up with the idea of internal archiving by
18386   locking subtrees.
18388 - Dale Smith proposed link abbreviations.
18390 - James TD Smith has contributed a large number of patches for
18391   useful tweaks and features.
18393 - Adam Spiers asked for global linking commands, inspired the link
18394   extension system, added support for mairix, and proposed the mapping
18395   API.
18397 - Ulf Stegemann created the table to translate special symbols to
18398   HTML, LaTeX, UTF-8, Latin-1 and ASCII.
18400 - Andy Stewart contributed code to {{{file(org-w3m.el)}}}, to copy
18401   HTML content with links transformation to Org syntax.
18403 - David O'Toole wrote {{{file(org-publish.el)}}} and drafted the
18404   manual chapter about publishing.
18406 - Jambunathan K contributed the ODT exporter.
18408 - Sebastien Vauban reported many issues with LaTeX and BEAMER
18409   export and enabled source code highlighting in Gnus.
18411 - Stefan Vollmar organized a video-recorded talk at the
18412   Max-Planck-Institute for Neurology.  He also inspired the creation
18413   of a concept index for HTML export.
18415 - J\"urgen Vollmer contributed code generating the table of contents
18416   in HTML output.
18418 - Samuel Wales has provided important feedback and bug reports.
18420 - Chris Wallace provided a patch implementing the {{{samp(QUOTE)}}}
18421   keyword.
18423 - David Wainberg suggested archiving, and improvements to the
18424   linking system.
18426 - Carsten Wimmer suggested some changes and helped fix a bug in
18427   linking to Gnus.
18429 - Roland Winkler requested additional key bindings to make Org work
18430   on a tty.
18432 - Piotr Zielinski wrote {{{file(org-mouse.el)}}}, proposed agenda
18433   blocks and contributed various ideas and code snippets.
18435 * GNU Free Documentation License
18436 :PROPERTIES:
18437 :APPENDIX: t
18438 :DESCRIPTION: The license for this documentation.
18439 :END:
18441 #+TEXINFO: @include ../doc/doclicense.texi
18443 * Concept index
18444 :PROPERTIES:
18445 :ALT_TITLE: Main Index
18446 :INDEX:    cp
18447 :DESCRIPTION: Org's concepts and features
18448 :END:
18450 * Key index
18451   :PROPERTIES:
18452   :DESCRIPTION: Key bindings and where they are described
18453   :ALT_TITLE: Key Index
18454   :INDEX:    ky
18455   :END:
18457 * Command and function index
18458   :PROPERTIES:
18459   :DESCRIPTION: Command names and some internal functions
18460   :ALT_TITLE: Command and Function Index
18461   :INDEX:    fn
18462   :END:
18464 * Variable index
18465   :PROPERTIES:
18466   :DESCRIPTION: Variables mentioned in the manual
18467   :ALT_TITLE: Variable Index
18468   :INDEX:    vr
18469   :END:
18471 This is not a complete index of variables and faces, only the ones
18472 that are mentioned in the manual.  For a more complete list, use
18473 {{{kbdspckey(M-x org-customize,RET)}}} and then click yourself through
18474 the tree.
18476 * Copying
18477    :PROPERTIES:
18478    :copying:  t
18479    :END:
18481 This manual is for Org version {{{version}}}.
18483 Copyright (C) 2004-2013  Free Software Foundation, Inc.
18485 #+BEGIN_QUOTE
18486 Permission is granted to copy, distribute and/or modify this document
18487 under the terms of the GNU Free Documentation License, Version 1.3 or
18488 any later version published by the Free Software Foundation; with no
18489 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
18490 and with the Back-Cover Texts as in (a) below.  A copy of the license
18491 is included in the section entitled ``GNU Free Documentation License.''
18493 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
18494 modify this GNU manual.  Buying copies from the FSF supports it in
18495 developing GNU and promoting software freedom.''
18497 This document is part of a collection distributed under the GNU Free
18498 Documentation License.  If you want to distribute this document
18499 separately from the collection, you can do so by adding a copy of the
18500 license to the document, as described in section 6 of the license.
18501 #+END_QUOTE
18503 * Macro definitions                                                     :noexport:
18505 # Version macro, with commit hash
18506 #+MACRO: version (eval (pcase (split-string (org-version nil t) "[ (_]" t) (`(,_ ,_ ,n ,_ ,r . ,_) (format "%s (release_%s)" n r))))
18508 # Markup macros.  In texinfo export they will be marked up, otherwise
18509 # they will be inserted verbatim.  markup is the generic form that can
18510 # be used to insert any @-command with the second variable being the
18511 # text to mark up.
18512 #+MACRO: markup @@info:@$1{@@$2@@info:}@@
18513 #+MACRO: kbd {{{markup(kbd,$1)}}}
18514 #+MACRO: key {{{markup(key,$1)}}}
18515 #+MACRO: samp {{{markup(samp,$1)}}}
18516 #+MACRO: command {{{markup(command,$1)}}}
18517 #+MACRO: file {{{markup(file,$1)}}}
18518 #+MACRO: var {{{markup(var,$1)}}}
18519 #+MACRO: cite {{{markup(cite,$1)}}}
18520 #+MACRO: value {{{markup(value,$1)}}}
18522 #+MACRO: kbdkey {{{kbd($1{{{key($2)}}})}}}
18523 #+MACRO: kbdspckey {{{kbd($1 {{{key($2)}}})}}}
18524 #+MACRO: ksksksk {{{kbd($1 {{{key($2)}}} $3 {{{key($4)}}})}}}
18525 #+MACRO: ksksksksk {{{kbd($1 {{{key($2)}}} $3 {{{key($4)}}} {{{key($5)}}})}}}
18526 #+MACRO: kbdkeys {{{kbd($1{{{key($2)}}}{{{key($3)}}})}}}
18528 # Plain macros.
18529 #+MACRO: noindent @@info:@noindent@@
18530 #+MACRO: result @@info:@result{}@@
18531 #+MACRO: page @@info:@page@@
18533 * Instructions for use                                             :noexport:
18534 - [ ] Tangle the makefile, `C-c C-v t'
18535 - [ ] Execute [[Editing setup][this source code block]]
18536 - [ ] Asynchronously generate the info file, `C-e i i'
18538 * Improvements and fixes [10/12]                                        :noexport:
18539 - [X] Jon will fix detailed node listing
18540 - [X] Jon will fix :INDEX: property
18541 - [ ] New link type to generate pxref? (asked on ML)
18542 - [X] New macro for kbdkey that preserves space, e.g., `C-c <RET>'
18543 - [X] Indent examples one more space to match indentation of footnotes
18544 - [X] How to generate @kbd{\}?
18545 - [X] How to generate @kbd{~}?
18546 - [X] How to include GNU Free Documentation License as Appendix D?
18547 - [X] Straighten out footnotes
18548 - [X] Truncated footnote (asked on ML)
18549 - [ ] Resolve macros with XXX arguments
18550 - [X] Get @appendix instead of @chapter?
18552 * Nicolas Goaziou's instructions for v.8                           :noexport:
18554 ** Global Changes
18555 All occurrences of "#+LABEL:" should be replaced with "#+NAME:".
18557 *** TODO Replace #+LABEL with #+NAME
18559 ** Chapter 2, Document Structure
18560    :PROPERTIES:
18561    :CATEGORY: Ch. 2
18562    :END:
18563 In "2.  Document Structure", one section could be added about
18564 cross-referencing, which would point to "Internal links".  There, targets
18565 in comments can be removed.  Also most back-ends will turn links to
18566 targets into proper cross-reference number (see `org-export-get-ordinal'
18567 docstring for cases handled).
18569 *** TODO Add section about cross-referencing
18571 ** Chapter 4, Hyperlinks
18572    :PROPERTIES:
18573    :CATEGORY: Ch. 4
18574    :END:
18575 "Internal links".  There, targets
18576 in comments can be removed.  Also most back-ends will turn links to
18577 targets into proper cross-reference number (see `org-export-get-ordinal'
18578 docstring for cases handled).
18580 *** TODO Remove targets in comments
18582 ** Chapter 11, Markup for Rich Export
18583    :PROPERTIES:
18584    :CATEGORY: Ch. 11
18585    :END:
18586 *** Include Keyword
18587 The "#+INCLUDE:" keyword syntax and effect is slightly different.  You
18588 may want to look at `org-export-expand-include-keyword'.
18590 **** TODO Revise Include keyword
18591 ** Chapter 12, Exporting
18592    :PROPERTIES:
18593    :CATEGORY: Ch. 12
18594    :END:
18595 *** Export Options
18596 In "12.  Exporting", "Export options" section need an overhaul.  See
18597 `org-export-options-alist' for the default list of export options.  Other
18598 options are back-end specific and should be introduced in their own
18599 section.  Also "#+KEYWORD:" renaming into ":EXPORT_KEYWORD:" property is
18600 systematic.
18602 **** TODO Overhaul Export options section
18604 **** TODO KEYWORD now EXPORT_KEYWORD
18606 *** Macros
18607 There should also be a section about macros (and move it out of "11
18608 Markup for rich export"), general, hard-coded ({{{time(...)}}},
18609 {{{property(...)}}}, {{{input-file}}} and {{{modification-time(...)}}})
18610 and specific ({{{date}}}, {{{author}}}, {{{title}}} and {{{email}}}).  It
18611 should be specified that macros are recursive and only apply to one
18612 line.  Therefore, they are appropriate for small replacements.  For more
18613 complex ones, one may use Babel instead.
18615 **** TODO Write macros section
18616 Subsections: General, Hard-coded, Specific
18618 *** Filters
18619 There should also be a section about filters used to customize export
18620 output and another one about `org-export-define-derived-backend' which
18621 allow someone to tweak a back-end.
18623 **** TODO Write filters section
18625 *** Define derived back-end
18626 and another one about `org-export-define-derived-backend' which
18627 allow someone to tweak a back-end.
18629 **** TODO Write derived back-end section
18631 *** Export Snippets
18632 A section can be added about export snippets, i.e.
18634   @@ob-latex:\something{...}@@
18636 They are a generalization for @<html> tags.
18638 **** TODO Write export snippets section
18639 *** Captions
18640 There may be a section about captions and their syntax.  A note should
18641 specify that export back-ends may or may not respect a caption.  On the
18642 other hand "11.2 Images and Tables" focuses on captions.  Since these are
18643 not specific to Images and Tables, it may be removed.
18645 **** TODO Write captions section
18646 *** Back-ends
18647 I would also regroup every back-end into a sub-section to not clutter
18648 main section.
18650 Other options are back-end specific and should be introduced in their
18651 own section.
18653 Also most back-ends will turn links to
18654 targets into proper cross-reference number (see `org-export-get-ordinal'
18655 docstring for cases handled).
18658 **** Old back-ends
18660 "DocBook export" (though texinfo back-end can export to DocBook) and
18661 "XOXO export" sections can be removed as the back-ends are discontinued.
18662 There is no equivalent to "Taskjuggler export" yet, so it can be removed
18663 too.
18665 ***** TODO Remove DocBook backend
18667 ***** TODO Remove XOXO backend
18669 ***** TODO Remove Taskjuggler backend
18671 **** Back-end template
18672 These are only suggestion.  There is also probably many more things to
18673 do.  But I think that the hardest part is to start writing it.  If you
18674 come up with a good organization for e-latex back-end documentation, we
18675 can use it for other back-ends thereafter.
18677 ***** TODO Write back-end template
18679 ****** TODO Does back-end turn links to targets?
18681 **** LaTeX Back-end
18682 About the latex back-end, you know certainly a lot.  It should be
18683 specified that it introduces 3 new keywords, namely "LATEX_CLASS",
18684 "LATEX_CLASS_OPTIONS" and "LATEX_HEADER".  It also introduces
18685 "BEGIN_LATEX" and "BEGIN_TEX" blocks (the latter being just a synonym
18686 for the former).  It would be worth to add that it handles footnotes in
18687 item tags and footnotes within footnotes.  It also handles booktabs,
18688 paralist types, automatic babel language selection with #+LANGUAGE: in
18689 addition to already present features (minted/listings package handling).
18691 ***** TODO Write LaTeX back-end
18692 **** Beamer Back-end
18693 The BEAMER export back-end deserves, IMO, its own section.
18695 ***** TODO Write Beamer back-end
18696 **** TexInfo Back-end
18697 > BTW, it would be great to have a texinfo exporter so the Org
18698 > documentation could be written in Org-mode :)
18700 There is one, albeit barely tested: (require 'org-e-texinfo).
18702 though texinfo back-end can export to DocBook
18704 ***** TODO Write texinfo backend
18705 *** Export dispatcher
18706 I think that the export dispatcher doesn't deserve its own section.  The
18707 introduction to Export subsystem can talk about "M-x
18708 org-export-dispatch" (bound to C-c C-e) instead.
18709 **** TODO Remove export dispatcher section
18711 *** Smart quotes
18712 There should be a section about smart-quotes too.
18714 **** TODO Add smart quotes section
18716 * Org-mode setup                                                   :noexport:
18717 ** Editing setup
18718 #+name: setup-editing
18719 #+header: :results silent
18720 #+header: :noweb yes
18721 #+header: :eval no-export
18722 #+begin_src emacs-lisp
18723 (require 'ox-texinfo)
18724 (define-key org-mode-map (kbd "C-c e") 'org-export-dispatch)
18725 (setq org-src-preserve-indentation t)
18726 (setq org-export-in-background t)
18727 (setq org-export-async-debug t)
18728 (setq org-export-async-init-file (expand-file-name "init.el"))
18729 (setq org-pretty-entities nil)
18730 (setq org-footnote-auto-adjust nil)
18731 (setq org-confirm-babel-evaluate nil)
18732 (org-babel-do-load-languages
18733  'org-babel-load-languages
18734  '((emacs-lisp . t)
18735    (sh . t)))
18736 (org-add-link-type
18737    "pxref" nil
18738    (lambda (path desc format)
18739      (cond
18740       ((eq format 'html)
18741        (format "<span class=\"pxref\">%s</span>" path))
18742       ((eq format 'latex)
18743        (format "\\ref{%s}" path))
18744       ((eq format 'texinfo)
18745        (format "@pxref{%s,%s}" path desc)))))
18746 (add-to-list 'org-export-snippet-translation-alist
18747              '("info" . "texinfo"))
18748 #+end_src
18750 ** init.el file
18751 This source code block requires paths to your Org mode installation.
18752 Modify accordingly.
18754 #+name: emacs-init
18755 #+header: :tangle init.el
18756 #+header: :results silent
18757 #+header: :eval no-export
18758 #+begin_src emacs-lisp
18759 (setq load-path (cons "~/.emacs.d/src/org-mode/lisp" load-path))
18760 ; (setq load-path (cons "~/.emacs.d/src/org-mode/contrib/lisp" load-path))
18761 (require 'ox-texinfo)
18762 (setq org-src-preserve-indentation t)
18763 (setq org-confirm-babel-evaluate nil)
18764 (setq org-footnote-auto-adjust nil)
18765 (org-babel-do-load-languages
18766  'org-babel-load-languages
18767  '((emacs-lisp . t)
18768    (makefile . t)
18769    (sh . t)))
18770 (add-to-list 'org-export-snippet-translation-alist
18771              '("info" . "texinfo"))
18772 #+end_src
18774 ** Texi -> Org helpers                                             :noexport:
18775 This section contains source code blocks that help translate from
18776 =texinfo= to =Org=.
18778 #+name: tsd-helpers
18779 #+header: :noweb yes
18780 #+header: :eval no-export
18781 #+begin_src emacs-lisp
18782 <<tsd-index-to-macro>>
18783 <<tsd-samp-to-macro>>
18784 <<tsd-kbdkey-to-macro>>
18785 <<tsd-kbd-to-macro>>
18786 <<tsd-key-to-macro>>
18787 <<tsd-command-to-macro>>
18788 <<tsd-file-to-macro>>
18789 <<tsd-noindent>>
18790 <<tsd-example-block-begin>>
18791 <<tsd-example-block-end>>
18792 <<tsd-table-begin>>
18793 <<tsd-table-end>>
18794 <<tsd-pxref>>
18795 <<tsd-xref>>
18796 <<tsd-ref>>
18797 <<tsd-orgcmd>>
18798 <<tsd-orgkey>>
18799 <<tsd-code-to-markup>>
18800 <<tsd-emph-to-markup>>
18801 <<tsd-i-to-markup>>
18802 <<tsd-lisp-begin>>
18803 <<tsd-lisp-end>>
18804 #+end_src
18806 #+results: tsd-helpers
18807 : tsd-lisp-end
18809 #+name: tsd-index-to-macro
18810 #+header: :results silent
18811 #+header: :eval no-export
18812 #+begin_src emacs-lisp
18813 (defun tsd-index-to-macro ()
18814   "Make macros out of @[cpfvk]index commands.  Doesn't handle commas."
18815   (interactive)
18816   (query-replace-regexp "@\\([cpfvk]\\)index\\ \\(.*\\)$" "{{{\\1index(\\2)}}}" nil))
18817 #+end_src
18819 #+name: tsd-samp-to-macro
18820 #+header: :results silent
18821 #+header: :eval no-export
18822 #+begin_src emacs-lisp
18823 (defun tsd-samp-to-macro ()
18824   "Make macros out of @samp commands."
18825   (interactive)
18826   (query-replace-regexp "@samp{\\([^}]*\\)}" "{{{samp(\\1)}}}" nil))
18827 #+end_src
18829 #+name: tsd-kbdkey-to-macro
18830 #+header: :results silent
18831 #+header: :eval no-export
18832 #+begin_src emacs-lisp
18833 (defun tsd-kbdkey-to-macro ()
18834   "Make macros out of @kbd,@key commands."
18835   (interactive)
18836   (query-replace-regexp "@kbd{\\([^@]*\\)@key{\\([^}]*\\)}}" "{{{kbdkey(\\1,\\2)}}}" nil))
18837 #+end_src
18839 #+name: tsd-kbd-to-macro
18840 #+header: :results silent
18841 #+header: :eval no-export
18842 #+begin_src emacs-lisp
18843 (defun tsd-kbd-to-macro ()
18844   "Make macros out of @kbd commands."
18845   (interactive)
18846   (query-replace-regexp "@kbd{\\([^}]*\\)}" "{{{kbd(\\1)}}}" nil))
18847 #+end_src
18849 #+name: tsd-key-to-macro
18850 #+header: :results silent
18851 #+header: :eval no-export
18852 #+begin_src emacs-lisp
18853 (defun tsd-key-to-macro ()
18854   "Make macros out of @key commands."
18855   (interactive)
18856   (query-replace-regexp "@key{\\([^}]*\\)}" "{{{key(\\1)}}}" nil))
18857 #+end_src
18859 #+name: tsd-command-to-macro
18860 #+header: :results silent
18861 #+header: :eval no-export
18862 #+begin_src emacs-lisp
18863 (defun tsd-command-to-macro ()
18864   "Make macros out of @command commands."
18865   (interactive)
18866   (query-replace-regexp "@command{\\([^}]*\\)}" "{{{command(\\1)}}}" nil))
18867 #+end_src
18869 #+name: tsd-file-to-macro
18870 #+header: :results silent
18871 #+header: :eval no-export
18872 #+begin_src emacs-lisp
18873 (defun tsd-file-to-macro ()
18874   "Make macros out of @file commands."
18875   (interactive)
18876   (query-replace-regexp "@file{\\([^}]*\\)}" "{{{file(\\1)}}}" nil))
18877 #+end_src
18879 #+name: tsd-noindent
18880 #+header: :results silent
18881 #+header: :eval no-export
18882 #+begin_src emacs-lisp
18883 (defun tsd-noindent ()
18884   "Make macros out of @noindent commands."
18885   (interactive)
18886   (query-replace "@noindent" "{{{noindent}}}" t))
18887 #+end_src
18889 #+name: tsd-example-block-begin
18890 #+header: :results silent
18891 #+header: :eval no-export
18892 #+begin_src emacs-lisp
18893 (defun tsd-example-block-begin ()
18894   "Convert example blocks."
18895   (interactive)
18896   (query-replace "@example" "#+begin_example" t))
18897 #+end_src
18899 #+name: tsd-example-block-end
18900 #+header: :results silent
18901 #+header: :eval no-export
18902 #+begin_src emacs-lisp
18903 (defun tsd-example-block-end ()
18904   "Convert example blocks."
18905   (interactive)
18906   (query-replace "@end example" "#+end_example" nil))
18907 #+end_src
18909 #+name: tsd-table-begin
18910 #+header: :results silent
18911 #+header: :eval no-export
18912 #+begin_src emacs-lisp
18913 (defun tsd-table-begin ()
18914   "Convert table blocks."
18915   (interactive)
18916   (query-replace-regexp "@table\\ \\([@a-z]*\\)" "#+attr_texinfo: :table-type table :indic \\1 t))
18917 #+end_src
18919 #+name: tsd-table-end
18920 #+header: :results silent
18921 #+header: :eval no-export
18922 #+begin_src emacs-lisp
18923 (defun tsd-table-end ()
18924   "Convert table blocks."
18925   (interactive)
18926   (query-replace "@end table" "" nil))
18927 #+end_src
18929 #+name: tsd-pxref
18930 #+header: :results silent
18931 #+header: :eval no-export
18932 #+begin_src emacs-lisp
18933 (defun tsd-pxref ()
18934   "Convert @pxref to links."
18935   (interactive)
18936   (query-replace-regexp "@pxref{\\([^}]*\\)}" "see \[\[\\1\]\]" nil))
18937 #+end_src
18939 #+name: tsd-xref
18940 #+header: :results silent
18941 #+header: :eval no-export
18942 #+begin_src emacs-lisp
18943 (defun tsd-xref ()
18944   "Convert @xref to links."
18945   (interactive)
18946   (query-replace-regexp "@xref{\\([^}]*\\)}" "See \[\[\\1\]\]" nil))
18947 #+end_src
18949 #+name: tsd-ref
18950 #+header: :results silent
18951 #+header: :eval no-export
18952 #+begin_src emacs-lisp
18953 (defun tsd-ref ()
18954   "Convert @ref to links."
18955   (interactive)
18956   (query-replace-regexp "@ref{\\([^}]*\\)}" "\[\[\\1\]\]" nil))
18957 #+end_src
18959 #+name: tsd-orgcmd
18960 #+header: :results silent
18961 #+header: :eval no-export
18962 #+begin_src emacs-lisp
18963 (defun tsd-orgcmd ()
18964   "Convert @orgcmd to list entry."
18965   (interactive)
18966   (query-replace-regexp "@orgcmd{\\([^,]*\\),\\([^}]*\\)}" "- {{{kbd(\\1)}}}, ~\\2~ ::" nil))
18967 #+end_src
18969 #+name: tsd-orgkey
18970 #+header: :results silent
18971 #+header: :eval no-export
18972 #+begin_src emacs-lisp
18973 (defun tsd-orgkey ()
18974   "Convert @orgkey to list entry."
18975   (interactive)
18976   (query-replace-regexp "@orgkey{\\([^}]*\\)}" "- {{{kbd(\\1)}}} ::" nil))
18977 #+end_src
18979 #+name: tsd-code-to-markup
18980 #+header: :results silent
18981 #+header: :eval no-export
18982 #+begin_src emacs-lisp
18983 (defun tsd-code-to-markup ()
18984   "Convert @code to markup."
18985   (interactive)
18986   (query-replace-regexp "@code{\\([^}]*\\)}" "~\\1~" nil))
18987 #+end_src
18989 #+name: tsd-emph-to-markup
18990 #+header: :results silent
18991 #+header: :eval no-export
18992 #+begin_src emacs-lisp
18993 (defun tsd-emph-to-markup ()
18994   "Convert @emph to markup."
18995   (interactive)
18996   (query-replace-regexp "@emph{\\([^}]*\\)}" "/\\1/" nil))
18997 #+end_src
18999 #+name: tsd-i-to-markup
19000 #+header: :results silent
19001 #+header: :eval no-export
19002 #+begin_src emacs-lisp
19003 (defun tsd-i-to-markup ()
19004   "Convert @i to markup."
19005   (interactive)
19006   (query-replace-regexp "@i{\\([^}]*\\)}" "/\\1/" nil))
19007 #+end_src
19009 #+name: tsd-b-to-markup
19010 #+header: :results silent
19011 #+header: :eval no-export
19012 #+begin_src emacs-lisp
19013 (defun tsd-b-to-markup ()
19014   "Convert @b to markup."
19015   (interactive)
19016   (query-replace-regexp "@b{\\([^}]*\\)}" "*\\1*" nil))
19017 #+end_src
19019 #+name: tsd-lisp-begin
19020 #+header: :results silent
19021 #+header: :eval no-export
19022 #+begin_src emacs-lisp
19023 (defun tsd-lisp-begin ()
19024   "Convert @lisp blocks."
19025   (interactive)
19026   (query-replace "@lisp" "#+begin_src emacs-lisp" t))
19027 #+end_src
19029 #+name: tsd-lisp-end
19030 #+header: :results silent
19031 #+header: :eval no-export
19032 #+begin_src emacs-lisp
19033 (defun tsd-lisp-end ()
19034   "Convert @lisp blocks."
19035   (interactive)
19036   (query-replace "@end lisp" "#+end_src" nil))
19037 #+end_src
19039 * Footnotes
19041 [fn:1] The iCalendar file will contain TODO and agenda items only.
19043 [fn:2] If your Emacs distribution does not come with Org,
19044 the function ~org-version~ will not be defined.
19046 [fn:3] The ~master~ branch is where development takes place.
19048 [fn:4] The output from install-info (if any) is system dependent.  In
19049 particular, Debian and its derivatives use two different versions of
19050 install-info.  You may safely ignore the message:
19051 #+begin_example
19052    This is not dpkg install-info anymore, but GNU install-info
19053    See the man page for ginstall-info for command line arguments
19054 #+end_example
19055 returned by install-info.
19057 [fn:5] If you don't use font-lock globally, turn it on in an Org
19058 buffer with ~(add-hook 'org-mode-hook 'turn-on-font-lock)~.
19060 [fn:6] Please consider subscribing to the mailing list in order to
19061 minimize the work the mailing list moderators have to do.
19063 [fn:7] Easy templates insert lowercase keywords and Babel dynamically
19064 inserts ~#+results~.
19066 [fn:8] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
19067 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
19068 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines.  Note
19069 also that clocking only works with headings indented less than 30
19070 stars.
19072 [fn:9] See the option ~org-cycle-global-at-bob~.
19074 [fn:10] The indirect buffer will contain the entire buffer, but will
19075 be narrowed to the current tree.  Editing the indirect buffer will also
19076 change the original buffer, but without affecting visibility in that
19077 buffer.  For more information about indirect buffers,
19078 [[info:emacs:Indirect Buffers][GNU Emacs Manual]].
19080 [fn:11] If you do not want the line to be split, customize the
19081 variable ~org-M-RET-may-split-line~.
19083 [fn:12] See also the variables ~org-show-hierarchy-above~,
19084 ~org-show-following-heading~, ~org-show-siblings~, and
19085 ~org-show-entry-below~ for detailed control on how much context is
19086 shown around each match.
19088 [fn:13] This depends on the option ~org-remove-highlights-with-change~.
19090 [fn:14] This does not work under XEmacs, because XEmacs uses selective
19091 display for outlining, not text properties.
19093 [fn:15] When using ~*~ as a bullet, lines must be indented or they will
19094 be seen as top-level headlines.  Also, when you are hiding leading
19095 stars to get a clean outline view, plain list items starting with a
19096 star may be hard to distinguish from true headlines.  In short: even
19097 though ~*~ is supported, it may be better to not use it for plain list
19098 items.
19100 [fn:16] You can filter out any of them by configuring
19101 ~org-plain-list-ordered-item-terminator~.
19103 [fn:17] If there's a checkbox in the item, the cookie must be put
19104 _before_ the checkbox.  If you have activated alphabetical lists, you
19105 can also use counters like ~[@b]~.
19107 [fn:18] Org only changes the filling settings for Emacs.  For XEmacs,
19108 you should use Kyle E.  Jones' {{{file(filladapt.el)}}}.
19110 [fn:19] If you do not want the item to be split, customize the
19111 variable ~org-M-RET-may-split-line~.
19113 [fn:20] If you want to cycle around items that way, you may customize
19114 ~org-list-use-circular-motion~.
19116 [fn:21] See ~org-list-use-circular-motion~ for a cyclic behavior.
19118 [fn:24] Centering does not work inside Emacs, but it does have an
19119 effect when exporting to HTML.
19121 [fn:26] For backward compatibility you can also use special names like
19122 ~$LR5~ and ~$LR12~ to refer in a stable way to the fifth and twelfth
19123 field in the last row of the table.  However, this syntax is
19124 deprecated, it should not be used for new documents.  Use ~@>$~
19125 instead.
19127 [fn:25] Org will understand references typed by the user as
19128 {{{samp(B4)}}}, but it will not use this syntax when offering a
19129 formula for editing.  You can customize this behavior using the
19130 variable ~org-table-use-standard-references~.
19132 [fn:22] To insert a vertical bar into a table field, use ~\vert~ or,
19133 inside a word ~abc\vert{}def~.
19135 [fn:23] This feature does not work on XEmacs.
19137 [fn:27] The computation time scales as O(N^2) because table FOO is
19138 parsed for each field to be copied.
19140 [fn:28] The {{{file(calc)}}} package has the non-standard
19141 convention that ~/~ has lower precedence than ~*~, so that ~a/b*c~ is
19142 interpreted as ~a/(b*c)~.
19144 [fn:29] The ~printf~ reformatting is limited in precision because the
19145 value passed to it is converted into an ~integer~ or ~double~.  The
19146 ~integer~ is limited in size by truncating the signed value to 32
19147 bits.  The ~double~ is limited in precision to 64 bits overall which
19148 leaves approximately 16 significant decimal digits.
19150 [fn:30] Such names must start with an alphabetic character and use
19151 only alphanumeric/underscore characters.
19153 [fn:31] Note that text before the first headline is usually not
19154 exported, so the first such target should be after the first headline,
19155 or in the line directly before the first headline.
19157 [fn:32] To insert a link targeting a headline, in-buffer completion
19158 can be used.  Just type a star followed by a few optional letters into
19159 the buffer and press {{{kbdkey(M-,TAB)}}}.  All headlines in the
19160 current buffer will be offered as completions.
19162 [fn:33] The actual behavior of the search will depend on the value of
19163 the variable ~org-link-search-must-match-exact-headline~.  If its value
19164 is ~nil~, then a fuzzy text search will be done.  If it is ~t~, then
19165 only the exact headline will be matched.  If the value is
19166 {{{samp('query-to-create)}}}, then an exact headline will be searched;
19167 if it is not found, then the user will be queried to create it.
19169 [fn:34] If the headline contains a timestamp, it will be removed from
19170 the link and result in a wrong link -- you should avoid putting a
19171 timestamp in the headline.
19173 [fn:35] Note that you don't have to use this command to insert a link.
19174 Links in Org are plain text, and you can type or paste them straight
19175 into the buffer.  By using this command, the links are automatically
19176 enclosed in double brackets, and you will be asked for the optional
19177 descriptive text.
19179 [fn:36] After insertion of a stored link, the link will be removed
19180 from the list of stored links.  To keep it in the list later use, use a
19181 triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
19182 configure the option ~org-keep-stored-link-after-insertion~.
19184 [fn:37] This works by calling a special function
19185 ~org-PREFIX-complete-link~.
19187 [fn:38] See the variable ~org-display-internal-link-with-indirect-buffer~.
19189 [fn:44] Check also the variable ~org-fast-tag-selection-include-todo~,
19190 it allows you to change the TODO state through the tags interface
19191 ([[Setting tags]]), in case you like to mingle the two concepts.  Note that
19192 this means you need to come up with unique keys across both sets of
19193 keywords.
19195 [fn:39] For backward compatibility, line numbers can also follow a
19196 single colon.
19198 [fn:40] Of course, you can make a document that contains only long
19199 lists of TODO items, but this is not required.
19201 [fn:41] Changing the variable ~org-todo-keywords~ only becomes
19202 effective after restarting Org mode in a buffer.
19204 [fn:42] This is also true for the {{{kbd(t)}}} command in the timeline
19205 and agenda buffers.
19207 [fn:43] All characters are allowed except ~@^!~, which have a special
19208 meaning here.
19210 [fn:45] Org mode parses these lines only when Org mode is activated
19211 after visiting a file.  {{{kbd(C-c C-c)}}} with the cursor in a line
19212 starting with {{{samp(#+)}}} is simply restarting Org mode for the
19213 current buffer.
19215 [fn:46] The corresponding in-buffer setting is: ~#+STARTUP: logdone~.
19217 [fn:47] The corresponding in-buffer setting is: ~#+STARTUP: lognotedone~.
19219 [fn:48] See the variable ~org-log-states-order-reversed~.
19221 [fn:54] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
19222 checkbox will add checkboxes to the rest of the list.
19224 [fn:49] It is possible that Org mode will record two timestamps when
19225 you are using both ~org-log-done~ and state change logging.  However,
19226 it will never prompt for two notes---if you have configured both, the
19227 state change recording note will take precedence and cancel the
19228 {{{samp(Closing Note)}}}.
19230 [fn:50] See also the option ~org-priority-start-cycle-with-default~.
19232 [fn:51] To keep subtasks out of the global TODO list, see the
19233 ~org-agenda-todo-list-sublevels~.
19235 [fn:52] With the exception of description lists.  But you can allow it
19236 by modifying ~org-list-automatic-rules~ accordingly.
19238 [fn:53] Set the variable ~org-hierarchical-checkbox-statistics~ if you
19239 want such cookies to count all checkboxes below the cookie, not just
19240 those belonging to direct children.
19242 [fn:55] As with all these in-buffer settings, pressing 
19243 {{{kbd(C-c C-c)}}} activates any changes in the line.
19245 [fn:56] This is only true if the search does not involve more complex
19246 tests including properties (see [[Property searches]]).
19248 [fn:57] Keys will automatically be assigned to tags that have no
19249 configured keys.
19251 [fn:58] Please note that the COLUMNS definition must be on a single
19252 line---it is wrapped here only because of formatting constraints.
19254 [fn:59] Contributed packages are not part of Emacs, but are
19255 distributed with the main distribution of Org (visit
19256 [[http://orgmode.org]]).
19258 [fn:60] The Org date format is inspired by the standard ISO 8601
19259 date/time format.  To use an alternative format, see [[Custom time
19260 format]].  The day name is optional when you type the date yourself.
19261 However, any dates inserted or modified by Org will add that day name,
19262 for reading convenience.
19264 [fn:61] When working with the standard diary sexp functions, you need
19265 to be very careful with the order of the arguments.  That order depends
19266 evilly on the variable ~calendar-date-style~ (or, for older Emacs
19267 versions, ~european-calendar-style~).  For example, to specify a date
19268 December 12, 2005, the call might look like ~(diary-date 12 1 2005)~
19269 or ~(diary-date 1 12 2005)~ or ~(diary-date 2005 12 1)~, depending on
19270 the settings.  This has been the source of much confusion.  Org mode
19271 users can resort to special versions of these functions like
19272 ~org-date~ or ~org-anniversary~.  These work just like the
19273 corresponding ~diary-~ functions, but with stable ISO order of
19274 arguments (year, month, day) wherever applicable, independent of the
19275 value of ~calendar-date-style~.
19277 [fn:62] See the variable ~org-read-date-prefer-future~.  You may
19278 set that variable to the symbol ~time~ to even make a time before now
19279 shift the date to tomorrow.
19281 [fn:63] If you don't need/want the calendar, configure the variable
19282 ~org-popup-calendar-for-date-prompt~.
19284 [fn:64] If you find this distracting, turn off the display with
19285 ~org-read-date-display-live~.
19287 [fn:65] It will still be listed on that date after it has been marked
19288 DONE.  If you don't like this, set the variable
19289 ~org-agenda-skip-scheduled-if-done~.
19291 [fn:66] The {{{samp(SCHEDULED)}}} and {{{samp(DEADLINE)}}} dates are
19292 inserted on the line right below the headline.  Don't put any text
19293 between this line and the headline.
19295 [fn:67] Note the corresponding ~#+STARTUP~ keywords ~logredeadline~,
19296 ~lognoteredeadline~, and ~nologredeadline~.
19298 [fn:68] Note the corresponding ~#+STARTUP~ keywords ~logreschedule~,
19299 ~lognotereschedule~, and ~nologreschedule~.
19301 [fn:69] In fact, the target state is taken from, in this sequence, the
19302 ~REPEAT_TO_STATE~ property or the variable ~org-todo-repeat-to-state~.
19303 If neither of these is specified, the target state defaults to the
19304 first state of the TODO state sequence.
19306 [fn:70] You can change this using the option ~org-log-repeat~, or the
19307 ~#+STARTUP~ options ~logrepeat~, ~lognoterepeat~, and ~nologrepeat~.
19308 With ~lognoterepeat~, you will also be prompted for a note.
19310 [fn:71] Clocking only works if all headings are indented with less
19311 than 30 stars.  This is a hardcoded limitation of ~lmax~ in
19312 ~org-clock-sum~.
19314 [fn:72] To resume the clock under the assumption that you have worked
19315 on this task while outside Emacs, use ~(setq org-clock-persist t)~.
19317 [fn:73] To add an effort estimate ``on the fly'', hook a function
19318 doing this to ~org-clock-in-prepare-hook~.
19320 [fn:74] The last reset of the task is recorded by the ~LAST_REPEAT~
19321 property.
19323 [fn:75] See also the variable ~org-clock-modeline-total~.
19325 [fn:76] The corresponding in-buffer setting is: 
19326 ~#+STARTUP: lognoteclock-out~.
19328 [fn:77] Language terms can be set through the variable
19329 ~org-clock-clocktable-language-setup~.
19331 [fn:78] Note that all parameters must be specified in a single
19332 line---the line is broken here only to fit it into the manual.
19334 [fn:79] On computers using Mac OS X, idleness is based on actual user
19335 idleness, not just Emacs' idle time.  For X11, you can install a
19336 utility program {{{file(x11idle.c)}}}, available in the
19337 ~contrib/scripts~ directory of the Org git distribution, to get the
19338 same general treatment of idleness.  On other systems, idle time refers
19339 to Emacs idle time only.
19341 [fn:80] You may change the property being used with the variable
19342 ~org-effort-property~.
19344 [fn:86] Note the corresponding ~#+STARTUP~ keywords ~logrefile~,
19345 ~lognoterefile~, and ~nologrefile~.
19347 [fn:81] Please select your own key, {{{kbd(C-c c)}}} is only a
19348 suggestion.
19350 [fn:82] If you need one of these sequences literally, escape the
19351 {{{kbd(%)}}} with a backslash.
19353 [fn:83] If you define your own link types (see [[Adding hyperlink
19354 types]]), any property you store with ~org-store-link-props~ can be
19355 accessed in capture templates in a similar way.
19357 [fn:84] This will always be the other, not the user.  See the variable
19358 ~org-from-is-user-regexp~.
19360 [fn:85] If you move entries or Org files from one directory to
19361 another, you may want to configure ~org-attach-directory~ to contain
19362 an absolute path.
19364 [fn:87] For backward compatibility, the following also works: If there
19365 are several such lines in a file, each specifies the archive location
19366 for the text below it.  The first such line also applies to any text
19367 before its definition.  However, using this method is /strongly/
19368 deprecated as it is incompatible with the outline structure of the
19369 document.  The correct method for setting multiple archive locations in
19370 a buffer is using properties.
19372 [fn:94] Only tags filtering will be respected here, effort filtering
19373 is ignored.
19375 [fn:88] When using the dispatcher, pressing {{{kbd(<)}}} before
19376 selecting a command will actually limit the command to the current
19377 file, and ignore ~org-agenda-files~ until the next dispatcher command.
19379 [fn:89] For backward compatibility, you can also press {{{kbd(1)}}} to
19380 restrict to the current buffer.
19382 [fn:90] For backward compatibility, you can also press {{{kbd(0)}}} to
19383 restrict to the current region/subtree.
19385 [fn:91] For backward compatibility, the universal prefix
19386 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
19387 This feature is deprecated, use the dedicated TODO list, or a block
19388 agenda instead (see [[Block agenda]]).
19390 [fn:92] But see [[x-agenda-skip-entry-regexp][skipping entries based on regexp]].
19392 [fn:93] For backward compatibility, the following also works: if
19393 there are several such lines in a file, each specifies the category
19394 for the text below it.  The first category also applies to any text
19395 before the first CATEGORY line.  However, using this method is
19396 /strongly/ deprecated as it is incompatible with the outline structure
19397 of the document.  The correct method for setting multiple categories in
19398 a buffer is using a property.
19400 [fn:95] Custom commands can preset a filter by binding the variable
19401 ~org-agenda-tag-filter-preset~ as an option.  This filter will then be
19402 applied to the view and persist as a basic filter through refreshes
19403 and more secondary filtering.  The filter is a global property of the
19404 entire agenda view---in a block agenda, you should only set this in
19405 the global options section, not in the section of an individual block.
19407 [fn:96] You can also create persistent custom functions through
19408 ~org-agenda-bulk-custom-functions~.
19410 [fn:97] The Emacs diary file is parsed for the agenda when
19411 ~org-agenda-include-diary~ is set.
19413 [fn:98] You can provide a description for a prefix key by inserting a
19414 cons cell with the prefix and the description.
19416 [fn:99] For HTML you need to install Hrvoje Niksic's
19417 {{{file(htmlize.el)}}}.  To create PDF output, the ghostscript
19418 {{{file(ps2pdf)}}} utility must be installed on the system.  Selecting
19419 a PDF file will also create the postscript file.
19421 [fn:100] If you want to store standard views like the weekly agenda or
19422 the global TODO list as well, you need to define custom commands for
19423 them in order to be able to specify file names.
19425 [fn:101] Quoting depends on the system you use, please check the FAQ
19426 for examples.
19428 [fn:102] This works automatically for the HTML backend (it requires
19429 version 1.34 of the {{{file(htmlize.el)}}} package, which is
19430 distributed with Org).  Fontified code chunks in LaTeX can be
19431 achieved using either the listings package or the [[http://code.google.com/p/minted][minted]] package.
19432 Refer to ~org-export-latex-listings~ documentation for details.
19434 [fn:103] Code in {{{samp(src)}}} blocks may also be evaluated either
19435 interactively or on export.  See [[Working with source code]] for more
19436 information on evaluating code blocks.
19438 [fn:104] Adding ~-k~ to ~-n -r~ will /keep/ the labels in the source
19439 code while using line numbers for the links, which might be useful to
19440 explain those in an Org mode example code.
19442 [fn:105] Upon exit, lines starting with {{{samp(*)}}}, {{{samp(\,*)}}},
19443 {{{samp(#+)}}} and {{{samp(\,#+)}}} will get a comma prepended, to keep
19444 them from being interpreted by Org as outline nodes or special syntax.
19445 These commas will be stripped for editing with {{{kbd(C-c ')}}}, and
19446 also for export.
19448 [fn:106] You may select a different-mode with the variable
19449 ~org-edit-fixed-width-region-mode~.
19451 [fn:107] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
19452 system.  Many of the features described here as LaTeX are really
19453 from TeX, but for simplicity I am blurring this distinction.
19455 [fn:108] You can turn this on by default by setting the variable
19456 ~org-pretty-entities~, or on a per-file base with the ~#+STARTUP~
19457 option ~entitiespretty~.
19459 [fn:109] If you plan to use this regularly or on pages with
19460 significant page views, you should install {{{file(MathJax)}}} on your
19461 own server in order to limit the load of our server.
19463 [fn:110] For this to work you need to be on a system with a working
19464 LaTeX installation.  You also need the {{{file(dvipng)}}} program or
19465 the {{{file(convert)}}}, respectively available at
19466 [[http://sourceforge.net/projects/dvipng/]] and from the
19467 {{{file(ImageMagick)}}} suite.  The LaTeX header that will be used
19468 when processing a fragment can be configured with the variable
19469 ~org-format-latex-header~.
19471 [fn:111] When {{{file(MathJax)}}} is used, only the environment
19472 recognized by {{{file(MathJax)}}} will be processed.  When
19473 {{{file(dvipng)}}} is used to create images, any LaTeX environments
19474 will be handled.
19476 [fn:112] Org mode has a method to test if the cursor is inside such a
19477 fragment, see the documentation of the function
19478 ~org-inside-LaTeX-fragment-p~.
19480 [fn:113] The variable ~org-export-date-timestamp-format~ defines how
19481 this timestamp will be exported.
19483 [fn:114] If you want to configure many options this way, you can use
19484 several ~#+OPTIONS~ lines.
19486 [fn:115] To make this behavior the default, customize the variable
19487 ~org-export-run-in-background~.
19489 [fn:116] This requires ~transient-mark-mode~ be turned on.
19491 [fn:117] To select the current subtree, use {{{kbd(C-c @)}}}.
19493 [fn:118] This requires ~transient-mark-mode~ be turned on.
19495 [fn:119] To select the current subtree, use {{{kbd(C-c @)}}}.
19497 [fn:120] But see the variable ~org-export-html-inline-images~.
19499 [fn:121] If you plan to use this regularly or on pages with
19500 significant page views, you should install MathJax on your own server
19501 in order to limit the load of our server.  Installation instructions
19502 can be found on the MathJax website, see
19503 [[http://www.mathjax.org/resources/docs/?installation.html]].
19505 [fn:122] If the classes on TODO keywords and tags lead to conflicts,
19506 use the variables ~org-export-html-todo-kwd-class-prefix~ and
19507 ~org-export-html-tag-class-prefix~ to make them unique.
19509 [fn:123] This style is defined in the constant
19510 ~org-export-html-style-default~, which you should not modify.  To turn
19511 inclusion of these defaults off, customize
19512 ~org-export-html-style-include-default~.
19514 [fn:124] The default LaTeX output is designed for processing with
19515 ~pdftex~ or LaTeX.  It includes packages that are not compatible
19516 with ~xetex~ and possibly ~luatex~.  See the variables
19517 ~org-export-latex-default-packages-alist~ and
19518 ~org-export-latex-packages-alist~.
19520 [fn:125] This requires ~transient-mark-mode~ be turned on.
19522 [fn:126] To select the current subtree, use {{{kbd(C-c @)}}}.
19524 [fn:127] Into which the values of
19525 ~org-export-latex-default-packages-alist~ and
19526 ~org-export-latex-packages-alist~ are spliced.
19528 [fn:128] One can also take advantage of this option to pass other,
19529 unrelated options into the figure or table environment.  For an example
19530 see the section ``Exporting org files'' in
19531 [[http://orgmode.org/worg/org-hacks.html]].
19533 [fn:129] This requires ~transient-mark-mode~ to be turned on.
19535 [fn:130] To select the current subtree, use {{{kbd(C-c @)}}}.
19537 [fn:131] ODT export was added in Org mode version 7.8.
19539 [fn:132] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications (OpenDocument)
19540 Version 1.2]].
19542 [fn:133] This requires ~transient-mark-mode~ to be turned on.
19544 [fn:134] To select the current subtree, use {{{kbd(C-c @)}}}.
19546 [fn:135] The column widths are interpreted as weighted ratios with the
19547 default weight being 1.
19549 [fn:136] Use of {{{file(ImageMagick)}}} is only desirable.  However, if
19550 you routinely produce documents that have large images or you export
19551 your Org files that has images using a Emacs batch script, then the
19552 use of {{{file(ImageMagick)}}} is mandatory.
19554 [fn:137] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
19556 [fn:138] Your {{{file(htmlfontify.el)}}} library must at least be at
19557 Emacs 24.1 levels for fontification to be turned on.
19559 [fn:139] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]].
19561 [fn:140] See the ~<table:table-template>~ element of the
19562 OpenDocument-v1.2 specification.
19564 [fn:141] See the attributes ~table:template-name~,
19565 ~table:use-first-row-styles~, ~table:use-last-row-styles~,
19566 ~table:use-first-column-styles~, ~table:use-last-column-styles~,
19567 ~table:use-banding-rows-styles~, and ~table:use-banding-column-styles~
19568 of the ~<table:table>~ element in the OpenDocument-v1.2 specification.
19570 [fn:142] Note that {{{file(.odt)}}} files are {{{samp(zip)}}}
19571 archives.
19573 [fn:143] See the variables ~org-icalendar-use-deadline~ and
19574 ~org-icalendar-use-scheduled~.
19576 [fn:144] To add inherited tags or the TODO state, configure the
19577 variable ~org-icalendar-categories~.
19579 [fn:145] The LOCATION property can be inherited from higher in the
19580 hierarchy if you configure ~org-use-property-inheritance~ accordingly.
19582 [fn:146] The files {{{file(file-source.org)}}} and
19583 {{{file(file-source.org.html)}}} if source and publishing directories
19584 are equal.  Note that with this kind of setup, you need to add
19585 ~:exclude "-source\\.org"~ to the project definition in
19586 ~org-publish-project-alist~ to prevent the published source files from
19587 being considered as new org files the next time the project is
19588 published.
19590 [fn:147] Note that {{{samp(src)}}} blocks may be inserted using Org
19591 mode's [[Easy templates]] system.
19593 [fn:148] Whenever code is evaluated there is a potential for that code
19594 to do harm.  Org mode provides safeguards to ensure that code is only
19595 evaluated after explicit confirmation from the user.  For information
19596 on these safeguards (and on how to disable them) see [[Code evaluation
19597 security]].
19599 [fn:149] The ~org-babel-no-eval-on-ctrl-c-ctrl-c~ variable can be used
19600 to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
19602 [fn:150] Note that evaluation of header arguments is guaranteed to
19603 take place in the original Org mode file, while there is no such
19604 guarantee for evaluation of the code block body.
19606 [fn:151] The example requires that property inheritance be turned on
19607 for the ~noweb-ref~ property, see [[Property inheritance]].
19609 [fn:152] In certain languages this also contains the error output
19610 stream; this is an area for future work.
19612 [fn:153] The last evaluation performed by the interpreter is obtained
19613 in a language-specific manner: the value of the variable ~_~ in Python
19614 and Ruby, and the value of ~.Last.value~ in R.
19616 [fn:161] If the {{{samp(#+TBLFM)}}} line contains an odd number of
19617 dollar characters, this may cause problems with font-lock in LaTeX
19618 mode.  As shown in the example you can fix this by adding an extra line
19619 inside the ~comment~ environment that is used to balance the dollar
19620 expressions.  If you are using AUCTeX with the font-latex library, a
19621 much better solution is to add the ~comment~ environment to the
19622 variable ~LaTeX-verbatim-environments~.
19624 [fn:162] The HTML translator uses the same code that produces tables
19625 during HTML export.
19627 [fn:154] Note that ~org-indent-mode~ also sets the ~wrap-prefix~
19628 property, such that ~visual-line-mode~ (or purely setting ~word-wrap~)
19629 wraps long lines (including headlines) correctly indented.
19631 [fn:155] See the variable ~org-indent-indentation-per-level~.
19633 [fn:156] Turning on ~org-indent-mode~ sets ~org-hide-leading-stars~ to
19634 ~t~ and ~org-adapt-indentation~ to ~nil~.
19636 [fn:157] See also the variable ~org-adapt-indentation~.
19638 [fn:158] When you need to specify a level for a property search or
19639 refile targets, ~LEVEL=2~ will correspond to 3 stars, etc.
19641 [fn:159] The {{{file(org-R.el)}}} package has been replaced by the
19642 Org mode functionality described in [[Working with source code]] and is
19643 now obsolete.
19645 [fn:160] By default this works only for LaTeX, HTML, and Texinfo.
19646 Configure the variable ~orgtbl-radio-tables~ to install templates for
19647 other modes.
19649 [fn:163] Note that, when using ~org-odd-levels-only~, a level number
19650 corresponds to order in the hierarchy, not to the number of stars.
19652 [fn:164] If you can safely store the password in your Emacs setup, you
19653 might also want to configure `org-mobile-encryption-password'.  Please
19654 read the docstring of that variable.  Note that encryption will apply
19655 only to the contents of the `.org' files.  The file names themselves
19656 will remain visible.
19658 [fn:165] If you cannot use Dropbox, or if your version of MobileOrg
19659 does not support it, you can use a webdav server.  For more
19660 information, check out the documentation of MobileOrg and also this
19661 [[http://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
19663 [fn:166] While creating the agendas, Org mode will force ID properties
19664 on all referenced entries, so that these entries can be uniquely
19665 identified if /MobileOrg/ flags them for further action.  If you do not
19666 want to get these properties in so many entries, you can set the
19667 variable ~org-mobile-force-id-on-agenda-items~ to ~nil~.  Org mode will
19668 then rely on outline paths, in the hope that these will be unique
19669 enough.
19671 [fn:167] Checksums are stored automatically in the file
19672 {{{file(checksums.dat)}}}.
19674 [fn:168] The file {{{file(mobileorg.org)}}} will be empty after this
19675 operation.
19677 [fn:169] Note, however, that there is a subtle difference.  The view
19678 created automatically by {{{kbdspckey(M-x org-mobile-pull,RET)}}} is
19679 guaranteed to search all files that have been addressed by the last
19680 pull.  This might include a file that is not currently in your list of
19681 agenda files.  If you later use {{{kbd(C-c a ?)}}} to regenerate the
19682 view, only the current agenda files will be searched.
19684 [fn:170] You can also get `a.', `A.', `a)' and `A)' by configuring
19685 `org-alphabetical-lists'.  To minimize confusion with normal text,
19686 those are limited to one character only.  Beyond that limit, bullets
19687 will automatically fallback to numbers.
19689 [fn:171] See also ~org-empty-line-terminates-plain-lists~.
19691 [fn:172] You can define additional drawers on a per-file basis with a
19692 line like ~#+DRAWERS: HIDDEN STATE~.
19694 [fn:173] The corresponding in-buffer setting is: ~#+STARTUP: fninline~ or
19695 ~#+STARTUP: nofninline~.
19697 [fn:174] The corresponding in-buffer options are ~#+STARTUP: fnadjust~ and
19698 ~#+STARTUP: nofnadjust~.
19700 [fn:175] The file {{{file(constants.el)}}} can supply the values of constants in two
19701 different unit systems, ~SI~ and ~cgs~.  Which one is used depends on
19702 the value of the variable ~constants-unit-system~.  You can use the
19703 ~#+STARTUP:~ options ~constSI~ and ~constcgs~ to set this value for the
19704 current buffer.
19706 [fn:176] The library {{{file(org-id)}}} must first be loaded, either through
19707 ~org-customize~ by enabling ~id~ in ~org-modules~, or by adding
19708 ~(require 'org-id)~ in your {{{file(.emacs)}}}.
19710 [fn:177] The variable ~org-startup-with-inline-images~ can be set
19711 within a buffer with the ~#+STARTUP:~ keywords ~inlineimages~ and
19712 ~noinlineimages~.
19714 [fn:178] Note that the ~LOGBOOK~ drawer is unfolded when pressing
19715 {{{key(SPC)}}} in the agenda to show an entry---use
19716 {{{kbdspckey(C-u,SPC)}}} to keep it folded here.
19718 [fn:179] Please note the pitfalls of summing hierarchical data in a flat
19719 list ([[Agenda column view]]).
19721 [fn:180] If the value of that variable is not a list, but a single file
19722 name, then the list of agenda files will be maintained in that external
19723 file.
19725 [fn:181] The variable ~org-anniversary~ used in the example
19726 is just like ~diary-anniversary~, but the argument order is
19727 always according to ISO and therefore independent of the value of
19728 ~calendar-date-style~.
19730 [fn:182] Emacs 23 and Org mode 6.29 are required.
19732 [fn:183] Emacs 23.1 can actually crash with ~org-indent-mode~.
19734 [fn:184] Symbolic links in ~org-directory~ need to have the same name
19735 as their targets.
19738 # Local Variables:
19739 # sentence-end-double-space: t
19740 # End: