dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

org-manual.org (801751B)


      1 #+title: The Org Manual
      2 #+subtitle:  Release {{{version}}}
      3 #+author:    The Org Mode Developers
      4 #+language:  en
      5 
      6 
      7 #+texinfo: @insertcopying
      8 
      9 * Introduction
     10 :PROPERTIES:
     11 :DESCRIPTION: Getting started.
     12 :END:
     13 #+cindex: introduction
     14 
     15 ** Summary
     16 :PROPERTIES:
     17 :DESCRIPTION: Brief summary of what Org does.
     18 :END:
     19 #+cindex: summary
     20 
     21 Org is a mode for keeping notes, maintaining TODO lists, and project
     22 planning with a fast and effective plain-text markup language.  It
     23 also is an authoring system with unique support for literate
     24 programming and reproducible research.
     25 
     26 Org is implemented on top of Outline mode, which makes it possible to
     27 keep the content of large files well structured.  Visibility cycling
     28 and structure editing help to work with the tree.  Tables are easily
     29 created with a built-in table editor.  Plain text URL-like links
     30 connect to websites, emails, Usenet messages, BBDB entries, and any
     31 files related to the projects.
     32 
     33 Org develops organizational tasks around notes files that contain
     34 lists or information about projects as plain text.  Project planning
     35 and task management make use of metadata which is part of an outline
     36 node.  Based on this data, specific entries can be extracted in
     37 queries and create dynamic /agenda views/ that also integrate the
     38 Emacs calendar and diary.  Org can be used to implement many different
     39 project planning schemes, such as David Allen's GTD system.
     40 
     41 Org files can serve as a single source authoring system with export to
     42 many different formats such as HTML, LaTeX, Open Document, and
     43 Markdown.  New export backends can be derived from existing ones, or
     44 defined from scratch.
     45 
     46 Org files can include source code blocks, which makes Org uniquely
     47 suited for authoring technical documents with code examples.  Org
     48 source code blocks are fully functional; they can be evaluated in
     49 place and their results can be captured in the file.  This makes it
     50 possible to create a single file reproducible research compendium.
     51 
     52 Org keeps simple things simple.  When first fired up, it should feel
     53 like a straightforward, easy to use outliner.  Complexity is not
     54 imposed, but a large amount of functionality is available when needed.
     55 Org is a toolbox.  Many users actually run only a---very
     56 personal---fraction of Org's capabilities, and know that there is more
     57 whenever they need it.
     58 
     59 All of this is achieved with strictly plain text files, the most
     60 portable and future-proof file format.  Org runs in Emacs.  Emacs is
     61 one of the most widely ported programs, so that Org mode is available
     62 on every major platform.
     63 
     64 #+cindex: FAQ
     65 There is a website for Org which provides links to the newest version
     66 of Org, as well as additional information, frequently asked questions
     67 (FAQ), links to tutorials, etc.  This page is located at
     68 [[https://orgmode.org]].
     69 
     70 #+cindex: print edition
     71 An earlier version (7.3) of this manual is available as a [[http://www.network-theory.co.uk/org/manual/][paperback
     72 book from Network Theory Ltd.]].
     73 
     74 ** Installation
     75 :PROPERTIES:
     76 :DESCRIPTION: Installing Org.
     77 :END:
     78 #+cindex: installation
     79 
     80 Org is included in all recent distributions of GNU Emacs, so you
     81 probably do not need to install it.  Most users will simply activate
     82 Org and begin exploring its many features.
     83 
     84 If, for one reason or another, you want to install Org on top of this
     85 pre-packaged version, you can use the Emacs package system or clone
     86 Org's git repository.
     87 
     88 We *strongly recommend* sticking to a single installation method.
     89 
     90 *** Using Emacs packaging system
     91 :PROPERTIES:
     92 :UNNUMBERED: notoc
     93 :END:
     94 
     95 Recent Emacs distributions include a packaging system which lets you
     96 install Elisp libraries.  You can install Org from the "package menu",
     97 with {{{kbd(M-x list-packages)}}}.  See [[info:emacs::Package Menu][Package Menu]].
     98 
     99 #+attr_texinfo: :tag Important
    100 #+begin_quote
    101 You need to do this in a session where no =.org= file has been
    102 visited, i.e., where no Org built-in function have been loaded.
    103 Otherwise autoload Org functions will mess up the installation.
    104 #+end_quote
    105 
    106 *** Using Org's git repository
    107 :PROPERTIES:
    108 :UNNUMBERED: notoc
    109 :END:
    110 
    111 You can clone Org's repository and install Org like this:
    112 
    113 #+begin_example
    114 $ cd ~/src/
    115 $ git clone https://git.savannah.gnu.org/git/emacs/org-mode.git
    116 $ cd org-mode/
    117 $ make autoloads
    118 #+end_example
    119 
    120 Note that in this case, =make autoloads= is mandatory: it defines
    121 Org's version in =org-version.el= and Org's autoloads in
    122 =org-loaddefs.el=.
    123 
    124 Remember to add the correct load path as described in the method
    125 above.
    126 
    127 You can also compile with =make=, generate the documentation with
    128 =make doc=, create a local configuration with =make config= and
    129 install Org with =make install=.  Please run =make help= to get the
    130 list of compilation/installation options.
    131 
    132 For more detailed explanations on Org's build system, please check the
    133 Org Build System page on [[https://orgmode.org/worg/dev/org-build-system.html][Worg]].
    134 
    135 *** Installing Org's contributed packages
    136 :PROPERTIES:
    137 :UNNUMBERED: notoc
    138 :END:
    139 
    140 Org's repository used to contain =contrib/= directory for add-ons
    141 contributed by others.  As of Org 9.5, the directory has bee moved to
    142 this new dedicated [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository, which you can install
    143 separately.
    144 
    145 ** Activation
    146 :PROPERTIES:
    147 :DESCRIPTION: How to activate Org for certain buffers.
    148 :END:
    149 #+cindex: activation
    150 #+cindex: autoload
    151 #+cindex: ELPA
    152 #+cindex: global key bindings
    153 #+cindex: key bindings, global
    154 
    155 Org mode buffers need Font Lock to be turned on: this is the default
    156 in Emacs[fn:1].
    157 
    158 There are compatibility issues between Org mode and some other Elisp
    159 packages (see [[*Packages that conflict with Org mode]]).  Please take the
    160 time to check the list.
    161 
    162 #+findex: org-agenda
    163 #+findex: org-capture
    164 #+findex: org-store-link
    165 For a better experience, the three Org commands ~org-store-link~,
    166 ~org-capture~ and ~org-agenda~ ought to be accessible anywhere in
    167 Emacs, not just in Org buffers.  To that effect, you need to bind them
    168 to globally available keys, like the ones reserved for users (see
    169 [[info:elisp::Key Binding Conventions]]).  Here are suggested bindings,
    170 please modify the keys to your own liking.
    171 
    172 #+begin_src emacs-lisp
    173 (global-set-key (kbd "C-c l") #'org-store-link)
    174 (global-set-key (kbd "C-c a") #'org-agenda)
    175 (global-set-key (kbd "C-c c") #'org-capture)
    176 #+end_src
    177 
    178 #+cindex: Org mode, turning on
    179 Files with the =.org= extension use Org mode by default.  To turn on
    180 Org mode in a file that does not have the extension =.org=, make the
    181 first line of a file look like this:
    182 
    183 : MY PROJECTS    -*- mode: org; -*-
    184 
    185 #+vindex: org-insert-mode-line-in-empty-file
    186 #+texinfo: @noindent
    187 which selects Org mode for this buffer no matter what the file's name
    188 is.  See also the variable ~org-insert-mode-line-in-empty-file~.
    189 
    190 Many commands in Org work on the region if the region is /active/.  To
    191 make use of this, you need to have Transient Mark mode turned on,
    192 which is the default.  If you do not like it, you can create an active
    193 region by using the mouse to select a region, or pressing
    194 {{{kbd(C-SPC)}}} twice before moving point.
    195 
    196 ** Feedback
    197 :PROPERTIES:
    198 :DESCRIPTION: Bug reports, ideas, patches, etc.
    199 :END:
    200 #+cindex: feedback
    201 #+cindex: bug reports
    202 #+cindex: reporting a bug
    203 #+cindex: maintainer
    204 #+cindex: author
    205 
    206 If you find problems with Org, or if you have questions, remarks, or
    207 ideas about it, please send an email to the Org mailing list
    208 [[mailto:emacs-orgmode@gnu.org]].  You can subscribe to the list [[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this
    209 web page]].  If you are not a member of the mailing list, your mail will
    210 be passed to the list after a moderator has approved it[fn:2].  We ask
    211 you to read and respect the [[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind Communications Guidelines]] when
    212 sending messages on this mailing list.
    213 
    214 #+findex: org-version
    215 #+findex: org-submit-bug-report
    216 For bug reports, please first try to reproduce the bug with the latest
    217 version of Org available---if you are running an outdated version, it
    218 is quite possible that the bug has been fixed already.  If the bug
    219 persists, prepare a report and provide as much information as
    220 possible, including the version information of Emacs ({{{kbd(M-x
    221 emacs-version)}}}) and Org ({{{kbd(M-x org-version)}}}), as well as
    222 the Org related setup in the Emacs init file.  The easiest way to do
    223 this is to use the command
    224 
    225 : M-x org-submit-bug-report <RET>
    226 
    227 #+texinfo: @noindent
    228 which puts all this information into an Emacs mail buffer so that you
    229 only need to add your description.  If you are not sending the Email
    230 from within Emacs, please copy and paste the content into your Email
    231 program.
    232 
    233 Sometimes you might face a problem due to an error in your Emacs or
    234 Org mode setup.  Before reporting a bug, it is very helpful to start
    235 Emacs with minimal customizations and reproduce the problem.  Doing so
    236 often helps you determine if the problem is with your customization or
    237 with Org mode itself.  You can start a typical minimal session with
    238 a command like the example below.
    239 
    240 : $ emacs -Q -l /path/to/minimal-org.el
    241 
    242 However if you are using Org mode as distributed with Emacs, a minimal
    243 setup is not necessary.  In that case it is sufficient to start Emacs
    244 as =emacs -Q=.  The =minimal-org.el= setup file can have contents as
    245 shown below.
    246 
    247 #+begin_src emacs-lisp
    248 ;;; Minimal setup to load latest `org-mode'.
    249 
    250 ;; Activate debugging.
    251 (setq debug-on-error t
    252       debug-on-signal nil
    253       debug-on-quit nil)
    254 
    255 ;; Add latest Org mode to load path.
    256 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
    257 #+end_src
    258 
    259 If an error occurs, a "backtrace" can be very useful---see below on
    260 how to create one.  Often a small example file helps, along with clear
    261 information about:
    262 
    263 1. What exactly did you do?
    264 2. What did you expect to happen?
    265 3. What happened instead?
    266 
    267 Thank you for helping to improve this program.
    268 
    269 *** How to create a useful backtrace
    270 :PROPERTIES:
    271 :UNNUMBERED: notoc
    272 :END:
    273 
    274 #+cindex: backtrace of an error
    275 If working with Org produces an error with a message you do not
    276 understand, you may have hit a bug.  The best way to report this is by
    277 providing, in addition to what was mentioned above, a backtrace.  This
    278 is information from the built-in debugger about where and how the
    279 error occurred.  Here is how to produce a useful backtrace:
    280 
    281 1. Reload uncompiled versions of all Org mode Lisp files.  The
    282    backtrace contains much more information if it is produced with
    283    uncompiled code.  To do this, use
    284 
    285    : C-u M-x org-reload <RET>
    286 
    287    #+texinfo: @noindent
    288    or, from the menu: Org \rarr Refresh/Reload \rarr Reload Org uncompiled.
    289 
    290 2. Then, activate the debugger:
    291 
    292    : M-x toggle-debug-on-error <RET>
    293 
    294    #+texinfo: @noindent
    295    or, from the menu: Options \rarr Enter Debugger on Error.
    296 
    297 3. Do whatever you have to do to hit the error.  Do not forget to
    298    document the steps you take.
    299 
    300 4. When you hit the error, a =*Backtrace*= buffer appears on the
    301    screen.  Save this buffer to a file---for example using {{{kbd(C-x
    302    C-w)}}}---and attach it to your bug report.
    303 
    304 ** Typesetting Conventions Used in this Manual
    305 :PROPERTIES:
    306 :DESCRIPTION: Typesetting conventions used in this manual.
    307 :ALT_TITLE: Conventions
    308 :END:
    309 
    310 *** TODO keywords, tags, properties, etc.
    311 :PROPERTIES:
    312 :UNNUMBERED: notoc
    313 :END:
    314 
    315 Org uses various syntactical elements: TODO keywords, tags, property
    316 names, keywords, blocks, etc.  In this manual we use the following
    317 conventions:
    318 
    319 #+attr_texinfo: :sep ,
    320 - =TODO=, =WAITING= ::
    321 
    322   TODO keywords are written with all capitals, even if they are
    323   user-defined.
    324 
    325 - =boss=, =ARCHIVE= ::
    326 
    327   Tags are case-sensitive.  User-defined tags are usually written in
    328   lowercase; built-in tags with special meaning are written as they
    329   should appear in the document, usually with all capitals.
    330 
    331 - =Release=, =PRIORITY= ::
    332 
    333   User-defined properties are capitalized; built-in properties with
    334   special meaning are written with all capitals.
    335 
    336 - =TITLE=, =BEGIN= ... =END= ::
    337 
    338   Keywords and blocks are written in uppercase to enhance their
    339   readability, but you can use lowercase in your Org files.
    340 
    341 *** Key bindings and commands
    342 :PROPERTIES:
    343 :UNNUMBERED: notoc
    344 :END:
    345 
    346 The manual lists both the keys and the corresponding commands for
    347 accessing a functionality.  Org mode often uses the same key for
    348 different functions, depending on context.  The command that is bound
    349 to such keys has a generic name, like ~org-metaright~.  In the manual
    350 we will, wherever possible, give the function that is internally
    351 called by the generic command.  For example, in the chapter on
    352 document structure, {{{kbd(M-RIGHT)}}} will be listed to call
    353 ~org-do-demote~, while in the chapter on tables, it will be listed to
    354 call ~org-table-move-column-right~.
    355 
    356 * Document Structure
    357 :PROPERTIES:
    358 :DESCRIPTION: A tree works like your brain.
    359 :END:
    360 
    361 #+cindex: document structure
    362 #+cindex: structure of document
    363 Org is an outliner.  Outlines allow a document to be organized in
    364 a hierarchical structure, which, least for me, is the best
    365 representation of notes and thoughts.  An overview of this structure
    366 is achieved by folding, i.e., hiding large parts of the document to
    367 show only the general document structure and the parts currently being
    368 worked on.  Org greatly simplifies the use of outlines by compressing
    369 the entire show and hide functionalities into a single command,
    370 ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key.
    371 
    372 ** Headlines
    373 :PROPERTIES:
    374 :DESCRIPTION: How to typeset Org tree headlines.
    375 :END:
    376 #+cindex: headlines
    377 #+cindex: outline tree
    378 #+vindex: org-special-ctrl-a/e
    379 #+vindex: org-special-ctrl-k
    380 #+vindex: org-ctrl-k-protect-subtree
    381 
    382 Headlines define the structure of an outline tree.  Org headlines
    383 start on the left margin[fn:3] with one or more stars followed by
    384 a space.  For example:
    385 
    386 #+begin_example
    387 ,* Top level headline
    388 ,** Second level
    389 ,*** Third level
    390     some text
    391 ,*** Third level
    392     more text
    393 ,* Another top level headline
    394 #+end_example
    395 
    396 #+vindex: org-footnote-section
    397 The name defined in ~org-footnote-section~ is reserved.  Do not use it
    398 as a title for your own headings.
    399 
    400 Some people find the many stars too noisy and would prefer an outline
    401 that has whitespace followed by a single star as headline starters.
    402 This can be achieved using a Org Indent minor mode.  See [[*A Cleaner
    403 Outline View]] for more information.
    404 
    405 Headlines are not numbered.  However, you may want to dynamically
    406 number some, or all, of them.  See [[*Dynamic Headline Numbering]].
    407 
    408 #+vindex: org-cycle-separator-lines
    409 An empty line after the end of a subtree is considered part of it and
    410 is hidden when the subtree is folded.  However, if you leave at least
    411 two empty lines, one empty line remains visible after folding the
    412 subtree, in order to structure the collapsed view.  See the variable
    413 ~org-cycle-separator-lines~ to modify this behavior.
    414 
    415 ** Visibility Cycling
    416 :PROPERTIES:
    417 :DESCRIPTION: Show and hide, much simplified.
    418 :END:
    419 #+cindex: cycling, visibility
    420 #+cindex: visibility cycling
    421 #+cindex: trees, visibility
    422 #+cindex: show hidden text
    423 #+cindex: hide text
    424 
    425 *** Global and local cycling
    426 :PROPERTIES:
    427 :DESCRIPTION: Cycling through various visibility states.
    428 :END:
    429 #+cindex: subtree visibility states
    430 #+cindex: subtree cycling
    431 #+cindex: folded, subtree visibility state
    432 #+cindex: children, subtree visibility state
    433 #+cindex: subtree, subtree visibility state
    434 
    435 Outlines make it possible to hide parts of the text in the buffer.
    436 Org uses just two commands, bound to {{{kbd(TAB)}}} and
    437 {{{kbd(S-TAB)}}} to change the visibility in the buffer.
    438 
    439 #+attr_texinfo: :sep ,
    440 - {{{kbd(TAB)}}} (~org-cycle~) ::
    441 
    442   #+kindex: TAB
    443   #+findex: org-cycle
    444   /Subtree cycling/: Rotate current subtree among the states
    445 
    446   #+begin_example
    447   ,-> FOLDED -> CHILDREN -> SUBTREE --.
    448   '-----------------------------------'
    449   #+end_example
    450 
    451   #+vindex: org-cycle-emulate-tab
    452   Point must be on a headline for this to work[fn:4].
    453 
    454 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
    455 
    456   #+cindex: global visibility states
    457   #+cindex: global cycling
    458   #+cindex: overview, global visibility state
    459   #+cindex: contents, global visibility state
    460   #+cindex: show all, global visibility state
    461   #+kindex: C-u TAB
    462   #+kindex: S-TAB
    463   #+findex: org-global-cycle
    464   /Global cycling/: Rotate the entire buffer among the states
    465 
    466   #+begin_example
    467   ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
    468   '--------------------------------------'
    469   #+end_example
    470 
    471   When {{{kbd(S-TAB)}}} is called with a numeric prefix argument
    472   {{{var(N)}}}, view contents only up to headlines of level
    473   {{{var(N)}}}.
    474 
    475   Note that inside tables (see [[*Tables]]), {{{kbd(S-TAB)}}} jumps to the
    476   previous field instead.
    477 
    478   #+vindex: org-cycle-global-at-bob
    479   You can run global cycling using {{{kbd(TAB)}}} only if point is at
    480   the very beginning of the buffer, but not on a headline, and
    481   ~org-cycle-global-at-bob~ is set to a non-~nil~ value.
    482 
    483 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
    484 
    485   #+cindex: startup visibility
    486   #+kindex: C-u C-u TAB
    487   #+findex: org-set-startup-visibility
    488   Switch back to the startup visibility of the buffer (see [[*Initial
    489   visibility]]).
    490 
    491 - {{{kbd(C-u C-u C-u TAB)}}} (~outline-show-all~) ::
    492 
    493   #+cindex: show all, command
    494   #+kindex: C-u C-u C-u TAB
    495   #+findex: outline-show-all
    496   Show all, including drawers.
    497 
    498 - {{{kbd(C-c C-r)}}} (~org-reveal~) ::
    499 
    500   #+cindex: revealing context
    501   #+kindex: C-c C-r
    502   #+findex: org-reveal
    503   Reveal context around point, showing the current entry, the
    504   following heading and the hierarchy above.  It is useful for working
    505   near a location that has been exposed by a sparse tree command (see
    506   [[*Sparse Trees]]) or an agenda command (see [[*Commands in the Agenda
    507   Buffer]]).  With a prefix argument, show, on each level, all sibling
    508   headings.  With a double prefix argument, also show the entire
    509   subtree of the parent.
    510 
    511 - {{{kbd(C-c C-k)}}} (~outline-show-branches~) ::
    512 
    513   #+cindex: show branches, command
    514   #+kindex: C-c C-k
    515   #+findex: outline-show-branches
    516   Expose all the headings of the subtree, but not their bodies.
    517 
    518 - {{{kbd(C-c TAB)}}} (~outline-show-children~) ::
    519 
    520   #+cindex: show children, command
    521   #+kindex: C-c TAB
    522   #+findex: outline-show-children
    523   Expose all direct children of the subtree.  With a numeric prefix
    524   argument {{{var(N)}}}, expose all children down to level
    525   {{{var(N)}}}.
    526 
    527 - {{{kbd(C-c C-x b)}}} (~org-tree-to-indirect-buffer~) ::
    528 
    529   #+kindex: C-c C-x b
    530   #+findex: org-tree-to-indirect-buffer
    531   Show the current subtree in an indirect buffer[fn:5].  With
    532   a numeric prefix argument {{{var(N)}}}, go up to level {{{var(N)}}}
    533   and then take that tree.  If {{{var(N)}}} is negative then go up
    534   that many levels.  With a {{{kbd(C-u)}}} prefix, do not remove the
    535   previously used indirect buffer.
    536 
    537 - {{{kbd(C-c C-x v)}}} (~org-copy-visible~) ::
    538 
    539   #+kindex: C-c C-x v
    540   #+findex: org-copy-visible
    541   Copy the /visible/ text in the region into the kill ring.
    542 
    543 *** Initial visibility
    544 :PROPERTIES:
    545 :DESCRIPTION: Setting the initial visibility state.
    546 :END:
    547 
    548 #+vindex: org-startup-folded
    549 When Emacs first visits an Org file, the global state is set to
    550 ~showeverything~, i.e., all file content is visible[fn:6].  This can
    551 be configured through the variable ~org-startup-folded~, or on
    552 a per-file basis by adding one of the following lines anywhere in the
    553 buffer:
    554 
    555 #+cindex: @samp{STARTUP}, keyword
    556 #+begin_example
    557 ,#+STARTUP: overview
    558 ,#+STARTUP: content
    559 ,#+STARTUP: showall
    560 ,#+STARTUP: show2levels
    561 ,#+STARTUP: show3levels
    562 ,#+STARTUP: show4levels
    563 ,#+STARTUP: show5levels
    564 ,#+STARTUP: showeverything
    565 #+end_example
    566 
    567 #+cindex: @samp{VISIBILITY}, property
    568 Furthermore, any entries with a =VISIBILITY= property (see [[*Properties
    569 and Columns]]) get their visibility adapted accordingly.  Allowed values
    570 for this property are =folded=, =children=, =content=, and =all=.
    571 
    572 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
    573 
    574   #+kindex: C-u C-u TAB
    575   #+findex: org-set-startup-visibility
    576   Switch back to the startup visibility of the buffer, i.e., whatever
    577   is requested by startup options and =VISIBILITY= properties in
    578   individual entries.
    579 
    580 *** Catching invisible edits
    581 :PROPERTIES:
    582 :DESCRIPTION: Preventing mistakes when editing invisible parts.
    583 :END:
    584 #+cindex: edits, catching invisible
    585 
    586 #+vindex: org-catch-invisible-edits
    587 Sometimes you may inadvertently edit an invisible part of the buffer
    588 and be confused on what has been edited and how to undo the mistake.
    589 Setting ~org-catch-invisible-edits~ to non-~nil~ helps preventing
    590 this.  See the docstring of this option on how Org should catch
    591 invisible edits and process them.
    592 
    593 ** Motion
    594 :PROPERTIES:
    595 :DESCRIPTION: Jumping to other headlines.
    596 :END:
    597 #+cindex: motion, between headlines
    598 #+cindex: jumping, to headlines
    599 #+cindex: headline navigation
    600 
    601 The following commands jump to other headlines in the buffer.
    602 
    603 - {{{kbd(C-c C-n)}}} (~org-next-visible-heading~) ::
    604 
    605   #+kindex: C-c C-n
    606   #+findex: org-next-visible-heading
    607   Next heading.
    608 
    609 - {{{kbd(C-c C-p)}}} (~org-previous-visible-heading~) ::
    610 
    611   #+kindex: C-c C-p
    612   #+findex: org-previous-visible-heading
    613   Previous heading.
    614 
    615 - {{{kbd(C-c C-f)}}} (~org-forward-heading-same-level~) ::
    616 
    617   #+kindex: C-c C-f
    618   #+findex: org-forward-heading-same-level
    619   Next heading same level.
    620 
    621 - {{{kbd(C-c C-b)}}} (~org-backward-heading-same-level~) ::
    622 
    623   #+kindex: C-c C-b
    624   #+findex: org-backward-heading-same-level
    625   Previous heading same level.
    626 
    627 - {{{kbd(C-c C-u)}}} (~outline-up-heading~) ::
    628 
    629   #+kindex: C-c C-u
    630   #+findex: outline-up-heading
    631   Backward to higher level heading.
    632 
    633 - {{{kbd(C-c C-j)}}} (~org-goto~) ::
    634 
    635   #+kindex: C-c C-j
    636   #+findex: org-goto
    637   #+vindex: org-goto-auto-isearch
    638   Jump to a different place without changing the current outline
    639   visibility.  Shows the document structure in a temporary buffer,
    640   where you can use the following keys to find your destination:
    641 
    642   #+attr_texinfo: :columns 0.3 0.7
    643   | {{{kbd(TAB)}}}            | Cycle visibility.               |
    644   | {{{kbd(DOWN)}}} / {{{kbd(UP)}}} | Next/previous visible headline. |
    645   | {{{kbd(RET)}}}            | Select this location.           |
    646   | {{{kbd(/)}}}              | Do a Sparse-tree search         |
    647 
    648   #+texinfo: @noindent
    649   The following keys work if you turn off ~org-goto-auto-isearch~
    650 
    651   #+attr_texinfo: :columns 0.3 0.7
    652   | {{{kbd(n)}}} / {{{kbd(p)}}}   | Next/previous visible headline.    |
    653   | {{{kbd(f)}}} / {{{kbd(b)}}}   | Next/previous headline same level. |
    654   | {{{kbd(u)}}}            | One level up.                      |
    655   | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument.                    |
    656   | {{{kbd(q)}}}            | Quit.                              |
    657 
    658   #+vindex: org-goto-interface
    659   #+texinfo: @noindent
    660   See also the variable ~org-goto-interface~.
    661 
    662 ** Structure Editing
    663 :PROPERTIES:
    664 :DESCRIPTION: Changing sequence and level of headlines.
    665 :END:
    666 #+cindex: structure editing
    667 #+cindex: headline, promotion and demotion
    668 #+cindex: promotion, of subtrees
    669 #+cindex: demotion, of subtrees
    670 #+cindex: subtree, cut and paste
    671 #+cindex: pasting, of subtrees
    672 #+cindex: cutting, of subtrees
    673 #+cindex: copying, of subtrees
    674 #+cindex: sorting, of subtrees
    675 #+cindex: subtrees, cut and paste
    676 
    677 #+attr_texinfo: :sep ,
    678 - {{{kbd(M-RET)}}} (~org-meta-return~) ::
    679 
    680   #+kindex: M-RET
    681   #+findex: org-meta-return
    682   #+vindex: org-M-RET-may-split-line
    683   Insert a new heading, item or row.
    684 
    685   If the command is used at the /beginning/ of a line, and if there is
    686   a heading or a plain list item (see [[*Plain Lists]]) at point, the new
    687   heading/item is created /before/ the current line.  When used at the
    688   beginning of a regular line of text, turn that line into a heading.
    689 
    690   When this command is used in the middle of a line, the line is split
    691   and the rest of the line becomes the new item or headline.  If you
    692   do not want the line to be split, customize
    693   ~org-M-RET-may-split-line~.
    694 
    695   Calling the command with a {{{kbd(C-u)}}} prefix unconditionally
    696   inserts a new heading at the end of the current subtree, thus
    697   preserving its contents.  With a double {{{kbd(C-u C-u)}}} prefix,
    698   the new heading is created at the end of the parent subtree instead.
    699 
    700 - {{{kbd(C-RET)}}} (~org-insert-heading-respect-content~) ::
    701 
    702   #+kindex: C-RET
    703   #+findex: org-insert-heading-respect-content
    704   Insert a new heading at the end of the current subtree.
    705 
    706 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
    707 
    708   #+kindex: M-S-RET
    709   #+findex: org-insert-todo-heading
    710   #+vindex: org-treat-insert-todo-heading-as-state-change
    711   Insert new TODO entry with same level as current heading.  See also
    712   the variable ~org-treat-insert-todo-heading-as-state-change~.
    713 
    714 - {{{kbd(C-S-RET)}}} (~org-insert-todo-heading-respect-content~) ::
    715 
    716   #+kindex: C-S-RET
    717   #+findex: org-insert-todo-heading-respect-content
    718   Insert new TODO entry with same level as current heading.  Like
    719   {{{kbd(C-RET)}}}, the new headline is inserted after the current
    720   subtree.
    721 
    722 - {{{kbd(TAB)}}} (~org-cycle~) ::
    723 
    724   #+kindex: TAB
    725   #+findex: org-cycle
    726   In a new entry with no text yet, the first {{{kbd(TAB)}}} demotes
    727   the entry to become a child of the previous one.  The next
    728   {{{kbd(TAB)}}} makes it a parent, and so on, all the way to top
    729   level.  Yet another {{{kbd(TAB)}}}, and you are back to the initial
    730   level.
    731 
    732 - {{{kbd(M-LEFT)}}} (~org-do-promote~), {{{kbd(M-RIGHT)}}} (~org-do-demote~) ::
    733 
    734   #+kindex: M-LEFT
    735   #+findex: org-do-promote
    736   #+kindex: M-RIGHT
    737   #+findex: org-do-demote
    738   Promote or demote current heading by one level.
    739 
    740   #+cindex: region, active
    741   #+cindex: active region
    742   #+cindex: transient mark mode
    743   When there is an active region---i.e., when Transient Mark mode is
    744   active---promotion and demotion work on all headlines in the region.
    745   To select a region of headlines, it is best to place both point and
    746   mark at the beginning of a line, mark at the beginning of the first
    747   headline, and point at the line just after the last headline to
    748   change.
    749 
    750 - {{{kbd(M-S-LEFT)}}} (~org-promote-subtree~) ::
    751 
    752   #+kindex: M-S-LEFT
    753   #+findex: org-promote-subtree
    754   Promote the current subtree by one level.
    755 
    756 - {{{kbd(M-S-RIGHT)}}} (~org-demote-subtree~) ::
    757 
    758   #+kindex: M-S-RIGHT
    759   #+findex: org-demote-subtree
    760   Demote the current subtree by one level.
    761 
    762 - {{{kbd(M-UP)}}} (~org-move-subtree-up~) ::
    763 
    764   #+kindex: M-UP
    765   #+findex: org-move-subtree-up
    766   Move subtree up, i.e., swap with previous subtree of same level.
    767 
    768 - {{{kbd(M-DOWN)}}} (~org-move-subtree-down~) ::
    769 
    770   #+kindex: M-DOWN
    771   #+findex: org-move-subtree-down
    772   Move subtree down, i.e., swap with next subtree of same level.
    773 
    774 - {{{kbd(C-c @)}}} (~org-mark-subtree~) ::
    775 
    776   #+kindex: C-c @@
    777   #+findex: org-mark-subtree
    778   Mark the subtree at point.  Hitting repeatedly marks subsequent
    779   subtrees of the same level as the marked subtree.
    780 
    781 - {{{kbd(C-c C-x C-w)}}} (~org-cut-subtree~) ::
    782 
    783   #+kindex: C-c C-x C-w
    784   #+findex: org-cut-subtree
    785   Kill subtree, i.e., remove it from buffer but save in kill ring.
    786   With a numeric prefix argument N, kill N sequential subtrees.
    787 
    788 - {{{kbd(C-c C-x M-w)}}} (~org-copy-subtree~) ::
    789 
    790   #+kindex: C-c C-x M-w
    791   #+findex: org-copy-subtree
    792   Copy subtree to kill ring.  With a numeric prefix argument N, copy
    793   the N sequential subtrees.
    794 
    795 - {{{kbd(C-c C-x C-y)}}} (~org-paste-subtree~) ::
    796 
    797   #+kindex: C-c C-x C-y
    798   #+findex: org-paste-subtree
    799   Yank subtree from kill ring.  This does modify the level of the
    800   subtree to make sure the tree fits in nicely at the yank position.
    801   The yank level can also be specified with a numeric prefix argument,
    802   or by yanking after a headline marker like =****=.
    803 
    804 - {{{kbd(C-y)}}} (~org-yank~) ::
    805 
    806   #+kindex: C-y
    807   #+findex: org-yank
    808   #+vindex: org-yank-adjusted-subtrees
    809   #+vindex: org-yank-folded-subtrees
    810   Depending on the variables ~org-yank-adjusted-subtrees~ and
    811   ~org-yank-folded-subtrees~, Org's internal ~yank~ command pastes
    812   subtrees folded and in a clever way, using the same command as
    813   {{{kbd(C-c C-x C-y)}}}.  With the default settings, no level
    814   adjustment takes place, but the yanked tree is folded unless doing
    815   so would swallow text previously visible.  Any prefix argument to
    816   this command forces a normal ~yank~ to be executed, with the prefix
    817   passed along.  A good way to force a normal yank is {{{kbd(C-u
    818   C-y)}}}.  If you use ~yank-pop~ after a yank, it yanks previous kill
    819   items plainly, without adjustment and folding.
    820 
    821 - {{{kbd(C-c C-x c)}}} (~org-clone-subtree-with-time-shift~) ::
    822 
    823   #+kindex: C-c C-x c
    824   #+findex: org-clone-subtree-with-time-shift
    825   Clone a subtree by making a number of sibling copies of it.  You are
    826   prompted for the number of copies to make, and you can also specify
    827   if any timestamps in the entry should be shifted.  This can be
    828   useful, for example, to create a number of tasks related to a series
    829   of lectures to prepare.  For more details, see the docstring of the
    830   command ~org-clone-subtree-with-time-shift~.
    831 
    832 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
    833 
    834   #+kindex: C-c C-w
    835   #+findex: org-refile
    836   Refile entry or region to a different location.  See [[*Refile and
    837   Copy]].
    838 
    839 - {{{kbd(C-c ^)}}} (~org-sort~) ::
    840 
    841   #+kindex: C-c ^
    842   #+findex: org-sort
    843   Sort same-level entries.  When there is an active region, all
    844   entries in the region are sorted.  Otherwise the children of the
    845   current headline are sorted.  The command prompts for the sorting
    846   method, which can be alphabetically, numerically, by time---first
    847   timestamp with active preferred, creation time, scheduled time,
    848   deadline time---by priority, by TODO keyword---in the sequence the
    849   keywords have been defined in the setup---or by the value of
    850   a property.  Reverse sorting is possible as well.  You can also
    851   supply your own function to extract the sorting key.  With
    852   a {{{kbd(C-u)}}} prefix, sorting is case-sensitive.
    853 
    854 - {{{kbd(C-x n s)}}} (~org-narrow-to-subtree~) ::
    855 
    856   #+kindex: C-x n s
    857   #+findex: org-narrow-to-subtree
    858   Narrow buffer to current subtree.
    859 
    860 - {{{kbd(C-x n b)}}} (~org-narrow-to-block~) ::
    861 
    862   #+kindex: C-x n b
    863   #+findex: org-narrow-to-block
    864   Narrow buffer to current block.
    865 
    866 - {{{kbd(C-x n w)}}} (~widen~) ::
    867 
    868   #+kindex: C-x n w
    869   #+findex: widen
    870   Widen buffer to remove narrowing.
    871 
    872 - {{{kbd(C-c *)}}} (~org-toggle-heading~) ::
    873 
    874   #+kindex: C-c *
    875   #+findex: org-toggle-heading
    876   Turn a normal line or plain list item into a headline---so that it
    877   becomes a subheading at its location.  Also turn a headline into
    878   a normal line by removing the stars.  If there is an active region,
    879   turn all lines in the region into headlines.  If the first line in
    880   the region was an item, turn only the item lines into headlines.
    881   Finally, if the first line is a headline, remove the stars from all
    882   headlines in the region.
    883 
    884 Note that when point is inside a table (see [[*Tables]]), the Meta-Cursor
    885 keys have different functionality.
    886 
    887 ** Sparse Trees
    888 :PROPERTIES:
    889 :DESCRIPTION: Matches embedded in context.
    890 :END:
    891 #+cindex: sparse trees
    892 #+cindex: trees, sparse
    893 #+cindex: folding, sparse trees
    894 #+cindex: occur, command
    895 
    896 #+vindex: org-show-context-detail
    897 An important feature of Org mode is the ability to construct /sparse
    898 trees/ for selected information in an outline tree, so that the entire
    899 document is folded as much as possible, but the selected information
    900 is made visible along with the headline structure above it[fn:7].
    901 Just try it out and you will see immediately how it works.
    902 
    903 Org mode contains several commands creating such trees, all these
    904 commands can be accessed through a dispatcher:
    905 
    906 - {{{kbd(C-c /)}}} (~org-sparse-tree~) ::
    907 
    908   #+kindex: C-c /
    909   #+findex: org-sparse-tree
    910   This prompts for an extra key to select a sparse-tree creating
    911   command.
    912 
    913 - {{{kbd(C-c / r)}}} or {{{kbd(C-c / /)}}} (~org-occur~) ::
    914 
    915   #+kindex: C-c / r
    916   #+kindex: C-c / /
    917   #+findex: org-occur
    918   #+vindex: org-remove-highlights-with-change
    919   Prompts for a regexp (see [[*Regular Expressions]]) and shows a sparse
    920   tree with all matches.  If the match is in a headline, the headline
    921   is made visible.  If the match is in the body of an entry, headline
    922   and body are made visible.  In order to provide minimal context,
    923   also the full hierarchy of headlines above the match is shown, as
    924   well as the headline following the match.  Each match is also
    925   highlighted; the highlights disappear when the buffer is changed by
    926   an editing command, or by pressing {{{kbd(C-c C-c)}}}[fn:8].  When
    927   called with a {{{kbd(C-u)}}} prefix argument, previous highlights
    928   are kept, so several calls to this command can be stacked.
    929 
    930 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
    931 
    932   #+kindex: M-g n
    933   #+kindex: M-g M-n
    934   #+findex: next-error
    935   Jump to the next sparse tree match in this buffer.
    936 
    937 - {{{kbd(M-g p)}}} or {{{kbd(M-g M-p)}}} (~previous-error~) ::
    938 
    939   #+kindex: M-g p
    940   #+kindex: M-g M-p
    941   #+findex: previous-error
    942   Jump to the previous sparse tree match in this buffer.
    943 
    944 #+vindex: org-agenda-custom-commands
    945 For frequently used sparse trees of specific search strings, you can
    946 use the variable ~org-agenda-custom-commands~ to define fast keyboard
    947 access to specific sparse trees.  These commands will then be
    948 accessible through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
    949 For example:
    950 
    951 #+begin_src emacs-lisp
    952 (setq org-agenda-custom-commands
    953       '(("f" occur-tree "FIXME")))
    954 #+end_src
    955 
    956 #+texinfo: @noindent
    957 defines the key {{{kbd(f)}}} as a shortcut for creating a sparse tree
    958 matching the string =FIXME=.
    959 
    960 The other sparse tree commands select headings based on TODO keywords,
    961 tags, or properties and are discussed later in this manual.
    962 
    963 #+kindex: C-c C-e C-v
    964 #+cindex: printing sparse trees
    965 #+cindex: visible text, printing
    966 To print a sparse tree, you can use the Emacs command
    967 ~ps-print-buffer-with-faces~ which does not print invisible parts of
    968 the document.  Or you can use the command {{{kbd(C-c C-e C-v)}}} to
    969 export only the visible part of the document and print the resulting
    970 file.
    971 
    972 ** Plain Lists
    973 :PROPERTIES:
    974 :DESCRIPTION: Additional structure within an entry.
    975 :END:
    976 #+cindex: plain lists
    977 #+cindex: lists, plain
    978 #+cindex: lists, ordered
    979 #+cindex: ordered lists
    980 
    981 Within an entry of the outline tree, hand-formatted lists can provide
    982 additional structure.  They also provide a way to create lists of
    983 checkboxes (see [[*Checkboxes]]).  Org supports editing such lists, and
    984 every exporter (see [[*Exporting]]) can parse and format them.
    985 
    986 Org knows ordered lists, unordered lists, and description lists.
    987 
    988 #+attr_texinfo: :indic @bullet
    989 - /Unordered/ list items start with =-=, =+=, or =*=[fn:9] as bullets.
    990 
    991 -
    992   #+vindex: org-plain-list-ordered-item-terminator
    993   #+vindex: org-alphabetical-lists
    994   /Ordered/ list items start with a numeral followed by either
    995   a period or a right parenthesis[fn:10], such as =1.= or =1)=[fn:11]
    996   If you want a list to start with a different value---e.g.,
    997   20---start the text of the item with =[@20]=[fn:12].  Those
    998   constructs can be used in any item of the list in order to enforce
    999   a particular numbering.
   1000 
   1001 - /Description/ list items are unordered list items, and contain the
   1002   separator =::= to distinguish the description /term/ from the
   1003   description.
   1004 
   1005 Items belonging to the same list must have the same indentation on the
   1006 first line.  In particular, if an ordered list reaches number =10.=,
   1007 then the 2-digit numbers must be written left-aligned with the other
   1008 numbers in the list.  An item ends before the next line that is less
   1009 or equally indented than its bullet/number.
   1010 
   1011 A list ends whenever every item has ended, which means before any line
   1012 less or equally indented than items at top level.  It also ends before
   1013 two blank lines.  In that case, all items are closed.  Here is an
   1014 example:
   1015 
   1016 #+begin_example
   1017 ,* Lord of the Rings
   1018 My favorite scenes are (in this order)
   1019 1. The attack of the Rohirrim
   1020 2. Eowyn's fight with the witch king
   1021    + this was already my favorite scene in the book
   1022    + I really like Miranda Otto.
   1023 3. Peter Jackson being shot by Legolas
   1024    - on DVD only
   1025    He makes a really funny face when it happens.
   1026 But in the end, no individual scenes matter but the film as a whole.
   1027 Important actors in this film are:
   1028 - Elijah Wood :: He plays Frodo
   1029 - Sean Astin :: He plays Sam, Frodo's friend.  I still remember him
   1030      very well from his role as Mikey Walsh in /The Goonies/.
   1031 #+end_example
   1032 
   1033 Org supports these lists by tuning filling and wrapping commands to
   1034 deal with them correctly, and by exporting them properly (see
   1035 [[*Exporting]]).  Since indentation is what governs the structure of these
   1036 lists, many structural constructs like =#+BEGIN_= blocks can be
   1037 indented to signal that they belong to a particular item.
   1038 
   1039 #+vindex: org-list-demote-modify-bullet
   1040 #+vindex: org-list-indent-offset
   1041 If you find that using a different bullet for a sub-list---than that
   1042 used for the current list-level---improves readability, customize the
   1043 variable ~org-list-demote-modify-bullet~.  To get a greater difference
   1044 of indentation between items and theirs sub-items, customize
   1045 ~org-list-indent-offset~.
   1046 
   1047 #+vindex: org-list-automatic-rules
   1048 The following commands act on items when point is in the first line of
   1049 an item---the line with the bullet or number.  Some of them imply the
   1050 application of automatic rules to keep list structure intact.  If some
   1051 of these actions get in your way, configure ~org-list-automatic-rules~
   1052 to disable them individually.
   1053 
   1054 #+attr_texinfo: :sep ,
   1055 - {{{kbd(TAB)}}} (~org-cycle~) ::
   1056 
   1057   #+cindex: cycling, in plain lists
   1058   #+kindex: TAB
   1059   #+findex: org-cycle
   1060   #+vindex: org-cycle-include-plain-lists
   1061   Items can be folded just like headline levels.  Normally this works
   1062   only if point is on a plain list item.  For more details, see the
   1063   variable ~org-cycle-include-plain-lists~.  If this variable is set
   1064   to ~integrate~, plain list items are treated like low-level
   1065   headlines.  The level of an item is then given by the indentation of
   1066   the bullet/number.  Items are always subordinate to real headlines,
   1067   however; the hierarchies remain completely separated.  In a new item
   1068   with no text yet, the first {{{kbd(TAB)}}} demotes the item to
   1069   become a child of the previous one.  Subsequent {{{kbd(TAB)}}}s move
   1070   the item to meaningful levels in the list and eventually get it back
   1071   to its initial position.
   1072 
   1073 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
   1074 
   1075   #+kindex: M-RET
   1076   #+findex: org-insert-heading
   1077   #+vindex: org-M-RET-may-split-line
   1078   Insert new item at current level.  With a prefix argument, force
   1079   a new heading (see [[*Structure Editing]]).  If this command is used in
   1080   the middle of an item, that item is /split/ in two, and the second
   1081   part becomes the new item[fn:13].  If this command is executed
   1082   /before item's body/, the new item is created /before/ the current
   1083   one.
   1084 
   1085 - {{{kbd(M-S-RET)}}} ::
   1086 
   1087   #+kindex: M-S-RET
   1088   Insert a new item with a checkbox (see [[*Checkboxes]]).
   1089 
   1090 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}} ::
   1091 
   1092   #+kindex: S-UP
   1093   #+kindex: S-DOWN
   1094   #+cindex: shift-selection-mode
   1095   #+vindex: org-support-shift-select
   1096   #+vindex: org-list-use-circular-motion
   1097   Jump to the previous/next item in the current list, but only if
   1098   ~org-support-shift-select~ is off[fn:14].  If not, you can still use
   1099   paragraph jumping commands like {{{kbd(C-UP)}}} and
   1100   {{{kbd(C-DOWN)}}} to quite similar effect.
   1101 
   1102 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
   1103 
   1104   #+kindex: M-UP
   1105   #+kindex: M-DOWN
   1106   Move the item including subitems up/down[fn:15], i.e., swap with
   1107   previous/next item of same indentation.  If the list is ordered,
   1108   renumbering is automatic.
   1109 
   1110 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
   1111 
   1112   #+kindex: M-LEFT
   1113   #+kindex: M-RIGHT
   1114   Decrease/increase the indentation of an item, leaving children
   1115   alone.
   1116 
   1117 - {{{kbd(M-S-LEFT)}}}, {{{kbd(M-S-RIGHT)}}} ::
   1118 
   1119   #+kindex: M-S-LEFT
   1120   #+kindex: M-S-RIGHT
   1121   Decrease/increase the indentation of the item, including subitems.
   1122   Initially, the item tree is selected based on current indentation.
   1123   When these commands are executed several times in direct succession,
   1124   the initially selected region is used, even if the new indentation
   1125   would imply a different hierarchy.  To use the new hierarchy, break
   1126   the command chain by moving point.
   1127 
   1128   As a special case, using this command on the very first item of
   1129   a list moves the whole list.  This behavior can be disabled by
   1130   configuring ~org-list-automatic-rules~.  The global indentation of
   1131   a list has no influence on the text /after/ the list.
   1132 
   1133 - {{{kbd(C-c C-c)}}} ::
   1134 
   1135   #+kindex: C-c C-c
   1136   If there is a checkbox (see [[*Checkboxes]]) in the item line, toggle
   1137   the state of the checkbox.  In any case, verify bullets and
   1138   indentation consistency in the whole list.
   1139 
   1140 - {{{kbd(C-c -)}}} ::
   1141 
   1142   #+kindex: C-c -
   1143   #+vindex: org-plain-list-ordered-item-terminator
   1144   Cycle the entire list level through the different itemize/enumerate
   1145   bullets (=-=, =+=, =*=, =1.=, =1)=) or a subset of them, depending
   1146   on ~org-plain-list-ordered-item-terminator~, the type of list, and
   1147   its indentation.  With a numeric prefix argument N, select the Nth
   1148   bullet from this list.  If there is an active region when calling
   1149   this, all lines are converted to list items.  With a prefix
   1150   argument, the selected text is changed into a single item.  If the
   1151   first line already was a list item, any item marker is removed from
   1152   the list.  Finally, even without an active region, a normal line is
   1153   converted into a list item.
   1154 
   1155 - {{{kbd(C-c *)}}} ::
   1156 
   1157   #+kindex: C-c *
   1158   Turn a plain list item into a headline---so that it becomes
   1159   a subheading at its location.  See [[*Structure Editing]], for
   1160   a detailed explanation.
   1161 
   1162 - {{{kbd(C-c C-*)}}} ::
   1163 
   1164   #+kindex: C-c C-*
   1165   Turn the whole plain list into a subtree of the current heading.
   1166   Checkboxes (see [[*Checkboxes]]) become =TODO=, respectively =DONE=,
   1167   keywords when unchecked, respectively checked.
   1168 
   1169 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
   1170 
   1171   #+vindex: org-support-shift-select
   1172   #+kindex: S-LEFT
   1173   #+kindex: S-RIGHT
   1174   This command also cycles bullet styles when point is in on the
   1175   bullet or anywhere in an item line, details depending on
   1176   ~org-support-shift-select~.
   1177 
   1178 - {{{kbd(C-c ^)}}} ::
   1179 
   1180   #+kindex: C-c ^
   1181   #+cindex: sorting, of plain list
   1182   Sort the plain list.  Prompt for the sorting method: numerically,
   1183   alphabetically, by time, or by custom function.
   1184 
   1185 ** Drawers
   1186 :PROPERTIES:
   1187 :DESCRIPTION: Tucking stuff away.
   1188 :END:
   1189 #+cindex: drawers
   1190 #+cindex: visibility cycling, drawers
   1191 
   1192 Sometimes you want to keep information associated with an entry, but
   1193 you normally do not want to see it.  For this, Org mode has /drawers/.
   1194 They can contain anything but a headline and another drawer.  Drawers
   1195 look like this:
   1196 
   1197 #+begin_example
   1198 ,** This is a headline
   1199 Still outside the drawer
   1200 :DRAWERNAME:
   1201 This is inside the drawer.
   1202 :END:
   1203 After the drawer.
   1204 #+end_example
   1205 
   1206 #+kindex: C-c C-x d
   1207 #+findex: org-insert-drawer
   1208 You can interactively insert a drawer at point by calling
   1209 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}.  With an
   1210 active region, this command puts the region inside the drawer.  With
   1211 a prefix argument, this command calls ~org-insert-property-drawer~,
   1212 which creates a =PROPERTIES= drawer right below the current headline.
   1213 Org mode uses this special drawer for storing properties (see
   1214 [[*Properties and Columns]]).  You cannot use it for anything else.
   1215 
   1216 Completion over drawer keywords is also possible using
   1217 {{{kbd(M-TAB)}}}[fn:16].
   1218 
   1219 Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and
   1220 shows the entry, but keep the drawer collapsed to a single line.  In
   1221 order to look inside the drawer, you need to move point to the drawer
   1222 line and press {{{kbd(TAB)}}} there.
   1223 
   1224 You can also arrange for state change notes (see [[Tracking TODO state
   1225 changes]]) and clock times (see [[*Clocking Work Time]]) to be stored in
   1226 a =LOGBOOK= drawer.  If you want to store a quick note there, in
   1227 a similar way to state changes, use
   1228 
   1229 - {{{kbd(C-c C-z)}}} ::
   1230 
   1231   #+kindex: C-c C-z
   1232   Add a time-stamped note to the =LOGBOOK= drawer.
   1233 
   1234 ** Blocks
   1235 :PROPERTIES:
   1236 :DESCRIPTION: Folding blocks.
   1237 :END:
   1238 #+vindex: org-hide-block-startup
   1239 #+cindex: blocks, folding
   1240 
   1241 Org mode uses =#+BEGIN= ... =#+END= blocks for various purposes from
   1242 including source code examples (see [[*Literal Examples]]) to capturing
   1243 time logging information (see [[*Clocking Work Time]]).  These blocks can
   1244 be folded and unfolded by pressing {{{kbd(TAB)}}} in the =#+BEGIN=
   1245 line.  You can also get all blocks folded at startup by configuring
   1246 the variable ~org-hide-block-startup~ or on a per-file basis by using
   1247 
   1248 #+cindex: STARTUP, keyword
   1249 #+begin_example
   1250 ,#+STARTUP: hideblocks
   1251 ,#+STARTUP: nohideblocks
   1252 #+end_example
   1253 
   1254 * Tables
   1255 :PROPERTIES:
   1256 :DESCRIPTION: Pure magic for quick formatting.
   1257 :END:
   1258 #+cindex: tables
   1259 #+cindex: editing tables
   1260 
   1261 Org comes with a fast and intuitive table editor.  Spreadsheet-like
   1262 calculations are supported using the Emacs Calc package (see [[info:calc][GNU Emacs
   1263 Calculator Manual]]).
   1264 
   1265 ** Built-in Table Editor
   1266 :PROPERTIES:
   1267 :DESCRIPTION: Simple tables.
   1268 :END:
   1269 #+cindex: table editor, built-in
   1270 
   1271 #+cindex: header lines, in tables
   1272 #+cindex: horizontal rule, in tables
   1273 #+cindex: row separator, in tables
   1274 #+cindex: table syntax
   1275 Org makes it easy to format tables in plain ASCII.  Any line with =|=
   1276 as the first non-whitespace character is considered part of a table.
   1277 =|= is also the column separator[fn:17].  Moreover, a line starting
   1278 with =|-= is a horizontal rule.  It separates rows explicitly.  Rows
   1279 before the first horizontal rule are header lines.  A table might look
   1280 like this:
   1281 
   1282 #+begin_example
   1283 | Name  | Phone | Age |
   1284 |-------+-------+-----|
   1285 | Peter |  1234 |  17 |
   1286 | Anna  |  4321 |  25 |
   1287 #+end_example
   1288 
   1289 A table is re-aligned automatically each time you press
   1290 {{{kbd(TAB)}}}, {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} inside the table.
   1291 {{{kbd(TAB)}}} also moves to the next field---{{{kbd(RET)}}} to the
   1292 next row---and creates new table rows at the end of the table or
   1293 before horizontal lines.  The indentation of the table is set by the
   1294 first line.  Horizontal rules are automatically expanded on every
   1295 re-align to span the whole table width.  So, to create the above
   1296 table, you would only type
   1297 
   1298 #+begin_example
   1299 |Name|Phone|Age|
   1300 |-
   1301 #+end_example
   1302 
   1303 #+texinfo: @noindent
   1304 and then press {{{kbd(TAB)}}} to align the table and start filling in
   1305 fields.  Even faster would be to type =|Name|Phone|Age= followed by
   1306 {{{kbd(C-c RET)}}}.
   1307 
   1308 When typing text into a field, Org treats {{{kbd(DEL)}}},
   1309 {{{kbd(Backspace)}}}, and all character keys in a special way, so that
   1310 inserting and deleting avoids shifting other fields.  Also, when
   1311 typing /immediately/ after point was moved into a new field with
   1312 {{{kbd(TAB)}}}, {{{kbd(S-TAB)}}} or {{{kbd(RET)}}}, the field is
   1313 automatically made blank.  If this behavior is too unpredictable for
   1314 you, configure the option ~org-table-auto-blank-field~.
   1315 
   1316 *** Creation and conversion
   1317 :PROPERTIES:
   1318 :UNNUMBERED: notoc
   1319 :END:
   1320 
   1321 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
   1322 
   1323   #+kindex: C-c |
   1324   #+findex: org-table-create-or-convert-from-region
   1325   Convert the active region to table.  If every line contains at least
   1326   one {{{kbd(TAB)}}} character, the function assumes that the material
   1327   is tab separated.  If every line contains a comma, comma-separated
   1328   values (CSV) are assumed.  If not, lines are split at whitespace
   1329   into fields.  You can use a prefix argument to force a specific
   1330   separator: {{{kbd(C-u)}}} forces CSV, {{{kbd(C-u C-u)}}} forces
   1331   {{{kbd(TAB)}}}, {{{kbd(C-u C-u C-u)}}} prompts for a regular
   1332   expression to match the separator, and a numeric argument
   1333   N indicates that at least N consecutive spaces, or alternatively
   1334   a {{{kbd(TAB)}}} will be the separator.
   1335 
   1336   If there is no active region, this command creates an empty Org
   1337   table.  But it is easier just to start typing, like {{{kbd(|
   1338   N a m e | P h o n e | A g e RET | - TAB)}}}.
   1339 
   1340 *** Re-aligning and field motion
   1341 :PROPERTIES:
   1342 :UNNUMBERED: notoc
   1343 :END:
   1344 
   1345 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
   1346 
   1347   #+kindex: C-c C-c
   1348   #+findex: org-table-align
   1349   Re-align the table without moving point.
   1350 
   1351 - {{{kbd(TAB)}}} (~org-table-next-field~) ::
   1352 
   1353   #+kindex: TAB
   1354   #+findex: org-table-next-field
   1355   Re-align the table, move to the next field.  Creates a new row if
   1356   necessary.
   1357 
   1358 - {{{kbd(C-c SPC)}}} (~org-table-blank-field~) ::
   1359 
   1360   #+kindex: C-c SPC
   1361   #+findex: org-table-blank-field
   1362   Blank the field at point.
   1363 
   1364 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
   1365 
   1366   #+kindex: S-TAB
   1367   #+findex: org-table-previous-field
   1368   Re-align, move to previous field.
   1369 
   1370 - {{{kbd(RET)}}} (~org-table-next-row~) ::
   1371 
   1372   #+kindex: RET
   1373   #+findex: org-table-next-row
   1374   Re-align the table and move down to next row.  Creates a new row if
   1375   necessary.  At the beginning or end of a line, {{{kbd(RET)}}} still
   1376   inserts a new line, so it can be used to split a table.
   1377 
   1378 - {{{kbd(M-a)}}} (~org-table-beginning-of-field~) ::
   1379 
   1380   #+kindex: M-a
   1381   #+findex: org-table-beginning-of-field
   1382   Move to beginning of the current table field, or on to the previous
   1383   field.
   1384 
   1385 - {{{kbd(M-e)}}} (~org-table-end-of-field~) ::
   1386 
   1387   #+kindex: M-e
   1388   #+findex: org-table-end-of-field
   1389   Move to end of the current table field, or on to the next field.
   1390 
   1391 *** Column and row editing
   1392 :PROPERTIES:
   1393 :UNNUMBERED: notoc
   1394 :END:
   1395 
   1396 - {{{kbd(M-LEFT)}}} (~org-table-move-column-left~) ::
   1397 
   1398   #+kindex: M-LEFT
   1399   #+findex: org-table-move-column-left
   1400   Move the current column left.
   1401 
   1402 - {{{kbd(M-RIGHT)}}} (~org-table-move-column-right~) ::
   1403 
   1404   #+kindex: M-RIGHT
   1405   #+findex: org-table-move-column-right
   1406   Move the current column right.
   1407 
   1408 - {{{kbd(M-S-LEFT)}}} (~org-table-delete-column~) ::
   1409 
   1410   #+kindex: M-S-LEFT
   1411   #+findex: org-table-delete-column
   1412   Kill the current column.
   1413 
   1414 - {{{kbd(M-S-RIGHT)}}} (~org-table-insert-column~) ::
   1415 
   1416   #+kindex: M-S-RIGHT
   1417   #+findex: org-table-insert-column
   1418   Insert a new column at point position.  Move the recent column and
   1419   all cells to the right of this column to the right.
   1420 
   1421 - {{{kbd(M-UP)}}} (~org-table-move-row-up~) ::
   1422 
   1423   #+kindex: M-UP
   1424   #+findex: org-table-move-row-up
   1425   Move the current row up.
   1426 
   1427 - {{{kbd(M-DOWN)}}} (~org-table-move-row-down~) ::
   1428 
   1429   #+kindex: M-DOWN
   1430   #+findex: org-table-move-row-down
   1431   Move the current row down.
   1432 
   1433 - {{{kbd(M-S-UP)}}} (~org-table-kill-row~) ::
   1434 
   1435   #+kindex: M-S-UP
   1436   #+findex: org-table-kill-row
   1437   Kill the current row or horizontal line.
   1438 
   1439 - {{{kbd(S-UP)}}} (~org-table-move-cell-up~) ::
   1440 
   1441   #+kindex: S-UP
   1442   #+findex: org-table-move-cell-up
   1443   Move cell up by swapping with adjacent cell.
   1444 
   1445 - {{{kbd(S-DOWN)}}} (~org-table-move-cell-down~) ::
   1446 
   1447   #+kindex: S-DOWN
   1448   #+findex: org-table-move-cell-down
   1449   Move cell down by swapping with adjacent cell.
   1450 
   1451 - {{{kbd(S-LEFT)}}} (~org-table-move-cell-left~) ::
   1452 
   1453   #+kindex: S-LEFT
   1454   #+findex: org-table-move-cell-left
   1455   Move cell left by swapping with adjacent cell.
   1456 
   1457 - {{{kbd(S-RIGHT)}}} (~org-table-move-cell-right~) ::
   1458 
   1459   #+kindex: S-RIGHT
   1460   #+findex: org-table-move-cell-right
   1461   Move cell right by swapping with adjacent cell.
   1462 
   1463 - {{{kbd(M-S-DOWN)}}} (~org-table-insert-row~) ::
   1464 
   1465   #+kindex: M-S-DOWN
   1466   #+findex: org-table-insert-row
   1467   Insert a new row above the current row.  With a prefix argument, the
   1468   line is created below the current one.
   1469 
   1470 - {{{kbd(C-c -)}}} (~org-table-insert-hline~) ::
   1471 
   1472   #+kindex: C-c -
   1473   #+findex: org-table-insert-hline
   1474   Insert a horizontal line below current row.  With a prefix argument,
   1475   the line is created above the current line.
   1476 
   1477 - {{{kbd(C-c RET)}}} (~org-table-hline-and-move~) ::
   1478 
   1479   #+kindex: C-c RET
   1480   #+findex: org-table-hline-and-move
   1481   Insert a horizontal line below current row, and move point into the
   1482   row below that line.
   1483 
   1484 - {{{kbd(C-c ^)}}} (~org-table-sort-lines~) ::
   1485 
   1486   #+kindex: C-c ^
   1487   #+findex: org-table-sort-lines
   1488   Sort the table lines in the region.  The position of point indicates
   1489   the column to be used for sorting, and the range of lines is the
   1490   range between the nearest horizontal separator lines, or the entire
   1491   table.  If point is before the first column, you are prompted for
   1492   the sorting column.  If there is an active region, the mark
   1493   specifies the first line and the sorting column, while point should
   1494   be in the last line to be included into the sorting.  The command
   1495   prompts for the sorting type, alphabetically, numerically, or by
   1496   time.  You can sort in normal or reverse order.  You can also supply
   1497   your own key extraction and comparison functions.  When called with
   1498   a prefix argument, alphabetic sorting is case-sensitive.
   1499 
   1500 *** Regions
   1501 :PROPERTIES:
   1502 :UNNUMBERED: notoc
   1503 :END:
   1504 
   1505 - {{{kbd(C-c C-x M-w)}}} (~org-table-copy-region~) ::
   1506 
   1507   #+kindex: C-c C-x M-w
   1508   #+findex: org-table-copy-region
   1509   Copy a rectangular region from a table to a special clipboard.
   1510   Point and mark determine edge fields of the rectangle.  If there is
   1511   no active region, copy just the current field.  The process ignores
   1512   horizontal separator lines.
   1513 
   1514 - {{{kbd(C-c C-x C-w)}}} (~org-table-cut-region~) ::
   1515 
   1516   #+kindex: C-c C-x C-w
   1517   #+findex: org-table-cut-region
   1518   Copy a rectangular region from a table to a special clipboard, and
   1519   blank all fields in the rectangle.  So this is the "cut" operation.
   1520 
   1521 - {{{kbd(C-c C-x C-y)}}} (~org-table-paste-rectangle~) ::
   1522 
   1523   #+kindex: C-c C-x C-y
   1524   #+findex: org-table-paste-rectangle
   1525   Paste a rectangular region into a table.  The upper left corner ends
   1526   up in the current field.  All involved fields are overwritten.  If
   1527   the rectangle does not fit into the present table, the table is
   1528   enlarged as needed.  The process ignores horizontal separator lines.
   1529 
   1530 - {{{kbd(M-RET)}}} (~org-table-wrap-region~) ::
   1531 
   1532   #+kindex: M-RET
   1533   #+findex: org-table-wrap-region
   1534   Split the current field at point position and move the rest to the
   1535   line below.  If there is an active region, and both point and mark
   1536   are in the same column, the text in the column is wrapped to minimum
   1537   width for the given number of lines.  A numeric prefix argument may
   1538   be used to change the number of desired lines.  If there is no
   1539   region, but you specify a prefix argument, the current field is made
   1540   blank, and the content is appended to the field above.
   1541 
   1542 *** Calculations
   1543 :PROPERTIES:
   1544 :UNNUMBERED: notoc
   1545 :END:
   1546 
   1547 #+cindex: formula, in tables
   1548 #+cindex: calculations, in tables
   1549 
   1550 - {{{kbd(C-c +)}}} (~org-table-sum~) ::
   1551 
   1552   #+kindex: C-c +
   1553   #+findex: org-table-sum
   1554   Sum the numbers in the current column, or in the rectangle defined
   1555   by the active region.  The result is shown in the echo area and can
   1556   be inserted with {{{kbd(C-y)}}}.
   1557 
   1558 - {{{kbd(S-RET)}}} (~org-table-copy-down~) ::
   1559 
   1560   #+kindex: S-RET
   1561   #+findex: org-table-copy-down
   1562   #+vindex: org-table-copy-increment
   1563   When current field is empty, copy from first non-empty field above.
   1564   When not empty, copy current field down to next row and move point
   1565   along with it.
   1566 
   1567   Depending on the variable ~org-table-copy-increment~, integer and
   1568   time stamp field values, and fields prefixed or suffixed with
   1569   a whole number, can be incremented during copy.  Also, a ~0~ prefix
   1570   argument temporarily disables the increment.
   1571 
   1572   This key is also used by shift-selection and related modes (see
   1573   [[*Packages that conflict with Org mode]]).
   1574 
   1575 *** Miscellaneous
   1576 :PROPERTIES:
   1577 :UNNUMBERED: notoc
   1578 :END:
   1579 
   1580 - {{{kbd(C-c `)}}} (~org-table-edit-field~) ::
   1581 
   1582   #+kindex: C-c `
   1583   #+findex: org-table-edit-field
   1584   Edit the current field in a separate window.  This is useful for
   1585   fields that are not fully visible (see [[*Column Width and Alignment]]).
   1586   When called with a {{{kbd(C-u)}}} prefix, just make the full field
   1587   visible, so that it can be edited in place.  When called with two
   1588   {{{kbd(C-u)}}} prefixes, make the editor window follow point through
   1589   the table and always show the current field.  The follow mode exits
   1590   automatically when point leaves the table, or when you repeat this
   1591   command with {{{kbd(C-u C-u C-c `)}}}.
   1592 
   1593 - {{{kbd(M-x org-table-import)}}} ::
   1594 
   1595   #+findex: org-table-import
   1596   Import a file as a table.  The table should be TAB or whitespace
   1597   separated.  Use, for example, to import a spreadsheet table or data
   1598   from a database, because these programs generally can write
   1599   TAB-separated text files.  This command works by inserting the file
   1600   into the buffer and then converting the region to a table.  Any
   1601   prefix argument is passed on to the converter, which uses it to
   1602   determine the separator.
   1603 
   1604 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
   1605 
   1606   #+kindex: C-c |
   1607   #+findex: org-table-create-or-convert-from-region
   1608   Tables can also be imported by pasting tabular text into the Org
   1609   buffer, selecting the pasted text with {{{kbd(C-x C-x)}}} and then
   1610   using the {{{kbd(C-c |)}}} command (see [[*Creation and conversion]]).
   1611 
   1612 - {{{kbd(M-x org-table-export)}}} ::
   1613 
   1614   #+findex: org-table-export
   1615   #+vindex: org-table-export-default-format
   1616   Export the table, by default as a TAB-separated file.  Use for data
   1617   exchange with, for example, spreadsheet or database programs.  The
   1618   format used to export the file can be configured in the variable
   1619   ~org-table-export-default-format~.  You may also use properties
   1620   =TABLE_EXPORT_FILE= and =TABLE_EXPORT_FORMAT= to specify the file
   1621   name and the format for table export in a subtree.  Org supports
   1622   quite general formats for exported tables.  The exporter format is
   1623   the same as the format used by Orgtbl radio tables, see [[*Translator
   1624   functions]], for a detailed description.
   1625 
   1626 - {{{kbd(M-x org-table-header-line-mode)}}} ::
   1627 
   1628   #+findex: org-table-header-line-mode
   1629   #+vindex: org-table-header-line-p
   1630   Turn on the display of the first data row of the table at point in
   1631   the window header line when this first row is not visible anymore in
   1632   the buffer.  You can activate this minor mode by default by setting
   1633   the option ~org-table-header-line-p~ to ~t~.
   1634 
   1635 - {{{kbd(M-x org-table-transpose-table-at-point)}}} ::
   1636 
   1637   #+findex: org-table-transpose-table-at-point
   1638   Transpose the table at point and eliminate hlines.
   1639 
   1640 ** Column Width and Alignment
   1641 :PROPERTIES:
   1642 :DESCRIPTION: Overrule the automatic settings.
   1643 :END:
   1644 #+cindex: narrow columns in tables
   1645 #+cindex: alignment in tables
   1646 
   1647 The width of columns is automatically determined by the table editor.
   1648 The alignment of a column is determined automatically from the
   1649 fraction of number-like versus non-number fields in the column.
   1650 
   1651 #+vindex: org-table-automatic-realign
   1652 Editing a field may modify alignment of the table.  Moving
   1653 a contiguous row or column---i.e., using {{{kbd(TAB)}}} or
   1654 {{{kbd(RET)}}}---automatically re-aligns it.  If you want to disable
   1655 this behavior, set ~org-table-automatic-realign~ to ~nil~.  In any
   1656 case, you can always align manually a table:
   1657 
   1658 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
   1659 
   1660   #+kindex: C-c C-c
   1661   #+findex: org-table-align
   1662   Align the current table.
   1663 
   1664 #+vindex: org-startup-align-all-tables
   1665 Setting the option ~org-startup-align-all-tables~ re-aligns all tables
   1666 in a file upon visiting it.  You can also set this option on
   1667 a per-file basis with:
   1668 
   1669 #+begin_example
   1670 ,#+STARTUP: align
   1671 ,#+STARTUP: noalign
   1672 #+end_example
   1673 
   1674 Sometimes a single field or a few fields need to carry more text,
   1675 leading to inconveniently wide columns.  Maybe you want to hide away
   1676 several columns or display them with a fixed width, regardless of
   1677 content, as shown in the following example.
   1678 
   1679 #+begin_example
   1680 |---+---------------------+--------|           |---+-------…+…|
   1681 |   | <6>                 |        |           |   | <6>   …|…|
   1682 | 1 | one                 | some   |   ----\   | 1 | one   …|…|
   1683 | 2 | two                 | boring |   ----/   | 2 | two   …|…|
   1684 | 3 | This is a long text | column |           | 3 | This i…|…|
   1685 |---+---------------------+--------|           |---+-------…+…|
   1686 #+end_example
   1687 
   1688 To set the width of a column, one field anywhere in the column may
   1689 contain just the string =<N>= where {{{var(N)}}} specifies the width
   1690 as a number of characters.  You control displayed width of columns
   1691 with the following tools:
   1692 
   1693 - {{{kbd(C-c TAB)}}} (~org-table-toggle-column-width~) ::
   1694 
   1695   #+kindex: C-c TAB
   1696   #+findex: org-table-toggle-column-width
   1697   Shrink or expand current column.
   1698 
   1699   If a width cookie specifies a width W for the column, shrinking it
   1700   displays the first W visible characters only.  Otherwise, the column
   1701   is shrunk to a single character.
   1702 
   1703   When called before the first column or after the last one, ask for
   1704   a list of column ranges to operate on.
   1705 
   1706 - {{{kbd(C-u C-c TAB)}}} (~org-table-shrink~) ::
   1707 
   1708   #+kindex: C-u C-c TAB
   1709   #+findex: org-table-shrink
   1710   Shrink all columns with a column width.  Expand the others.
   1711 
   1712 - {{{kbd(C-u C-u C-c TAB)}}} (~org-table-expand~) ::
   1713 
   1714   #+kindex: C-u C-u C-c TAB
   1715   #+findex: org-table-expand
   1716   Expand all columns.
   1717 
   1718 To see the full text of a shrunk field, hold the mouse over it:
   1719 a tool-tip window then shows the full contents of the field.
   1720 Alternatively, {{{kbd(C-h .)}}} (~display-local-help~) reveals them,
   1721 too.  For convenience, any change near the shrunk part of a column
   1722 expands it.
   1723 
   1724 #+vindex: org-startup-shrink-all-tables
   1725 Setting the option ~org-startup-shrink-all-tables~ shrinks all columns
   1726 containing a width cookie in a file the moment it is visited.  You can
   1727 also set this option on a per-file basis with:
   1728 
   1729 : #+STARTUP: shrink
   1730 
   1731 If you would like to overrule the automatic alignment of number-rich
   1732 columns to the right and of string-rich columns to the left, you can
   1733 use =<r>=, =<c>= or =<l>= in a similar fashion.  You may also combine
   1734 alignment and field width like this: =<r10>=.
   1735 
   1736 Lines which only contain these formatting cookies are removed
   1737 automatically upon exporting the document.
   1738 
   1739 ** Column Groups
   1740 :PROPERTIES:
   1741 :DESCRIPTION: Grouping to trigger vertical lines.
   1742 :END:
   1743 #+cindex: grouping columns in tables
   1744 
   1745 When Org exports tables, it does so by default without vertical lines
   1746 because that is visually more satisfying in general.  Occasionally
   1747 however, vertical lines can be useful to structure a table into groups
   1748 of columns, much like horizontal lines can do for groups of rows.  In
   1749 order to specify column groups, you can use a special row where the
   1750 first field contains only =/=.  The further fields can either contain
   1751 =<= to indicate that this column should start a group, =>= to indicate
   1752 the end of a column, or =<>= (no space between =<= and =>=) to make
   1753 a column a group of its own.  Upon export, boundaries between column
   1754 groups are marked with vertical lines.  Here is an example:
   1755 
   1756 #+begin_example
   1757 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
   1758 |---+-----+-----+-----+---------+------------|
   1759 | / |  <  |     |  >  |       < |          > |
   1760 | 1 |  1  |  1  |  1  |       1 |          1 |
   1761 | 2 |  4  |  8  | 16  |  1.4142 |     1.1892 |
   1762 | 3 |  9  | 27  | 81  |  1.7321 |     1.3161 |
   1763 |---+-----+-----+-----+---------+------------|
   1764 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
   1765 #+end_example
   1766 
   1767 It is also sufficient to just insert the column group starters after
   1768 every vertical line you would like to have:
   1769 
   1770 #+begin_example
   1771 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
   1772 |---+-----+-----+-----+---------+------------|
   1773 | / | <   |     |     | <       |            |
   1774 #+end_example
   1775 
   1776 ** The Orgtbl Minor Mode
   1777 :PROPERTIES:
   1778 :DESCRIPTION: The table editor as minor mode.
   1779 :ALT_TITLE: Orgtbl Mode
   1780 :END:
   1781 #+cindex: Orgtbl mode
   1782 #+cindex: minor mode for tables
   1783 
   1784 #+findex: orgtbl-mode
   1785 If you like the intuitive way the Org table editor works, you might
   1786 also want to use it in other modes like Text mode or Mail mode.  The
   1787 minor mode Orgtbl mode makes this possible.  You can always toggle the
   1788 mode with {{{kbd(M-x orgtbl-mode)}}}.  To turn it on by default, for
   1789 example in Message mode, use
   1790 
   1791 #+begin_src emacs-lisp
   1792 (add-hook 'message-mode-hook #'turn-on-orgtbl)
   1793 #+end_src
   1794 
   1795 Furthermore, with some special setup, it is possible to maintain
   1796 tables in arbitrary syntax with Orgtbl mode.  For example, it is
   1797 possible to construct LaTeX tables with the underlying ease and power
   1798 of Orgtbl mode, including spreadsheet capabilities.  For details, see
   1799 [[*Tables in Arbitrary Syntax]].
   1800 
   1801 ** The Spreadsheet
   1802 :PROPERTIES:
   1803 :DESCRIPTION: The table editor has spreadsheet capabilities.
   1804 :END:
   1805 #+cindex: calculations, in tables
   1806 #+cindex: spreadsheet capabilities
   1807 #+cindex: Calc package
   1808 
   1809 The table editor makes use of the Emacs Calc package to implement
   1810 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms
   1811 to derive fields from other fields.  While fully featured, Org's
   1812 implementation is not identical to other spreadsheets.  For example,
   1813 Org knows the concept of a /column formula/ that will be applied to
   1814 all non-header fields in a column without having to copy the formula
   1815 to each relevant field.  There is also a formula debugger, and a
   1816 formula editor with features for highlighting fields in the table
   1817 corresponding to the references at point in the formula, moving these
   1818 references by arrow keys.
   1819 
   1820 *** References
   1821 :PROPERTIES:
   1822 :DESCRIPTION: How to refer to another field or range.
   1823 :END:
   1824 #+cindex: references
   1825 
   1826 To compute fields in the table from other fields, formulas must
   1827 reference other fields or ranges.  In Org, fields can be referenced by
   1828 name, by absolute coordinates, and by relative coordinates.  To find
   1829 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in
   1830 that field, or press {{{kbd(C-c })}}} to toggle the display of a grid.
   1831 
   1832 **** Field references
   1833 :PROPERTIES:
   1834 :UNNUMBERED: notoc
   1835 :END:
   1836 
   1837 #+cindex: field references
   1838 #+cindex: references, to fields
   1839 Formulas can reference the value of another field in two ways.  Like
   1840 in any other spreadsheet, you may reference fields with
   1841 a letter/number combination like =B3=, meaning the second field in the
   1842 third row.  However, Org prefers to use another, more general
   1843 representation that looks like this:[fn:18]
   1844 
   1845 : @ROW$COLUMN
   1846 
   1847 Column specifications can be absolute like =$1=, =$2=, ..., =$N=, or
   1848 relative to the current column, i.e., the column of the field which is
   1849 being computed, like =$+1= or =$-2=.  =$<= and =$>= are immutable
   1850 references to the first and last column, respectively, and you can use
   1851 =$>>>= to indicate the third column from the right.
   1852 
   1853 The row specification only counts data lines and ignores horizontal
   1854 separator lines, or "hlines".  Like with columns, you can use absolute
   1855 row numbers =@1=, =@2=, ..., =@N=, and row numbers relative to the
   1856 current row like =@+3= or =@-1=.  =@<= and =@>= are immutable
   1857 references the first and last row in the table, respectively.  You may
   1858 also specify the row relative to one of the hlines: =@I= refers to the
   1859 first hline, =@II= to the second, etc.  =@-I= refers to the first such
   1860 line above the current line, =@+I= to the first such line below the
   1861 current line.  You can also write =@III+2= which is the second data
   1862 line after the third hline in the table.
   1863 
   1864 =@0= and =$0= refer to the current row and column, respectively, i.e.,
   1865 to the row/column for the field being computed.  Also, if you omit
   1866 either the column or the row part of the reference, the current
   1867 row/column is implied.
   1868 
   1869 Org's references with /unsigned/ numbers are fixed references in the
   1870 sense that if you use the same reference in the formula for two
   1871 different fields, the same field is referenced each time.  Org's
   1872 references with /signed/ numbers are floating references because the
   1873 same reference operator can reference different fields depending on
   1874 the field being calculated by the formula.
   1875 
   1876 Here are a few examples:
   1877 
   1878 #+attr_texinfo: :columns 0.2 0.8
   1879 | =@2$3=   | 2nd row, 3rd column (same as =C2=)                 |
   1880 | =$5=     | column 5 in the current row (same as =E&=)         |
   1881 | =@2=     | current column, row 2                              |
   1882 | =@-1$-3= | field one row up, three columns to the left        |
   1883 | =@-I$2=  | field just under hline above current row, column 2 |
   1884 | =@>$5=   | field in the last row, in column 5                 |
   1885 
   1886 **** Range references
   1887 :PROPERTIES:
   1888 :UNNUMBERED: notoc
   1889 :END:
   1890 
   1891 #+cindex: range references
   1892 #+cindex: references, to ranges
   1893 You may reference a rectangular range of fields by specifying two
   1894 field references connected by two dots =..=.  The ends are included in
   1895 the range.  If both fields are in the current row, you may simply use
   1896 =$2..$7=, but if at least one field is in a different row, you need to
   1897 use the general =@ROW$COLUMN= format at least for the first field,
   1898 i.e., the reference must start with =@= in order to be interpreted
   1899 correctly.  Examples:
   1900 
   1901 #+attr_texinfo: :columns 0.2 0.8
   1902 | =$1..$3=      | first three fields in the current row                          |
   1903 | =$P..$Q=      | range, using column names (see [[*Advanced features]])             |
   1904 | =$<<<..$>>=   | start in third column, continue to the last but one            |
   1905 | =@2$1..@4$3=  | nine fields between these two fields (same as =A2..C4=)        |
   1906 | =@-1$-2..@-1= | 3 fields in the row above, starting from 2 columns on the left |
   1907 | =@I..II=      | between first and second hline, short for =@I..@II=            |
   1908 
   1909 #+texinfo: @noindent
   1910 Range references return a vector of values that can be fed into Calc
   1911 vector functions.  Empty fields in ranges are normally suppressed, so
   1912 that the vector contains only the non-empty fields.  For other options
   1913 with the mode switches =E=, =N= and examples, see [[*Formula syntax for
   1914 Calc]].
   1915 
   1916 **** Field coordinates in formulas
   1917 :PROPERTIES:
   1918 :UNNUMBERED: notoc
   1919 :END:
   1920 
   1921 #+cindex: field coordinates
   1922 #+cindex: coordinates, of field
   1923 #+cindex: row, of field coordinates
   1924 #+cindex: column, of field coordinates
   1925 #+vindex: org-table-current-column
   1926 #+vindex: org-table-current-dline
   1927 One of the very first actions during evaluation of Calc formulas and
   1928 Lisp formulas is to substitute =@#= and =$#= in the formula with the
   1929 row or column number of the field where the current result will go to.
   1930 The traditional Lisp formula equivalents are ~org-table-current-dline~
   1931 and ~org-table-current-column~.  Examples:
   1932 
   1933 - =if(@# % 2, $#, string(""))= ::
   1934 
   1935   Insert column number on odd rows, set field to empty on even rows.
   1936 
   1937 - =$2 = '(identity remote(FOO, @@#$1))= ::
   1938 
   1939   Copy text or values of each row of column 1 of the table named
   1940   {{{var(FOO)}}} into column 2 of the current table.
   1941 
   1942 - =@3 = 2 * remote(FOO, @1$$#)= ::
   1943 
   1944   Insert the doubled value of each column of row 1 of the table
   1945   named {{{var(FOO)}}} into row 3 of the current table.
   1946 
   1947 #+texinfo: @noindent
   1948 For the second and third examples, table {{{var(FOO)}}} must have at
   1949 least as many rows or columns as the current table.  Note that this is
   1950 inefficient[fn:19] for large number of rows.
   1951 
   1952 **** Named references
   1953 :PROPERTIES:
   1954 :UNNUMBERED: notoc
   1955 :END:
   1956 #+cindex: named references
   1957 #+cindex: references, named
   1958 #+cindex: name, of column or field
   1959 #+cindex: constants, in calculations
   1960 #+cindex: @samp{CONSTANTS}, keyword
   1961 #+vindex: org-table-formula-constants
   1962 
   1963 =$name= is interpreted as the name of a column, parameter or constant.
   1964 Constants are defined globally through the variable
   1965 ~org-table-formula-constants~, and locally---for the file---through
   1966 a line like this example:
   1967 
   1968 : #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
   1969 
   1970 #+vindex: constants-unit-system
   1971 #+pindex: constants.el
   1972 Also, properties (see [[*Properties and Columns]]) can be used as
   1973 constants in table formulas: for a property =Xyz= use the name
   1974 =$PROP_Xyz=, and the property will be searched in the current outline
   1975 entry and in the hierarchy above it.  If you have the =constants.el=
   1976 package, it will also be used to resolve constants, including natural
   1977 constants like =$h= for Planck's constant, and units like =$km= for
   1978 kilometers[fn:20].  Column names and parameters can be specified in
   1979 special table lines.  These are described below, see [[*Advanced
   1980 features]].  All names must start with a letter, and further consist
   1981 of letters and numbers.
   1982 
   1983 **** Remote references
   1984 :PROPERTIES:
   1985 :UNNUMBERED: notoc
   1986 :END:
   1987 
   1988 #+cindex: remote references
   1989 #+cindex: references, remote
   1990 #+cindex: references, to a different table
   1991 #+cindex: name, of column or field
   1992 #+cindex: @samp{NAME}, keyword
   1993 You may also reference constants, fields and ranges from a different
   1994 table, either in the current file or even in a different file.  The
   1995 syntax is
   1996 
   1997 : remote(NAME,REF)
   1998 
   1999 #+texinfo: @noindent
   2000 where {{{var(NAME)}}} can be the name of a table in the current file
   2001 as set by a =#+NAME:= line before the table.  It can also be the ID of
   2002 an entry, even in a different file, and the reference then refers to
   2003 the first table in that entry.  {{{var(REF)}}} is an absolute field or
   2004 range reference as described above for example =@3$3= or =$somename=,
   2005 valid in the referenced table.
   2006 
   2007 #+cindex: table indirection
   2008 When {{{var(NAME)}}} has the format =@ROW$COLUMN=, it is substituted
   2009 with the name or ID found in this field of the current table.  For
   2010 example =remote($1, @@>$2)= \Rightarrow =remote(year_2013, @@>$1)=.  The format
   2011 =B3= is not supported because it can not be distinguished from a plain
   2012 table name or ID.
   2013 
   2014 *** Formula syntax for Calc
   2015 :PROPERTIES:
   2016 :DESCRIPTION: Using Calc to compute stuff.
   2017 :END:
   2018 #+cindex: formula syntax, Calc
   2019 #+cindex: syntax, of formulas
   2020 
   2021 A formula can be any algebraic expression understood by the Emacs Calc
   2022 package.  Note that Calc has the non-standard convention that =/= has
   2023 lower precedence than =*=, so that =a/b*c= is interpreted as
   2024 =(a/(b*c))=.  Before evaluation by ~calc-eval~ (see [[info:calc#Calling Calc from Your Programs][Calling Calc from
   2025 Your Lisp Programs]]), variable substitution takes place according to
   2026 the rules described above.
   2027 
   2028 #+cindex: vectors, in table calculations
   2029 The range vectors can be directly fed into the Calc vector functions
   2030 like ~vmean~ and ~vsum~.
   2031 
   2032 #+cindex: format specifier, in spreadsheet
   2033 #+cindex: mode, for Calc
   2034 #+vindex: org-calc-default-modes
   2035 A formula can contain an optional mode string after a semicolon.  This
   2036 string consists of flags to influence Calc and other modes during
   2037 execution.  By default, Org uses the standard Calc modes (precision
   2038 12, angular units degrees, fraction and symbolic modes off).  The
   2039 display format, however, has been changed to =(float 8)= to keep
   2040 tables compact.  The default settings can be configured using the
   2041 variable ~org-calc-default-modes~.
   2042 
   2043 - =p20= ::
   2044 
   2045   Set the internal Calc calculation precision to 20 digits.
   2046 
   2047 - =n3=, =s3=, =e2=, =f4= ::
   2048 
   2049   Normal, scientific, engineering or fixed format of the result of
   2050   Calc passed back to Org.  Calc formatting is unlimited in precision
   2051   as long as the Calc calculation precision is greater.
   2052 
   2053 - =D=, =R= ::
   2054 
   2055   Degree and radian angle modes of Calc.
   2056 
   2057 - =F=, =S= ::
   2058 
   2059   Fraction and symbolic modes of Calc.
   2060 
   2061 - =u= ::
   2062 
   2063   Units simplification mode of Calc.  Calc is also a symbolic
   2064   calculator and is capable of working with values having a unit,
   2065   represented with numerals followed by a unit string in Org table
   2066   cells.  This mode instructs Calc to simplify the units in the
   2067   computed expression before returning the result.
   2068 
   2069 - =T=, =t=, =U= ::
   2070 
   2071   Duration computations in Calc or Lisp, [[*Durations and time values]].
   2072 
   2073 - =E= ::
   2074 
   2075   If and how to consider empty fields.  Without =E= empty fields in
   2076   range references are suppressed so that the Calc vector or Lisp list
   2077   contains only the non-empty fields.  With =E= the empty fields are
   2078   kept.  For empty fields in ranges or empty field references the
   2079   value =nan= (not a number) is used in Calc formulas and the empty
   2080   string is used for Lisp formulas.  Add =N= to use 0 instead for both
   2081   formula types.  For the value of a field the mode =N= has higher
   2082   precedence than =E=.
   2083 
   2084 - =N= ::
   2085 
   2086   Interpret all fields as numbers, use 0 for non-numbers.  See the
   2087   next section to see how this is essential for computations with Lisp
   2088   formulas.  In Calc formulas it is used only occasionally because
   2089   there number strings are already interpreted as numbers without =N=.
   2090 
   2091 - =L= ::
   2092 
   2093   Literal, for Lisp formulas only.  See the next section.
   2094 
   2095 Unless you use large integer numbers or high-precision calculation and
   2096 display for floating point numbers you may alternatively provide
   2097 a ~printf~ format specifier to reformat the Calc result after it has
   2098 been passed back to Org instead of letting Calc already do the
   2099 formatting[fn:21].  A few examples:
   2100 
   2101 | =$1+$2=            | Sum of first and second field                    |
   2102 | =$1+$2;%.2f=       | Same, format result to two decimals              |
   2103 | =exp($2)+exp($1)=  | Math functions can be used                       |
   2104 | =$0;%.1f=          | Reformat current cell to 1 decimal               |
   2105 | =($3-32)*5/9=      | Degrees F \to C conversion                         |
   2106 | =$c/$1/$cm=        | Hz \to cm conversion, using =constants.el=         |
   2107 | =tan($1);Dp3s1=    | Compute in degrees, precision 3, display SCI 1   |
   2108 | =sin($1);Dp3%.1e=  | Same, but use ~printf~ specifier for display     |
   2109 | =vmean($2..$7)=    | Compute column range mean, using vector function |
   2110 | =vmean($2..$7);EN= | Same, but treat empty fields as 0                |
   2111 | =taylor($3,x=7,2)= | Taylor series of $3, at x=7, second degree       |
   2112 
   2113 Calc also contains a complete set of logical operations (see [[info:calc#Logical Operations][Logical
   2114 Operations]]).  For example
   2115 
   2116 - =if($1 < 20, teen, string(""))= ::
   2117 
   2118   ="teen"= if age =$1= is less than 20, else the Org table result
   2119   field is set to empty with the empty string.
   2120 
   2121 - =if("$1" =​= "nan" || "$2" =​= "nan", string(""), $1 + $2); E f-1= ::
   2122 
   2123   Sum of the first two columns.  When at least one of the input fields
   2124   is empty the Org table result field is set to empty.  =E= is
   2125   required to not convert empty fields to 0.  =f-1= is an optional
   2126   Calc format string similar to =%.1f= but leaves empty results empty.
   2127 
   2128 - =if(typeof(vmean($1..$7)) =​= 12, string(""), vmean($1..$7); E= ::
   2129 
   2130   Mean value of a range unless there is any empty field.  Every field
   2131   in the range that is empty is replaced by =nan= which lets =vmean=
   2132   result in =nan=.  Then =typeof == 12= detects the =nan= from ~vmean~
   2133   and the Org table result field is set to empty.  Use this when the
   2134   sample set is expected to never have missing values.
   2135 
   2136 - =if("$1..$7" =​= "[]", string(""), vmean($1..$7))= ::
   2137 
   2138   Mean value of a range with empty fields skipped.  Every field in the
   2139   range that is empty is skipped.  When all fields in the range are
   2140   empty the mean value is not defined and the Org table result field
   2141   is set to empty.  Use this when the sample set can have a variable
   2142   size.
   2143 
   2144 - =vmean($1..$7); EN= ::
   2145 
   2146   To complete the example before: Mean value of a range with empty
   2147   fields counting as samples with value 0.  Use this only when
   2148   incomplete sample sets should be padded with 0 to the full size.
   2149 
   2150 You can add your own Calc functions defined in Emacs Lisp with
   2151 ~defmath~ and use them in formula syntax for Calc.
   2152 
   2153 *** Emacs Lisp forms as formulas
   2154 :PROPERTIES:
   2155 :DESCRIPTION: Writing formulas in Emacs Lisp.
   2156 :ALT_TITLE: Formula syntax for Lisp
   2157 :END:
   2158 #+cindex: Lisp forms, as table formulas
   2159 
   2160 It is also possible to write a formula in Emacs Lisp.  This can be
   2161 useful for string manipulation and control structures, if Calc's
   2162 functionality is not enough.
   2163 
   2164 A formula is evaluated as a Lisp form when it starts with a
   2165 single-quote followed by an opening parenthesis.  Cell table
   2166 references are interpolated into the Lisp form before execution.  The
   2167 evaluation should return either a string or a number.  Evaluation
   2168 modes and a ~printf~ format used to render the returned values can be
   2169 specified after a semicolon.
   2170 
   2171 By default, references are interpolated as literal Lisp strings: the
   2172 field content is replaced in the Lisp form stripped of leading and
   2173 trailing white space and surrounded in double-quotes.  For example:
   2174 
   2175 : '(concat $1 $2)
   2176 
   2177 #+texinfo: @noindent
   2178 concatenates the content of columns 1 and column 2.
   2179 
   2180 When the =N= flag is used, all referenced elements are parsed as
   2181 numbers and interpolated as Lisp numbers, without quotes.  Fields that
   2182 cannot be parsed as numbers are interpolated as zeros.  For example:
   2183 
   2184 : '(+ $1 $2);N
   2185 
   2186 #+texinfo: @noindent
   2187 adds columns 1 and 2, equivalent to Calc's =$1+$2=.  Ranges are
   2188 inserted as space-separated fields, so they can be embedded in list or
   2189 vector syntax.  For example:
   2190 
   2191 : '(apply '+ '($1..$4));N
   2192 
   2193 #+texinfo: @noindent
   2194 computes the sum of columns 1 to 4, like Calc's =vsum($1..$4)=.
   2195 
   2196 When the =L= flag is used, all fields are interpolated literally: the
   2197 cell content is replaced in the Lisp form stripped of leading and
   2198 trailing white space and without quotes.  If a reference is intended
   2199 to be interpreted as a string by the Lisp form, the reference operator
   2200 itself should be enclosed in double-quotes, like ="$3"=.  The =L= flag
   2201 is useful when strings and numbers are used in the same Lisp form.  For
   2202 example:
   2203 
   2204 : '(substring "$1" $2 $3);L
   2205 
   2206 #+texinfo: @noindent
   2207 extracts the part of the string in column 1 between the character
   2208 positions specified in the integers in column 2 and 3 and it is easier
   2209 to read than the equivalent:
   2210 
   2211 : '(substring $1 (string-to-number $2) (string-to-number $3))
   2212 
   2213 *** Durations and time values
   2214 :PROPERTIES:
   2215 :DESCRIPTION: How to compute durations and time values.
   2216 :END:
   2217 #+cindex: duration, computing
   2218 #+cindex: time, computing
   2219 #+vindex: org-table-duration-custom-format
   2220 
   2221 If you want to compute time values use the =T=, =t=, or =U= flag,
   2222 either in Calc formulas or Elisp formulas:
   2223 
   2224 #+begin_example
   2225 |  Task 1 |   Task 2 |    Total |
   2226 |---------+----------+----------|
   2227 |    2:12 |     1:47 | 03:59:00 |
   2228 |    2:12 |     1:47 |    03:59 |
   2229 | 3:02:20 | -2:07:00 |     0.92 |
   2230 ,#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t
   2231 #+end_example
   2232 
   2233 Input duration values must be of the form =HH:MM[:SS]=, where seconds
   2234 are optional.  With the =T= flag, computed durations are displayed as
   2235 =HH:MM:SS= (see the first formula above).  With the =U= flag, seconds
   2236 are omitted so that the result is only =HH:MM= (see second formula
   2237 above).  Zero-padding of the hours field depends upon the value of the
   2238 variable ~org-table-duration-hour-zero-padding~.
   2239 
   2240 With the =t= flag, computed durations are displayed according to the
   2241 value of the option ~org-table-duration-custom-format~, which defaults
   2242 to ~hours~ and displays the result as a fraction of hours (see the
   2243 third formula in the example above).
   2244 
   2245 Negative duration values can be manipulated as well, and integers are
   2246 considered as seconds in addition and subtraction.
   2247 
   2248 *** Field and range formulas
   2249 :PROPERTIES:
   2250 :DESCRIPTION: Formula for specific (ranges of) fields.
   2251 :END:
   2252 #+cindex: field formula
   2253 #+cindex: range formula
   2254 #+cindex: formula, for individual table field
   2255 #+cindex: formula, for range of fields
   2256 
   2257 To assign a formula to a particular field, type it directly into the
   2258 field, preceded by =:==, for example =vsum(@II..III)=.  When you press
   2259 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point
   2260 still in the field, the formula is stored as the formula for this
   2261 field, evaluated, and the current field is replaced with the result.
   2262 
   2263 #+cindex: @samp{TBLFM}, keyword
   2264 Formulas are stored in a special =TBLFM= keyword located directly
   2265 below the table.  If you type the equation in the fourth field of the
   2266 third data line in the table, the formula looks like =@3$4=$1+$2=.
   2267 When inserting/deleting/swapping column and rows with the appropriate
   2268 commands, /absolute references/ (but not relative ones) in stored
   2269 formulas are modified in order to still reference the same field.  To
   2270 avoid this from happening, in particular in range references, anchor
   2271 ranges at the table borders (using =@<=, =@>=, =$<=, =$>=), or at
   2272 hlines using the =@I= notation.  Automatic adaptation of field
   2273 references does not happen if you edit the table structure with normal
   2274 editing commands---you must fix the formulas yourself.
   2275 
   2276 Instead of typing an equation into the field, you may also use the
   2277 following command
   2278 
   2279 - {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
   2280 
   2281   #+kindex: C-u C-c =
   2282   #+findex: org-table-eval-formula
   2283   Install a new formula for the current field.  The command prompts
   2284   for a formula with default taken from the =TBLFM= keyword,
   2285   applies it to the current field, and stores it.
   2286 
   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
   2291 the =TBLFM= keyword directly.
   2292 
   2293 - =$2== ::
   2294 
   2295   Column formula, valid for the entire column.  This is so common that
   2296   Org treats these formulas in a special way, see [[*Column formulas]].
   2297 
   2298 - =@3== ::
   2299 
   2300   Row formula, applies to all fields in the specified row.  =@>==
   2301   means the last row.
   2302 
   2303 - =@1$2..@4$3== ::
   2304 
   2305   Range formula, applies to all fields in the given rectangular range.
   2306   This can also be used to assign a formula to some but not all fields
   2307   in a row.
   2308 
   2309 - =$NAME== ::
   2310 
   2311   Named field, see [[*Advanced features]].
   2312 
   2313 *** Column formulas
   2314 :PROPERTIES:
   2315 :DESCRIPTION: Formulas valid for an entire column.
   2316 :END:
   2317 #+cindex: column formula
   2318 #+cindex: formula, for table column
   2319 
   2320 When you assign a formula to a simple column reference like =$3==, the
   2321 same formula is used in all fields of that column, with the following
   2322 very convenient exceptions: (i) If the table contains horizontal
   2323 separator hlines with rows above and below, everything before the
   2324 first such hline is considered part of the table /header/ and is not
   2325 modified by column formulas.  Therefore a header is mandatory when you
   2326 use column formulas and want to add hlines to group rows, like for
   2327 example to separate a total row at the bottom from the summand rows
   2328 above.  (ii) Fields that already get a value from a field/range
   2329 formula are left alone by column formulas.  These conditions make
   2330 column formulas very easy to use.
   2331 
   2332 To assign a formula to a column, type it directly into any field in
   2333 the column, preceded by an equal sign, like ==$1+$2=.  When you press
   2334 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point
   2335 still in the field, the formula is stored as the formula for the
   2336 current column, evaluated and the current field replaced with the
   2337 result.  If the field contains only ===, the previously stored formula
   2338 for this column is used.  For each column, Org only remembers the most
   2339 recently used formula.  In the =TBLFM= keyword, column formulas look
   2340 like =$4=$1+$2=.  The left-hand side of a column formula can not be
   2341 the name of column, it must be the numeric column reference or =$>=.
   2342 
   2343 Instead of typing an equation into the field, you may also use the
   2344 following command:
   2345 
   2346 - {{{kbd(C-c =)}}} (~org-table-eval-formula~) ::
   2347 
   2348   #+kindex: C-c =
   2349   #+findex: org-table-eval-formula
   2350   Install a new formula for the current column and replace current
   2351   field with the result of the formula.  The command prompts for
   2352   a formula, with default taken from the =TBLFM= keyword, applies it
   2353   to the current field and stores it.  With a numeric prefix argument,
   2354   e.g., {{{kbd(C-5 C-c =)}}}, the command applies it to that many
   2355   consecutive fields in the current column.
   2356 
   2357 *** Lookup functions
   2358 :PROPERTIES:
   2359 :DESCRIPTION: Lookup functions for searching tables.
   2360 :END:
   2361 #+cindex: lookup functions in tables
   2362 #+cindex: table lookup functions
   2363 
   2364 Org has three predefined Emacs Lisp functions for lookups in tables.
   2365 
   2366 - =(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)= ::
   2367 
   2368   #+findex: org-lookup-first
   2369   Searches for the first element {{{var(S)}}} in list
   2370   {{{var(S-LIST)}}} for which
   2371   #+begin_src emacs-lisp
   2372   (PREDICATE VAL S)
   2373   #+end_src
   2374   is non-~nil~; returns the value from the corresponding position in
   2375   list {{{var(R-LIST)}}}.  The default {{{var(PREDICATE)}}} is
   2376   ~equal~.  Note that the parameters {{{var(VAL)}}} and {{{var(S)}}}
   2377   are passed to {{{var(PREDICATE)}}} in the same order as the
   2378   corresponding parameters are in the call to ~org-lookup-first~,
   2379   where {{{var(VAL)}}} precedes {{{var(S-LIST)}}}.  If
   2380   {{{var(R-LIST)}}} is ~nil~, the matching element {{{var(S)}}} of
   2381   {{{var(S-LIST)}}} is returned.
   2382 
   2383 - =(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)= ::
   2384 
   2385   #+findex: org-lookup-last
   2386   Similar to ~org-lookup-first~ above, but searches for the /last/
   2387   element for which {{{var(PREDICATE)}}} is non-~nil~.
   2388 
   2389 - =(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)= ::
   2390 
   2391   #+findex: org-lookup-all
   2392   Similar to ~org-lookup-first~, but searches for /all/ elements for
   2393   which {{{var(PREDICATE)}}} is non-~nil~, and returns /all/
   2394   corresponding values.  This function can not be used by itself in
   2395   a formula, because it returns a list of values.  However, powerful
   2396   lookups can be built when this function is combined with other Emacs
   2397   Lisp functions.
   2398 
   2399 If the ranges used in these functions contain empty fields, the =E=
   2400 mode for the formula should usually be specified: otherwise empty
   2401 fields are not included in {{{var(S-LIST)}}} and/or {{{var(R-LIST)}}}
   2402 which can, for example, result in an incorrect mapping from an element
   2403 of {{{var(S-LIST)}}} to the corresponding element of
   2404 {{{var(R-LIST)}}}.
   2405 
   2406 These three functions can be used to implement associative arrays,
   2407 count matching cells, rank results, group data, etc.  For practical
   2408 examples see [[https://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]].
   2409 
   2410 *** Editing and debugging formulas
   2411 :PROPERTIES:
   2412 :DESCRIPTION: Fixing formulas.
   2413 :END:
   2414 #+cindex: formula editing
   2415 #+cindex: editing, of table formulas
   2416 
   2417 #+vindex: org-table-use-standard-references
   2418 You can edit individual formulas in the minibuffer or directly in the
   2419 field.  Org can also prepare a special buffer with all active formulas
   2420 of a table.  When offering a formula for editing, Org converts
   2421 references to the standard format (like =B3= or =D&=) if possible.  If
   2422 you prefer to only work with the internal format (like =@3$2= or
   2423 =$4=), configure the variable ~org-table-use-standard-references~.
   2424 
   2425 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
   2426 
   2427   #+kindex: C-c =
   2428   #+kindex: C-u C-c =
   2429   #+findex: org-table-eval-formula
   2430   Edit the formula associated with the current column/field in the
   2431   minibuffer.  See [[*Column formulas]], and [[*Field and range formulas]].
   2432 
   2433 - {{{kbd(C-u C-u C-c =)}}} (~org-table-eval-formula~) ::
   2434 
   2435   #+kindex: C-u C-u C-c =
   2436   #+findex: org-table-eval-formula
   2437   Re-insert the active formula (either a field formula, or a column
   2438   formula) into the current field, so that you can edit it directly in
   2439   the field.  The advantage over editing in the minibuffer is that you
   2440   can use the command {{{kbd(C-c ?)}}}.
   2441 
   2442 - {{{kbd(C-c ?)}}} (~org-table-field-info~) ::
   2443 
   2444   #+kindex: C-c ?
   2445   #+findex: org-table-field-info
   2446   While editing a formula in a table field, highlight the field(s)
   2447   referenced by the reference at point position in the formula.
   2448 
   2449 - {{{kbd(C-c })}}} (~org-table-toggle-coordinate-overlays~) ::
   2450 
   2451   #+kindex: C-c @}
   2452   #+findex: org-table-toggle-coordinate-overlays
   2453   Toggle the display of row and column numbers for a table, using
   2454   overlays.  These are updated each time the table is aligned; you can
   2455   force it with {{{kbd(C-c C-c)}}}.
   2456 
   2457 - {{{kbd(C-c {)}}} (~org-table-toggle-formula-debugger~) ::
   2458 
   2459   #+kindex: C-c @{
   2460   #+findex: org-table-toggle-formula-debugger
   2461   Toggle the formula debugger on and off.  See below.
   2462 
   2463 - {{{kbd(C-c ')}}} (~org-table-edit-formulas~) ::
   2464 
   2465   #+kindex: C-c '
   2466   #+findex: org-table-edit-formulas
   2467   Edit all formulas for the current table in a special buffer, where
   2468   the formulas are displayed one per line.  If the current field has
   2469   an active formula, point in the formula editor marks it.  While
   2470   inside the special buffer, Org automatically highlights any field or
   2471   range reference at point position.  You may edit, remove and add
   2472   formulas, and use the following commands:
   2473 
   2474   - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}} (~org-table-fedit-finish~) ::
   2475 
   2476     #+kindex: C-x C-s
   2477     #+kindex: C-c C-c
   2478     #+findex: org-table-fedit-finish
   2479     Exit the formula editor and store the modified formulas.  With
   2480     {{{kbd(C-u)}}} prefix, also apply the new formulas to the
   2481     entire table.
   2482 
   2483   - {{{kbd(C-c C-q)}}} (~org-table-fedit-abort~) ::
   2484 
   2485     #+kindex: C-c C-q
   2486     #+findex: org-table-fedit-abort
   2487     Exit the formula editor without installing changes.
   2488 
   2489   - {{{kbd(C-c C-r)}}} (~org-table-fedit-toggle-ref-type~) ::
   2490 
   2491     #+kindex: C-c C-r
   2492     #+findex: org-table-fedit-toggle-ref-type
   2493     Toggle all references in the formula editor between standard (like
   2494     =B3=) and internal (like =@3$2=).
   2495 
   2496   - {{{kbd(TAB)}}} (~org-table-fedit-lisp-indent~) ::
   2497 
   2498     #+kindex: TAB
   2499     #+findex: org-table-fedit-lisp-indent
   2500     Pretty-print or indent Lisp formula at point.  When in a line
   2501     containing a Lisp formula, format the formula according to Emacs
   2502     Lisp rules.  Another {{{kbd(TAB)}}} collapses the formula back
   2503     again.  In the open formula, {{{kbd(TAB)}}} re-indents just like
   2504     in Emacs Lisp mode.
   2505 
   2506   - {{{kbd(M-TAB)}}} (~lisp-complete-symbol~) ::
   2507 
   2508     #+kindex: M-TAB
   2509     #+findex: lisp-complete-symbol
   2510     Complete Lisp symbols, just like in Emacs Lisp mode.
   2511 
   2512   - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}}, {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
   2513 
   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     Shift the reference at point.  For example, if the reference is
   2523     =B3= and you press {{{kbd(S-RIGHT)}}}, it becomes =C3=.  This also
   2524     works for relative references and for hline references.
   2525 
   2526   - {{{kbd(M-S-UP)}}} (~org-table-fedit-line-up~) ::
   2527 
   2528     #+kindex: M-S-UP
   2529     #+findex: org-table-fedit-line-up
   2530     Move the test line for column formulas up in the Org buffer.
   2531 
   2532   - {{{kbd(M-S-DOWN)}}} (~org-table-fedit-line-down~) ::
   2533 
   2534     #+kindex: M-S-DOWN
   2535     #+findex: org-table-fedit-line-down
   2536     Move the test line for column formulas down in the Org buffer.
   2537 
   2538   - {{{kbd(M-UP)}}} (~org-table-fedit-scroll-up~) ::
   2539 
   2540     #+kindex: M-UP
   2541     #+findex: org-table-fedit-scroll-up
   2542     Scroll up the window displaying the table.
   2543 
   2544   - {{{kbd(M-DOWN)}}} (~org-table-fedit-scroll-down~) ::
   2545 
   2546     #+kindex: M-DOWN
   2547     #+findex: org-table-fedit-scroll-down
   2548     Scroll down the window displaying the table.
   2549 
   2550   - {{{kbd(C-c })}}} ::
   2551 
   2552     #+kindex: C-c @}
   2553     #+findex: org-table-toggle-coordinate-overlays
   2554     Turn the coordinate grid in the table on and off.
   2555 
   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 =TBLFM=
   2558 keyword line.  During the next recalculation, the field will be filled
   2559 again.  To remove a formula from a field, you have to give an empty
   2560 reply when prompted for the formula, or to edit the =TBLFM= keyword.
   2561 
   2562 #+kindex: C-c C-c
   2563 You may edit the =TBLFM= keyword directly and re-apply the changed
   2564 equations with {{{kbd(C-c C-c)}}} in that line or with the normal
   2565 recalculation commands in the table.
   2566 
   2567 **** Using multiple =TBLFM= lines
   2568 :PROPERTIES:
   2569 :UNNUMBERED: notoc
   2570 :END:
   2571 #+cindex: multiple formula lines
   2572 #+cindex: @samp{TBLFM} keywords, multiple
   2573 #+cindex: @samp{TBLFM}, switching
   2574 
   2575 #+kindex: C-c C-c
   2576 You may apply the formula temporarily.  This is useful when you want
   2577 to switch the formula applied to the table.  Place multiple =TBLFM=
   2578 keywords right after the table, and then press {{{kbd(C-c C-c)}}} on
   2579 the formula to apply.  Here is an example:
   2580 
   2581 #+begin_example
   2582 | x | y |
   2583 |---+---|
   2584 | 1 |   |
   2585 | 2 |   |
   2586 ,#+TBLFM: $2=$1*1
   2587 ,#+TBLFM: $2=$1*2
   2588 #+end_example
   2589 
   2590 #+texinfo: @noindent
   2591 Pressing {{{kbd(C-c C-c)}}} in the line of =#+TBLFM: $2=$1*2= yields:
   2592 
   2593 #+begin_example
   2594 | x | y |
   2595 |---+---|
   2596 | 1 | 2 |
   2597 | 2 | 4 |
   2598 ,#+TBLFM: $2=$1*1
   2599 ,#+TBLFM: $2=$1*2
   2600 #+end_example
   2601 
   2602 #+texinfo: @noindent
   2603 If you recalculate this table, with {{{kbd(C-u C-c *)}}}, for example,
   2604 you get the following result from applying only the first =TBLFM=
   2605 keyword.
   2606 
   2607 #+begin_example
   2608 | x | y |
   2609 |---+---|
   2610 | 1 | 1 |
   2611 | 2 | 2 |
   2612 ,#+TBLFM: $2=$1*1
   2613 ,#+TBLFM: $2=$1*2
   2614 #+end_example
   2615 
   2616 **** Debugging formulas
   2617 :PROPERTIES:
   2618 :UNNUMBERED: notoc
   2619 :END:
   2620 #+cindex: formula debugging
   2621 #+cindex: debugging, of table formulas
   2622 
   2623 When the evaluation of a formula leads to an error, the field content
   2624 becomes the string =#ERROR=.  If you would like to see what is going
   2625 on during variable substitution and calculation in order to find
   2626 a bug, turn on formula debugging in the Tbl menu and repeat the
   2627 calculation, for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in
   2628 a field.  Detailed information are displayed.
   2629 
   2630 *** Updating the table
   2631 :PROPERTIES:
   2632 :DESCRIPTION: Recomputing all dependent fields.
   2633 :END:
   2634 #+cindex: recomputing table fields
   2635 #+cindex: updating, table
   2636 
   2637 Recalculation of a table is normally not automatic, but needs to be
   2638 triggered by a command.  To make recalculation at least
   2639 semi-automatic, see [[*Advanced features]].
   2640 
   2641 In order to recalculate a line of a table or the entire table, use the
   2642 following commands:
   2643 
   2644 - {{{kbd(C-c *)}}} (~org-table-recalculate~) ::
   2645 
   2646   #+kindex: C-c *
   2647   #+findex: org-table-recalculate
   2648   Recalculate the current row by first applying the stored column
   2649   formulas from left to right, and all field/range formulas in the
   2650   current row.
   2651 
   2652 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} ::
   2653 
   2654   #+kindex: C-u C-c *
   2655   #+kindex: C-u C-c C-c
   2656   Recompute the entire table, line by line.  Any lines before the
   2657   first hline are left alone, assuming that these are part of the
   2658   table header.
   2659 
   2660 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}} (~org-table-iterate~) ::
   2661 
   2662   #+kindex: C-u C-u C-c *
   2663   #+kindex: C-u C-u C-c C-c
   2664   #+findex: org-table-iterate
   2665   Iterate the table by recomputing it until no further changes occur.
   2666   This may be necessary if some computed fields use the value of other
   2667   fields that are computed /later/ in the calculation sequence.
   2668 
   2669 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} ::
   2670 
   2671   #+findex: org-table-recalculate-buffer-tables
   2672   Recompute all tables in the current buffer.
   2673 
   2674 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} ::
   2675 
   2676   #+findex: org-table-iterate-buffer-tables
   2677   Iterate all tables in the current buffer, in order to converge
   2678   table-to-table dependencies.
   2679 
   2680 *** Advanced features
   2681 :PROPERTIES:
   2682 :DESCRIPTION: Field and column names, automatic recalculation...
   2683 :END:
   2684 
   2685 If you want the recalculation of fields to happen automatically, or if
   2686 you want to be able to assign /names/[fn:22] to fields and columns,
   2687 you need to reserve the first column of the table for special marking
   2688 characters.
   2689 
   2690 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
   2691 
   2692   #+kindex: C-#
   2693   #+findex: org-table-rotate-recalc-marks
   2694   Rotate the calculation mark in first column through the states =#=,
   2695   =*=, =!=, =$=.  When there is an active region, change all marks in
   2696   the region.
   2697 
   2698 Here is an example of a table that collects exam results of students
   2699 and makes use of these features:
   2700 
   2701 #+begin_example
   2702 |---+---------+--------+--------+--------+-------+------|
   2703 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
   2704 |---+---------+--------+--------+--------+-------+------|
   2705 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
   2706 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
   2707 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
   2708 |---+---------+--------+--------+--------+-------+------|
   2709 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
   2710 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
   2711 |---+---------+--------+--------+--------+-------+------|
   2712 |   | Average |        |        |        |  25.0 |      |
   2713 | ^ |         |        |        |        |    at |      |
   2714 | $ | max=50  |        |        |        |       |      |
   2715 |---+---------+--------+--------+--------+-------+------|
   2716 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f
   2717 #+end_example
   2718 
   2719 #+attr_texinfo: :tag Important
   2720 #+begin_quote
   2721 Please note that for these special tables, recalculating the table
   2722 with {{{kbd(C-u C-c *)}}} only affects rows that are marked =#= or
   2723 =*=, and fields that have a formula assigned to the field itself.  The
   2724 column formulas are not applied in rows with empty first field.
   2725 #+end_quote
   2726 
   2727 #+cindex: marking characters, tables
   2728 The marking characters have the following meaning:
   2729 
   2730 - =!= ::
   2731 
   2732   The fields in this line define names for the columns, so that you
   2733   may refer to a column as =$Tot= instead of =$6=.
   2734 
   2735 - =^= ::
   2736 
   2737   This row defines names for the fields /above/ the row.  With such
   2738   a definition, any formula in the table may use =$m1= to refer to the
   2739   value =10=.  Also, if you assign a formula to a names field, it is
   2740   stored as =$name = ...=.
   2741 
   2742 - =_= ::
   2743 
   2744   Similar to =^=, but defines names for the fields in the row /below/.
   2745 
   2746 - =$= ::
   2747 
   2748   Fields in this row can define /parameters/ for formulas.  For
   2749   example, if a field in a =$= row contains =max=50=, then formulas in
   2750   this table can refer to the value 50 using =$max=.  Parameters work
   2751   exactly like constants, only that they can be defined on a per-table
   2752   basis.
   2753 
   2754 - =#= ::
   2755 
   2756   Fields in this row are automatically recalculated when pressing
   2757   {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(S-TAB)}}} in this row.
   2758   Also, this row is selected for a global recalculation with
   2759   {{{kbd(C-u C-c *)}}}.  Unmarked lines are left alone by this
   2760   command.
   2761 
   2762 - =*= ::
   2763 
   2764   Selects this line for global recalculation with {{{kbd(C-u C-c
   2765   *)}}}, but not for automatic recalculation.  Use this when automatic
   2766   recalculation slows down editing too much.
   2767 
   2768 - =/= ::
   2769 
   2770   Do not export this line.  Useful for lines that contain the
   2771   narrowing =<N>= markers or column group markers.
   2772 
   2773 Finally, just to whet your appetite for what can be done with the
   2774 fantastic Calc package, here is a table that computes the Taylor
   2775 series of degree n at location x for a couple of functions.
   2776 
   2777 #+begin_example
   2778 |---+-------------+---+-----+--------------------------------------|
   2779 |   | Func        | n | x   | Result                               |
   2780 |---+-------------+---+-----+--------------------------------------|
   2781 | # | exp(x)      | 1 | x   | 1 + x                                |
   2782 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
   2783 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
   2784 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
   2785 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
   2786 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
   2787 |---+-------------+---+-----+--------------------------------------|
   2788 ,#+TBLFM: $5=taylor($2,$4,$3);n3
   2789 #+end_example
   2790 
   2791 ** Org Plot
   2792 :PROPERTIES:
   2793 :DESCRIPTION: Plotting from Org tables.
   2794 :END:
   2795 #+cindex: graph, in tables
   2796 #+cindex: plot tables using Gnuplot
   2797 
   2798 Org Plot can produce graphs of information stored in Org tables,
   2799 either graphically or in ASCII art.
   2800 
   2801 *** Graphical plots using Gnuplot
   2802 :PROPERTIES:
   2803 :UNNUMBERED: notoc
   2804 :END:
   2805 
   2806 #+cindex: @samp{PLOT}, keyword
   2807 Org Plot can produce 2D and 3D graphs of information stored in Org
   2808 tables using [[https://www.gnuplot.info/][Gnuplot]] and [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][Gnuplot mode]].  To see this in action, ensure
   2809 that you have both Gnuplot and Gnuplot mode installed on your system,
   2810 then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the
   2811 following table.
   2812 
   2813 #+begin_example
   2814 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
   2815 | Sede      | Max cites | H-index |
   2816 |-----------+-----------+---------|
   2817 | Chile     |    257.72 |   21.39 |
   2818 | Leeds     |    165.77 |   19.68 |
   2819 | Sao Paolo |     71.00 |   11.50 |
   2820 | Stockholm |    134.19 |   14.33 |
   2821 | Morelia   |    257.56 |   17.67 |
   2822 #+end_example
   2823 
   2824 Org Plot supports a range of plot types, and provides the ability to add more.
   2825 For example, a radar plot can be generated like so:
   2826 #+begin_example
   2827 ,#+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4
   2828 | Format            | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility |
   2829 |-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------|
   2830 | Word              |                    2 |              4 |                 4 |              2 |            3 |                   2 |           2 |
   2831 | LaTeX             |                    4 |              1 |                 1 |              3 |            2 |                   4 |           3 |
   2832 | Org Mode          |                    4 |              2 |               3.5 |              1 |            4 |                   4 |           4 |
   2833 | Markdown          |                    1 |              3 |                 3 |              4 |            3 |                   3 |           1 |
   2834 | Markdown + Pandoc |                  2.5 |            2.5 |               2.5 |              3 |            3 |                   3 |           2 |
   2835 #+end_example
   2836 
   2837 Notice that Org Plot is smart enough to apply the table's headers as
   2838 labels.  Further control over the labels, type, content, and
   2839 appearance of plots can be exercised through the =PLOT= keyword
   2840 preceding a table.  See below for a complete list of Org Plot options.
   2841 For more information and examples see the [[https://orgmode.org/worg/org-tutorials/org-plot.html][Org Plot tutorial]].
   2842 
   2843 **** Plot options
   2844 :PROPERTIES:
   2845 :UNNUMBERED: notoc
   2846 :END:
   2847 
   2848 - =set= ::
   2849 
   2850   Specify any Gnuplot option to be set when graphing.
   2851 
   2852 - =title= ::
   2853 
   2854   Specify the title of the plot.
   2855 
   2856 - =ind= ::
   2857 
   2858   Specify which column of the table to use as the =x= axis.
   2859 
   2860 - =deps= ::
   2861 
   2862   Specify the columns to graph as a Lisp style list, surrounded by
   2863   parentheses and separated by spaces for example =dep:(3 4)= to graph
   2864   the third and fourth columns.  Defaults to graphing all other
   2865   columns aside from the =ind= column.
   2866 
   2867 - transpose ::
   2868 
   2869   When =y=, =yes=, or =t= attempt to transpose the table data before
   2870   plotting.  Also recognises the shorthand option =trans=.
   2871 
   2872 - =type= ::
   2873 
   2874   Specify the type of the plot, by default one of  =2d=, =3d=, =radar=, or =grid=.
   2875   Available types can be customised with ~org-plot/preset-plot-types~.
   2876 
   2877 - =with= ::
   2878 
   2879   Specify a =with= option to be inserted for every column being
   2880   plotted, e.g., =lines=, =points=, =boxes=, =impulses=.  Defaults to
   2881   =lines=.
   2882 
   2883 - =file= ::
   2884 
   2885   If you want to plot to a file, specify
   2886   ="path/to/desired/output-file"=.
   2887 
   2888 - =labels= ::
   2889 
   2890   List of labels to be used for the =deps=.  Defaults to the column
   2891   headers if they exist.
   2892 
   2893 - =line= ::
   2894 
   2895   Specify an entire line to be inserted in the Gnuplot script.
   2896 
   2897 - =map= ::
   2898 
   2899   When plotting =3d= or =grid= types, set this to =t= to graph a flat
   2900   mapping rather than a =3d= slope.
   2901 
   2902 - min ::
   2903 
   2904   Provides a minimum axis value that may be used by a plot type.
   2905   Implicitly assumes the =y= axis is being referred to.  Can
   2906   explicitly provide a value for a either the =x= or =y= axis with
   2907   =xmin= and =ymin=.
   2908 
   2909 - max ::
   2910 
   2911   Provides a maximum axis value that may be used by a plot type.
   2912   Implicitly assumes the =y= axis is being referred to.  Can
   2913   explicitly provide a value for a either the =x= or =y= axis with
   2914   =xmax= and =ymax=.
   2915 
   2916 - ticks ::
   2917 
   2918   Provides a desired number of axis ticks to display, that may be used
   2919   by a plot type.  If none is given a plot type that requires ticks
   2920   will use ~org--plot/sensible-tick-num~ to try to determine a good
   2921   value.
   2922 
   2923 - =timefmt= ::
   2924 
   2925   Specify format of Org mode timestamps as they will be parsed by
   2926   Gnuplot.  Defaults to =%Y-%m-%d-%H:%M:%S=.
   2927 
   2928 - =script= ::
   2929 
   2930   If you want total control, you can specify a script file---place the
   2931   file name between double-quotes---which will be used to plot.
   2932   Before plotting, every instance of =$datafile= in the specified
   2933   script will be replaced with the path to the generated data file.
   2934   Note: even if you set this option, you may still want to specify the
   2935   plot type, as that can impact the content of the data file.
   2936 
   2937 *** ASCII bar plots
   2938 :PROPERTIES:
   2939 :UNNUMBERED: notoc
   2940 :END:
   2941 
   2942 While point is on a column, typing {{{kbd(C-c " a)}}} or {{{kbd(M-x
   2943 orgtbl-ascii-plot)}}} create a new column containing an ASCII-art bars
   2944 plot.  The plot is implemented through a regular column formula.  When
   2945 the source column changes, the bar plot may be updated by refreshing
   2946 the table, for example typing {{{kbd(C-u C-c *)}}}.
   2947 
   2948 #+begin_example
   2949 | Sede          | Max cites |              |
   2950 |---------------+-----------+--------------|
   2951 | Chile         |    257.72 | WWWWWWWWWWWW |
   2952 | Leeds         |    165.77 | WWWWWWWh     |
   2953 | Sao Paolo     |     71.00 | WWW;         |
   2954 | Stockholm     |    134.19 | WWWWWW:      |
   2955 | Morelia       |    257.56 | WWWWWWWWWWWH |
   2956 | Rochefourchat |      0.00 |              |
   2957 ,#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
   2958 #+end_example
   2959 
   2960 The formula is an Elisp call.
   2961 
   2962 #+attr_texinfo: :options orgtbl-ascii-draw value min max &optional width
   2963 #+begin_defun
   2964 Draw an ASCII bar in a table.
   2965 
   2966 {{{var(VALUE)}}} is the value to plot.
   2967 
   2968 {{{var(MIN)}}} is the value displayed as an empty bar.  {{{var(MAX)}}}
   2969 is the value filling all the {{{var(WIDTH)}}}.  Sources values outside
   2970 this range are displayed as =too small= or =too large=.
   2971 
   2972 {{{var(WIDTH)}}} is the number of characters of the bar plot.  It
   2973 defaults to =12=.
   2974 #+end_defun
   2975 
   2976 * Hyperlinks
   2977 :PROPERTIES:
   2978 :DESCRIPTION: Notes in context.
   2979 :END:
   2980 #+cindex: hyperlinks
   2981 
   2982 Like HTML, Org provides support for links inside a file, external
   2983 links to other files, Usenet articles, emails, and much more.
   2984 
   2985 ** Link Format
   2986 :PROPERTIES:
   2987 :DESCRIPTION: How links in Org are formatted.
   2988 :END:
   2989 #+cindex: link format
   2990 #+cindex: format, of links
   2991 
   2992 #+cindex: angle bracket links
   2993 #+cindex: plain links
   2994 Org recognizes plain URIs, possibly wrapped within angle
   2995 brackets[fn:23], and activate them as clickable links.
   2996 
   2997 #+cindex: bracket links
   2998 The general link format, however, looks like this:
   2999 
   3000 : [[LINK][DESCRIPTION]]
   3001 
   3002 #+texinfo: @noindent
   3003 or alternatively
   3004 
   3005 : [[LINK]]
   3006 
   3007 #+cindex: escape syntax, for links
   3008 #+cindex: backslashes, in links
   3009 Some =\=, =[= and =]= characters in the {{{var(LINK)}}} part need to
   3010 be "escaped", i.e., preceded by another =\= character.  More
   3011 specifically, the following characters, and only them, must be
   3012 escaped:
   3013 
   3014 1. all =[= and =]= characters,
   3015 2. every =\= character preceding either =]= or =[=,
   3016 3. every =\= character at the end of the link.
   3017 
   3018 #+findex: org-link-escape
   3019 Functions inserting links (see [[*Handling Links]]) properly escape
   3020 ambiguous characters.  You only need to bother about the rules above
   3021 when inserting directly, or yanking, a URI within square brackets.
   3022 When in doubt, you may use the function ~org-link-escape~, which turns
   3023 a link string into its escaped form.
   3024 
   3025 Once a link in the buffer is complete, with all brackets present, Org
   3026 changes the display so that =DESCRIPTION= is displayed instead of
   3027 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=.
   3028 Links are highlighted in the ~org-link~ face, which, by default, is an
   3029 underlined face.
   3030 
   3031 You can directly edit the visible part of a link.  This can be either
   3032 the {{{var(LINK)}}} part, if there is no description, or the
   3033 {{{var(DESCRIPTION)}}} part otherwise.  To also edit the invisible
   3034 {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}} with point on the link
   3035 (see [[*Handling Links]]).
   3036 
   3037 If you place point at the beginning or just behind the end of the
   3038 displayed text and press {{{kbd(BS)}}}, you remove
   3039 the---invisible---bracket at that location[fn:24].  This makes the link
   3040 incomplete and the internals are again displayed as plain text.
   3041 Inserting the missing bracket hides the link internals again.  To show
   3042 the internal structure of all links, use the menu: Org \rarr Hyperlinks \rarr
   3043 Literal links.
   3044 
   3045 ** Internal Links
   3046 :PROPERTIES:
   3047 :DESCRIPTION: Links to other places in the current file.
   3048 :END:
   3049 #+cindex: internal links
   3050 #+cindex: links, internal
   3051 
   3052 A link that does not look like a URL---i.e., does not start with
   3053 a known scheme or a file name---refers to the current document.  You
   3054 can follow it with {{{kbd(C-c C-o)}}} when point is on the link, or
   3055 with a mouse click (see [[*Handling Links]]).
   3056 
   3057 #+cindex: @samp{CUSTOM_ID}, property
   3058 Org provides several refinements to internal navigation within
   3059 a document.  Most notably, a construct like =[[#my-custom-id]]=
   3060 specifically targets the entry with the =CUSTOM_ID= property set to
   3061 =my-custom-id=.  Also, an internal link looking like =[[*Some
   3062 section]]= points to a headline with the name =Some section=[fn:25].
   3063 
   3064 #+cindex: targets, for links
   3065 When the link does not belong to any of the cases above, Org looks for
   3066 a /dedicated target/: the same string in double angular brackets, like
   3067 =<<My Target>>=.
   3068 
   3069 #+cindex: @samp{NAME}, keyword
   3070 If no dedicated target exists, the link tries to match the exact name
   3071 of an element within the buffer.  Naming is done, unsurprisingly, with
   3072 the =NAME= keyword, which has to be put in the line before the element
   3073 it refers to, as in the following example
   3074 
   3075 #+begin_example
   3076 ,#+NAME: My Target
   3077 | a  | table      |
   3078 |----+------------|
   3079 | of | four cells |
   3080 #+end_example
   3081 
   3082 #+vindex: org-link-search-must-match-exact-headline
   3083 Ultimately, if none of the above succeeds, Org searches for a headline
   3084 that is exactly the link text but may also include a TODO keyword and
   3085 tags, or initiates a plain text search, according to the value of
   3086 ~org-link-search-must-match-exact-headline~.
   3087 
   3088 Note that you must make sure custom IDs, dedicated targets, and names
   3089 are unique throughout the document.  Org provides a linter to assist
   3090 you in the process, if needed.  See [[*Org Syntax]].
   3091 
   3092 During export, internal links are used to mark objects and assign them
   3093 a number.  Marked objects are then referenced by links pointing to
   3094 them.  In particular, links without a description appear as the number
   3095 assigned to the marked object[fn:26].  In the following excerpt from
   3096 an Org buffer
   3097 
   3098 #+begin_example
   3099 1. one item
   3100 2. <<target>>another item
   3101 Here we refer to item [[target]].
   3102 #+end_example
   3103 
   3104 #+texinfo: @noindent
   3105 The last sentence will appear as =Here we refer to item 2= when
   3106 exported.
   3107 
   3108 In non-Org files, the search looks for the words in the link text.  In
   3109 the above example the search would be for =target=.
   3110 
   3111 Following a link pushes a mark onto Org's own mark ring.  You can
   3112 return to the previous position with {{{kbd(C-c &)}}}.  Using this
   3113 command several times in direct succession goes back to positions
   3114 recorded earlier.
   3115 
   3116 ** Radio Targets
   3117 :PROPERTIES:
   3118 :DESCRIPTION: Make targets trigger links in plain text.
   3119 :END:
   3120 #+cindex: radio targets
   3121 #+cindex: targets, radio
   3122 #+cindex: links, radio targets
   3123 
   3124 Org can automatically turn any occurrences of certain target names in
   3125 normal text into a link.  So without explicitly creating a link, the
   3126 text connects to the target radioing its position.  Radio targets are
   3127 enclosed by triple angular brackets.  For example, a target =<<<My
   3128 Target>>>= causes each occurrence of =my target= in normal text to
   3129 become activated as a link.  The Org file is scanned automatically for
   3130 radio targets only when the file is first loaded into Emacs.  To
   3131 update the target list during editing, press {{{kbd(C-c C-c)}}} with
   3132 point on or at a target.
   3133 
   3134 ** External Links
   3135 :PROPERTIES:
   3136 :DESCRIPTION: URL-like links to the world.
   3137 :END:
   3138 #+cindex: links, external
   3139 #+cindex: external links
   3140 #+cindex: attachment links
   3141 #+cindex: BBDB links
   3142 #+cindex: Elisp links
   3143 #+cindex: file links
   3144 #+cindex: Gnus links
   3145 #+cindex: Help links
   3146 #+cindex: IRC links
   3147 #+cindex: Info links
   3148 #+cindex: MH-E links
   3149 #+cindex: Rmail links
   3150 #+cindex: shell links
   3151 #+cindex: URL links
   3152 #+cindex: Usenet links
   3153 
   3154 Org supports links to files, websites, Usenet and email messages, BBDB
   3155 database entries and links to both IRC conversations and their logs.
   3156 External links are URL-like locators.  They start with a short
   3157 identifying string followed by a colon.  There can be no space after
   3158 the colon.
   3159 
   3160 Here is the full set of built-in link types:
   3161 
   3162 - =file= ::
   3163 
   3164   File links.  File name may be remote, absolute, or relative.
   3165 
   3166   Additionally, you can specify a line number, or a text search.
   3167   In Org files, you may link to a headline name, a custom ID, or a
   3168   code reference instead.
   3169 
   3170   As a special case, "file" prefix may be omitted if the file name
   3171   is complete, e.g., it starts with =./=, or =/=.
   3172 
   3173 - =attachment= ::
   3174 
   3175   Same as file links but for files and folders attached to the current
   3176   node (see [[*Attachments]]).  Attachment links are intended to behave
   3177   exactly as file links but for files relative to the attachment
   3178   directory.
   3179 
   3180 - =bbdb= ::
   3181 
   3182   Link to a BBDB record, with possible regexp completion.
   3183 
   3184 - =docview= ::
   3185 
   3186   Link to a document opened with DocView mode.  You may specify a page
   3187   number.
   3188 
   3189 - =doi= ::
   3190 
   3191   Link to an electronic resource, through its handle.
   3192 
   3193 - =elisp= ::
   3194 
   3195   Execute an Elisp command upon activation.
   3196 
   3197 - =gnus=, =rmail=, =mhe= ::
   3198 
   3199   Link to messages or folders from a given Emacs' MUA.
   3200 
   3201 - =help= ::
   3202 
   3203   Display documentation of a symbol in =*Help*= buffer.
   3204 
   3205 - =http=, =https= ::
   3206 
   3207   Web links.
   3208 
   3209 - =id= ::
   3210 
   3211   Link to a specific headline by its ID property, in an Org file.
   3212 
   3213 - =info= ::
   3214 
   3215   Link to an Info manual, or to a specific node.
   3216 
   3217 - =irc= ::
   3218 
   3219   Link to an IRC channel.
   3220 
   3221 - =mailto= ::
   3222 
   3223   Link to message composition.
   3224 
   3225 - =news= ::
   3226 
   3227   Usenet links.
   3228 
   3229 - =shell= ::
   3230 
   3231   Execute a shell command upon activation.
   3232 
   3233 The following table illustrates the link types above, along with their
   3234 options:
   3235 
   3236 | Link Type  | Example                                                  |
   3237 |------------+----------------------------------------------------------|
   3238 | http       | =http://staff.science.uva.nl/c.dominik/=                 |
   3239 | https      | =https://orgmode.org/=                                   |
   3240 | doi        | =doi:10.1000/182=                                        |
   3241 | file       | =file:/home/dominik/images/jupiter.jpg=                  |
   3242 |            | =/home/dominik/images/jupiter.jpg= (same as above)       |
   3243 |            | =file:papers/last.pdf=                                   |
   3244 |            | =./papers/last.pdf= (same as above)                      |
   3245 |            | =file:/ssh:me@some.where:papers/last.pdf= (remote)       |
   3246 |            | =/ssh:me@some.where:papers/last.pdf= (same as above)     |
   3247 |            | =file:sometextfile::NNN= (jump to line number)           |
   3248 |            | =file:projects.org=                                      |
   3249 |            | =file:projects.org::some words= (text search)[fn:27]     |
   3250 |            | =file:projects.org::*task title= (headline search)       |
   3251 |            | =file:projects.org::#custom-id= (headline search)        |
   3252 | attachment | =attachment:projects.org=                                |
   3253 |            | =attachment:projects.org::some words= (text search)      |
   3254 | docview    | =docview:papers/last.pdf::NNN=                           |
   3255 | id         | =id:B7423F4D-2E8A-471B-8810-C40F074717E9=                |
   3256 | news       | =news:comp.emacs=                                        |
   3257 | mailto     | =mailto:adent@galaxy.net=                                |
   3258 | mhe        | =mhe:folder= (folder link)                               |
   3259 |            | =mhe:folder#id= (message link)                           |
   3260 | rmail      | =rmail:folder= (folder link)                             |
   3261 |            | =rmail:folder#id= (message link)                         |
   3262 | gnus       | =gnus:group= (group link)                                |
   3263 |            | =gnus:group#id= (article link)                           |
   3264 | bbdb       | =bbdb:R.*Stallman= (record with regexp)                  |
   3265 | irc        | =irc:/irc.com/#emacs/bob=                                |
   3266 | help       | =help:org-store-link=                                    |
   3267 | info       | =info:org#External links=                                |
   3268 | shell      | =shell:ls *.org=                                         |
   3269 | elisp      | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate) |
   3270 |            | =elisp:org-agenda= (interactive Elisp command)           |
   3271 
   3272 #+cindex: VM links
   3273 #+cindex: Wanderlust links
   3274 On top of these built-in link types, additional ones are available
   3275 through the =org-contrib= repository (see [[*Installation]]).  For
   3276 example, these links to VM or Wanderlust messages are available when
   3277 you load the corresponding libraries from the =org-contrib=
   3278 repository:
   3279 
   3280 | =vm:folder=                            | VM folder link          |
   3281 | =vm:folder#id=                         | VM message link         |
   3282 | =vm://myself@some.where.org/folder#id= | VM on remote machine    |
   3283 | =vm-imap:account:folder=               | VM IMAP folder link     |
   3284 | =vm-imap:account:folder#id=            | VM IMAP message link    |
   3285 | =wl:folder=                            | Wanderlust folder link  |
   3286 | =wl:folder#id=                         | Wanderlust message link |
   3287 
   3288 For information on customizing Org to add new link types, see [[*Adding
   3289 Hyperlink Types]].
   3290 
   3291 A link should be enclosed in double brackets and may contain
   3292 descriptive text to be displayed instead of the URL (see [[*Link
   3293 Format]]), for example:
   3294 
   3295 : [[https://www.gnu.org/software/emacs/][GNU Emacs]]
   3296 
   3297 If the description is a file name or URL that points to an image, HTML
   3298 export (see [[*HTML Export]]) inlines the image as a clickable button.  If
   3299 there is no description at all and the link points to an image, that
   3300 image is inlined into the exported HTML file.
   3301 
   3302 #+cindex: square brackets, around links
   3303 #+cindex: angular brackets, around links
   3304 #+cindex: plain text external links
   3305 Org also recognizes external links amid normal text and activates them
   3306 as links.  If spaces must be part of the link (for example in
   3307 =bbdb:R.*Stallman=), or if you need to remove ambiguities about the
   3308 end of the link, enclose the link in square or angular brackets.
   3309 
   3310 ** Handling Links
   3311 :PROPERTIES:
   3312 :DESCRIPTION: Creating, inserting and following.
   3313 :END:
   3314 #+cindex: links, handling
   3315 
   3316 Org provides methods to create a link in the correct syntax, to insert
   3317 it into an Org file, and to follow the link.
   3318 
   3319 #+findex: org-store-link
   3320 #+cindex: storing links
   3321 The main function is ~org-store-link~, called with {{{kbd(M-x
   3322 org-store-link)}}}.  Because of its importance, we suggest to bind it
   3323 to a widely available key (see [[*Activation]]).  It stores a link to the
   3324 current location.  The link is stored for later insertion into an Org
   3325 buffer---see below.  The kind of link that is created depends on the
   3326 current buffer:
   3327 
   3328 - /Org mode buffers/ ::
   3329 
   3330   For Org files, if there is a =<<target>>= at point, the link points
   3331   to the target.  Otherwise it points to the current headline, which
   3332   is also the description[fn:28].
   3333 
   3334   #+vindex: org-id-link-to-org-use-id
   3335   #+cindex: @samp{CUSTOM_ID}, property
   3336   #+cindex: @samp{ID}, property
   3337   If the headline has a =CUSTOM_ID= property, store a link to this
   3338   custom ID.  In addition or alternatively, depending on the value of
   3339   ~org-id-link-to-org-use-id~, create and/or use a globally unique
   3340   =ID= property for the link[fn:29].  So using this command in Org
   3341   buffers potentially creates two links: a human-readable link from
   3342   the custom ID, and one that is globally unique and works even if the
   3343   entry is moved from file to file.  The =ID= property can be either a
   3344   UUID (default) or a timestamp, depending on ~org-id-method~.  Later,
   3345   when inserting the link, you need to decide which one to use.
   3346 
   3347 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
   3348 
   3349   #+vindex: org-link-email-description-format
   3350   Pretty much all Emacs mail clients are supported.  The link points
   3351   to the current article, or, in some Gnus buffers, to the group.  The
   3352   description is constructed according to the variable
   3353   ~org-link-email-description-format~.  By default, it refers to the
   3354   addressee and the subject.
   3355 
   3356 - /Web browsers: W3, W3M and EWW/ ::
   3357 
   3358   Here the link is the current URL, with the page title as the
   3359   description.
   3360 
   3361 - /Contacts: BBDB/ ::
   3362 
   3363   Links created in a BBDB buffer point to the current entry.
   3364 
   3365 - /Chat: IRC/ ::
   3366 
   3367   #+vindex: org-irc-links-to-logs
   3368   For IRC links, if the variable ~org-irc-link-to-logs~ is non-~nil~,
   3369   create a =file= style link to the relevant point in the logs for the
   3370   current conversation.  Otherwise store an =irc= style link to the
   3371   user/channel/server under the point.
   3372 
   3373 - /Other files/ ::
   3374 
   3375   For any other file, the link points to the file, with a search
   3376   string (see [[*Search Options in File Links]]) pointing to the contents
   3377   of the current line.  If there is an active region, the selected
   3378   words form the basis of the search string.  You can write custom Lisp
   3379   functions to select the search string and perform the search for
   3380   particular file types (see [[*Custom Searches]]).
   3381 
   3382   You can also define dedicated links to other files.  See [[*Adding
   3383   Hyperlink Types]].
   3384 
   3385 - /Agenda view/ ::
   3386 
   3387   When point is in an agenda view, the created link points to the
   3388   entry referenced by the current line.
   3389 
   3390 From an Org buffer, the following commands create, navigate or, more
   3391 generally, act on links.
   3392 
   3393 #+attr_texinfo: :sep ,
   3394 - {{{kbd(C-c C-l)}}} (~org-insert-link~) ::
   3395 
   3396   #+kindex: C-c C-l
   3397   #+findex: org-insert-link
   3398   #+cindex: link completion
   3399   #+cindex: completion, of links
   3400   #+cindex: inserting links
   3401   #+vindex: org-link-keep-stored-after-insertion
   3402   Insert a link[fn:30].  This prompts for a link to be inserted into
   3403   the buffer.  You can just type a link, using text for an internal
   3404   link, or one of the link type prefixes mentioned in the examples
   3405   above.  The link is inserted into the buffer, along with
   3406   a descriptive text[fn:31].  If some text was selected at this time,
   3407   it becomes the default description.
   3408 
   3409   - /Inserting stored links/ ::
   3410 
   3411     All links stored during the current session are part of the
   3412     history for this prompt, so you can access them with {{{kbd(UP)}}}
   3413     and {{{kbd(DOWN)}}} (or {{{kbd(M-p)}}}, {{{kbd(M-n)}}}).
   3414 
   3415   - /Completion support/ ::
   3416 
   3417     Completion with {{{kbd(TAB)}}} helps you to insert valid link
   3418     prefixes like =http= or =ftp=, including the prefixes defined
   3419     through link abbreviations (see [[*Link Abbreviations]]).  If you
   3420     press {{{kbd(RET)}}} after inserting only the prefix, Org offers
   3421     specific completion support for some link types[fn:32].  For
   3422     example, if you type {{{kbd(f i l e RET)}}}---alternative access:
   3423     {{{kbd(C-u C-c C-l)}}}, see below---Org offers file name
   3424     completion, and after {{{kbd(b b d b RET)}}} you can complete
   3425     contact names.
   3426 
   3427 - {{{kbd(C-u C-c C-l)}}} ::
   3428 
   3429   #+cindex: file name completion
   3430   #+cindex: completion, of file names
   3431   #+kindex: C-u C-c C-l
   3432   When {{{kbd(C-c C-l)}}} is called with a {{{kbd(C-u)}}} prefix
   3433   argument, insert a link to a file.  You may use file name completion
   3434   to select the name of the file.  The path to the file is inserted
   3435   relative to the directory of the current Org file, if the linked
   3436   file is in the current directory or in a sub-directory of it, or if
   3437   the path is written relative to the current directory using =../=.
   3438   Otherwise an absolute path is used, if possible with =~/= for your
   3439   home directory.  You can force an absolute path with two
   3440   {{{kbd(C-u)}}} prefixes.
   3441 
   3442 - {{{kbd(C-c C-l)}}} (with point on existing link) ::
   3443 
   3444   #+cindex: following links
   3445   When point is on an existing link, {{{kbd(C-c C-l)}}} allows you to
   3446   edit the link and description parts of the link.
   3447 
   3448 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
   3449 
   3450   #+kindex: C-c C-o
   3451   #+findex: org-open-at-point
   3452   #+vindex: org-file-apps
   3453   Open link at point.  This launches a web browser for URL (using
   3454   ~browse-url-at-point~), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
   3455   the corresponding links, and execute the command in a shell link.
   3456   When point is on an internal link, this command runs the
   3457   corresponding search.  When point is on the tags part of a headline,
   3458   it creates the corresponding tags view (see [[*Matching tags and
   3459   properties]]).  If point is on a timestamp, it compiles the agenda for
   3460   that date.  Furthermore, it visits text and remote files in =file=
   3461   links with Emacs and select a suitable application for local
   3462   non-text files.  Classification of files is based on file extension
   3463   only.  See option ~org-file-apps~.  If you want to override the
   3464   default application and visit the file with Emacs, use
   3465   a {{{kbd(C-u)}}} prefix.  If you want to avoid opening in Emacs, use
   3466   a {{{kbd(C-u C-u)}}} prefix.
   3467 
   3468   #+vindex: org-link-frame-setup
   3469   If point is on a headline, but not on a link, offer all links in the
   3470   headline and entry text.  If you want to setup the frame
   3471   configuration for following links, customize ~org-link-frame-setup~.
   3472 
   3473 - {{{kbd(RET)}}} ::
   3474 
   3475   #+vindex: org-return-follows-link
   3476   #+kindex: RET
   3477   When ~org-return-follows-link~ is set, {{{kbd(RET)}}} also follows
   3478   the link at point.
   3479 
   3480 - {{{kbd(mouse-2)}}} or {{{kbd(mouse-1)}}} ::
   3481 
   3482   #+kindex: mouse-2
   3483   #+kindex: mouse-1
   3484   On links, {{{kbd(mouse-1)}}} and {{{kbd(mouse-2)}}} opens the link
   3485   just as {{{kbd(C-c C-o)}}} does.
   3486 
   3487 - {{{kbd(mouse-3)}}} ::
   3488 
   3489   #+vindex: org-link-use-indirect-buffer-for-internals
   3490   #+kindex: mouse-3
   3491   Like {{{kbd(mouse-2)}}}, but force file links to be opened with
   3492   Emacs, and internal links to be displayed in another window[fn:33].
   3493 
   3494 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
   3495 
   3496   #+kindex: C-c %
   3497   #+findex: org-mark-ring-push
   3498   #+cindex: mark ring
   3499   Push the current position onto the Org mark ring, to be able to
   3500   return easily.  Commands following an internal link do this
   3501   automatically.
   3502 
   3503 - {{{kbd(C-c &)}}} (~org-mark-ring-goto~) ::
   3504 
   3505   #+kindex: C-c &
   3506   #+findex: org-mark-ring-goto
   3507   #+cindex: links, returning to
   3508   Jump back to a recorded position.  A position is recorded by the
   3509   commands following internal links, and by {{{kbd(C-c %)}}}.  Using
   3510   this command several times in direct succession moves through a ring
   3511   of previously recorded positions.
   3512 
   3513 - {{{kbd(C-c C-x C-n)}}} (~org-next-link~), {{{kbd(C-c C-x C-p)}}} (~org-previous-link~) ::
   3514 
   3515   #+kindex: C-c C-x C-p
   3516   #+findex: org-previous-link
   3517   #+kindex: C-c C-x C-n
   3518   #+findex: org-next-link
   3519   #+cindex: links, finding next/previous
   3520   Move forward/backward to the next link in the buffer.  At the limit
   3521   of the buffer, the search fails once, and then wraps around.  The
   3522   key bindings for this are really too long; you might want to bind
   3523   this also to {{{kbd(M-n)}}} and {{{kbd(M-p)}}}.
   3524 
   3525   #+begin_src emacs-lisp
   3526   (with-eval-after-load 'org
   3527     (define-key org-mode-map (kbd "M-n") #'org-next-link)
   3528     (define-key org-mode-map (kbd "M-p") #'org-previous-link))
   3529   #+end_src
   3530 
   3531 ** Using Links Outside Org
   3532 :PROPERTIES:
   3533 :DESCRIPTION: Linking from my C source code?
   3534 :END:
   3535 
   3536 #+findex: org-insert-link-global
   3537 #+findex: org-open-at-point-global
   3538 You can insert and follow links that have Org syntax not only in Org,
   3539 but in any Emacs buffer.  For this, Org provides two functions:
   3540 ~org-insert-link-global~ and ~org-open-at-point-global~.
   3541 
   3542 You might want to bind them to globally available keys.  See
   3543 [[*Activation]] for some advice.
   3544 
   3545 ** Link Abbreviations
   3546 :PROPERTIES:
   3547 :DESCRIPTION: Shortcuts for writing complex links.
   3548 :END:
   3549 #+cindex: link abbreviations
   3550 #+cindex: abbreviation, links
   3551 
   3552 Long URL can be cumbersome to type, and often many similar links are
   3553 needed in a document.  For this you can use link abbreviations.  An
   3554 abbreviated link looks like this
   3555 
   3556 : [[linkword:tag][description]]
   3557 
   3558 #+texinfo: @noindent
   3559 #+vindex: org-link-abbrev-alist
   3560 where the tag is optional.  The /linkword/ must be a word, starting
   3561 with a letter, followed by letters, numbers, =-=, and =_=.
   3562 Abbreviations are resolved according to the information in the
   3563 variable ~org-link-abbrev-alist~ that relates the linkwords to
   3564 replacement text.  Here is an example:
   3565 
   3566 #+begin_src emacs-lisp
   3567 (setq org-link-abbrev-alist
   3568       '(("bugzilla"        . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
   3569         ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h")
   3570 	("duckduckgo"      . "https://duckduckgo.com/?q=%s")
   3571         ("omap"            . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
   3572         ("ads"             . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\"")))
   3573 #+end_src
   3574 
   3575 If the replacement text contains the string =%s=, it is replaced with
   3576 the tag.  Using =%h= instead of =%s= percent-encodes the tag (see the
   3577 example above, where we need to encode the URL parameter).  Using
   3578 =%(my-function)= passes the tag to a custom Lisp function, and replace
   3579 it by the resulting string.
   3580 
   3581 If the replacement text do not contain any specifier, it is simply
   3582 appended to the string in order to create the link.
   3583 
   3584 Instead of a string, you may also specify a Lisp function to create
   3585 the link.  Such a function will be called with the tag as the only
   3586 argument.
   3587 
   3588 With the above setting, you could link to a specific bug with
   3589 =[[bugzilla:129]]=, search the web for =OrgMode= with =[[duckduckgo:OrgMode]]=,
   3590 show the map location of the Free Software Foundation =[[gmap:51
   3591 Franklin Street, Boston]]= or of Carsten office =[[omap:Science Park 904,
   3592 Amsterdam, The Netherlands]]= and find out what the Org author is doing
   3593 besides Emacs hacking with =[[ads:Dominik,C]]=.
   3594 
   3595 If you need special abbreviations just for a single Org buffer, you
   3596 can define them in the file with
   3597 
   3598 #+cindex: @samp{LINK}, keyword
   3599 #+begin_example
   3600 ,#+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
   3601 ,#+LINK: duckduckgo https://duckduckgo.com/?q=%s
   3602 #+end_example
   3603 
   3604 In-buffer completion (see [[*Completion]]) can be used after =[= to
   3605 complete link abbreviations.  You may also define a Lisp function that
   3606 implements special (e.g., completion) support for inserting such a
   3607 link with {{{kbd(C-c C-l)}}}.  Such a function should not accept any
   3608 arguments, and should return the full link with a prefix.  You can set
   3609 the link completion function like this:
   3610 
   3611 #+begin_src emacs-lisp
   3612 (org-link-set-parameter "type" :complete #'some-completion-function)
   3613 #+end_src
   3614 
   3615 ** Search Options in File Links
   3616 :PROPERTIES:
   3617 :DESCRIPTION: Linking to a specific location.
   3618 :ALT_TITLE: Search Options
   3619 :END:
   3620 #+cindex: search option in file links
   3621 #+cindex: file links, searching
   3622 #+cindex: attachment links, searching
   3623 
   3624 File links can contain additional information to make Emacs jump to a
   3625 particular location in the file when following a link.  This can be a
   3626 line number or a search option after a double colon[fn:34].  For
   3627 example, when the command ~org-store-link~ creates a link (see
   3628 [[*Handling Links]]) to a file, it encodes the words in the current line
   3629 as a search string that can be used to find this line back later when
   3630 following the link with {{{kbd(C-c C-o)}}}.
   3631 
   3632 Note that all search options apply for Attachment links in the same
   3633 way that they apply for File links.
   3634 
   3635 Here is the syntax of the different ways to attach a search to a file
   3636 link, together with explanations for each:
   3637 
   3638 #+begin_example
   3639 [[file:~/code/main.c::255]]
   3640 [[file:~/xx.org::My Target]]
   3641 [[file:~/xx.org::*My Target]]
   3642 [[file:~/xx.org::#my-custom-id]]
   3643 [[file:~/xx.org::/regexp/]]
   3644 [[attachment:main.c::255]]
   3645 #+end_example
   3646 
   3647 - =255= ::
   3648 
   3649   Jump to line 255.
   3650 
   3651 - =My Target= ::
   3652 
   3653   Search for a link target =<<My Target>>=, or do a text search for
   3654   =my target=, similar to the search in internal links, see [[*Internal
   3655   Links]].  In HTML export (see [[*HTML Export]]), such a file link becomes
   3656   a HTML reference to the corresponding named anchor in the linked
   3657   file.
   3658 
   3659 - =*My Target= ::
   3660 
   3661   In an Org file, restrict search to headlines.
   3662 
   3663 - =#my-custom-id= ::
   3664 
   3665   Link to a heading with a =CUSTOM_ID= property
   3666 
   3667 - =/REGEXP/= ::
   3668 
   3669   Do a regular expression search for {{{var(REGEXP)}}} (see [[*Regular
   3670   Expressions]]).  This uses the Emacs command ~occur~ to list all
   3671   matches in a separate window.  If the target file is in Org mode,
   3672   ~org-occur~ is used to create a sparse tree with the matches.
   3673 
   3674 As a degenerate case, a file link with an empty file name can be used
   3675 to search the current file.  For example, =[[file:::find me]]= does
   3676 a search for =find me= in the current file, just as =[[find me]]=
   3677 would.
   3678 
   3679 ** Custom Searches
   3680 :PROPERTIES:
   3681 :DESCRIPTION: When the default search is not enough.
   3682 :END:
   3683 #+cindex: custom search strings
   3684 #+cindex: search strings, custom
   3685 
   3686 The default mechanism for creating search strings and for doing the
   3687 actual search related to a file link may not work correctly in all
   3688 cases.  For example, BibTeX database files have many entries like
   3689 ~year="1993"~ which would not result in good search strings, because
   3690 the only unique identification for a BibTeX entry is the citation key.
   3691 
   3692 #+vindex: org-create-file-search-functions
   3693 #+vindex: org-execute-file-search-functions
   3694 If you come across such a problem, you can write custom functions to
   3695 set the right search string for a particular file type, and to do the
   3696 search for the string in the file.  Using ~add-hook~, these functions
   3697 need to be added to the hook variables
   3698 ~org-create-file-search-functions~ and
   3699 ~org-execute-file-search-functions~.  See the docstring for these
   3700 variables for more information.  Org actually uses this mechanism for
   3701 BibTeX database files, and you can use the corresponding code as an
   3702 implementation example.  See the file =ol-bibtex.el=.
   3703 
   3704 * TODO Items
   3705 :PROPERTIES:
   3706 :DESCRIPTION: Every tree branch can be a TODO item.
   3707 :END:
   3708 #+cindex: TODO items
   3709 
   3710 Org mode does not maintain TODO lists as separate documents[fn:35].
   3711 Instead, TODO items are an integral part of the notes file, because
   3712 TODO items usually come up while taking notes!  With Org mode, simply
   3713 mark any entry in a tree as being a TODO item.  In this way,
   3714 information is not duplicated, and the entire context from which the
   3715 TODO item emerged is always present.
   3716 
   3717 Of course, this technique for managing TODO items scatters them
   3718 throughout your notes file.  Org mode compensates for this by
   3719 providing methods to give you an overview of all the things that you
   3720 have to do.
   3721 
   3722 ** Basic TODO Functionality
   3723 :PROPERTIES:
   3724 :DESCRIPTION: Marking and displaying TODO entries.
   3725 :ALT_TITLE: TODO Basics
   3726 :END:
   3727 
   3728 Any headline becomes a TODO item when it starts with the word =TODO=,
   3729 for example:
   3730 
   3731 : *** TODO Write letter to Sam Fortune
   3732 
   3733 The most important commands to work with TODO entries are:
   3734 
   3735 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
   3736 
   3737   #+kindex: C-c C-t
   3738   #+cindex: cycling, of TODO states
   3739   Rotate the TODO state of the current item among
   3740 
   3741   #+begin_example
   3742   ,-> (unmarked) -> TODO -> DONE --.
   3743   '--------------------------------'
   3744   #+end_example
   3745 
   3746   If TODO keywords have fast access keys (see [[*Fast access to TODO
   3747   states]]), prompt for a TODO keyword through the fast selection
   3748   interface; this is the default behavior when
   3749   ~org-use-fast-todo-selection~ is non-~nil~.
   3750 
   3751   The same state changing can also be done "remotely" from the agenda
   3752   buffer with the {{{kbd(t)}}} command key (see [[*Commands in the
   3753   Agenda Buffer]]).
   3754 
   3755 - {{{kbd(S-RIGHT)}}} {{{kbd(S-LEFT)}}} ::
   3756 
   3757   #+kindex: S-RIGHT
   3758   #+kindex: S-LEFT
   3759   #+vindex: org-treat-S-cursor-todo-selection-as-state-change
   3760   Select the following/preceding TODO state, similar to cycling.
   3761   Useful mostly if more than two TODO states are possible (see
   3762   [[*Extended Use of TODO Keywords]]).  See also [[*Packages that conflict
   3763   with Org mode]], for a discussion of the interaction with
   3764   shift-selection.  See also the variable
   3765   ~org-treat-S-cursor-todo-selection-as-state-change~.
   3766 
   3767 - {{{kbd(C-c / t)}}} (~org-show-todo-tree~) ::
   3768 
   3769   #+kindex: C-c / t
   3770   #+cindex: sparse tree, for TODO
   3771   #+vindex: org-todo-keywords
   3772   #+findex: org-show-todo-tree
   3773   View TODO items in a /sparse tree/ (see [[*Sparse Trees]]).  Folds the
   3774   entire buffer, but shows all TODO items---with not-DONE state---and
   3775   the headings hierarchy above them.  With a prefix argument, or by
   3776   using {{{kbd(C-c / T)}}}, search for a specific TODO.  You are
   3777   prompted for the keyword, and you can also give a list of keywords
   3778   like =KWD1|KWD2|...= to list entries that match any one of these
   3779   keywords.  With a numeric prefix argument N, show the tree for the
   3780   Nth keyword in the variable ~org-todo-keywords~.  With two prefix
   3781   arguments, find all TODO states, both un-done and done.
   3782 
   3783 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
   3784 
   3785   #+kindex: t @r{(Agenda dispatcher)}
   3786   Show the global TODO list.  Collects the TODO items (with not-DONE
   3787   states) from all agenda files (see [[*Agenda Views]]) into a single
   3788   buffer.  The new buffer is in Org Agenda mode, which provides
   3789   commands to examine and manipulate the TODO entries from the new
   3790   buffer (see [[*Commands in the Agenda Buffer]]).  See [[*The global TODO
   3791   list]], for more information.
   3792 
   3793 - {{{kbd(S-M-RET)}}} (~org-insert-todo-heading~) ::
   3794 
   3795   #+kindex: S-M-RET
   3796   #+findex: org-insert-todo-heading
   3797   Insert a new TODO entry below the current one.
   3798 
   3799 #+vindex: org-todo-state-tags-triggers
   3800 Changing a TODO state can also trigger tag changes.  See the docstring
   3801 of the option ~org-todo-state-tags-triggers~ for details.
   3802 
   3803 ** Extended Use of TODO Keywords
   3804 :PROPERTIES:
   3805 :DESCRIPTION: Workflow and assignments.
   3806 :ALT_TITLE: TODO Extensions
   3807 :END:
   3808 #+cindex: extended TODO keywords
   3809 
   3810 #+vindex: org-todo-keywords
   3811 By default, marked TODO entries have one of only two states: TODO and
   3812 DONE.  Org mode allows you to classify TODO items in more complex ways
   3813 with /TODO keywords/ (stored in ~org-todo-keywords~).  With special
   3814 setup, the TODO keyword system can work differently in different
   3815 files.
   3816 
   3817 Note that /tags/ are another way to classify headlines in general and
   3818 TODO items in particular (see [[*Tags]]).
   3819 
   3820 *** TODO keywords as workflow states
   3821 :PROPERTIES:
   3822 :DESCRIPTION: From TODO to DONE in steps.
   3823 :ALT_TITLE: Workflow states
   3824 :END:
   3825 #+cindex: TODO workflow
   3826 #+cindex: workflow states as TODO keywords
   3827 
   3828 You can use TODO keywords to indicate different, possibly /sequential/
   3829 states in the process of working on an item, for example[fn:36]:
   3830 
   3831 #+begin_src emacs-lisp
   3832 (setq org-todo-keywords
   3833       '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
   3834 #+end_src
   3835 
   3836 The vertical bar separates the TODO keywords (states that /need
   3837 action/) from the DONE states (which need /no further action/).  If
   3838 you do not provide the separator bar, the last state is used as the
   3839 DONE state.
   3840 
   3841 #+cindex: completion, of TODO keywords
   3842 With this setup, the command {{{kbd(C-c C-t)}}} cycles an entry from
   3843 =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to =DONE= and
   3844 =DELEGATED=.  You may also use a numeric prefix argument to quickly
   3845 select a specific state.  For example {{{kbd(C-3 C-c C-t)}}} changes
   3846 the state immediately to =VERIFY=.  Or you can use {{{kbd(S-RIGHT)}}}
   3847 and {{{kbd(S-LEFT)}}} to go forward and backward through the states.
   3848 If you define many keywords, you can use in-buffer completion (see
   3849 [[*Completion]]) or a special one-key selection scheme (see [[*Fast
   3850 access to TODO states]]) to insert these words into the buffer.
   3851 Changing a TODO state can be logged with a timestamp, see [[*Tracking
   3852 TODO state changes]], for more information.
   3853 
   3854 *** TODO keywords as types
   3855 :PROPERTIES:
   3856 :DESCRIPTION: I do this, Fred does the rest.
   3857 :ALT_TITLE: TODO types
   3858 :END:
   3859 #+cindex: TODO types
   3860 #+cindex: names as TODO keywords
   3861 #+cindex: types as TODO keywords
   3862 
   3863 The second possibility is to use TODO keywords to indicate different
   3864 /types/ of action items.  For example, you might want to indicate that
   3865 items are for "work" or "home".  Or, when you work with several people
   3866 on a single project, you might want to assign action items directly to
   3867 persons, by using their names as TODO keywords.  This type of
   3868 functionality is actually much better served by using tags (see
   3869 [[*Tags]]), so the TODO implementation is kept just for backward
   3870 compatibility.
   3871 
   3872 Using TODO types, it would be set up like this:
   3873 
   3874 #+begin_src emacs-lisp
   3875 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
   3876 #+end_src
   3877 
   3878 In this case, different keywords do not indicate states, but
   3879 rather different types.  So the normal work flow would be to assign
   3880 a task to a person, and later to mark it DONE.  Org mode supports this
   3881 style by adapting the workings of the command {{{kbd(C-c
   3882 C-t)}}}[fn:37].  When used several times in succession, it still
   3883 cycles through all names, in order to first select the right type for
   3884 a task.  But when you return to the item after some time and execute
   3885 {{{kbd(C-c C-t)}}} again, it will switch from any name directly to
   3886 =DONE=.  Use prefix arguments or completion to quickly select
   3887 a specific name.  You can also review the items of a specific TODO
   3888 type in a sparse tree by using a numeric prefix to {{{kbd(C-c / t)}}}.
   3889 For example, to see all things Lucy has to do, you would use
   3890 {{{kbd(C-3 C-c / t)}}}.  To collect Lucy's items from all agenda files
   3891 into a single buffer, you would use the numeric prefix argument as
   3892 well when creating the global TODO list: {{{kbd(C-3 M-x org-agenda
   3893 t)}}}.
   3894 
   3895 *** Multiple keyword sets in one file
   3896 :PROPERTIES:
   3897 :DESCRIPTION: Mixing it all, still finding your way.
   3898 :ALT_TITLE: Multiple sets in one file
   3899 :END:
   3900 #+cindex: TODO keyword sets
   3901 
   3902 Sometimes you may want to use different sets of TODO keywords in
   3903 parallel.  For example, you may want to have the basic TODO/DONE, but
   3904 also a workflow for bug fixing, and a separate state indicating that
   3905 an item has been canceled---so it is not DONE, but also does not
   3906 require action.  Your setup would then look like this:
   3907 
   3908 #+begin_src emacs-lisp
   3909 (setq org-todo-keywords
   3910       '((sequence "TODO" "|" "DONE")
   3911         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
   3912         (sequence "|" "CANCELED")))
   3913 #+end_src
   3914 
   3915 The keywords should all be different, this helps Org mode keep track
   3916 of which subsequence should be used for a given entry.  In this setup,
   3917 {{{kbd(C-c C-t)}}} only operates within a sub-sequence, so it switches
   3918 from =DONE= to (nothing) to =TODO=, and from =FIXED= to (nothing) to
   3919 =REPORT=.  Therefore you need a mechanism to initially select the
   3920 correct sequence.  In addition to typing a keyword or using completion
   3921 (see [[*Completion]]), you may also apply the following commands:
   3922 
   3923 #+attr_texinfo: :sep ,
   3924 - {{{kbd(C-u C-u C-c C-t)}}}, {{{kbd(C-S-RIGHT)}}}, {{{kbd(C-S-LEFT)}}} ::
   3925 
   3926   #+kindex: C-S-RIGHT
   3927   #+kindex: C-S-LEFT
   3928   #+kindex: C-u C-u C-c C-t
   3929   These keys jump from one TODO sub-sequence to the next.  In the
   3930   above example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbd(C-S-RIGHT)}}}
   3931   would jump from =TODO= or =DONE= to =REPORT=, and any of the words
   3932   in the second row to =CANCELED=.  Note that the {{{kbd(C-S-)}}} key
   3933   binding conflict with shift-selection (see [[*Packages that conflict
   3934   with Org mode]]).
   3935 
   3936 - {{{kbd(S-RIGHT)}}}, {{{kbd(S-LEFT)}}} ::
   3937 
   3938   #+kindex: S-RIGHT
   3939   #+kindex: S-LEFT
   3940   {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}} walk through /all/ keywords
   3941   from all sub-sequences, so for example {{{kbd(S-RIGHT)}}} would
   3942   switch from =DONE= to =REPORT= in the example above.  For
   3943   a discussion of the interaction with shift-selection, see [[*Packages
   3944   that conflict with Org mode]].
   3945 
   3946 *** Fast access to TODO states
   3947 :PROPERTIES:
   3948 :DESCRIPTION: Single letter selection of state.
   3949 :END:
   3950 
   3951 If you would like to quickly change an entry to an arbitrary TODO
   3952 state instead of cycling through the states, you can set up keys for
   3953 single-letter access to the states.  This is done by adding the
   3954 selection character after each keyword, in parentheses[fn:38].  For
   3955 example:
   3956 
   3957 #+begin_src emacs-lisp
   3958 (setq org-todo-keywords
   3959       '((sequence "TODO(t)" "|" "DONE(d)")
   3960         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
   3961         (sequence "|" "CANCELED(c)")))
   3962 #+end_src
   3963 
   3964 #+vindex: org-fast-tag-selection-include-todo
   3965 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
   3966 the entry is switched to this state.  {{{kbd(SPC)}}} can be used to
   3967 remove any TODO keyword from an entry[fn:39].
   3968 
   3969 *** Setting up keywords for individual files
   3970 :PROPERTIES:
   3971 :DESCRIPTION: Different files, different requirements.
   3972 :ALT_TITLE: Per-file keywords
   3973 :END:
   3974 #+cindex: keyword options
   3975 #+cindex: per-file keywords
   3976 #+cindex: @samp{TODO}, keyword
   3977 #+cindex: @samp{TYP_TODO}, keyword
   3978 #+cindex: @samp{SEQ_TODO}, keyword
   3979 
   3980 It can be very useful to use different aspects of the TODO mechanism
   3981 in different files.  For file-local settings, you need to add special
   3982 lines to the file which set the keywords and interpretation for that
   3983 file only.  For example, to set one of the two examples discussed
   3984 above, you need one of the following lines, starting in column zero
   3985 anywhere in the file:
   3986 
   3987 : #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
   3988 
   3989 You may also write =#+SEQ_TODO= to be explicit about the
   3990 interpretation, but it means the same as =#+TODO=, or
   3991 
   3992 : #+TYP_TODO: Fred Sara Lucy Mike | DONE
   3993 
   3994 A setup for using several sets in parallel would be:
   3995 
   3996 #+begin_example
   3997 ,#+TODO: TODO(t) | DONE(d)
   3998 ,#+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f)
   3999 ,#+TODO: | CANCELED(c)
   4000 #+end_example
   4001 
   4002 #+cindex: completion, of option keywords
   4003 #+kindex: M-TAB
   4004 To make sure you are using the correct keyword, type =#+= into the
   4005 buffer and then use {{{kbd(M-TAB)}}} to complete it (see [[*Completion]]).
   4006 
   4007 #+cindex: DONE, final TODO keyword
   4008 Remember that the keywords after the vertical bar---or the last
   4009 keyword if no bar is there---must always mean that the item is DONE,
   4010 although you may use a different word.  After changing one of these
   4011 lines, use {{{kbd(C-c C-c)}}} with point still in the line to make the
   4012 changes known to Org mode[fn:40].
   4013 
   4014 *** Faces for TODO keywords
   4015 :PROPERTIES:
   4016 :DESCRIPTION: Highlighting states.
   4017 :END:
   4018 #+cindex: faces, for TODO keywords
   4019 
   4020 #+vindex: org-todo, face
   4021 #+vindex: org-done, face
   4022 #+vindex: org-todo-keyword-faces
   4023 Org mode highlights TODO keywords with special faces: ~org-todo~ for
   4024 keywords indicating that an item still has to be acted upon, and
   4025 ~org-done~ for keywords indicating that an item is finished.  If you
   4026 are using more than two different states, you might want to use
   4027 special faces for some of them.  This can be done using the variable
   4028 ~org-todo-keyword-faces~.  For example:
   4029 
   4030 #+begin_src emacs-lisp
   4031 (setq org-todo-keyword-faces
   4032       '(("TODO" . org-warning) ("STARTED" . "yellow")
   4033         ("CANCELED" . (:foreground "blue" :weight bold))))
   4034 #+end_src
   4035 
   4036 #+vindex: org-faces-easy-properties
   4037 While using a list with face properties as shown for =CANCELED=
   4038 /should/ work, this does not always seem to be the case.  If
   4039 necessary, define a special face and use that.  A string is
   4040 interpreted as a color.  The variable ~org-faces-easy-properties~
   4041 determines if that color is interpreted as a foreground or
   4042 a background color.
   4043 
   4044 *** TODO dependencies
   4045 :PROPERTIES:
   4046 :DESCRIPTION: When one task needs to wait for others.
   4047 :END:
   4048 #+cindex: TODO dependencies
   4049 #+cindex: dependencies, of TODO states
   4050 
   4051 #+vindex: org-enforce-todo-dependencies
   4052 #+cindex: @samp{ORDERED}, property
   4053 The structure of Org files---hierarchy and lists---makes it easy to
   4054 define TODO dependencies.  Usually, a parent TODO task should not be
   4055 marked as done until all TODO subtasks, or children tasks, are marked
   4056 as done.  Sometimes there is a logical sequence to (sub)tasks, so that
   4057 one subtask cannot be acted upon before all siblings above it have
   4058 been marked as done.  If you customize the variable
   4059 ~org-enforce-todo-dependencies~, Org blocks entries from changing
   4060 state to DONE while they have TODO children that are not DONE.
   4061 Furthermore, if an entry has a property =ORDERED=, each of its TODO
   4062 children is blocked until all earlier siblings are marked as done.
   4063 Here is an example:
   4064 
   4065 #+begin_example
   4066 ,* TODO Blocked until (two) is done
   4067 ,** DONE one
   4068 ,** TODO two
   4069 
   4070 ,* Parent
   4071 :PROPERTIES:
   4072 :ORDERED:  t
   4073 :END:
   4074 ,** TODO a
   4075 ,** TODO b, needs to wait for (a)
   4076 ,** TODO c, needs to wait for (a) and (b)
   4077 #+end_example
   4078 
   4079 #+cindex: TODO dependencies, @samp{NOBLOCKING}
   4080 #+cindex: @samp{NOBLOCKING}, property
   4081 You can ensure an entry is never blocked by using the =NOBLOCKING=
   4082 property (see [[*Properties and Columns]]):
   4083 
   4084 #+begin_example
   4085 ,* This entry is never blocked
   4086 :PROPERTIES:
   4087 :NOBLOCKING: t
   4088 :END:
   4089 #+end_example
   4090 
   4091 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
   4092 
   4093   #+kindex: C-c C-x o
   4094   #+findex: org-toggle-ordered-property
   4095   #+vindex: org-track-ordered-property-with-tag
   4096   Toggle the =ORDERED= property of the current entry.  A property is
   4097   used for this behavior because this should be local to the current
   4098   entry, not inherited from entries above like a tag (see [[*Tags]]).
   4099   However, if you would like to /track/ the value of this property
   4100   with a tag for better visibility, customize the variable
   4101   ~org-track-ordered-property-with-tag~.
   4102 
   4103 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
   4104 
   4105   #+kindex: C-u C-u C-u C-u C-c C-t
   4106   Change TODO state, regardless of any state blocking.
   4107 
   4108 #+vindex: org-agenda-dim-blocked-tasks
   4109 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
   4110 that cannot be marked as done because of unmarked children are shown
   4111 in a dimmed font or even made invisible in agenda views (see [[*Agenda
   4112 Views]]).
   4113 
   4114 #+cindex: checkboxes and TODO dependencies
   4115 #+vindex: org-enforce-todo-dependencies
   4116 You can also block changes of TODO states by using checkboxes (see
   4117 [[*Checkboxes]]).  If you set the variable
   4118 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
   4119 checkboxes is blocked from switching to DONE.
   4120 
   4121 If you need more complex dependency structures, for example
   4122 dependencies between entries in different trees or files, check out
   4123 the module =org-depend.el= in the =org-contrib= repository.
   4124 
   4125 ** Progress Logging
   4126 :PROPERTIES:
   4127 :DESCRIPTION: Dates and notes for progress.
   4128 :END:
   4129 #+cindex: progress logging
   4130 #+cindex: logging, of progress
   4131 
   4132 To record a timestamp and a note when changing a TODO state, call the
   4133 command ~org-todo~ with a prefix argument.
   4134 
   4135 - {{{kbd(C-u C-c C-t)}}} (~org-todo~) ::
   4136 
   4137   #+kindex: C-u C-c C-t
   4138   Prompt for a note and record a the time of the TODO state change.
   4139   The note is inserted as a list item below the headline, but can also
   4140   be placed into a drawer, see [[*Tracking TODO state changes]].
   4141 
   4142 If you want to be more systematic, Org mode can automatically record a
   4143 timestamp and optionally a note when you mark a TODO item as DONE, or
   4144 even each time you change the state of a TODO item.  This system is
   4145 highly configurable, settings can be on a per-keyword basis and can be
   4146 localized to a file or even a subtree.  For information on how to
   4147 clock working time for a task, see [[*Clocking Work Time]].
   4148 
   4149 *** Closing items
   4150 :PROPERTIES:
   4151 :DESCRIPTION: When was this entry marked as done?
   4152 :END:
   4153 
   4154 The most basic automatic logging is to keep track of /when/ a certain
   4155 TODO item was marked as done.  This can be achieved with[fn:41]
   4156 
   4157 #+begin_src emacs-lisp
   4158 (setq org-log-done 'time)
   4159 #+end_src
   4160 
   4161 #+vindex: org-closed-keep-when-no-todo
   4162 #+texinfo: @noindent
   4163 Then each time you turn an entry from a TODO (not-done) state into any
   4164 of the DONE states, a line =CLOSED: [timestamp]= is inserted just
   4165 after the headline.  If you turn the entry back into a TODO item
   4166 through further state cycling, that line is removed again.  If you
   4167 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t
   4168 SPC)}}} for example), that line is also removed, unless you set
   4169 ~org-closed-keep-when-no-todo~ to non-~nil~.  If you want to record
   4170 a note along with the timestamp, use[fn:42]
   4171 
   4172 #+begin_src emacs-lisp
   4173 (setq org-log-done 'note)
   4174 #+end_src
   4175 
   4176 #+texinfo: @noindent
   4177 You are then prompted for a note, and that note is stored below the
   4178 entry with a =Closing Note= heading.
   4179 
   4180 *** Tracking TODO state changes
   4181 :PROPERTIES:
   4182 :DESCRIPTION: When did the status change?
   4183 :END:
   4184 #+cindex: drawer, for state change recording
   4185 
   4186 #+vindex: org-log-states-order-reversed
   4187 #+vindex: org-log-into-drawer
   4188 #+cindex: @samp{LOG_INTO_DRAWER}, property
   4189 You might want to automatically keep track of when a state change
   4190 occurred and maybe take a note about this change.  You can either
   4191 record just a timestamp, or a time-stamped note.  These records are
   4192 inserted after the headline as an itemized list, newest first[fn:43].
   4193 When taking a lot of notes, you might want to get the notes out of the
   4194 way into a drawer (see [[*Drawers]]).  Customize the variable
   4195 ~org-log-into-drawer~ to get this behavior---the recommended drawer
   4196 for this is called =LOGBOOK=[fn:44].  You can also overrule the
   4197 setting of this variable for a subtree by setting a =LOG_INTO_DRAWER=
   4198 property.
   4199 
   4200 Since it is normally too much to record a note for every state, Org
   4201 mode expects configuration on a per-keyword basis for this.  This is
   4202 achieved by adding special markers =!= (for a timestamp) or =@= (for
   4203 a note with timestamp) in parentheses after each keyword.  For
   4204 example, with the setting
   4205 
   4206 #+begin_src emacs-lisp
   4207 (setq org-todo-keywords
   4208       '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
   4209 #+end_src
   4210 
   4211 #+vindex: org-log-done
   4212 You not only define global TODO keywords and fast access keys, but
   4213 also request that a time is recorded when the entry is set to =DONE=,
   4214 and that a note is recorded when switching to =WAIT= or
   4215 =CANCELED=[fn:45].  The setting for =WAIT= is even more special: the
   4216 =!= after the slash means that in addition to the note taken when
   4217 entering the state, a timestamp should be recorded when /leaving/ the
   4218 =WAIT= state, if and only if the /target/ state does not configure
   4219 logging for entering it.  So it has no effect when switching from
   4220 =WAIT= to =DONE=, because =DONE= is configured to record a timestamp
   4221 only.  But when switching from =WAIT= back to =TODO=, the =/!= in the
   4222 =WAIT= setting now triggers a timestamp even though =TODO= has no
   4223 logging configured.
   4224 
   4225 You can use the exact same syntax for setting logging preferences local
   4226 to a buffer:
   4227 
   4228 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
   4229 
   4230 To record a timestamp without a note for TODO keywords configured with
   4231 =@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted.
   4232 
   4233 #+cindex: @samp{LOGGING}, property
   4234 In order to define logging settings that are local to a subtree or
   4235 a single item, define a =LOGGING= property in this entry.  Any
   4236 non-empty =LOGGING= property resets all logging settings to ~nil~.
   4237 You may then turn on logging for this specific tree using =STARTUP=
   4238 keywords like =lognotedone= or =logrepeat=, as well as adding state
   4239 specific settings like =TODO(!)=.  For example:
   4240 
   4241 #+begin_example
   4242 ,* TODO Log each state with only a time
   4243   :PROPERTIES:
   4244   :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
   4245   :END:
   4246 ,* TODO Only log when switching to WAIT, and when repeating
   4247   :PROPERTIES:
   4248   :LOGGING: WAIT(@) logrepeat
   4249   :END:
   4250 ,* TODO No logging at all
   4251   :PROPERTIES:
   4252   :LOGGING: nil
   4253   :END:
   4254 #+end_example
   4255 
   4256 *** Tracking your habits
   4257 :PROPERTIES:
   4258 :DESCRIPTION: How consistent have you been?
   4259 :END:
   4260 #+cindex: habits
   4261 #+cindex: @samp{STYLE}, property
   4262 
   4263 Org has the ability to track the consistency of a special category of
   4264 TODO, called "habits."  To use habits, you have to enable the ~habits~
   4265 module by customizing the variable ~org-modules~.
   4266 
   4267 A habit has the following properties:
   4268 
   4269 1. The habit is a TODO item, with a TODO keyword representing an open
   4270    state.
   4271 
   4272 2. The property =STYLE= is set to the value =habit= (see [[*Properties
   4273    and Columns]]).
   4274 
   4275 3. The TODO has a scheduled date, usually with a =.+= style repeat
   4276    interval.  A =++= style may be appropriate for habits with time
   4277    constraints, e.g., must be done on weekends, or a =+= style for an
   4278    unusual habit that can have a backlog, e.g., weekly reports.
   4279 
   4280 4. The TODO may also have minimum and maximum ranges specified by
   4281    using the syntax =.+2d/3d=, which says that you want to do the task
   4282    at least every three days, but at most every two days.
   4283 
   4284 5. State logging for the DONE state is enabled (see [[*Tracking TODO
   4285    state changes]]), in order for historical data to be represented in
   4286    the consistency graph.  If it is not enabled it is not an error,
   4287    but the consistency graphs are largely meaningless.
   4288 
   4289 To give you an idea of what the above rules look like in action, here's an
   4290 actual habit with some history:
   4291 
   4292 #+begin_example
   4293 ,** TODO Shave
   4294    SCHEDULED: <2009-10-17 Sat .+2d/4d>
   4295    :PROPERTIES:
   4296    :STYLE:    habit
   4297    :LAST_REPEAT: [2009-10-19 Mon 00:36]
   4298    :END:
   4299    - State "DONE"       from "TODO"       [2009-10-15 Thu]
   4300    - State "DONE"       from "TODO"       [2009-10-12 Mon]
   4301    - State "DONE"       from "TODO"       [2009-10-10 Sat]
   4302    - State "DONE"       from "TODO"       [2009-10-04 Sun]
   4303    - State "DONE"       from "TODO"       [2009-10-02 Fri]
   4304    - State "DONE"       from "TODO"       [2009-09-29 Tue]
   4305    - State "DONE"       from "TODO"       [2009-09-25 Fri]
   4306    - State "DONE"       from "TODO"       [2009-09-19 Sat]
   4307    - State "DONE"       from "TODO"       [2009-09-16 Wed]
   4308    - State "DONE"       from "TODO"       [2009-09-12 Sat]
   4309 #+end_example
   4310 
   4311 What this habit says is: I want to shave at most every 2 days---given
   4312 by the =SCHEDULED= date and repeat interval---and at least every
   4313 4 days.  If today is the 15th, then the habit first appears in the
   4314 agenda (see [[*Agenda Views]]) on Oct 17, after the minimum of 2 days has
   4315 elapsed, and will appear overdue on Oct 19, after four days have
   4316 elapsed.
   4317 
   4318 What's really useful about habits is that they are displayed along
   4319 with a consistency graph, to show how consistent you've been at
   4320 getting that task done in the past.  This graph shows every day that
   4321 the task was done over the past three weeks, with colors for each day.
   4322 The colors used are:
   4323 
   4324 - Blue :: If the task was not to be done yet on that day.
   4325 - Green :: If the task could have been done on that day.
   4326 - Yellow :: If the task was going to be overdue the next day.
   4327 - Red :: If the task was overdue on that day.
   4328 
   4329 In addition to coloring each day, the day is also marked with an
   4330 asterisk if the task was actually done that day, and an exclamation
   4331 mark to show where the current day falls in the graph.
   4332 
   4333 There are several configuration variables that can be used to change
   4334 the way habits are displayed in the agenda.
   4335 
   4336 - ~org-habit-graph-column~ ::
   4337 
   4338   #+vindex: org-habit-graph-column
   4339   The buffer column at which the consistency graph should be drawn.
   4340   This overwrites any text in that column, so it is a good idea to
   4341   keep your habits' titles brief and to the point.
   4342 
   4343 - ~org-habit-preceding-days~ ::
   4344 
   4345   #+vindex: org-habit-preceding-days
   4346   The amount of history, in days before today, to appear in
   4347   consistency graphs.
   4348 
   4349 - ~org-habit-following-days~ ::
   4350 
   4351   #+vindex: org-habit-following-days
   4352   The number of days after today that appear in consistency graphs.
   4353 
   4354 - ~org-habit-show-habits-only-for-today~ ::
   4355 
   4356   #+vindex: org-habit-show-habits-only-for-today
   4357   If non-~nil~, only show habits in today's agenda view.  The default
   4358   value is ~t~.  Pressing {{{kbd(C-u K)}}} in the agenda toggles this
   4359   variable.
   4360 
   4361 Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to
   4362 temporarily be disabled and do not appear at all.  Press {{{kbd(K)}}}
   4363 again to bring them back.  They are also subject to tag filtering, if
   4364 you have habits which should only be done in certain contexts, for
   4365 example.
   4366 
   4367 ** Priorities
   4368 :PROPERTIES:
   4369 :DESCRIPTION: Some things are more important than others.
   4370 :END:
   4371 #+cindex: priorities
   4372 #+cindex: priority cookie
   4373 
   4374 If you use Org mode extensively, you may end up with enough TODO items
   4375 that it starts to make sense to prioritize them.  Prioritizing can be
   4376 done by placing a /priority cookie/ into the headline of a TODO item
   4377 right after the TODO keyword, like this:
   4378 
   4379 : *** TODO [#A] Write letter to Sam Fortune
   4380 
   4381 #+vindex: org-priority-faces
   4382 By default, Org mode supports three priorities: =A=, =B=, and =C=.
   4383 =A= is the highest priority.  An entry without a cookie is treated as
   4384 equivalent if it had priority =B=.  Priorities make a difference only
   4385 for sorting in the agenda (see [[*Weekly/daily agenda]]).  Outside the
   4386 agenda, they have no inherent meaning to Org mode.  The cookies are
   4387 displayed with the face defined by the variable ~org-priority-faces~,
   4388 which can be customized.
   4389 
   4390 You can also use numeric values for priorities, such as
   4391 
   4392 : *** TODO [#1] Write letter to Sam Fortune
   4393 
   4394 When using numeric priorities, you need to set ~org-priority-highest~,
   4395 ~org-priority-lowest~ and ~org-priority-default~ to integers, which
   4396 must all be strictly inferior to 65.
   4397 
   4398 Priorities can be attached to any outline node; they do not need to be
   4399 TODO items.
   4400 
   4401 #+attr_texinfo: :sep ;
   4402 - {{{kbd(C-c \,)}}} (~org-priority~) ::
   4403 
   4404   #+kindex: C-c ,
   4405   #+findex: org-priority
   4406   Set the priority of the current headline.  The command prompts for
   4407   a priority character =A=, =B= or =C=.  When you press {{{kbd(SPC)}}}
   4408   instead, the priority cookie, if one is set, is removed from the
   4409   headline.  The priorities can also be changed "remotely" from the
   4410   agenda buffer with the {{{kbd(\,)}}} command (see [[*Commands in the
   4411   Agenda Buffer]]).
   4412 
   4413 - {{{kbd(S-UP)}}} (~org-priority-up~); {{{kbd(S-DOWN)}}} (~org-priority-down~) ::
   4414 
   4415   #+kindex: S-UP
   4416   #+kindex: S-DOWN
   4417   #+findex: org-priority-up
   4418   #+findex: org-priority-down
   4419   #+vindex: org-priority-start-cycle-with-default
   4420   Increase/decrease the priority of the current headline[fn:46].  Note
   4421   that these keys are also used to modify timestamps (see [[*Creating
   4422   Timestamps]]).  See also [[*Packages that conflict with Org mode]], for
   4423   a discussion of the interaction with shift-selection.
   4424 
   4425 #+vindex: org-priority-highest
   4426 #+vindex: org-priority-lowest
   4427 #+vindex: org-priority-default
   4428 You can change the range of allowed priorities by setting the
   4429 variables ~org-priority-highest~, ~org-priority-lowest~, and
   4430 ~org-priority-default~.  For an individual buffer, you may set these
   4431 values (highest, lowest, default) like this (please make sure that the
   4432 highest priority is earlier in the alphabet than the lowest priority):
   4433 
   4434 #+cindex: @samp{PRIORITIES}, keyword
   4435 : #+PRIORITIES: A C B
   4436 
   4437 Or, using numeric values:
   4438 
   4439 : #+PRIORITIES: 1 10 5
   4440 
   4441 ** Breaking Down Tasks into Subtasks
   4442 :PROPERTIES:
   4443 :DESCRIPTION: Splitting a task into manageable pieces.
   4444 :ALT_TITLE: Breaking Down Tasks
   4445 :END:
   4446 #+cindex: tasks, breaking down
   4447 #+cindex: statistics, for TODO items
   4448 
   4449 #+vindex: org-agenda-todo-list-sublevels
   4450 It is often advisable to break down large tasks into smaller,
   4451 manageable subtasks.  You can do this by creating an outline tree
   4452 below a TODO item, with detailed subtasks on the tree[fn:47].  To keep
   4453 an overview of the fraction of subtasks that have already been marked
   4454 as done, insert either =[/]= or =[%]= anywhere in the headline.  These
   4455 cookies are updated each time the TODO status of a child changes, or
   4456 when pressing {{{kbd(C-c C-c)}}} on the cookie.  For example:
   4457 
   4458 #+begin_example
   4459 ,* Organize Party [33%]
   4460 ,** TODO Call people [1/2]
   4461 ,*** TODO Peter
   4462 ,*** DONE Sarah
   4463 ,** TODO Buy food
   4464 ,** DONE Talk to neighbor
   4465 #+end_example
   4466 
   4467 #+cindex: @samp{COOKIE_DATA}, property
   4468 If a heading has both checkboxes and TODO children below it, the
   4469 meaning of the statistics cookie become ambiguous.  Set the property
   4470 =COOKIE_DATA= to either =checkbox= or =todo= to resolve this issue.
   4471 
   4472 #+vindex: org-hierarchical-todo-statistics
   4473 If you would like to have the statistics cookie count any TODO entries
   4474 in the subtree (not just direct children), configure the variable
   4475 ~org-hierarchical-todo-statistics~.  To do this for a single subtree,
   4476 include the word =recursive= into the value of the =COOKIE_DATA=
   4477 property.
   4478 
   4479 #+begin_example org
   4480 ,* Parent capturing statistics [2/20]
   4481   :PROPERTIES:
   4482   :COOKIE_DATA: todo recursive
   4483   :END:
   4484 #+end_example
   4485 
   4486 If you would like a TODO entry to automatically change to DONE when
   4487 all children are done, you can use the following setup:
   4488 
   4489 #+begin_src emacs-lisp
   4490 (defun org-summary-todo (n-done n-not-done)
   4491   "Switch entry to DONE when all subentries are done, to TODO otherwise."
   4492   (let (org-log-done org-log-states)   ; turn off logging
   4493     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
   4494 
   4495 (add-hook 'org-after-todo-statistics-hook #'org-summary-todo)
   4496 #+end_src
   4497 
   4498 Another possibility is the use of checkboxes to identify (a hierarchy
   4499 of) a large number of subtasks (see [[*Checkboxes]]).
   4500 
   4501 ** Checkboxes
   4502 :PROPERTIES:
   4503 :DESCRIPTION: Tick-off lists.
   4504 :END:
   4505 #+cindex: checkboxes
   4506 
   4507 #+vindex: org-list-automatic-rules
   4508 Every item in a plain list[fn:48] (see [[*Plain Lists]]) can be made into
   4509 a checkbox by starting it with the string =[ ]=.  This feature is
   4510 similar to TODO items (see [[*TODO Items]]), but is more lightweight.
   4511 Checkboxes are not included into the global TODO list, so they are
   4512 often great to split a task into a number of simple steps.  Or you can
   4513 use them in a shopping list.
   4514 
   4515 Here is an example of a checkbox list.
   4516 
   4517 #+begin_example
   4518 ,* TODO Organize party [2/4]
   4519   - [-] call people [1/3]
   4520     - [ ] Peter
   4521     - [X] Sarah
   4522     - [ ] Sam
   4523   - [X] order food
   4524   - [ ] think about what music to play
   4525   - [X] talk to the neighbors
   4526 #+end_example
   4527 
   4528 Checkboxes work hierarchically, so if a checkbox item has children
   4529 that are checkboxes, toggling one of the children checkboxes makes the
   4530 parent checkbox reflect if none, some, or all of the children are
   4531 checked.
   4532 
   4533 #+cindex: statistics, for checkboxes
   4534 #+cindex: checkbox statistics
   4535 #+cindex: @samp{COOKIE_DATA}, property
   4536 #+vindex: org-hierarchical-checkbox-statistics
   4537 The =[2/4]= and =[1/3]= in the first and second line are cookies
   4538 indicating how many checkboxes present in this entry have been checked
   4539 off, and the total number of checkboxes present.  This can give you an
   4540 idea on how many checkboxes remain, even without opening a folded
   4541 entry.  The cookies can be placed into a headline or into (the first
   4542 line of) a plain list item.  Each cookie covers checkboxes of direct
   4543 children structurally below the headline/item on which the cookie
   4544 appears[fn:49].  You have to insert the cookie yourself by typing
   4545 either =[/]= or =[%]=.  With =[/]= you get an =n out of m= result, as
   4546 in the examples above.  With =[%]= you get information about the
   4547 percentage of checkboxes checked (in the above example, this would be
   4548 =[50%]= and =[33%]=, respectively).  In a headline, a cookie can count
   4549 either checkboxes below the heading or TODO states of children, and it
   4550 displays whatever was changed last.  Set the property =COOKIE_DATA= to
   4551 either =checkbox= or =todo= to resolve this issue.
   4552 
   4553 #+cindex: blocking, of checkboxes
   4554 #+cindex: checkbox blocking
   4555 #+cindex: @samp{ORDERED}, property
   4556 If the current outline node has an =ORDERED= property, checkboxes must
   4557 be checked off in sequence, and an error is thrown if you try to check
   4558 off a box while there are unchecked boxes above it.
   4559 
   4560 The following commands work with checkboxes:
   4561 
   4562 - {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
   4563 
   4564   #+kindex: C-c C-c
   4565   #+findex: org-toggle-checkbox
   4566   Toggle checkbox status or---with prefix argument---checkbox presence
   4567   at point.  With a single prefix argument, add an empty checkbox or
   4568   remove the current one[fn:50].  With a double prefix argument, set
   4569   it to =[-]=, which is considered to be an intermediate state.
   4570 
   4571 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
   4572 
   4573   #+kindex: C-c C-x C-b
   4574   Toggle checkbox status or---with prefix argument---checkbox presence
   4575   at point.  With double prefix argument, set it to =[-]=, which is
   4576   considered to be an intermediate state.
   4577 
   4578   - If there is an active region, toggle the first checkbox in the
   4579     region and set all remaining boxes to the same status as the
   4580     first.  With a prefix argument, add or remove the checkbox for all
   4581     items in the region.
   4582 
   4583   - If point is in a headline, toggle checkboxes in the region between
   4584     this headline and the next---so /not/ the entire subtree.
   4585 
   4586   - If there is no active region, just toggle the checkbox at point.
   4587 
   4588 - {{{kbd(C-c C-x C-r)}}} (~org-toggle-radio-button~) ::
   4589 
   4590   #+kindex: C-c C-x C-r
   4591   #+findex: org-toggle-radio-button
   4592   #+cindex: radio button, checkbox as
   4593   Toggle checkbox status by using the checkbox of the item at point as
   4594   a radio button: when the checkbox is turned on, all other checkboxes
   4595   on the same level will be turned off.  With a universal prefix
   4596   argument, toggle the presence of the checkbox.  With a double prefix
   4597   argument, set it to =[-]=.
   4598 
   4599   #+findex: org-list-checkbox-radio-mode
   4600   {{{kbd(C-c C-c)}}} can be told to consider checkboxes as radio buttons by
   4601   setting =#+ATTR_ORG: :radio t= right before the list or by calling
   4602   {{{kbd(M-x org-list-checkbox-radio-mode)}}} to activate this minor mode.
   4603 
   4604 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
   4605 
   4606   #+kindex: M-S-RET
   4607   #+findex: org-insert-todo-heading
   4608   Insert a new item with a checkbox.  This works only if point is
   4609   already in a plain list item (see [[*Plain Lists]]).
   4610 
   4611 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
   4612 
   4613   #+kindex: C-c C-x o
   4614   #+findex: org-toggle-ordered-property
   4615   #+vindex: org-track-ordered-property-with-tag
   4616   Toggle the =ORDERED= property of the entry, to toggle if checkboxes
   4617   must be checked off in sequence.  A property is used for this
   4618   behavior because this should be local to the current entry, not
   4619   inherited like a tag.  However, if you would like to /track/ the
   4620   value of this property with a tag for better visibility, customize
   4621   ~org-track-ordered-property-with-tag~.
   4622 
   4623 - {{{kbd(C-c #)}}} (~org-update-statistics-cookies~) ::
   4624 
   4625   #+kindex: C-c #
   4626   #+findex: org-update-statistics-cookies
   4627   Update the statistics cookie in the current outline entry.  When
   4628   called with a {{{kbd(C-u)}}} prefix, update the entire file.
   4629   Checkbox statistic cookies are updated automatically if you toggle
   4630   checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
   4631   {{{kbd(M-S-RET)}}}.  TODO statistics cookies update when changing
   4632   TODO states.  If you delete boxes/entries or add/change them by
   4633   hand, use this command to get things back into sync.
   4634 
   4635 * Tags
   4636 :PROPERTIES:
   4637 :DESCRIPTION: Tagging headlines and matching sets of tags.
   4638 :END:
   4639 #+cindex: tags
   4640 #+cindex: headline tagging
   4641 #+cindex: matching, tags
   4642 #+cindex: sparse tree, tag based
   4643 
   4644 An excellent way to implement labels and contexts for
   4645 cross-correlating information is to assign /tags/ to headlines.  Org
   4646 mode has extensive support for tags.
   4647 
   4648 #+vindex: org-tag-faces
   4649 Every headline can contain a list of tags; they occur at the end of
   4650 the headline.  Tags are normal words containing letters, numbers, =_=,
   4651 and =@=.  Tags must be preceded and followed by a single colon, e.g.,
   4652 =:work:=.  Several tags can be specified, as in =:work:urgent:=.  Tags
   4653 by default are in bold face with the same color as the headline.  You
   4654 may specify special faces for specific tags using the variable
   4655 ~org-tag-faces~, in much the same way as you can for TODO keywords
   4656 (see [[*Faces for TODO keywords]]).
   4657 
   4658 ** Tag Inheritance
   4659 :PROPERTIES:
   4660 :DESCRIPTION: Tags use the tree structure of an outline.
   4661 :END:
   4662 #+cindex: tag inheritance
   4663 #+cindex: inheritance, of tags
   4664 #+cindex: sublevels, inclusion into tags match
   4665 
   4666 /Tags/ make use of the hierarchical structure of outline trees.  If
   4667 a heading has a certain tag, all subheadings inherit the tag as well.
   4668 For example, in the list
   4669 
   4670 #+begin_example
   4671 ,* Meeting with the French group      :work:
   4672 ,** Summary by Frank                  :boss:notes:
   4673 ,*** TODO Prepare slides for him      :action:
   4674 #+end_example
   4675 
   4676 #+texinfo: @noindent
   4677 the final heading has the tags =work=, =boss=, =notes=, and =action=
   4678 even though the final heading is not explicitly marked with those
   4679 tags.  You can also set tags that all entries in a file should inherit
   4680 just as if these tags were defined in a hypothetical level zero that
   4681 surrounds the entire file.  Use a line like this[fn:51]
   4682 
   4683 #+cindex: @samp{FILETAGS}, keyword
   4684 : #+FILETAGS: :Peter:Boss:Secret:
   4685 
   4686 #+vindex: org-use-tag-inheritance
   4687 #+vindex: org-tags-exclude-from-inheritance
   4688 To limit tag inheritance to specific tags, or to turn it off entirely,
   4689 use the variables ~org-use-tag-inheritance~ and
   4690 ~org-tags-exclude-from-inheritance~.
   4691 
   4692 #+vindex: org-tags-match-list-sublevels
   4693 When a headline matches during a tags search while tag inheritance is
   4694 turned on, all the sublevels in the same tree---for a simple match
   4695 form---match as well[fn:52].  The list of matches may then become
   4696 very long.  If you only want to see the first tags match in a subtree,
   4697 configure the variable ~org-tags-match-list-sublevels~ (not
   4698 recommended).
   4699 
   4700 #+vindex: org-agenda-use-tag-inheritance
   4701 Tag inheritance is relevant when the agenda search tries to match
   4702 a tag, either in the ~tags~ or ~tags-todo~ agenda types.  In other
   4703 agenda types, ~org-use-tag-inheritance~ has no effect.  Still, you may
   4704 want to have your tags correctly set in the agenda, so that tag
   4705 filtering works fine, with inherited tags.  Set
   4706 ~org-agenda-use-tag-inheritance~ to control this: the default value
   4707 includes all agenda types, but setting this to ~nil~ can really speed
   4708 up agenda generation.
   4709 
   4710 ** Setting Tags
   4711 :PROPERTIES:
   4712 :DESCRIPTION: How to assign tags to a headline.
   4713 :END:
   4714 #+cindex: setting tags
   4715 #+cindex: tags, setting
   4716 
   4717 #+kindex: M-TAB
   4718 Tags can simply be typed into the buffer at the end of a headline.
   4719 After a colon, {{{kbd(M-TAB)}}} offers completion on tags.  There is
   4720 also a special command for inserting tags:
   4721 
   4722 - {{{kbd(C-c C-q)}}} (~org-set-tags-command~) ::
   4723 
   4724   #+kindex: C-c C-q
   4725   #+findex: org-set-tags-command
   4726   #+cindex: completion, of tags
   4727   #+vindex: org-tags-column
   4728   Enter new tags for the current headline.  Org mode either offers
   4729   completion or a special single-key interface for setting tags, see
   4730   below.  After pressing {{{kbd(RET)}}}, the tags are inserted and
   4731   aligned to ~org-tags-column~.  When called with a {{{kbd(C-u)}}}
   4732   prefix, all tags in the current buffer are aligned to that column,
   4733   just to make things look nice.  Tags are automatically realigned
   4734   after promotion, demotion, and TODO state changes (see [[*Basic TODO
   4735   Functionality]]).
   4736 
   4737 - {{{kbd(C-c C-c)}}} (~org-set-tags-command~) ::
   4738 
   4739   #+kindex: C-c C-c
   4740   When point is in a headline, this does the same as {{{kbd(C-c
   4741   C-q)}}}.
   4742 
   4743 #+vindex: org-complete-tags-always-offer-all-agenda-tags
   4744 #+vindex: org-tag-alist
   4745 #+cindex: @samp{TAGS}, keyword
   4746 Org supports tag insertion based on a /list of tags/.  By default this
   4747 list is constructed dynamically, containing all tags currently used in
   4748 the buffer[fn:53].  You may also globally specify a hard list of tags
   4749 with the variable ~org-tag-alist~.  Finally you can set the default
   4750 tags for a given file using the =TAGS= keyword, like
   4751 
   4752 #+begin_example
   4753 ,#+TAGS: @work @home @tennisclub
   4754 ,#+TAGS: laptop car pc sailboat
   4755 #+end_example
   4756 
   4757 If you have globally defined your preferred set of tags using the
   4758 variable ~org-tag-alist~, but would like to use a dynamic tag list in
   4759 a specific file, add an empty =TAGS= keyword to that file:
   4760 
   4761 : #+TAGS:
   4762 
   4763 #+vindex: org-tag-persistent-alist
   4764 If you have a preferred set of tags that you would like to use in
   4765 every file, in addition to those defined on a per-file basis by =TAGS=
   4766 keyword, then you may specify a list of tags with the variable
   4767 ~org-tag-persistent-alist~.  You may turn this off on a per-file basis
   4768 by adding a =STARTUP= keyword to that file:
   4769 
   4770 : #+STARTUP: noptag
   4771 
   4772 By default Org mode uses the standard minibuffer completion facilities
   4773 for entering tags.  However, it also implements another, quicker, tag
   4774 selection method called /fast tag selection/.  This allows you to
   4775 select and deselect tags with just a single key press.  For this to
   4776 work well you should assign unique letters to most of your commonly
   4777 used tags.  You can do this globally by configuring the variable
   4778 ~org-tag-alist~ in your Emacs init file.  For example, you may find
   4779 the need to tag many items in different files with =@home=.  In this
   4780 case you can set something like:
   4781 
   4782 #+begin_src emacs-lisp
   4783 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))
   4784 #+end_src
   4785 
   4786 If the tag is only relevant to the file you are working on, then you
   4787 can instead set the =TAGS= keyword as:
   4788 
   4789 : #+TAGS: @work(w)  @home(h)  @tennisclub(t)  laptop(l)  pc(p)
   4790 
   4791 The tags interface shows the available tags in a splash window.  If
   4792 you want to start a new line after a specific tag, insert =\n= into
   4793 the tag list
   4794 
   4795 : #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)
   4796 
   4797 #+texinfo: @noindent
   4798 or write them in two lines:
   4799 
   4800 #+begin_example
   4801 ,#+TAGS: @work(w)  @home(h)  @tennisclub(t)
   4802 ,#+TAGS: laptop(l)  pc(p)
   4803 #+end_example
   4804 
   4805 You can also group together tags that are mutually exclusive by using
   4806 braces, as in:
   4807 
   4808 : #+TAGS: { @work(w)  @home(h)  @tennisclub(t) }  laptop(l)  pc(p)
   4809 
   4810 #+texinfo: @noindent
   4811 you indicate that at most one of =@work=, =@home=, and =@tennisclub=
   4812 should be selected.  Multiple such groups are allowed.
   4813 
   4814 Do not forget to press {{{kbd(C-c C-c)}}} with point in one of these
   4815 lines to activate any changes.
   4816 
   4817 To set these mutually exclusive groups in the variable
   4818 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
   4819 ~:endgroup~ instead of the braces.  Similarly, you can use ~:newline~
   4820 to indicate a line break.  The previous example would be set globally
   4821 by the following configuration:
   4822 
   4823 #+begin_src emacs-lisp
   4824 (setq org-tag-alist '((:startgroup . nil)
   4825                       ("@work" . ?w) ("@home" . ?h)
   4826                       ("@tennisclub" . ?t)
   4827                       (:endgroup . nil)
   4828                       ("laptop" . ?l) ("pc" . ?p)))
   4829 #+end_src
   4830 
   4831 If at least one tag has a selection key then pressing {{{kbd(C-c
   4832 C-c)}}} automatically presents you with a special interface, listing
   4833 inherited tags, the tags of the current headline, and a list of all
   4834 valid tags with corresponding keys[fn:54].
   4835 
   4836 Pressing keys assigned to tags adds or removes them from the list of
   4837 tags in the current line.  Selecting a tag in a group of mutually
   4838 exclusive tags turns off any other tag from that group.
   4839 
   4840 In this interface, you can also use the following special keys:
   4841 
   4842 - {{{kbd(TAB)}}} ::
   4843 
   4844   #+kindex: TAB
   4845   Enter a tag in the minibuffer, even if the tag is not in the
   4846   predefined list.  You can complete on all tags present in the buffer
   4847   and globally pre-defined tags from ~org-tag-alist~ and
   4848   ~org-tag-persistent-alist~.  You can also add several tags: just
   4849   separate them with a comma.
   4850 
   4851 - {{{kbd(SPC)}}} ::
   4852 
   4853   #+kindex: SPC
   4854   Clear all tags for this line.
   4855 
   4856 - {{{kbd(RET)}}} ::
   4857 
   4858   #+kindex: RET
   4859   Accept the modified set.
   4860 
   4861 - {{{kbd(C-g)}}} ::
   4862 
   4863   #+kindex: C-g
   4864   Abort without installing changes.
   4865 
   4866 - {{{kbd(q)}}} ::
   4867 
   4868   #+kindex: q
   4869   If {{{kbd(q)}}} is not assigned to a tag, it aborts like
   4870   {{{kbd(C-g)}}}.
   4871 
   4872 - {{{kbd(!)}}} ::
   4873 
   4874   #+kindex: !
   4875   Turn off groups of mutually exclusive tags.  Use this to (as an
   4876   exception) assign several tags from such a group.
   4877 
   4878 - {{{kbd(C-c)}}} ::
   4879 
   4880   #+kindex: C-c C-c
   4881   Toggle auto-exit after the next change (see below).  If you are
   4882   using expert mode, the first {{{kbd(C-c)}}} displays the selection
   4883   window.
   4884 
   4885 This method lets you assign tags to a headline with very few keys.
   4886 With the above setup, you could clear the current tags and set
   4887 =@home=, =laptop= and =pc= tags with just the following keys:
   4888 {{{kbd(C-c C-c SPC h l p RET)}}}.  Switching from =@home= to =@work=
   4889 would be done with {{{kbd(C-c C-c w RET)}}} or alternatively with
   4890 {{{kbd(C-c C-c C-c w)}}}.  Adding the non-predefined tag =sarah= could
   4891 be done with {{{kbd(C-c C-c TAB s a r a h RET)}}}.
   4892 
   4893 #+vindex: org-fast-tag-selection-single-key
   4894 If you find that most of the time you need only a single key press to
   4895 modify your list of tags, set the variable
   4896 ~org-fast-tag-selection-single-key~.  Then you no longer have to press
   4897 {{{kbd(RET)}}} to exit fast tag selection---it exits after the first
   4898 change.  If you then occasionally need more keys, press {{{kbd(C-c)}}}
   4899 to turn off auto-exit for the current tag selection process (in
   4900 effect: start selection with {{{kbd(C-c C-c C-c)}}} instead of
   4901 {{{kbd(C-c C-c)}}}).  If you set the variable to the value ~expert~,
   4902 the special window is not even shown for single-key tag selection, it
   4903 comes up only when you press an extra {{{kbd(C-c)}}}.
   4904 
   4905 ** Tag Hierarchy
   4906 :PROPERTIES:
   4907 :DESCRIPTION: Create a hierarchy of tags.
   4908 :END:
   4909 #+cindex: group tags
   4910 #+cindex: tags, groups
   4911 #+cindex: tags hierarchy
   4912 
   4913 Tags can be defined in hierarchies.  A tag can be defined as a /group
   4914 tag/ for a set of other tags.  The group tag can be seen as the
   4915 "broader term" for its set of tags.  Defining multiple group tags and
   4916 nesting them creates a tag hierarchy.
   4917 
   4918 One use-case is to create a taxonomy of terms (tags) that can be used
   4919 to classify nodes in a document or set of documents.
   4920 
   4921 When you search for a group tag, it return matches for all members in
   4922 the group and its subgroups.  In an agenda view, filtering by a group
   4923 tag displays or hide headlines tagged with at least one of the members
   4924 of the group or any of its subgroups.  This makes tag searches and
   4925 filters even more flexible.
   4926 
   4927 You can set group tags by using brackets and inserting a colon between
   4928 the group tag and its related tags---beware that all whitespaces are
   4929 mandatory so that Org can parse this line correctly:
   4930 
   4931 : #+TAGS: [ GTD : Control Persp ]
   4932 
   4933 In this example, =GTD= is the group tag and it is related to two other
   4934 tags: =Control=, =Persp=.  Defining =Control= and =Persp= as group
   4935 tags creates a hierarchy of tags:
   4936 
   4937 #+begin_example
   4938 ,#+TAGS: [ Control : Context Task ]
   4939 ,#+TAGS: [ Persp : Vision Goal AOF Project ]
   4940 #+end_example
   4941 
   4942 That can conceptually be seen as a hierarchy of tags:
   4943 
   4944 - =GTD=
   4945   - =Persp=
   4946     - =Vision=
   4947     - =Goal=
   4948     - =AOF=
   4949     - =Project=
   4950   - =Control=
   4951     - =Context=
   4952     - =Task=
   4953 
   4954 You can use the ~:startgrouptag~, ~:grouptags~ and ~:endgrouptag~
   4955 keyword directly when setting ~org-tag-alist~ directly:
   4956 
   4957 #+begin_src emacs-lisp
   4958 (setq org-tag-alist '((:startgrouptag)
   4959                       ("GTD")
   4960                       (:grouptags)
   4961                       ("Control")
   4962                       ("Persp")
   4963                       (:endgrouptag)
   4964                       (:startgrouptag)
   4965                       ("Control")
   4966                       (:grouptags)
   4967                       ("Context")
   4968                       ("Task")
   4969                       (:endgrouptag)))
   4970 #+end_src
   4971 
   4972 The tags in a group can be mutually exclusive if using the same group
   4973 syntax as is used for grouping mutually exclusive tags together; using
   4974 curly brackets.
   4975 
   4976 : #+TAGS: { Context : @Home @Work @Call }
   4977 
   4978 When setting ~org-tag-alist~ you can use ~:startgroup~ and ~:endgroup~
   4979 instead of ~:startgrouptag~ and ~:endgrouptag~ to make the tags
   4980 mutually exclusive.
   4981 
   4982 Furthermore, the members of a group tag can also be regular
   4983 expressions, creating the possibility of a more dynamic and rule-based
   4984 tag structure (see [[*Regular Expressions]]).  The regular expressions in
   4985 the group must be specified within curly brackets.  Here is an
   4986 expanded example:
   4987 
   4988 #+begin_example
   4989 ,#+TAGS: [ Vision : {V@.+} ]
   4990 ,#+TAGS: [ Goal : {G@.+} ]
   4991 ,#+TAGS: [ AOF : {AOF@.+} ]
   4992 ,#+TAGS: [ Project : {P@.+} ]
   4993 #+end_example
   4994 
   4995 Searching for the tag =Project= now lists all tags also including
   4996 regular expression matches for =P@.+=, and similarly for tag searches
   4997 on =Vision=, =Goal= and =AOF=.  For example, this would work well for
   4998 a project tagged with a common project-identifier, e.g.,
   4999 =P@2014_OrgTags=.
   5000 
   5001 #+kindex: C-c C-x q
   5002 #+findex: org-toggle-tags-groups
   5003 #+vindex: org-group-tags
   5004 If you want to ignore group tags temporarily, toggle group tags
   5005 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}.
   5006 If you want to disable tag groups completely, set ~org-group-tags~ to
   5007 ~nil~.
   5008 
   5009 ** Tag Searches
   5010 :PROPERTIES:
   5011 :DESCRIPTION: Searching for combinations of tags.
   5012 :END:
   5013 #+cindex: tag searches
   5014 #+cindex: searching for tags
   5015 
   5016 Once a system of tags has been set up, it can be used to collect
   5017 related information into special lists.
   5018 
   5019 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
   5020 
   5021   #+kindex: C-c / m
   5022   #+kindex: C-c \
   5023   #+findex: org-match-sparse-tree
   5024   Create a sparse tree with all headlines matching a tags search.
   5025   With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
   5026   a TODO line.
   5027 
   5028 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
   5029 
   5030   #+kindex: m @r{(Agenda dispatcher)}
   5031   #+findex: org-tags-view
   5032   Create a global list of tag matches from all agenda files.  See
   5033   [[*Matching tags and properties]].
   5034 
   5035 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
   5036 
   5037   #+kindex: M @r{(Agenda dispatcher)}
   5038   #+vindex: org-tags-match-list-sublevels
   5039   Create a global list of tag matches from all agenda files, but check
   5040   only TODO items and force checking subitems (see the option
   5041   ~org-tags-match-list-sublevels~).
   5042 
   5043 These commands all prompt for a match string which allows basic
   5044 Boolean logic like =+boss+urgent-project1=, to find entries with tags
   5045 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find
   5046 entries which are tagged, like =Kathy= or =Sally=.  The full syntax of
   5047 the search string is rich and allows also matching against TODO
   5048 keywords, entry levels and properties.  For a complete description
   5049 with many examples, see [[*Matching tags and properties]].
   5050 
   5051 * Properties and Columns
   5052 :PROPERTIES:
   5053 :DESCRIPTION: Storing information about an entry.
   5054 :END:
   5055 #+cindex: properties
   5056 
   5057 A property is a key-value pair associated with an entry.  Properties
   5058 can be set so they are associated with a single entry, with every
   5059 entry in a tree, or with the whole buffer.
   5060 
   5061 There are two main applications for properties in Org mode.  First,
   5062 properties are like tags, but with a value.  Imagine maintaining
   5063 a file where you document bugs and plan releases for a piece of
   5064 software.  Instead of using tags like =release_1=, =release_2=, you
   5065 can use a property, say =Release=, that in different subtrees has
   5066 different values, such as =1.0= or =2.0=.  Second, you can use
   5067 properties to implement (very basic) database capabilities in an Org
   5068 buffer.  Imagine keeping track of your music CDs, where properties
   5069 could be things such as the album, artist, date of release, number of
   5070 tracks, and so on.
   5071 
   5072 Properties can be conveniently edited and viewed in column view (see
   5073 [[*Column View]]).
   5074 
   5075 ** Property Syntax
   5076 :PROPERTIES:
   5077 :DESCRIPTION: How properties are spelled out.
   5078 :END:
   5079 #+cindex: property syntax
   5080 #+cindex: drawer, for properties
   5081 
   5082 Properties are key--value pairs.  When they are associated with
   5083 a single entry or with a tree they need to be inserted into a special
   5084 drawer (see [[*Drawers]]) with the name =PROPERTIES=, which has to be
   5085 located right below a headline, and its planning line (see [[*Deadlines
   5086 and Scheduling]]) when applicable.  Each property is specified on
   5087 a single line, with the key---surrounded by colons---first, and the
   5088 value after it.  Keys are case-insensitive.  Here is an example:
   5089 
   5090 #+begin_example
   5091 ,* CD collection
   5092 ,** Classic
   5093 ,*** Goldberg Variations
   5094     :PROPERTIES:
   5095     :Title:     Goldberg Variations
   5096     :Composer:  J.S. Bach
   5097     :Artist:    Glenn Gould
   5098     :Publisher: Deutsche Grammophon
   5099     :NDisks:    1
   5100     :END:
   5101 #+end_example
   5102 
   5103 Depending on the value of ~org-use-property-inheritance~, a property
   5104 set this way is associated either with a single entry, or with the
   5105 sub-tree defined by the entry, see [[*Property Inheritance]].
   5106 
   5107 You may define the allowed values for a particular property =Xyz= by
   5108 setting a property =Xyz_ALL=.  This special property is /inherited/,
   5109 so if you set it in a level 1 entry, it applies to the entire tree.
   5110 When allowed values are defined, setting the corresponding property
   5111 becomes easier and is less prone to typing errors.  For the example
   5112 with the CD collection, we can pre-define publishers and the number of
   5113 disks in a box like this:
   5114 
   5115 #+begin_example
   5116 ,* CD collection
   5117   :PROPERTIES:
   5118   :NDisks_ALL:  1 2 3 4
   5119   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
   5120   :END:
   5121 #+end_example
   5122 
   5123 Properties can be inserted on buffer level.  That means they apply
   5124 before the first headline and can be inherited by all entries in a
   5125 file.  Property blocks defined before first headline needs to be
   5126 located at the top of the buffer, allowing only comments above.
   5127 
   5128 Properties can also be defined using lines like:
   5129 
   5130 #+cindex: @samp{_ALL} suffix, in properties
   5131 #+cindex: @samp{PROPERTY}, keyword
   5132 : #+PROPERTY: NDisks_ALL 1 2 3 4
   5133 
   5134 #+cindex: @samp{+} suffix, in properties
   5135 If you want to add to the value of an existing property, append a =+=
   5136 to the property name.  The following results in the property =var=
   5137 having the value =foo=1 bar=2=.
   5138 
   5139 #+begin_example
   5140 ,#+PROPERTY: var  foo=1
   5141 ,#+PROPERTY: var+ bar=2
   5142 #+end_example
   5143 
   5144 It is also possible to add to the values of inherited properties.  The
   5145 following results in the =Genres= property having the value =Classic
   5146 Baroque= under the =Goldberg Variations= subtree.
   5147 
   5148 #+begin_example
   5149 ,* CD collection
   5150 ,** Classic
   5151     :PROPERTIES:
   5152     :Genres: Classic
   5153     :END:
   5154 ,*** Goldberg Variations
   5155     :PROPERTIES:
   5156     :Title:     Goldberg Variations
   5157     :Composer:  J.S. Bach
   5158     :Artist:    Glenn Gould
   5159     :Publisher: Deutsche Grammophon
   5160     :NDisks:    1
   5161     :Genres+:   Baroque
   5162     :END:
   5163 #+end_example
   5164 
   5165 Note that a property can only have one entry per drawer.
   5166 
   5167 #+vindex: org-global-properties
   5168 Property values set with the global variable ~org-global-properties~
   5169 can be inherited by all entries in all Org files.
   5170 
   5171 The following commands help to work with properties:
   5172 
   5173 #+attr_texinfo: :sep ,
   5174 - {{{kbd(M-TAB)}}} (~pcomplete~) ::
   5175 
   5176   #+kindex: M-TAB
   5177   #+findex: pcomplete
   5178   After an initial colon in a line, complete property keys.  All keys
   5179   used in the current file are offered as possible completions.
   5180 
   5181 - {{{kbd(C-c C-x p)}}} (~org-set-property~) ::
   5182 
   5183   #+kindex: C-c C-x p
   5184   #+findex: org-set-property
   5185   Set a property.  This prompts for a property name and a value.  If
   5186   necessary, the property drawer is created as well.
   5187 
   5188 - {{{kbd(C-u M-x org-insert-drawer)}}} ::
   5189 
   5190   #+findex: org-insert-drawer
   5191   Insert a property drawer into the current entry.  The drawer is
   5192   inserted early in the entry, but after the lines with planning
   5193   information like deadlines.  If before first headline the drawer is
   5194   inserted at the top of the drawer after any potential comments.
   5195 
   5196 - {{{kbd(C-c C-c)}}} (~org-property-action~) ::
   5197 
   5198   #+kindex: C-c C-c
   5199   #+findex: org-property-action
   5200   With point in a property drawer, this executes property commands.
   5201 
   5202 - {{{kbd(C-c C-c s)}}} (~org-set-property~) ::
   5203 
   5204   #+kindex: C-c C-c s
   5205   #+findex: org-set-property
   5206   Set a property in the current entry.  Both the property and the
   5207   value can be inserted using completion.
   5208 
   5209 - {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-values~),  {{{kbd(S-LEFT)}}} (~org-property-previous-allowed-value~) ::
   5210 
   5211   #+kindex: S-RIGHT
   5212   #+kindex: S-LEFT
   5213   Switch property at point to the next/previous allowed value.
   5214 
   5215 - {{{kbd(C-c C-c d)}}} (~org-delete-property~) ::
   5216 
   5217   #+kindex: C-c C-c d
   5218   #+findex: org-delete-property
   5219   Remove a property from the current entry.
   5220 
   5221 - {{{kbd(C-c C-c D)}}} (~org-delete-property-globally~) ::
   5222 
   5223   #+kindex: C-c C-c D
   5224   #+findex: org-delete-property-globally
   5225   Globally remove a property, from all entries in the current file.
   5226 
   5227 - {{{kbd(C-c C-c c)}}} (~org-compute-property-at-point~) ::
   5228 
   5229   #+kindex: C-c C-c c
   5230   #+findex: org-compute-property-at-point
   5231   Compute the property at point, using the operator and scope from the
   5232   nearest column format definition.
   5233 
   5234 ** Special Properties
   5235 :PROPERTIES:
   5236 :DESCRIPTION: Access to other Org mode features.
   5237 :END:
   5238 #+cindex: properties, special
   5239 
   5240 Special properties provide an alternative access method to Org mode
   5241 features, like the TODO state or the priority of an entry, discussed
   5242 in the previous chapters.  This interface exists so that you can
   5243 include these states in a column view (see [[*Column View]]), or to use
   5244 them in queries.  The following property names are special and should
   5245 not be used as keys in the properties drawer:
   5246 
   5247 #+cindex: @samp{ALLTAGS}, special property
   5248 #+cindex: @samp{BLOCKED}, special property
   5249 #+cindex: @samp{CLOCKSUM}, special property
   5250 #+cindex: @samp{CLOCKSUM_T}, special property
   5251 #+cindex: @samp{CLOSED}, special property
   5252 #+cindex: @samp{DEADLINE}, special property
   5253 #+cindex: @samp{FILE}, special property
   5254 #+cindex: @samp{ITEM}, special property
   5255 #+cindex: @samp{PRIORITY}, special property
   5256 #+cindex: @samp{SCHEDULED}, special property
   5257 #+cindex: @samp{TAGS}, special property
   5258 #+cindex: @samp{TIMESTAMP}, special property
   5259 #+cindex: @samp{TIMESTAMP_IA}, special property
   5260 #+cindex: @samp{TODO}, special property
   5261 | =ALLTAGS=      | All tags, including inherited ones.                            |
   5262 | =BLOCKED=      | ~t~ if task is currently blocked by children or siblings.      |
   5263 | =CATEGORY=     | The category of an entry.                                      |
   5264 | =CLOCKSUM=     | The sum of CLOCK intervals in the subtree.  ~org-clock-sum~    |
   5265 |                | must be run first to compute the values in the current buffer. |
   5266 | =CLOCKSUM_T=   | The sum of CLOCK intervals in the subtree for today.           |
   5267 |                | ~org-clock-sum-today~ must be run first to compute the         |
   5268 |                | values in the current buffer.                                  |
   5269 | =CLOSED=       | When was this entry closed?                                    |
   5270 | =DEADLINE=     | The deadline timestamp.                                        |
   5271 | =FILE=         | The filename the entry is located in.                          |
   5272 | =ITEM=         | The headline of the entry.                                     |
   5273 | =PRIORITY=     | The priority of the entry, a string with a single letter.      |
   5274 | =SCHEDULED=    | The scheduling timestamp.                                      |
   5275 | =TAGS=         | The tags defined directly in the headline.                     |
   5276 | =TIMESTAMP=    | The first keyword-less timestamp in the entry.                 |
   5277 | =TIMESTAMP_IA= | The first inactive timestamp in the entry.                     |
   5278 | =TODO=         | The TODO keyword of the entry.                                 |
   5279 
   5280 ** Property Searches
   5281 :PROPERTIES:
   5282 :DESCRIPTION: Matching property values.
   5283 :END:
   5284 #+cindex: properties, searching
   5285 #+cindex: searching, of properties
   5286 
   5287 To create sparse trees and special lists with selection based on
   5288 properties, the same commands are used as for tag searches (see [[*Tag
   5289 Searches]]).
   5290 
   5291 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
   5292 
   5293   #+kindex: C-c / m
   5294   #+kindex: C-c \
   5295   #+findex: org-match-sparse-tree
   5296   Create a sparse tree with all matching entries.  With
   5297   a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
   5298   a TODO line.
   5299 
   5300 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
   5301 
   5302   #+kindex: m @r{(Agenda dispatcher)}
   5303   #+findex: org-tags-view
   5304   Create a global list of tag/property matches from all agenda files.
   5305 
   5306 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
   5307 
   5308   #+kindex: M @r{(Agenda dispatcher)}
   5309   #+vindex: org-tags-match-list-sublevels
   5310   Create a global list of tag matches from all agenda files, but check
   5311   only TODO items and force checking of subitems (see the option
   5312   ~org-tags-match-list-sublevels~).
   5313 
   5314 The syntax for the search string is described in [[*Matching tags and
   5315 properties]].
   5316 
   5317 There is also a special command for creating sparse trees based on a
   5318 single property:
   5319 
   5320 - {{{kbd(C-c / p)}}} ::
   5321 
   5322   #+kindex: C-c / p
   5323   Create a sparse tree based on the value of a property.  This first
   5324   prompts for the name of a property, and then for a value.  A sparse
   5325   tree is created with all entries that define this property with the
   5326   given value.  If you enclose the value in curly braces, it is
   5327   interpreted as a regular expression and matched against the property
   5328   values (see [[*Regular Expressions]]).
   5329 
   5330 ** Property Inheritance
   5331 :PROPERTIES:
   5332 :DESCRIPTION: Passing values down a tree.
   5333 :END:
   5334 #+cindex: properties, inheritance
   5335 #+cindex: inheritance, of properties
   5336 
   5337 #+vindex: org-use-property-inheritance
   5338 The outline structure of Org documents lends itself to an inheritance
   5339 model of properties: if the parent in a tree has a certain property,
   5340 the children can inherit this property.  Org mode does not turn this
   5341 on by default, because it can slow down property searches
   5342 significantly and is often not needed.  However, if you find
   5343 inheritance useful, you can turn it on by setting the variable
   5344 ~org-use-property-inheritance~.  It may be set to ~t~ to make all
   5345 properties inherited from the parent, to a list of properties that
   5346 should be inherited, or to a regular expression that matches inherited
   5347 properties.  If a property has the value ~nil~, this is interpreted as
   5348 an explicit un-define of the property, so that inheritance search
   5349 stops at this value and returns ~nil~.
   5350 
   5351 Org mode has a few properties for which inheritance is hard-coded, at
   5352 least for the special applications for which they are used:
   5353 
   5354 - ~COLUMNS~ ::
   5355 
   5356   #+cindex: @samp{COLUMNS}, property
   5357   The =COLUMNS= property defines the format of column view (see
   5358   [[*Column View]]).  It is inherited in the sense that the level where
   5359   a =COLUMNS= property is defined is used as the starting point for
   5360   a column view table, independently of the location in the subtree
   5361   from where columns view is turned on.
   5362 
   5363 - ~CATEGORY~ ::
   5364 
   5365   #+cindex: @samp{CATEGORY}, property
   5366   For agenda view, a category set through a =CATEGORY= property
   5367   applies to the entire subtree.
   5368 
   5369 - ~ARCHIVE~ ::
   5370 
   5371   #+cindex: @samp{ARCHIVE}, property
   5372   For archiving, the =ARCHIVE= property may define the archive
   5373   location for the entire subtree (see [[*Moving a tree to an archive
   5374   file]]).
   5375 
   5376 - ~LOGGING~ ::
   5377 
   5378   #+cindex: @samp{LOGGING}, property
   5379   The =LOGGING= property may define logging settings for an entry or
   5380   a subtree (see [[*Tracking TODO state changes]]).
   5381 
   5382 ** Column View
   5383 :PROPERTIES:
   5384 :DESCRIPTION: Tabular viewing and editing.
   5385 :END:
   5386 
   5387 A great way to view and edit properties in an outline tree is /column
   5388 view/.  In column view, each outline node is turned into a table row.
   5389 Columns in this table provide access to properties of the entries.
   5390 Org mode implements columns by overlaying a tabular structure over the
   5391 headline of each item.  While the headlines have been turned into
   5392 a table row, you can still change the visibility of the outline tree.
   5393 For example, you get a compact table by switching to "contents"
   5394 view---{{{kbd(S-TAB)}}} {{{kbd(S-TAB)}}}, or simply {{{kbd(c)}}}
   5395 while column view is active---but you can still open, read, and edit
   5396 the entry below each headline.  Or, you can switch to column view
   5397 after executing a sparse tree command and in this way get a table only
   5398 for the selected items.  Column view also works in agenda buffers (see
   5399 [[*Agenda Views]]) where queries have collected selected items, possibly
   5400 from a number of files.
   5401 
   5402 *** Defining columns
   5403 :PROPERTIES:
   5404 :DESCRIPTION: The COLUMNS format property.
   5405 :END:
   5406 #+cindex: column view, for properties
   5407 #+cindex: properties, column view
   5408 
   5409 Setting up a column view first requires defining the columns.  This is
   5410 done by defining a column format line.
   5411 
   5412 **** Scope of column definitions
   5413 :PROPERTIES:
   5414 :DESCRIPTION: Where defined, where valid?
   5415 :END:
   5416 
   5417 To specify a format that only applies to a specific tree, add
   5418 a =COLUMNS= property to the top node of that tree, for example:
   5419 
   5420 #+begin_example
   5421 ,** Top node for columns view
   5422    :PROPERTIES:
   5423    :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
   5424    :END:
   5425 #+end_example
   5426 
   5427 A =COLUMNS= property within a property drawer before first headline
   5428 will apply to the entire file.  As an addition to property drawers,
   5429 keywords can also be defined for an entire file using a line like:
   5430 
   5431 #+cindex: @samp{COLUMNS}, keyword
   5432 : #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
   5433 
   5434 If a =COLUMNS= property is present in an entry, it defines columns for
   5435 the entry itself, and for the entire subtree below it.  Since the
   5436 column definition is part of the hierarchical structure of the
   5437 document, you can define columns on level 1 that are general enough
   5438 for all sublevels, and more specific columns further down, when you
   5439 edit a deeper part of the tree.
   5440 
   5441 **** Column attributes
   5442 :PROPERTIES:
   5443 :DESCRIPTION: Appearance and content of a column.
   5444 :END:
   5445 
   5446 A column definition sets the attributes of a column.  The general
   5447 definition looks like this:
   5448 
   5449 : %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}]
   5450 
   5451 #+texinfo: @noindent
   5452 Except for the percent sign and the property name, all items are
   5453 optional.  The individual parts have the following meaning:
   5454 
   5455 - {{{var(WIDTH)}}} ::
   5456 
   5457   An integer specifying the width of the column in characters.  If
   5458   omitted, the width is determined automatically.
   5459 
   5460 - {{{var(PROPERTY)}}} ::
   5461 
   5462   The property that should be edited in this column.  Special
   5463   properties representing meta data are allowed here as well (see
   5464   [[*Special Properties]]).
   5465 
   5466 - {{{var(TITLE)}}} ::
   5467 
   5468   The header text for the column.  If omitted, the property name is
   5469   used.
   5470 
   5471 - {{{var(SUMMARY-TYPE)}}} ::
   5472 
   5473   The summary type.  If specified, the column values for parent nodes
   5474   are computed from the children[fn:55].
   5475 
   5476   Supported summary types are:
   5477 
   5478   | =+=      | Sum numbers in this column.                           |
   5479   | =+;%.1f= | Like =+=, but format result with =%.1f=.              |
   5480   | =$=      | Currency, short for =+;%.2f=.                         |
   5481   | =min=    | Smallest number in column.                            |
   5482   | =max=    | Largest number.                                       |
   5483   | =mean=   | Arithmetic mean of numbers.                           |
   5484   | =X=      | Checkbox status, =[X]= if all children are =[X]=.     |
   5485   | =X/=     | Checkbox status, =[n/m]=.                             |
   5486   | =X%=     | Checkbox status, =[n%]=.                              |
   5487   | =:=      | Sum times, HH:MM, plain numbers are minutes.          |
   5488   | =:min=   | Smallest time value in column.                        |
   5489   | =:max=   | Largest time value.                                   |
   5490   | =:mean=  | Arithmetic mean of time values.                       |
   5491   | =@min=   | Minimum age[fn:56] (in days/hours/mins/seconds).      |
   5492   | =@max=   | Maximum age (in days/hours/mins/seconds).             |
   5493   | =@mean=  | Arithmetic mean of ages (in days/hours/mins/seconds). |
   5494   | =est+=   | Add low-high estimates.                               |
   5495 
   5496   #+vindex: org-columns-summary-types
   5497   You can also define custom summary types by setting
   5498   ~org-columns-summary-types~.
   5499 
   5500 The =est+= summary type requires further explanation.  It is used for
   5501 combining estimates, expressed as low-high ranges.  For example,
   5502 instead of estimating a particular task will take 5 days, you might
   5503 estimate it as 5--6 days if you're fairly confident you know how much
   5504 work is required, or 1--10 days if you do not really know what needs
   5505 to be done.  Both ranges average at 5.5 days, but the first represents
   5506 a more predictable delivery.
   5507 
   5508 When combining a set of such estimates, simply adding the lows and
   5509 highs produces an unrealistically wide result.  Instead, =est+= adds
   5510 the statistical mean and variance of the subtasks, generating a final
   5511 estimate from the sum.  For example, suppose you had ten tasks, each
   5512 of which was estimated at 0.5 to 2 days of work.  Straight addition
   5513 produces an estimate of 5 to 20 days, representing what to expect if
   5514 everything goes either extremely well or extremely poorly.  In
   5515 contrast, =est+= estimates the full job more realistically, at 10--15
   5516 days.
   5517 
   5518 Here is an example for a complete columns definition, along with
   5519 allowed values[fn:57].
   5520 
   5521 #+begin_example
   5522 :COLUMNS:  %25ITEM %9Approved(Approved?){X} %Owner %11Status \
   5523                    %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
   5524 :Owner_ALL:    Tammy Mark Karl Lisa Don
   5525 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
   5526 :Approved_ALL: "[ ]" "[X]"
   5527 #+end_example
   5528 
   5529 #+texinfo: @noindent
   5530 The first column, =%25ITEM=, means the first 25 characters of the item
   5531 itself, i.e., of the headline.  You probably always should start the
   5532 column definition with the =ITEM= specifier.  The other specifiers
   5533 create columns =Owner= with a list of names as allowed values, for
   5534 =Status= with four different possible values, and for a checkbox field
   5535 =Approved=.  When no width is given after the =%= character, the
   5536 column is exactly as wide as it needs to be in order to fully display
   5537 all values.  The =Approved= column does have a modified title
   5538 (=Approved?=, with a question mark).  Summaries are created for the
   5539 =Time_Estimate= column by adding time duration expressions like HH:MM,
   5540 and for the =Approved= column, by providing an =[X]= status if all
   5541 children have been checked.  The =CLOCKSUM= and =CLOCKSUM_T= columns
   5542 are special, they lists the sums of CLOCK intervals in the subtree,
   5543 either for all clocks or just for today.
   5544 
   5545 *** Using column view
   5546 :PROPERTIES:
   5547 :DESCRIPTION: How to create and use column view.
   5548 :END:
   5549 
   5550 **** Turning column view on or off
   5551 :PROPERTIES:
   5552 :UNNUMBERED: notoc
   5553 :END:
   5554 
   5555 - {{{kbd(C-c C-x C-c)}}} (~org-columns~) ::
   5556 
   5557   #+kindex: C-c C-x C-c
   5558   #+vindex: org-columns
   5559   #+vindex: org-columns-default-format
   5560   Turn on column view.  If point is before the first headline in the
   5561   file, column view is turned on for the entire file, using the
   5562   =#+COLUMNS= definition.  If point is somewhere inside the outline,
   5563   this command searches the hierarchy, up from point, for a =COLUMNS=
   5564   property that defines a format.  When one is found, the column view
   5565   table is established for the tree starting at the entry that
   5566   contains the =COLUMNS= property.  If no such property is found, the
   5567   format is taken from the =#+COLUMNS= line or from the variable
   5568   ~org-columns-default-format~, and column view is established for the
   5569   current entry and its subtree.
   5570 
   5571 - {{{kbd(r)}}} or {{{kbd(g)}}} on a columns view line (~org-columns-redo~) ::
   5572 
   5573   #+kindex: r
   5574   #+kindex: g
   5575   #+findex: org-columns-redo
   5576   Recreate the column view, to include recent changes made in the
   5577   buffer.
   5578 
   5579 - {{{kbd(C-c C-c)}}} or {{{kbd(q)}}} on a columns view line (~org-columns-quit~) ::
   5580 
   5581   #+kindex: q
   5582   #+kindex: C-c C-c
   5583   #+findex: org-columns-quit
   5584   Exit column view.
   5585 
   5586 **** Editing values
   5587 :PROPERTIES:
   5588 :UNNUMBERED: notoc
   5589 :END:
   5590 
   5591 #+attr_texinfo: :sep and
   5592 - {{{kbd(LEFT)}}}, {{{kbd(RIGHT)}}}, {{{kbd(UP)}}}, {{{kbd(DOWN)}}} ::
   5593 
   5594   Move through the column view from field to field.
   5595 
   5596 - {{{kbd(1..9\,0)}}} ::
   5597 
   5598   #+kindex: 1..9,0
   5599   Directly select the Nth allowed value, {{{kbd(0)}}} selects the
   5600   10th value.
   5601 
   5602 - {{{kbd(n)}}} or {{{kbd(S-RIGHT)}}} (~org-columns-next-allowed-value~) and {{{kbd(p)}}} or {{{kbd(S-LEFT)}}} (~org-columns-previous-allowed-value~) ::
   5603 
   5604   #+kindex: n
   5605   #+kindex: S-RIGHT
   5606   #+kindex: p
   5607   #+kindex: S-LEFT
   5608   #+findex: org-columns-next-allowed-value
   5609   #+findex: org-columns-previous-allowed-value
   5610   Switch to the next/previous allowed value of the field.  For this,
   5611   you have to have specified allowed values for a property.
   5612 
   5613 - {{{kbd(e)}}} (~org-columns-edit-value~) ::
   5614 
   5615   #+kindex: e
   5616   #+findex: org-columns-edit-value
   5617   Edit the property at point.  For the special properties, this
   5618   invokes the same interface that you normally use to change that
   5619   property.  For example, the tag completion or fast selection
   5620   interface pops up when editing a =TAGS= property.
   5621 
   5622 - {{{kbd(C-c C-c)}}} (~org-columns-toggle-or-columns-quit~) ::
   5623 
   5624   #+kindex: C-c C-c
   5625   #+findex: org-columns-toggle-or-columns-quit
   5626   When there is a checkbox at point, toggle it.  Else exit column
   5627   view.
   5628 
   5629 - {{{kbd(v)}}} (~org-columns-show-value~) ::
   5630 
   5631   #+kindex: v
   5632   #+findex: org-columns-show-value
   5633   View the full value of this property.  This is useful if the width
   5634   of the column is smaller than that of the value.
   5635 
   5636 - {{{kbd(a)}}} (~org-columns-edit-allowed~) ::
   5637 
   5638   #+kindex: a
   5639   #+findex: org-columns-edit-allowed
   5640   Edit the list of allowed values for this property.  If the list is
   5641   found in the hierarchy, the modified values is stored there.  If no
   5642   list is found, the new value is stored in the first entry that is
   5643   part of the current column view.
   5644 
   5645 **** Modifying column view on-the-fly
   5646 :PROPERTIES:
   5647 :UNNUMBERED: notoc
   5648 :END:
   5649 
   5650 #+attr_texinfo: :sep and
   5651 - {{{kbd(<)}}} (~org-columns-narrow~) and {{{kbd(>)}}} (~org-columns-widen~) ::
   5652 
   5653   #+kindex: <
   5654   #+kindex: >
   5655   #+findex: org-columns-narrow
   5656   #+findex: org-columns-widen
   5657   Make the column narrower/wider by one character.
   5658 
   5659 - {{{kbd(S-M-RIGHT)}}} (~org-columns-new~) ::
   5660 
   5661   #+kindex: S-M-RIGHT
   5662   #+findex: org-columns-new
   5663   Insert a new column, to the left of the current column.
   5664 
   5665 - {{{kbd(S-M-LEFT)}}} (~org-columns-delete~) ::
   5666 
   5667   #+kindex: S-M-LEFT
   5668   #+findex: org-columns-delete
   5669   Delete the current column.
   5670 
   5671 *** Capturing column view
   5672 :PROPERTIES:
   5673 :DESCRIPTION: A dynamic block for column view.
   5674 :END:
   5675 
   5676 Since column view is just an overlay over a buffer, it cannot be
   5677 exported or printed directly.  If you want to capture a column view,
   5678 use a =columnview= dynamic block (see [[*Dynamic Blocks]]).  The frame of
   5679 this block looks like this:
   5680 
   5681 #+cindex: @samp{BEGIN columnview}
   5682 #+begin_example
   5683 ,* The column view
   5684 ,#+BEGIN: columnview :hlines 1 :id "label"
   5685 
   5686 ,#+END:
   5687 #+end_example
   5688 
   5689 This dynamic block has the following parameters:
   5690 
   5691 - =:id= ::
   5692 
   5693   This is the most important parameter.  Column view is a feature that
   5694   is often localized to a certain (sub)tree, and the capture block
   5695   might be at a different location in the file.  To identify the tree
   5696   whose view to capture, you can use four values:
   5697 
   5698   - =local= ::
   5699 
   5700     Use the tree in which the capture block is located.
   5701 
   5702   - =global= ::
   5703 
   5704     Make a global view, including all headings in the file.
   5705 
   5706   - =file:FILENAME= ::
   5707 
   5708     Run column view at the top of the {{{var(FILENAME)}}} file.
   5709 
   5710   - =LABEL= ::
   5711 
   5712     #+cindex: @samp{ID}, property
   5713     Call column view in the tree that has an =ID= property with the
   5714     value {{{var(LABEL)}}}.  You can use {{{kbd(M-x org-id-copy)}}} to
   5715     create a globally unique ID for the current entry and copy it to
   5716     the kill-ring.
   5717 
   5718 - =:match= ::
   5719 
   5720   When set to a string, use this as a tags/property match filter to
   5721   select only a subset of the headlines in the scope set by the ~:id~
   5722   parameter.
   5723 
   5724 
   5725 - =:hlines= ::
   5726 
   5727   When ~t~, insert an hline after every line.  When a number N, insert
   5728   an hline before each headline with level ~<= N~.
   5729 
   5730 - =:vlines= ::
   5731 
   5732   When non-~nil~, force column groups to get vertical lines.
   5733 
   5734 - =:maxlevel= ::
   5735 
   5736   When set to a number, do not capture entries below this level.
   5737 
   5738 - =:skip-empty-rows= ::
   5739 
   5740   When non-~nil~, skip rows where the only non-empty specifier of
   5741   the column view is =ITEM=.
   5742 
   5743 - =:exclude-tags= ::
   5744 
   5745   List of tags to exclude from column view table: entries with these
   5746   tags will be excluded from the column view.
   5747 
   5748 - =:indent= ::
   5749 
   5750   When non-~nil~, indent each =ITEM= field according to its level.
   5751 
   5752 - =:format= ::
   5753 
   5754   Specify a column attribute (see [[*Column attributes]]) for the dynamic
   5755   block.
   5756 
   5757 The following commands insert or update the dynamic block:
   5758 
   5759 - ~org-columns-insert-dblock~ ::
   5760 
   5761   #+kindex: C-c C-x x
   5762   #+findex: org-columns-insert-dblock
   5763   Insert a dynamic block capturing a column view.  Prompt for the
   5764   scope or ID of the view.
   5765 
   5766   This command can be invoked by calling
   5767   ~org-dynamic-block-insert-dblock~ ({{{kbd(C-c C-x x)}}}) and
   5768   selecting "columnview" (see [[*Dynamic Blocks]]).
   5769 
   5770 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
   5771 
   5772   #+kindex: C-c C-c
   5773   #+kindex: C-c C-x C-u
   5774   #+findex: org-dblock-update
   5775   Update dynamic block at point.  point needs to be in the =#+BEGIN=
   5776   line of the dynamic block.
   5777 
   5778 - {{{kbd(C-u C-c C-x C-u)}}} (~org-update-all-dblocks~) ::
   5779 
   5780   #+kindex: C-u C-c C-x C-u
   5781   Update all dynamic blocks (see [[*Dynamic Blocks]]).  This is useful if
   5782   you have several clock table blocks, column-capturing blocks or
   5783   other dynamic blocks in a buffer.
   5784 
   5785 You can add formulas to the column view table and you may add plotting
   5786 instructions in front of the table---these survive an update of the
   5787 block.  If there is a =TBLFM= keyword after the table, the table is
   5788 recalculated automatically after an update.
   5789 
   5790 An alternative way to capture and process property values into a table
   5791 is provided by Eric Schulte's =org-collector.el=, which is a package
   5792 in =org-contrib=[fn:58].  It provides a general API to collect
   5793 properties from entries in a certain scope, and arbitrary Lisp
   5794 expressions to process these values before inserting them into a table
   5795 or a dynamic block.
   5796 
   5797 * Dates and Times
   5798 :PROPERTIES:
   5799 :DESCRIPTION: Making items useful for planning.
   5800 :END:
   5801 #+cindex: dates
   5802 #+cindex: times
   5803 #+cindex: timestamp
   5804 #+cindex: date stamp
   5805 
   5806 To assist project planning, TODO items can be labeled with a date
   5807 and/or a time.  The specially formatted string carrying the date and
   5808 time information is called a /timestamp/ in Org mode.  This may be
   5809 a little confusing because timestamp is often used as indicating when
   5810 something was created or last changed.  However, in Org mode this term
   5811 is used in a much wider sense.
   5812 
   5813 ** Timestamps
   5814 :PROPERTIES:
   5815 :DESCRIPTION: Assigning a time to a tree entry.
   5816 :END:
   5817 #+cindex: timestamps
   5818 #+cindex: ranges, time
   5819 #+cindex: date stamps
   5820 #+cindex: deadlines
   5821 #+cindex: scheduling
   5822 
   5823 A timestamp is a specification of a date (possibly with a time or
   5824 a range of times) in a special format, either =<2003-09-16 Tue>= or
   5825 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:59].
   5826 A timestamp can appear anywhere in the headline or body of an Org tree
   5827 entry.  Its presence causes entries to be shown on specific dates in
   5828 the agenda (see [[*Weekly/daily agenda]]).  We distinguish:
   5829 
   5830 - Plain timestamp; Event; Appointment ::
   5831 
   5832   #+cindex: timestamp
   5833   #+cindex: appointment
   5834   A simple timestamp just assigns a date/time to an item.  This is
   5835   just like writing down an appointment or event in a paper agenda.
   5836   In the agenda display, the headline of an entry associated with
   5837   a plain timestamp is shown exactly on that date.
   5838 
   5839   #+begin_example
   5840   ,* Meet Peter at the movies
   5841     <2006-11-01 Wed 19:15>
   5842   ,* Discussion on climate change
   5843     <2006-11-02 Thu 20:00-22:00>
   5844   #+end_example
   5845 
   5846 - Timestamp with repeater interval ::
   5847 
   5848   #+cindex: timestamp, with repeater interval
   5849   A timestamp may contain a /repeater interval/, indicating that it
   5850   applies not only on the given date, but again and again after
   5851   a certain interval of N days (d), weeks (w), months (m), or years
   5852   (y).  The following shows up in the agenda every Wednesday:
   5853 
   5854   #+begin_example
   5855   ,* Pick up Sam at school
   5856     <2007-05-16 Wed 12:30 +1w>
   5857   #+end_example
   5858 
   5859 - Diary-style expression entries ::
   5860 
   5861   #+cindex: diary style timestamps
   5862   #+cindex: sexp timestamps
   5863   For more complex date specifications, Org mode supports using the
   5864   special expression diary entries implemented in the Emacs Calendar
   5865   package[fn:60].  For example, with optional time:
   5866 
   5867   #+begin_example
   5868   ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
   5869     <%%(diary-float t 4 2)>
   5870   #+end_example
   5871 
   5872 - Time/Date range ::
   5873 
   5874   #+cindex: timerange
   5875   #+cindex: date range
   5876   Two timestamps connected by =--= denote a range.  The headline is
   5877   shown on the first and last day of the range, and on any dates that
   5878   are displayed and fall in the range.  Here is an example:
   5879 
   5880   #+begin_example
   5881   ,** Meeting in Amsterdam
   5882      <2004-08-23 Mon>--<2004-08-26 Thu>
   5883   #+end_example
   5884 
   5885 - Inactive timestamp ::
   5886 
   5887   #+cindex: timestamp, inactive
   5888   #+cindex: inactive timestamp
   5889   Just like a plain timestamp, but with square brackets instead of
   5890   angular ones.  These timestamps are inactive in the sense that they
   5891   do /not/ trigger an entry to show up in the agenda.
   5892 
   5893   #+begin_example
   5894   ,* Gillian comes late for the fifth time
   5895     [2006-11-01 Wed]
   5896   #+end_example
   5897 
   5898 ** Creating Timestamps
   5899 :PROPERTIES:
   5900 :DESCRIPTION: Commands to insert timestamps.
   5901 :END:
   5902 
   5903 For Org mode to recognize timestamps, they need to be in the specific
   5904 format.  All commands listed below produce timestamps in the correct
   5905 format.
   5906 
   5907 #+attr_texinfo: :sep ,
   5908 - {{{kbd(C-c .)}}} (~org-time-stamp~) ::
   5909 
   5910   #+kindex: C-c .
   5911   #+findex: org-time-stamp
   5912   Prompt for a date and insert a corresponding timestamp.  When point
   5913   is at an existing timestamp in the buffer, the command is used to
   5914   modify this timestamp instead of inserting a new one.  When this
   5915   command is used twice in succession, a time range is inserted.
   5916 
   5917   #+kindex: C-u C-c .
   5918   #+vindex: org-time-stamp-rounding-minutes
   5919   When called with a prefix argument, use the alternative format which
   5920   contains date and time.  The default time can be rounded to
   5921   multiples of 5 minutes.  See the option
   5922   ~org-time-stamp-rounding-minutes~.
   5923 
   5924   #+kindex: C-u C-u C-c .
   5925   With two prefix arguments, insert an active timestamp with the
   5926   current time without prompting.
   5927 
   5928 - {{{kbd(C-c !)}}} (~org-time-stamp-inactive~) ::
   5929 
   5930   #+kindex: C-c !
   5931   #+kindex: C-u C-c !
   5932   #+kindex: C-u C-u C-c !
   5933   #+findex: org-time-stamp-inactive
   5934   Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does
   5935   not cause an agenda entry.
   5936 
   5937 - {{{kbd(C-c C-c)}}} ::
   5938 
   5939   #+kindex: C-c C-c
   5940   Normalize timestamp, insert or fix day name if missing or wrong.
   5941 
   5942 - {{{kbd(C-c <)}}} (~org-date-from-calendar~) ::
   5943 
   5944   #+kindex: C-c <
   5945   #+findex: org-date-from-calendar
   5946   Insert a timestamp corresponding to point date in the calendar.
   5947 
   5948 - {{{kbd(C-c >)}}} (~org-goto-calendar~) ::
   5949 
   5950   #+kindex: C-c >
   5951   #+findex: org-goto-calendar
   5952   Access the Emacs calendar for the current date.  If there is
   5953   a timestamp in the current line, go to the corresponding date
   5954   instead.
   5955 
   5956 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
   5957 
   5958   #+kindex: C-c C-o
   5959   #+findex: org-open-at-point
   5960   Access the agenda for the date given by the timestamp or -range at
   5961   point (see [[*Weekly/daily agenda]]).
   5962 
   5963 - {{{kbd(S-LEFT)}}} (~org-timestamp-down-day~), {{{kbd(S-RIGHT)}}} (~org-timestamp-up-day~) ::
   5964 
   5965   #+kindex: S-LEFT
   5966   #+kindex: S-RIGHT
   5967   #+findex: org-timestamp-down-day
   5968   #+findex: org-timestamp-up-day
   5969   Change date at point by one day.  These key bindings conflict with
   5970   shift-selection and related modes (see [[*Packages that conflict with
   5971   Org mode]]).
   5972 
   5973 - {{{kbd(S-UP)}}} (~org-timestamp-up~), {{{kbd(S-DOWN)}}} (~org-timestamp-down~) ::
   5974 
   5975   #+kindex: S-UP
   5976   #+kindex: S-DOWN
   5977   On the beginning or enclosing bracket of a timestamp, change its
   5978   type.  Within a timestamp, change the item under point.  Point can
   5979   be on a year, month, day, hour or minute.  When the timestamp
   5980   contains a time range like =15:30-16:30=, modifying the first time
   5981   also shifts the second, shifting the time block with constant
   5982   length.  To change the length, modify the second time.  Note that if
   5983   point is in a headline and not at a timestamp, these same keys
   5984   modify the priority of an item (see [[*Priorities]]).  The key bindings
   5985   also conflict with shift-selection and related modes (see [[*Packages
   5986   that conflict with Org mode]]).
   5987 
   5988 - {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
   5989 
   5990   #+kindex: C-c C-y
   5991   #+findex: org-evaluate-time-range
   5992   #+cindex: evaluate time range
   5993   Evaluate a time range by computing the difference between start and
   5994   end.  With a prefix argument, insert result after the time range (in
   5995   a table: into the following column).
   5996 
   5997 *** The date/time prompt
   5998 :PROPERTIES:
   5999 :DESCRIPTION: How Org mode helps you enter dates and times.
   6000 :END:
   6001 #+cindex: date, reading in minibuffer
   6002 #+cindex: time, reading in minibuffer
   6003 
   6004 #+vindex: org-read-date-prefer-future
   6005 When Org mode prompts for a date/time, the default is shown in default
   6006 date/time format, and the prompt therefore seems to ask for a specific
   6007 format.  But it in fact accepts date/time information in a variety of
   6008 formats.  Generally, the information should start at the beginning of
   6009 the string.  Org mode finds whatever information is in there and
   6010 derives anything you have not specified from the /default date and
   6011 time/.  The default is usually the current date and time, but when
   6012 modifying an existing timestamp, or when entering the second stamp of
   6013 a range, it is taken from the stamp in the buffer.  When filling in
   6014 information, Org mode assumes that most of the time you want to enter
   6015 a date in the future: if you omit the month/year and the given
   6016 day/month is /before/ today, it assumes that you mean a future
   6017 date[fn:61].  If the date has been automatically shifted into the
   6018 future, the time prompt shows this with =(=>F)=.
   6019 
   6020 For example, let's assume that today is *June 13, 2006*.  Here is how
   6021 various inputs are interpreted, the items filled in by Org mode are in
   6022 *bold*.
   6023 
   6024 | =3-2-5=        | \rArr{} 2003-02-05                              |
   6025 | =2/5/3=        | \rArr{} 2003-02-05                              |
   6026 | =14=           | \rArr{} *2006*-*06*-14                          |
   6027 | =12=           | \rArr{} *2006*-*07*-12                          |
   6028 | =2/5=          | \rArr{} *2007*-02-05                            |
   6029 | =Fri=          | \rArr{} nearest Friday (default date or later)  |
   6030 | =sep 15=       | \rArr{} *2006*-09-15                            |
   6031 | =feb 15=       | \rArr{} *2007*-02-15                            |
   6032 | =sep 12 9=     | \rArr{} 2009-09-12                              |
   6033 | =12:45=        | \rArr{} *2006*-*06*-*13* 12:45                  |
   6034 | =22 sept 0:34= | \rArr{} *2006*-09-22 0:34                       |
   6035 | =w4=           | \rArr{} ISO week for of the current year *2006* |
   6036 | =2012 w4 fri=  | \rArr{} Friday of ISO week 4 in 2012            |
   6037 | =2012-w04-5=   | \rArr{} Same as above                           |
   6038 
   6039 Furthermore you can specify a relative date by giving, as the /first/
   6040 thing in the input: a plus/minus sign, a number and a letter---=h=,
   6041 =d=, =w=, =m= or =y=---to indicate a change in hours, days, weeks,
   6042 months, or years.  With =h= the date is relative to the current time,
   6043 with the other letters and a single plus or minus, the date is
   6044 relative to today at 00:00.  With a double plus or minus, it is
   6045 relative to the default date.  If instead of a single letter, you use
   6046 the abbreviation of day name, the date is the Nth such day, e.g.:
   6047 
   6048 | =+0=    | \rArr{} today                       |
   6049 | =.=     | \rArr{} today                       |
   6050 | =+2h=   | \rArr{} two hours from now          |
   6051 | =+4d=   | \rArr{} four days from today        |
   6052 | =+4=    | \rArr{} same as +4d                 |
   6053 | =+2w=   | \rArr{} two weeks from today        |
   6054 | =++5=   | \rArr{} five days from default date |
   6055 | =+2tue= | \rArr{} second Tuesday from now     |
   6056 
   6057 #+vindex: parse-time-months
   6058 #+vindex: parse-time-weekdays
   6059 The function understands English month and weekday abbreviations.  If
   6060 you want to use un-abbreviated names and/or other languages, configure
   6061 the variables ~parse-time-months~ and ~parse-time-weekdays~.
   6062 
   6063 #+vindex: org-read-date-force-compatible-dates
   6064 Not all dates can be represented in a given Emacs implementation.  By
   6065 default Org mode forces dates into the compatibility range 1970--2037
   6066 which works on all Emacs implementations.  If you want to use dates
   6067 outside of this range, read the docstring of the variable
   6068 ~org-read-date-force-compatible-dates~.
   6069 
   6070 You can specify a time range by giving start and end times or by
   6071 giving a start time and a duration (in HH:MM format).  Use one or two
   6072 dash(es) as the separator in the former case and use =+= as the
   6073 separator in the latter case, e.g.:
   6074 
   6075 | =11am-1:15pm=  | \rArr{} 11:00-13:15   |
   6076 | =11h-13h15=    | \rArr{} same as above |
   6077 | =11am--1:15pm= | \rArr{} same as above |
   6078 | =11am+2:15=    | \rArr{} same as above |
   6079 
   6080 #+cindex: calendar, for selecting date
   6081 #+vindex: org-popup-calendar-for-date-prompt
   6082 Parallel to the minibuffer prompt, a calendar is popped up[fn:62].
   6083 When you exit the date prompt, either by clicking on a date in the
   6084 calendar, or by pressing {{{kbd(RET)}}}, the date selected in the
   6085 calendar is combined with the information entered at the prompt.  You
   6086 can control the calendar fully from the minibuffer:
   6087 
   6088 #+kindex: <
   6089 #+kindex: >
   6090 #+kindex: M-v
   6091 #+kindex: C-v
   6092 #+kindex: mouse-1
   6093 #+kindex: S-RIGHT
   6094 #+kindex: S-LEFT
   6095 #+kindex: S-DOWN
   6096 #+kindex: S-UP
   6097 #+kindex: M-S-RIGHT
   6098 #+kindex: M-S-LEFT
   6099 #+kindex: RET
   6100 #+kindex: .
   6101 #+kindex: C-.
   6102 #+attr_texinfo: :columns 0.25 0.55
   6103 | {{{kbd(RET)}}}       | Choose date at point in calendar.      |
   6104 | {{{kbd(mouse-1)}}}   | Select date by clicking on it.         |
   6105 | {{{kbd(S-RIGHT)}}}   | One day forward.                       |
   6106 | {{{kbd(S-LEFT)}}}    | One day backward.                      |
   6107 | {{{kbd(S-DOWN)}}}    | One week forward.                      |
   6108 | {{{kbd(S-UP)}}}      | One week backward.                     |
   6109 | {{{kbd(M-S-RIGHT)}}} | One month forward.                     |
   6110 | {{{kbd(M-S-LEFT)}}}  | One month backward.                    |
   6111 | {{{kbd(>)}}}         | Scroll calendar forward by one month.  |
   6112 | {{{kbd(<)}}}         | Scroll calendar backward by one month. |
   6113 | {{{kbd(M-v)}}}       | Scroll calendar forward by 3 months.   |
   6114 | {{{kbd(C-v)}}}       | Scroll calendar backward by 3 months.  |
   6115 | {{{kbd(C-.)}}}       | Select today's date[fn:63]             |
   6116 
   6117 #+vindex: org-read-date-display-live
   6118 The actions of the date/time prompt may seem complex, but I assure you
   6119 they will grow on you, and you will start getting annoyed by pretty
   6120 much any other way of entering a date/time out there.  To help you
   6121 understand what is going on, the current interpretation of your input
   6122 is displayed live in the minibuffer[fn:64].
   6123 
   6124 *** Custom time format
   6125 :PROPERTIES:
   6126 :DESCRIPTION: Making dates look different.
   6127 :END:
   6128 #+cindex: custom date/time format
   6129 #+cindex: time format, custom
   6130 #+cindex: date format, custom
   6131 
   6132 #+vindex: org-display-custom-times
   6133 #+vindex: org-time-stamp-custom-formats
   6134 Org mode uses the standard ISO notation for dates and times as it is
   6135 defined in ISO 8601.  If you cannot get used to this and require
   6136 another representation of date and time to keep you happy, you can get
   6137 it by customizing the variables ~org-display-custom-times~ and
   6138 ~org-time-stamp-custom-formats~.
   6139 
   6140 - {{{kbd(C-c C-x C-t)}}} (~org-toggle-time-stamp-overlays~) ::
   6141 
   6142   #+kindex: C-c C-x C-t
   6143   #+findex: org-toggle-time-stamp-overlays
   6144   Toggle the display of custom formats for dates and times.
   6145 
   6146 Org mode needs the default format for scanning, so the custom
   6147 date/time format does not /replace/ the default format.  Instead, it
   6148 is put /over/ the default format using text properties.  This has the
   6149 following consequences:
   6150 
   6151 - You cannot place point onto a timestamp anymore, only before or
   6152   after.
   6153 
   6154 - The {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} keys can no longer be used
   6155   to adjust each component of a timestamp.  If point is at the
   6156   beginning of the stamp, {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} change
   6157   the stamp by one day, just like {{{kbd(S-LEFT)}}}
   6158   {{{kbd(S-RIGHT)}}}.  At the end of the stamp, change the time by one
   6159   minute.
   6160 
   6161 - If the timestamp contains a range of clock times or a repeater,
   6162   these are not overlaid, but remain in the buffer as they were.
   6163 
   6164 - When you delete a timestamp character-by-character, it only
   6165   disappears from the buffer after /all/ (invisible) characters
   6166   belonging to the ISO timestamp have been removed.
   6167 
   6168 - If the custom timestamp format is longer than the default and you
   6169   are using dates in tables, table alignment will be messed up.  If
   6170   the custom format is shorter, things do work as expected.
   6171 
   6172 ** Deadlines and Scheduling
   6173 :PROPERTIES:
   6174 :DESCRIPTION: Planning your work.
   6175 :END:
   6176 
   6177 A timestamp may be preceded by special keywords to facilitate
   6178 planning.  Both the timestamp and the keyword have to be positioned
   6179 immediately after the task they refer to.
   6180 
   6181 - =DEADLINE= ::
   6182 
   6183   #+cindex: @samp{DEADLINE} marker
   6184   Meaning: the task---most likely a TODO item, though not
   6185   necessarily---is supposed to be finished on that date.
   6186 
   6187   #+vindex: org-deadline-warning-days
   6188   On the deadline date, the task is listed in the agenda.  In
   6189   addition, the agenda for /today/ carries a warning about the
   6190   approaching or missed deadline, starting ~org-deadline-warning-days~
   6191   before the due date, and continuing until the entry is marked as
   6192   done.  An example:
   6193 
   6194   #+begin_example
   6195   ,*** TODO write article about the Earth for the Guide
   6196       DEADLINE: <2004-02-29 Sun>
   6197       The editor in charge is [[bbdb:Ford Prefect]]
   6198   #+end_example
   6199 
   6200   #+vindex: org-agenda-skip-deadline-prewarning-if-scheduled
   6201   You can specify a different lead time for warnings for a specific
   6202   deadlines using the following syntax.  Here is an example with
   6203   a warning period of 5 days =DEADLINE: <2004-02-29 Sun -5d>=.  This
   6204   warning is deactivated if the task gets scheduled and you set
   6205   ~org-agenda-skip-deadline-prewarning-if-scheduled~ to ~t~.
   6206 
   6207 - =SCHEDULED= ::
   6208 
   6209   #+cindex: @samp{SCHEDULED} marker
   6210   Meaning: you are planning to start working on that task on the given
   6211   date.
   6212 
   6213   #+vindex: org-agenda-skip-scheduled-if-done
   6214   The headline is listed under the given date[fn:65].  In addition,
   6215   a reminder that the scheduled date has passed is present in the
   6216   compilation for /today/, until the entry is marked as done, i.e.,
   6217   the task is automatically forwarded until completed.
   6218 
   6219   #+begin_example
   6220   ,*** TODO Call Trillian for a date on New Years Eve.
   6221       SCHEDULED: <2004-12-25 Sat>
   6222   #+end_example
   6223 
   6224   #+vindex: org-scheduled-delay-days
   6225   #+vindex: org-agenda-skip-scheduled-delay-if-deadline
   6226   If you want to /delay/ the display of this task in the agenda, use
   6227   =SCHEDULED: <2004-12-25 Sat -2d>=: the task is still scheduled on
   6228   the 25th but will appear two days later.  In case the task contains
   6229   a repeater, the delay is considered to affect all occurrences; if
   6230   you want the delay to only affect the first scheduled occurrence of
   6231   the task, use =--2d= instead.  See ~org-scheduled-delay-days~ and
   6232   ~org-agenda-skip-scheduled-delay-if-deadline~ for details on how to
   6233   control this globally or per agenda.
   6234 
   6235   #+attr_texinfo: :tag Important
   6236   #+begin_quote
   6237   Scheduling an item in Org mode should /not/ be understood in the
   6238   same way that we understand /scheduling a meeting/.  Setting a date
   6239   for a meeting is just a simple appointment, you should mark this
   6240   entry with a simple plain timestamp, to get this item shown on the
   6241   date where it applies.  This is a frequent misunderstanding by Org
   6242   users.  In Org mode, /scheduling/ means setting a date when you want
   6243   to start working on an action item.
   6244   #+end_quote
   6245 
   6246 You may use timestamps with repeaters in scheduling and deadline
   6247 entries.  Org mode issues early and late warnings based on the
   6248 assumption that the timestamp represents the /nearest instance/ of the
   6249 repeater.  However, the use of diary expression entries like
   6250 
   6251 : <%%(diary-float t 42)>
   6252 
   6253 #+texinfo: @noindent
   6254 in scheduling and deadline timestamps is limited.  Org mode does not
   6255 know enough about the internals of each function to issue early and
   6256 late warnings.  However, it shows the item on each day where the
   6257 expression entry matches.
   6258 
   6259 *** Inserting deadlines or schedules
   6260 :PROPERTIES:
   6261 :DESCRIPTION: Planning items.
   6262 :ALT_TITLE: Inserting deadline/schedule
   6263 :END:
   6264 
   6265 The following commands allow you to quickly insert a deadline or to
   6266 schedule an item:[fn:66]
   6267 
   6268 - {{{kbd(C-c C-d)}}} (~org-deadline~) ::
   6269 
   6270   #+kindex: C-c C-d
   6271   #+findex: org-deadline
   6272   #+vindex: org-log-redeadline
   6273   Insert =DEADLINE= keyword along with a stamp.  The insertion happens
   6274   in the line directly following the headline.  Remove any =CLOSED=
   6275   timestamp .  When called with a prefix argument, also remove any
   6276   existing deadline from the entry.  Depending on the variable
   6277   ~org-log-redeadline~, take a note when changing an existing
   6278   deadline[fn:67].
   6279 
   6280 - {{{kbd(C-c C-s)}}} (~org-schedule~) ::
   6281 
   6282   #+kindex: C-c C-s
   6283   #+findex: org-schedule
   6284   #+vindex: org-log-reschedule
   6285   Insert =SCHEDULED= keyword along with a stamp.  The insertion
   6286   happens in the line directly following the headline.  Remove any
   6287   =CLOSED= timestamp.  When called with a prefix argument, also remove
   6288   the scheduling date from the entry.  Depending on the variable
   6289   ~org-log-reschedule~, take a note when changing an existing
   6290   scheduling time[fn:68].
   6291 
   6292 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
   6293 
   6294   #+kindex: C-c / d
   6295   #+findex: org-check-deadlines
   6296   #+cindex: sparse tree, for deadlines
   6297   #+vindex: org-deadline-warning-days
   6298   Create a sparse tree with all deadlines that are either past-due, or
   6299   which will become due within ~org-deadline-warning-days~.  With
   6300   {{{kbd(C-u)}}} prefix, show all deadlines in the file.  With
   6301   a numeric prefix, check that many days.  For example, {{{kbd(C-1 C-c
   6302   / d)}}} shows all deadlines due tomorrow.
   6303 
   6304 - {{{kbd(C-c / b)}}} (~org-check-before-date~) ::
   6305 
   6306   #+kindex: C-c / b
   6307   #+findex: org-check-before-date
   6308   Sparse tree for deadlines and scheduled items before a given date.
   6309 
   6310 - {{{kbd(C-c / a)}}} (~org-check-after-date~) ::
   6311 
   6312   #+kindex: C-c / a
   6313   #+findex: org-check-after-date
   6314   Sparse tree for deadlines and scheduled items after a given date.
   6315 
   6316 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
   6317 by indicating a relative time e.g., =+1d= sets the date to the next
   6318 day after today, and =--1w= sets the date to the previous week before
   6319 any current timestamp.
   6320 
   6321 *** Repeated tasks
   6322 :PROPERTIES:
   6323 :DESCRIPTION: Items that show up again and again.
   6324 :END:
   6325 #+cindex: tasks, repeated
   6326 #+cindex: repeated tasks
   6327 
   6328 Some tasks need to be repeated again and again.  Org mode helps to
   6329 organize such tasks using a so-called repeater in a =DEADLINE=,
   6330 =SCHEDULED=, or plain timestamps[fn:69].  In the following example:
   6331 
   6332 #+begin_example
   6333 ,** TODO Pay the rent
   6334    DEADLINE: <2005-10-01 Sat +1m>
   6335 #+end_example
   6336 
   6337 #+texinfo: @noindent
   6338 the =+1m= is a repeater; the intended interpretation is that the task
   6339 has a deadline on =<2005-10-01>= and repeats itself every (one) month
   6340 starting from that time.  You can use yearly, monthly, weekly, daily
   6341 and hourly repeat cookies by using the =y=, =m=, =w=, =d= and =h=
   6342 letters.  If you need both a repeater and a special warning period in
   6343 a deadline entry, the repeater should come first and the warning
   6344 period last
   6345 
   6346 : DEADLINE: <2005-10-01 Sat +1m -3d>
   6347 
   6348 #+vindex: org-todo-repeat-to-state
   6349 Deadlines and scheduled items produce entries in the agenda when they
   6350 are over-due, so it is important to be able to mark such an entry as
   6351 done once you have done so.  When you mark a =DEADLINE= or
   6352 a =SCHEDULED= with the TODO keyword =DONE=, it no longer produces
   6353 entries in the agenda.  The problem with this is, however, is that
   6354 then also the /next/ instance of the repeated entry will not be
   6355 active.  Org mode deals with this in the following way: when you try
   6356 to mark such an entry as done, using {{{kbd(C-c C-t)}}}, it shifts the
   6357 base date of the repeating timestamp by the repeater interval, and
   6358 immediately sets the entry state back to TODO[fn:70].  In the example
   6359 above, setting the state to =DONE= would actually switch the date like
   6360 this:
   6361 
   6362 #+begin_example
   6363 ,** TODO Pay the rent
   6364    DEADLINE: <2005-11-01 Tue +1m>
   6365 #+end_example
   6366 
   6367 To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}},
   6368 i.e., ~org-todo~ with a numeric prefix argument of =-1=.
   6369 
   6370 #+vindex: org-log-repeat
   6371 A timestamp[fn:71] is added under the deadline, to keep a record that
   6372 you actually acted on the previous instance of this deadline.
   6373 
   6374 As a consequence of shifting the base date, this entry is no longer
   6375 visible in the agenda when checking past dates, but all future
   6376 instances will be visible.
   6377 
   6378 With the =+1m= cookie, the date shift is always exactly one month.  So
   6379 if you have not paid the rent for three months, marking this entry
   6380 DONE still keeps it as an overdue deadline.  Depending on the task,
   6381 this may not be the best way to handle it.  For example, if you forgot
   6382 to call your father for 3 weeks, it does not make sense to call him
   6383 3 times in a single day to make up for it.  Finally, there are tasks,
   6384 like changing batteries, which should always repeat a certain time
   6385 /after/ the last time you did it.  For these tasks, Org mode has
   6386 special repeaters =++= and =.+=.  For example:
   6387 
   6388 #+begin_example
   6389 ,** TODO Call Father
   6390    DEADLINE: <2008-02-10 Sun ++1w>
   6391    Marking this DONE shifts the date by at least one week, but also
   6392    by as many weeks as it takes to get this date into the future.
   6393    However, it stays on a Sunday, even if you called and marked it
   6394    done on Saturday.
   6395 
   6396 ,** TODO Empty kitchen trash
   6397    DEADLINE: <2008-02-08 Fri 20:00 ++1d>
   6398    Marking this DONE shifts the date by at least one day, and also
   6399    by as many days as it takes to get the timestamp into the future.
   6400    Since there is a time in the timestamp, the next deadline in the
   6401    future will be on today's date if you complete the task before
   6402    20:00.
   6403 
   6404 ,** TODO Check the batteries in the smoke detectors
   6405    DEADLINE: <2005-11-01 Tue .+1m>
   6406    Marking this DONE shifts the date to one month after today.
   6407 
   6408 ,** TODO Wash my hands
   6409    DEADLINE: <2019-04-05 08:00 Sun .+1h>
   6410    Marking this DONE shifts the date to exactly one hour from now.
   6411 #+end_example
   6412 
   6413 #+vindex: org-agenda-skip-scheduled-if-deadline-is-shown
   6414 You may have both scheduling and deadline information for a specific
   6415 task.  If the repeater is set for the scheduling information only, you
   6416 probably want the repeater to be ignored after the deadline.  If so,
   6417 set the variable ~org-agenda-skip-scheduled-if-deadline-is-shown~ to
   6418 ~repeated-after-deadline~.  However, any scheduling information
   6419 without a repeater is no longer relevant once the task is done, and
   6420 thus, removed upon repeating the task.  If you want both scheduling
   6421 and deadline information to repeat after the same interval, set the
   6422 same repeater for both timestamps.
   6423 
   6424 An alternative to using a repeater is to create a number of copies of
   6425 a task subtree, with dates shifted in each copy.  The command
   6426 {{{kbd(C-c C-x c)}}} was created for this purpose; it is described in
   6427 [[*Structure Editing]].
   6428 
   6429 ** Clocking Work Time
   6430 :PROPERTIES:
   6431 :DESCRIPTION: Tracking how long you spend on a task.
   6432 :END:
   6433 #+cindex: clocking time
   6434 #+cindex: time clocking
   6435 
   6436 Org mode allows you to clock the time you spend on specific tasks in
   6437 a project.  When you start working on an item, you can start the
   6438 clock.  When you stop working on that task, or when you mark the task
   6439 done, the clock is stopped and the corresponding time interval is
   6440 recorded.  It also computes the total time spent on each
   6441 subtree[fn:72] of a project.  And it remembers a history or tasks
   6442 recently clocked, so that you can jump quickly between a number of
   6443 tasks absorbing your time.
   6444 
   6445 To save the clock history across Emacs sessions, use:
   6446 
   6447 #+begin_src emacs-lisp
   6448 (setq org-clock-persist 'history)
   6449 (org-clock-persistence-insinuate)
   6450 #+end_src
   6451 
   6452 #+vindex: org-clock-persist
   6453 When you clock into a new task after resuming Emacs, the incomplete
   6454 clock[fn:73] is retrieved (see [[*Resolving idle time]]) and you are
   6455 prompted about what to do with it.
   6456 
   6457 *** Clocking commands
   6458 :PROPERTIES:
   6459 :DESCRIPTION: Starting and stopping a clock.
   6460 :END:
   6461 
   6462 #+attr_texinfo: :sep ,
   6463 - {{{kbd(C-c C-x C-i)}}} (~org-clock-in~) ::
   6464 
   6465   #+kindex: C-c C-x C-i
   6466   #+findex: org-clock-in
   6467   #+vindex: org-clock-into-drawer
   6468   #+vindex: org-clock-continuously
   6469   #+cindex: @samp{LOG_INTO_DRAWER}, property
   6470   Start the clock on the current item (clock-in).  This inserts the
   6471   =CLOCK= keyword together with a timestamp.  If this is not the first
   6472   clocking of this item, the multiple =CLOCK= lines are wrapped into
   6473   a =LOGBOOK= drawer (see also the variable ~org-clock-into-drawer~).
   6474   You can also overrule the setting of this variable for a subtree by
   6475   setting a =CLOCK_INTO_DRAWER= or =LOG_INTO_DRAWER= property.  When
   6476   called with a {{{kbd(C-u)}}} prefix argument, select the task from
   6477   a list of recently clocked tasks.  With two {{{kbd(C-u C-u)}}}
   6478   prefixes, clock into the task at point and mark it as the default
   6479   task; the default task is always be available with letter
   6480   {{{kbd(d)}}} when selecting a clocking task.  With three {{{kbd(C-u
   6481   C-u C-u)}}} prefixes, force continuous clocking by starting the
   6482   clock when the last clock stopped.
   6483 
   6484   #+cindex: @samp{CLOCK_MODELINE_TOTAL}, property
   6485   #+cindex: @samp{LAST_REPEAT}, property
   6486   #+vindex: org-clock-mode-line-total
   6487   #+vindex: org-clock-in-prepare-hook
   6488   While the clock is running, Org shows the current clocking time in
   6489   the mode line, along with the title of the task.  The clock time
   6490   shown is all time ever clocked for this task and its children.  If
   6491   the task has an effort estimate (see [[*Effort Estimates]]), the mode
   6492   line displays the current clocking time against it[fn:74].  If the
   6493   task is a repeating one (see [[*Repeated tasks]]), show only the time
   6494   since the last reset of the task[fn:75].  You can exercise more
   6495   control over show time with the =CLOCK_MODELINE_TOTAL= property.  It
   6496   may have the values =current= to show only the current clocking
   6497   instance, =today= to show all time clocked on this tasks today---see
   6498   also the variable ~org-extend-today-until~, ~all~ to include all
   6499   time, or ~auto~ which is the default[fn:76].  Clicking with
   6500   {{{kbd(mouse-1)}}} onto the mode line entry pops up a menu with
   6501   clocking options.
   6502 
   6503 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
   6504 
   6505   #+kindex: C-c C-x C-o
   6506   #+findex: org-clock-out
   6507   #+vindex: org-log-note-clock-out
   6508   Stop the clock (clock-out).  This inserts another timestamp at the
   6509   same location where the clock was last started.  It also directly
   6510   computes the resulting time in inserts it after the time range as
   6511   ==>HH:MM=.  See the variable ~org-log-note-clock-out~ for the
   6512   possibility to record an additional note together with the clock-out
   6513   timestamp[fn:77].
   6514 
   6515 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
   6516 
   6517   #+kindex: C-c C-x C-x
   6518   #+findex: org-clock-in-last
   6519   #+vindex: org-clock-continuously
   6520   Re-clock the last clocked task.  With one {{{kbd(C-u)}}} prefix
   6521   argument, select the task from the clock history.  With two
   6522   {{{kbd(C-u)}}} prefixes, force continuous clocking by starting the
   6523   clock when the last clock stopped.
   6524 
   6525 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
   6526 
   6527   #+kindex: C-c C-x C-e
   6528   #+findex: org-clock-modify-effort-estimate
   6529   Update the effort estimate for the current clock task.
   6530 
   6531 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
   6532 
   6533   #+kindex: C-c C-c
   6534   #+kindex: C-c C-y
   6535   #+findex: org-evaluate-time-range
   6536   Recompute the time interval after changing one of the timestamps.
   6537   This is only necessary if you edit the timestamps directly.  If you
   6538   change them with {{{kbd(S-<cursor>)}}} keys, the update is
   6539   automatic.
   6540 
   6541 - {{{kbd(C-S-UP)}}} (~org-clock-timestamps-up~), {{{kbd(C-S-DOWN)}}} (~org-clock-timestamps-down~) ::
   6542 
   6543   #+kindex: C-S-UP
   6544   #+findex: org-clock-timestamps-up
   6545   #+kindex: C-S-DOWN
   6546   #+findex: org-clock-timestamps-down
   6547   On CLOCK log lines, increase/decrease both timestamps so that the
   6548   clock duration keeps the same value.
   6549 
   6550 - {{{kbd(S-M-UP)}}} (~org-timestamp-up~), {{{kbd(S-M-DOWN)}}} (~org-timestamp-down~) ::
   6551 
   6552   #+kindex: S-M-UP
   6553   #+findex: org-clock-timestamp-up
   6554   #+kindex: S-M-DOWN
   6555   #+findex: org-clock-timestamp-down
   6556   On =CLOCK= log lines, increase/decrease the timestamp at point and
   6557   the one of the previous, or the next, clock timestamp by the same
   6558   duration.  For example, if you hit {{{kbd(S-M-UP)}}} to increase
   6559   a clocked-out timestamp by five minutes, then the clocked-in
   6560   timestamp of the next clock is increased by five minutes.
   6561 
   6562 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
   6563 
   6564   #+kindex: C-c C-t
   6565   #+findex: org-todo
   6566   Changing the TODO state of an item to DONE automatically stops the
   6567   clock if it is running in this same item.
   6568 
   6569 - {{{kbd(C-c C-x C-q)}}} (~org-clock-cancel~) ::
   6570 
   6571   #+kindex: C-c C-x C-q
   6572   #+findex: org-clock-cancel
   6573   Cancel the current clock.  This is useful if a clock was started by
   6574   mistake, or if you ended up working on something else.
   6575 
   6576 - {{{kbd(C-c C-x C-j)}}} (~org-clock-goto~) ::
   6577 
   6578   #+kindex: C-c C-x C-j
   6579   #+findex: or-clock-goto
   6580   Jump to the headline of the currently clocked in task.  With
   6581   a {{{kbd(C-u)}}} prefix argument, select the target task from a list
   6582   of recently clocked tasks.
   6583 
   6584 - {{{kbd(C-c C-x C-d)}}} (~org-clock-display~) ::
   6585 
   6586   #+kindex: C-c C-x C-d
   6587   #+findex: org-clock-display
   6588   #+vindex: org-remove-highlights-with-change
   6589   Display time summaries for each subtree in the current buffer.  This
   6590   puts overlays at the end of each headline, showing the total time
   6591   recorded under that heading, including the time of any subheadings.
   6592   You can use visibility cycling to study the tree, but the overlays
   6593   disappear when you change the buffer (see variable
   6594   ~org-remove-highlights-with-change~) or press {{{kbd(C-c C-c)}}}.
   6595 
   6596 The {{{kbd(l)}}} key may be used in the agenda (see [[*Weekly/daily
   6597 agenda]]) to show which tasks have been worked on or closed during
   6598 a day.
   6599 
   6600 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
   6601 can have a global keybinding and do not modify the window disposition.
   6602 
   6603 *** The clock table
   6604 :PROPERTIES:
   6605 :DESCRIPTION: Detailed reports.
   6606 :END:
   6607 #+cindex: clocktable, dynamic block
   6608 #+cindex: report, of clocked time
   6609 
   6610 Org mode can produce quite complex reports based on the time clocking
   6611 information.  Such a report is called a /clock table/, because it is
   6612 formatted as one or several Org tables.
   6613 
   6614 #+attr_texinfo: :sep ,
   6615 - ~org-clock-report~ ::
   6616 
   6617   #+kindex: C-c C-x x
   6618   #+findex: org-clock-report
   6619   Insert or update a clock table.  When called with a prefix argument,
   6620   jump to the first clock table in the current document and update it.
   6621   The clock table includes archived trees.
   6622 
   6623   This command can be invoked by calling
   6624   ~org-dynamic-block-insert-dblock~ ({{{kbd(C-c C-x x)}}}) and
   6625   selecting "clocktable" (see [[*Dynamic Blocks]]).
   6626 
   6627 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
   6628 
   6629   #+kindex: C-c C-c
   6630   #+kindex: C-c C-x C-u
   6631   #+findex: org-dblock-update
   6632   Update dynamic block at point.  Point needs to be in the =BEGIN=
   6633   line of the dynamic block.
   6634 
   6635 - {{{kbd(C-u C-c C-x C-u)}}} ::
   6636 
   6637   #+kindex: C-u C-c C-x C-u
   6638   Update all dynamic blocks (see [[*Dynamic Blocks]]).  This is useful if
   6639   you have several clock table blocks in a buffer.
   6640 
   6641 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} (~org-clocktable-try-shift~) ::
   6642 
   6643   #+kindex: S-LEFT
   6644   #+kindex: S-RIGHT
   6645   #+findex: org-clocktable-try-shift
   6646   Shift the current =:block= interval and update the table.  Point
   6647   needs to be in the =#+BEGIN: clocktable= line for this command.  If
   6648   =:block= is =today=, it is shifted to =today-1=, etc.
   6649 
   6650 Here is an example of the frame for a clock table as it is inserted
   6651 into the buffer by ~org-clock-report~:
   6652 
   6653 #+cindex: @samp{BEGIN clocktable}
   6654 #+begin_example
   6655 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
   6656 ,#+END: clocktable
   6657 #+end_example
   6658 
   6659 #+vindex: org-clocktable-defaults
   6660 The =#+BEGIN= line contains options to define the scope, structure,
   6661 and formatting of the report.  Defaults for all these options can be
   6662 configured in the variable ~org-clocktable-defaults~.
   6663 
   6664 First there are options that determine which clock entries are to
   6665 be selected:
   6666 
   6667 - =:maxlevel= ::
   6668 
   6669   Maximum level depth to which times are listed in the table.  Clocks
   6670   at deeper levels are summed into the upper level.
   6671 
   6672 - =:scope= ::
   6673 
   6674   The scope to consider.  This can be any of the following:
   6675 
   6676   | =nil=                  | the current buffer or narrowed region                               |
   6677   | =file=                 | the full current buffer                                             |
   6678   | =subtree=              | the subtree where the clocktable is located                         |
   6679   | =treeN=                | the surrounding level N tree, for example =tree3=                   |
   6680   | =tree=                 | the surrounding level 1 tree                                        |
   6681   | =agenda=               | all agenda files                                                    |
   6682   | =("file" ...)=         | scan these files                                                    |
   6683   | =FUNCTION=             | scan files returned by calling {{{var(FUNCTION)}}} with no argument |
   6684   | =file-with-archives=   | current file and its archives                                       |
   6685   | =agenda-with-archives= | all agenda files, including archives                                |
   6686 
   6687 - =:block= ::
   6688 
   6689   The time block to consider.  This block is specified either
   6690   absolutely, or relative to the current time and may be any of these
   6691   formats:
   6692 
   6693   | =2007-12-31=                            | New year eve 2007     |
   6694   | =2007-12=                               | December 2007         |
   6695   | =2007-W50=                              | ISO-week 50 in 2007   |
   6696   | =2007-Q2=                               | 2nd quarter in 2007   |
   6697   | =2007=                                  | the year 2007         |
   6698   | =today=, =yesterday=, =today-N=         | a relative day        |
   6699   | =thisweek=, =lastweek=, =thisweek-N=    | a relative week       |
   6700   | =thismonth=, =lastmonth=, =thismonth-N= | a relative month      |
   6701   | =thisyear=, =lastyear=, =thisyear-N=    | a relative year       |
   6702   | =untilnow=[fn:78]                       | all clocked time ever |
   6703 
   6704   #+vindex: org-clock-display-default-range
   6705   When this option is not set, Org falls back to the value in
   6706   ~org-clock-display-default-range~, which defaults to the current
   6707   year.
   6708 
   6709   Use {{{kbd(S-LEFT)}}} or {{{kbd(S-RIGHT)}}} to shift the time
   6710   interval.
   6711 
   6712 - =:tstart= ::
   6713 
   6714   A time string specifying when to start considering times.  Relative
   6715   times like ="<-2w>"= can also be used.  See [[*Matching tags and
   6716   properties]] for relative time syntax.
   6717 
   6718 - =:tend= ::
   6719 
   6720   A time string specifying when to stop considering times.  Relative
   6721   times like ="<now>"= can also be used.  See [[*Matching tags and
   6722   properties]] for relative time syntax.
   6723 
   6724 - =:wstart= ::
   6725 
   6726   The starting day of the week.  The default is 1 for Monday.
   6727 
   6728 - =:mstart= ::
   6729 
   6730   The starting day of the month.  The default is 1 for the first.
   6731 
   6732 - =:step= ::
   6733 
   6734   Set to =day=, =week=, =semimonth=, =month=, or =year= to split the
   6735   table into chunks.  To use this, either =:block=, or =:tstart= and
   6736   =:tend= are required.
   6737 
   6738 - =:stepskip0= ::
   6739 
   6740   When non-~nil~, do not show steps that have zero time.
   6741 
   6742 - =:fileskip0= ::
   6743 
   6744   When non-~nil~, do not show table sections from files which did not
   6745   contribute.
   6746 
   6747 - =:match= ::
   6748 
   6749   A tags match to select entries that should contribute.  See
   6750   [[*Matching tags and properties]] for the match syntax.
   6751 
   6752 #+findex: org-clocktable-write-default
   6753 Then there are options that determine the formatting of the table.
   6754 There options are interpreted by the function
   6755 ~org-clocktable-write-default~, but you can specify your own function
   6756 using the =:formatter= parameter.
   6757 
   6758 - =:emphasize= ::
   6759 
   6760   When non-~nil~, emphasize level one and level two items.
   6761 
   6762 - =:lang= ::
   6763 
   6764   Language[fn:79] to use for descriptive cells like "Task".
   6765 
   6766 - =:link= ::
   6767 
   6768   Link the item headlines in the table to their origins.
   6769 
   6770 - =:narrow= ::
   6771 
   6772   An integer to limit the width of the headline column in the Org
   6773   table.  If you write it like =50!=, then the headline is also
   6774   shortened in export.
   6775 
   6776 - =:indent= ::
   6777 
   6778   Indent each headline field according to its level.
   6779 
   6780 - =:hidefiles= ::
   6781 
   6782   Hide the file column when multiple files are used to produce the
   6783   table.
   6784 
   6785 - =:tcolumns= ::
   6786 
   6787   Number of columns to be used for times.  If this is smaller than
   6788   =:maxlevel=, lower levels are lumped into one column.
   6789 
   6790 - =:level= ::
   6791 
   6792   Should a level number column be included?
   6793 
   6794 - =:sort= ::
   6795 
   6796   A cons cell containing the column to sort and a sorting type.  E.g.,
   6797   =:sort (1 . ?a)= sorts the first column alphabetically.
   6798 
   6799 - =:compact= ::
   6800 
   6801   Abbreviation for =:level nil :indent t :narrow 40! :tcolumns 1=.
   6802   All are overwritten except if there is an explicit =:narrow=.
   6803 
   6804 - =:timestamp= ::
   6805 
   6806   A timestamp for the entry, when available.  Look for =SCHEDULED=,
   6807   =DEADLINE=, =TIMESTAMP= and =TIMESTAMP_IA= special properties (see
   6808   [[*Special Properties]]), in this order.
   6809 
   6810 - =:tags= ::
   6811 
   6812   When this flag is non-~nil~, show the headline's tags.
   6813 
   6814 - =:properties= ::
   6815 
   6816   List of properties shown in the table.  Each property gets its own
   6817   column.
   6818 
   6819 - =:inherit-props= ::
   6820 
   6821   When this flag is non-~nil~, the values for =:properties= are
   6822   inherited.
   6823 
   6824 - =:formula= ::
   6825 
   6826   Content of a =TBLFM= keyword to be added and evaluated.  As
   6827   a special case, =:formula %= adds a column with % time.  If you do
   6828   not specify a formula here, any existing formula below the clock
   6829   table survives updates and is evaluated.
   6830 
   6831 - =:formatter= ::
   6832 
   6833   A function to format clock data and insert it into the buffer.
   6834 
   6835 To get a clock summary of the current level 1 tree, for the current
   6836 day, you could write:
   6837 
   6838 #+begin_example
   6839 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
   6840 ,#+END: clocktable
   6841 #+end_example
   6842 
   6843 #+texinfo: @noindent
   6844 To use a specific time range you could write[fn:80]
   6845 
   6846 #+begin_example
   6847 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
   6848                     :tend "<2006-08-10 Thu 12:00>"
   6849 ,#+END: clocktable
   6850 #+end_example
   6851 
   6852 #+texinfo: @noindent
   6853 A range starting a week ago and ending right now could be written as
   6854 
   6855 #+begin_example
   6856 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
   6857 ,#+END: clocktable
   6858 #+end_example
   6859 
   6860 #+texinfo: @noindent
   6861 A summary of the current subtree with % times would be
   6862 
   6863 #+begin_example
   6864 ,#+BEGIN: clocktable :scope subtree :link t :formula %
   6865 ,#+END: clocktable
   6866 #+end_example
   6867 
   6868 #+texinfo: @noindent
   6869 A horizontally compact representation of everything clocked during
   6870 last week would be
   6871 
   6872 #+begin_example
   6873 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
   6874 ,#+END: clocktable
   6875 #+end_example
   6876 
   6877 *** Resolving idle time and continuous clocking
   6878 :PROPERTIES:
   6879 :DESCRIPTION: Resolving time when you've been idle.
   6880 :ALT_TITLE: Resolving idle time
   6881 :END:
   6882 
   6883 **** Resolving idle time
   6884 :PROPERTIES:
   6885 :UNNUMBERED: notoc
   6886 :END:
   6887 
   6888 #+cindex: resolve idle time
   6889 #+cindex: idle, resolve, dangling
   6890 
   6891 If you clock in on a work item, and then walk away from your
   6892 computer---perhaps to take a phone call---you often need to
   6893 "resolve" the time you were away by either subtracting it from the
   6894 current clock, or applying it to another one.
   6895 
   6896 #+vindex: org-clock-idle-time
   6897 #+vindex: org-clock-x11idle-program-name
   6898 By customizing the variable ~org-clock-idle-time~ to some integer,
   6899 such as 10 or 15, Emacs can alert you when you get back to your
   6900 computer after being idle for that many minutes[fn:81], and ask what
   6901 you want to do with the idle time.  There will be a question waiting
   6902 for you when you get back, indicating how much idle time has passed
   6903 constantly updated with the current amount, as well as a set of
   6904 choices to correct the discrepancy:
   6905 
   6906 - {{{kbd(k)}}} ::
   6907 
   6908   #+kindex: k
   6909   To keep some or all of the minutes and stay clocked in, press
   6910   {{{kbd(k)}}}.  Org asks how many of the minutes to keep.  Press
   6911   {{{kbd(RET)}}} to keep them all, effectively changing nothing, or
   6912   enter a number to keep that many minutes.
   6913 
   6914 - {{{kbd(K)}}} ::
   6915 
   6916   #+kindex: K
   6917   If you use the shift key and press {{{kbd(K)}}}, it keeps however
   6918   many minutes you request and then immediately clock out of that
   6919   task.  If you keep all of the minutes, this is the same as just
   6920   clocking out of the current task.
   6921 
   6922 - {{{kbd(s)}}} ::
   6923 
   6924   #+kindex: s
   6925   To keep none of the minutes, use {{{kbd(s)}}} to subtract all the
   6926   away time from the clock, and then check back in from the moment you
   6927   returned.
   6928 
   6929 - {{{kbd(S)}}} ::
   6930 
   6931   #+kindex: S
   6932   To keep none of the minutes and just clock out at the start of the
   6933   away time, use the shift key and press {{{kbd(S)}}}.  Remember that
   6934   using shift always leave you clocked out, no matter which option you
   6935   choose.
   6936 
   6937 - {{{kbd(C)}}} ::
   6938 
   6939   #+kindex: C
   6940   To cancel the clock altogether, use {{{kbd(C)}}}.  Note that if
   6941   instead of canceling you subtract the away time, and the resulting
   6942   clock amount is less than a minute, the clock is still canceled
   6943   rather than cluttering up the log with an empty entry.
   6944 
   6945 What if you subtracted those away minutes from the current clock, and
   6946 now want to apply them to a new clock?  Simply clock in to any task
   6947 immediately after the subtraction.  Org will notice that you have
   6948 subtracted time "on the books", so to speak, and will ask if you want
   6949 to apply those minutes to the next task you clock in on.
   6950 
   6951 There is one other instance when this clock resolution magic occurs.
   6952 Say you were clocked in and hacking away, and suddenly your cat chased
   6953 a mouse who scared a hamster that crashed into your UPS's power
   6954 button!  You suddenly lose all your buffers, but thanks to auto-save
   6955 you still have your recent Org mode changes, including your last clock
   6956 in.
   6957 
   6958 If you restart Emacs and clock into any task, Org will notice that you
   6959 have a dangling clock which was never clocked out from your last
   6960 session.  Using that clock's starting time as the beginning of the
   6961 unaccounted-for period, Org will ask how you want to resolve that
   6962 time.  The logic and behavior is identical to dealing with away time
   6963 due to idleness; it is just happening due to a recovery event rather
   6964 than a set amount of idle time.
   6965 
   6966 You can also check all the files visited by your Org agenda for
   6967 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks
   6968 RET)}}} (or {{{kbd(C-c C-x C-z)}}}).
   6969 
   6970 **** Continuous clocking
   6971 :PROPERTIES:
   6972 :UNNUMBERED: notoc
   6973 :END:
   6974 #+cindex: continuous clocking
   6975 
   6976 #+vindex: org-clock-continuously
   6977 You may want to start clocking from the time when you clocked out the
   6978 previous task.  To enable this systematically, set
   6979 ~org-clock-continuously~ to non-~nil~.  Each time you clock in, Org
   6980 retrieves the clock-out time of the last clocked entry for this
   6981 session, and start the new clock from there.
   6982 
   6983 If you only want this from time to time, use three universal prefix
   6984 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
   6985 ~org-clock-in-last~.
   6986 
   6987 **** Clocking out automatically after some idle time
   6988 :PROPERTIES:
   6989 :UNNUMBERED: notoc
   6990 :END:
   6991 #+cindex: auto clocking out after idle time
   6992 
   6993 #+vindex: org-clock-auto-clockout-timer
   6994 When you often forget to clock out before being idle and you don't
   6995 want to manually set the clocking time to take into account, you can
   6996 set ~org-clock-auto-clockout-timer~ to a number of seconds and add
   6997 =(org-clock-auto-clockout-insinuate)= to your =.emacs= file.
   6998 
   6999 When the clock is running and Emacs is idle for more than this number
   7000 of seconds, the clock will be clocked out automatically.
   7001 
   7002 Use =M-x org-clock-toggle-auto-clockout RET= to temporarily turn this
   7003 on or off.
   7004 
   7005 ** Effort Estimates
   7006 :PROPERTIES:
   7007 :DESCRIPTION: Planning work effort in advance.
   7008 :END:
   7009 #+cindex: effort estimates
   7010 #+cindex: @samp{EFFORT}, property
   7011 #+vindex: org-effort-property
   7012 
   7013 If you want to plan your work in a very detailed way, or if you need
   7014 to produce offers with quotations of the estimated work effort, you
   7015 may want to assign effort estimates to entries.  If you are also
   7016 clocking your work, you may later want to compare the planned effort
   7017 with the actual working time, a great way to improve planning
   7018 estimates.
   7019 
   7020 Effort estimates are stored in a special property =EFFORT=.  Multiple
   7021 formats are supported, such as =3:12=, =1:23:45=, or =1d3h5min=; see
   7022 the file =org-duration.el= for more detailed information about the
   7023 format.
   7024 
   7025 You can set the effort for an entry with the following commands:
   7026 
   7027 - {{{kbd(C-c C-x e)}}}  (~org-set-effort~) ::
   7028 
   7029   #+kindex: C-c C-x e
   7030   #+findex: org-set-effort
   7031   Set the effort estimate for the current entry.  With a prefix
   7032   argument, set it to the next allowed value---see below.  This
   7033   command is also accessible from the agenda with the {{{kbd(e)}}}
   7034   key.
   7035 
   7036 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
   7037 
   7038   #+kindex: C-c C-x C-e
   7039   #+findex: org-clock-modify-effort-estimate
   7040   Modify the effort estimate of the item currently being clocked.
   7041 
   7042 Clearly the best way to work with effort estimates is through column
   7043 view (see [[*Column View]]).  You should start by setting up discrete
   7044 values for effort estimates, and a =COLUMNS= format that displays
   7045 these values together with clock sums---if you want to clock your
   7046 time.  For a specific buffer you can use:
   7047 
   7048 #+begin_example
   7049 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
   7050 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
   7051 #+end_example
   7052 
   7053 #+texinfo: @noindent
   7054 #+vindex: org-global-properties
   7055 #+vindex: org-columns-default-format
   7056 or, even better, you can set up these values globally by customizing
   7057 the variables ~org-global-properties~ and
   7058 ~org-columns-default-format~.  In particular if you want to use this
   7059 setup also in the agenda, a global setup may be advised.
   7060 
   7061 The way to assign estimates to individual items is then to switch to
   7062 column mode, and to use {{{kbd(S-RIGHT)}}} and {{{kbd(S-LEFT)}}} to
   7063 change the value.  The values you enter are immediately summed up in
   7064 the hierarchy.  In the column next to it, any clocked time is
   7065 displayed.
   7066 
   7067 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
   7068 If you switch to column view in the daily/weekly agenda, the effort
   7069 column summarizes the estimated work effort for each day[fn:82], and
   7070 you can use this to find space in your schedule.  To get an overview
   7071 of the entire part of the day that is committed, you can set the
   7072 option ~org-agenda-columns-add-appointments-to-effort-sum~.  The
   7073 appointments on a day that take place over a specified time interval
   7074 are then also added to the load estimate of the day.
   7075 
   7076 Effort estimates can be used in secondary agenda filtering that is
   7077 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in
   7078 the Agenda Buffer]]).  If you have these estimates defined consistently,
   7079 two or three key presses narrow down the list to stuff that fits into
   7080 an available time slot.
   7081 
   7082 ** Taking Notes with a Relative Timer
   7083 :PROPERTIES:
   7084 :DESCRIPTION: Notes with a running timer.
   7085 :ALT_TITLE: Timers
   7086 :END:
   7087 #+cindex: relative timer
   7088 #+cindex: countdown timer
   7089 
   7090 Org provides two types of timers.  There is a relative timer that
   7091 counts up, which can be useful when taking notes during, for example,
   7092 a meeting or a video viewing.  There is also a countdown timer.
   7093 
   7094 The relative and countdown are started with separate commands.
   7095 
   7096 - {{{kbd(C-c C-x 0)}}} (~org-timer-start~) ::
   7097 
   7098   #+kindex: C-c C-x 0
   7099   #+findex: org-timer-start
   7100   Start or reset the relative timer.  By default, the timer is set
   7101   to 0.  When called with a {{{kbd(C-u)}}} prefix, prompt the user for
   7102   a starting offset.  If there is a timer string at point, this is
   7103   taken as the default, providing a convenient way to restart taking
   7104   notes after a break in the process.  When called with a double
   7105   prefix argument {{{kbd(C-u C-u)}}}, change all timer strings in the
   7106   active region by a certain amount.  This can be used to fix timer
   7107   strings if the timer was not started at exactly the right moment.
   7108 
   7109 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
   7110 
   7111   #+kindex: C-c C-x ;
   7112   #+findex: org-timer-set-timer
   7113   #+vindex: org-timer-default-timer
   7114   Start a countdown timer.  The user is prompted for a duration.
   7115   ~org-timer-default-timer~ sets the default countdown value.  Giving
   7116   a numeric prefix argument overrides this default value.  This
   7117   command is available as {{{kbd(;)}}} in agenda buffers.
   7118 
   7119 Once started, relative and countdown timers are controlled with the
   7120 same commands.
   7121 
   7122 - {{{kbd(C-c C-x .)}}} (~org-timer~) ::
   7123 
   7124   #+kindex: C-c C-x .
   7125   #+findex: org-timer
   7126   Insert a relative time into the buffer.  The first time you use
   7127   this, the timer starts.  Using a prefix argument restarts it.
   7128 
   7129 - {{{kbd(C-c C-x -)}}} (~org-timer-item~) ::
   7130 
   7131   #+kindex: C-c C-x -
   7132   #+findex: org-timer-item
   7133   Insert a description list item with the current relative time.  With
   7134   a prefix argument, first reset the timer to 0.
   7135 
   7136 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
   7137 
   7138   #+kindex: M-RET
   7139   #+findex: org-insert-heading
   7140   Once the timer list is started, you can also use {{{kbd(M-RET)}}} to
   7141   insert new timer items.
   7142 
   7143 - {{{kbd(C-c C-x \,)}}} (~org-timer-pause-or-continue~) ::
   7144 
   7145   #+kindex: C-c C-x ,
   7146   #+findex: org-timer-pause-or-continue
   7147   Pause the timer, or continue it if it is already paused.
   7148 
   7149 - {{{kbd(C-c C-x _)}}} (~org-timer-stop~) ::
   7150 
   7151   #+kindex: C-c C-x _
   7152   #+findex: org-timer-stop
   7153   Stop the timer.  After this, you can only start a new timer, not
   7154   continue the old one.  This command also removes the timer from the
   7155   mode line.
   7156 
   7157 * Refiling and Archiving
   7158 :PROPERTIES:
   7159 :DESCRIPTION: Moving and copying information with ease.
   7160 :END:
   7161 #+cindex: refiling notes
   7162 #+cindex: copying notes
   7163 #+cindex: archiving
   7164 
   7165 Once information is in the system, it may need to be moved around.
   7166 Org provides Refile, Copy and Archive commands for this.  Refile and
   7167 Copy helps with moving and copying outlines.  Archiving helps to keep
   7168 the system compact and fast.
   7169 
   7170 ** Refile and Copy
   7171 :PROPERTIES:
   7172 :DESCRIPTION: Moving/copying a tree from one place to another.
   7173 :END:
   7174 #+cindex: refiling notes
   7175 #+cindex: copying notes
   7176 
   7177 When reviewing the captured data, you may want to refile or to copy
   7178 some of the entries into a different list, for example into a project.
   7179 Cutting, finding the right location, and then pasting the note is
   7180 cumbersome.  To simplify this process, you can use the following
   7181 special command:
   7182 
   7183 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
   7184 
   7185   #+kindex: C-c C-w
   7186   #+findex: org-refile
   7187   #+vindex: org-reverse-note-order
   7188   #+vindex: org-refile-targets
   7189   #+vindex: org-refile-use-outline-path
   7190   #+vindex: org-outline-path-complete-in-steps
   7191   #+vindex: org-refile-allow-creating-parent-nodes
   7192   #+vindex: org-log-refile
   7193   Refile the entry or region at point.  This command offers possible
   7194   locations for refiling the entry and lets you select one with
   7195   completion.  The item (or all items in the region) is filed below
   7196   the target heading as a subitem.  Depending on
   7197   ~org-reverse-note-order~, it is either the first or last subitem.
   7198 
   7199   By default, all level 1 headlines in the current buffer are
   7200   considered to be targets, but you can have more complex definitions
   7201   across a number of files.  See the variable ~org-refile-targets~ for
   7202   details.  If you would like to select a location via
   7203   a file-path-like completion along the outline path, see the
   7204   variables ~org-refile-use-outline-path~ and
   7205   ~org-outline-path-complete-in-steps~.  If you would like to be able
   7206   to create new nodes as new parents for refiling on the fly, check
   7207   the variable ~org-refile-allow-creating-parent-nodes~.  When the
   7208   variable ~org-log-refile~[fn:83] is set, a timestamp or a note is
   7209   recorded whenever an entry is refiled.
   7210 
   7211 - {{{kbd(C-u C-c C-w)}}} ::
   7212 
   7213   #+kindex: C-u C-c C-w
   7214   Use the refile interface to jump to a heading.
   7215 
   7216 - {{{kbd(C-u C-u C-c C-w)}}} (~org-refile-goto-last-stored~) ::
   7217 
   7218   #+kindex: C-u C-u C-c C-w
   7219   #+findex: org-refile-goto-last-stored
   7220   Jump to the location where ~org-refile~ last moved a tree to.
   7221 
   7222 - {{{kbd(C-2 C-c C-w)}}} ::
   7223 
   7224   #+kindex: C-2 C-c C-w
   7225   Refile as the child of the item currently being clocked.
   7226 
   7227 - {{{kbd(C-3 C-c C-w)}}} ::
   7228 
   7229   #+kindex: C-3 C-c C-w
   7230   #+vindex: org-refile-keep
   7231   Refile and keep the entry in place.  Also see ~org-refile-keep~ to
   7232   make this the default behavior, and beware that this may result in
   7233   duplicated =ID= properties.
   7234 
   7235 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}} (~org-refile-cache-clear~) ::
   7236 
   7237   #+kindex: C-u C-u C-u C-c C-w
   7238   #+kindex: C-0 C-c C-w
   7239   #+findex: org-refile-cache-clear
   7240   #+vindex: org-refile-use-cache
   7241   Clear the target cache.  Caching of refile targets can be turned on
   7242   by setting ~org-refile-use-cache~.  To make the command see new
   7243   possible targets, you have to clear the cache with this command.
   7244 
   7245 - {{{kbd(C-c M-w)}}} (~org-refile-copy~) ::
   7246 
   7247   #+kindex: C-c M-w
   7248   #+findex: org-refile-copy
   7249   Copying works like refiling, except that the original note is not
   7250   deleted.
   7251 
   7252 - {{{kbd(C-c C-M-w)}}} (~org-refile-reverse~) ::
   7253 
   7254   #+kindex: C-c C-M-w
   7255   #+findex: org-refile-reverse
   7256   Works like refiling, except that it temporarily toggles how the
   7257   value of ~org-reverse-note-order~ applies to the current buffer.  So
   7258   if ~org-refile~ would append the entry as the last entry under the
   7259   target header, ~org-refile-reverse~ will prepend it as the first
   7260   entry, and vice-versa.
   7261 
   7262 ** Archiving
   7263 :PROPERTIES:
   7264 :DESCRIPTION: What to do with finished products.
   7265 :END:
   7266 #+cindex: archiving
   7267 
   7268 When a project represented by a (sub)tree is finished, you may want to
   7269 move the tree out of the way and to stop it from contributing to the
   7270 agenda.  Archiving is important to keep your working files compact and
   7271 global searches like the construction of agenda views fast.
   7272 
   7273 - {{{kbd(C-c C-x C-a)}}} (~org-archive-subtree-default~) ::
   7274 
   7275   #+kindex: C-c C-x C-a
   7276   #+findex: org-archive-subtree-default
   7277   #+vindex: org-archive-default-command
   7278   Archive the current entry using the command specified in the
   7279   variable ~org-archive-default-command~.
   7280 
   7281 *** Moving a tree to an archive file
   7282 :PROPERTIES:
   7283 :DESCRIPTION: Moving a tree to an archive file.
   7284 :ALT_TITLE: Moving subtrees
   7285 :END:
   7286 #+cindex: external archiving
   7287 
   7288 The most common archiving action is to move a project tree to another
   7289 file, the archive file.
   7290 
   7291 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} (~org-archive-subtree~) ::
   7292 
   7293   #+kindex: C-c C-x C-s
   7294   #+kindex: C-c $
   7295   #+findex: org-archive-subtree
   7296   #+vindex: org-archive-location
   7297   Archive the subtree starting at point position to the location given
   7298   by ~org-archive-location~.
   7299 
   7300 - {{{kbd(C-u C-c C-x C-s)}}} ::
   7301 
   7302   #+kindex: C-u C-c C-x C-s
   7303   Check if any direct children of the current headline could be moved
   7304   to the archive.  To do this, check each subtree for open TODO
   7305   entries.  If none is found, the command offers to move it to the
   7306   archive location.  If point is /not/ on a headline when this command
   7307   is invoked, check level 1 trees.
   7308 
   7309 - {{{kbd(C-u C-u C-c C-x C-s)}}} ::
   7310 
   7311   #+kindex: C-u C-u C-c C-x C-s
   7312   As above, but check subtree for timestamps instead of TODO entries.
   7313   The command offers to archive the subtree if it /does/ contain
   7314   a timestamp, and that timestamp is in the past.
   7315 
   7316 #+cindex: archive locations
   7317 The default archive location is a file in the same directory as the
   7318 current file, with the name derived by appending =_archive= to the
   7319 current file name.  You can also choose what heading to file archived
   7320 items under, with the possibility to add them to a datetree in a file.
   7321 For information and examples on how to specify the file and the
   7322 heading, see the documentation string of the variable
   7323 ~org-archive-location~.
   7324 
   7325 There is also an in-buffer option for setting this variable, for
   7326 example:
   7327 
   7328 #+cindex: @samp{ARCHIVE}, keyword
   7329 : #+ARCHIVE: %s_done::
   7330 
   7331 #+cindex: ARCHIVE, property
   7332 If you would like to have a special archive location for a single
   7333 entry or a (sub)tree, give the entry an =ARCHIVE= property with the
   7334 location as the value (see [[*Properties and Columns]]).
   7335 
   7336 #+vindex: org-archive-save-context-info
   7337 When a subtree is moved, it receives a number of special properties
   7338 that record context information like the file from where the entry
   7339 came, its outline path the archiving time etc.  Configure the variable
   7340 ~org-archive-save-context-info~ to adjust the amount of information
   7341 added.
   7342 
   7343 #+vindex: org-archive-subtree-save-file-p
   7344 When ~org-archive-subtree-save-file-p~ is non-~nil~, save the target
   7345 archive buffer.
   7346 
   7347 *** Internal archiving
   7348 :PROPERTIES:
   7349 :DESCRIPTION: Switch off a tree but keep it in the file.
   7350 :END:
   7351 
   7352 #+cindex: @samp{ARCHIVE}, tag
   7353 If you want to just switch off---for agenda views---certain subtrees
   7354 without moving them to a different file, you can use the =ARCHIVE=
   7355 tag.
   7356 
   7357 A headline that is marked with the =ARCHIVE= tag (see [[*Tags]]) stays at
   7358 its location in the outline tree, but behaves in the following way:
   7359 
   7360 -
   7361   #+vindex: org-cycle-open-archived-trees
   7362   It does not open when you attempt to do so with a visibility cycling
   7363   command (see [[*Visibility Cycling]]).  You can force cycling archived
   7364   subtrees with {{{kbd(C-TAB)}}}, or by setting the option
   7365   ~org-cycle-open-archived-trees~.  Also normal outline commands, like
   7366   ~outline-show-all~, open archived subtrees.
   7367 
   7368 -
   7369   #+vindex: org-sparse-tree-open-archived-trees
   7370   During sparse tree construction (see [[*Sparse Trees]]), matches in
   7371   archived subtrees are not exposed, unless you configure the option
   7372   ~org-sparse-tree-open-archived-trees~.
   7373 
   7374 -
   7375   #+vindex: org-agenda-skip-archived-trees
   7376   During agenda view construction (see [[*Agenda Views]]), the content of
   7377   archived trees is ignored unless you configure the option
   7378   ~org-agenda-skip-archived-trees~, in which case these trees are
   7379   always included.  In the agenda you can press {{{kbd(v a)}}} to get
   7380   archives temporarily included.
   7381 
   7382 -
   7383   #+vindex: org-export-with-archived-trees
   7384   Archived trees are not exported (see [[*Exporting]]), only the headline
   7385   is.  Configure the details using the variable
   7386   ~org-export-with-archived-trees~.
   7387 
   7388 -
   7389   #+vindex: org-columns-skip-archived-trees
   7390   Archived trees are excluded from column view unless the variable
   7391   ~org-columns-skip-archived-trees~ is configured to ~nil~.
   7392 
   7393 The following commands help manage the =ARCHIVE= tag:
   7394 
   7395 - {{{kbd(C-c C-x a)}}} (~org-toggle-archive-tag~) ::
   7396 
   7397   #+kindex: C-c C-x a
   7398   #+findex: org-toggle-archive-tag
   7399   Toggle the archive tag for the current headline.  When the tag is
   7400   set, the headline changes to a shadowed face, and the subtree below
   7401   it is hidden.
   7402 
   7403 - {{{kbd(C-u C-c C-x a)}}} ::
   7404 
   7405   #+kindex: C-u C-c C-x a
   7406   Check if any direct children of the current headline should be
   7407   archived.  To do this, check each subtree for open TODO entries.  If
   7408   none is found, the command offers to set the =ARCHIVE= tag for the
   7409   child.  If point is /not/ on a headline when this command is
   7410   invoked, check the level 1 trees.
   7411 
   7412 - {{{kbd(C-c C-TAB)}}} (~org-force-cycle-archived~) ::
   7413 
   7414   #+kindex: C-TAB
   7415   Cycle a tree even if it is tagged with =ARCHIVE=.
   7416 
   7417 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
   7418 
   7419   #+kindex: C-c C-x A
   7420   #+findex: org-archive-to-archive-sibling
   7421   Move the current entry to the /Archive Sibling/.  This is a sibling
   7422   of the entry with the heading =Archive= and the archive tag.  The
   7423   entry becomes a child of that sibling and in this way retains a lot
   7424   of its original context, including inherited tags and approximate
   7425   position in the outline.
   7426 
   7427 * Capture and Attachments
   7428 :PROPERTIES:
   7429 :DESCRIPTION: Dealing with external data.
   7430 :END:
   7431 #+cindex: capture
   7432 #+cindex: attachments
   7433 #+cindex: RSS feeds
   7434 #+cindex: Atom feeds
   7435 #+cindex: protocols, for external access
   7436 
   7437 An important part of any organization system is the ability to quickly
   7438 capture new ideas and tasks, and to associate reference material with
   7439 them.  Org does this using a process called /capture/.  It also can
   7440 store files related to a task (/attachments/) in a special directory.
   7441 Finally, it can parse RSS feeds for information.  To learn how to let
   7442 external programs (for example a web browser) trigger Org to capture
   7443 material, see [[*Protocols for External Access]].
   7444 
   7445 ** Capture
   7446 :PROPERTIES:
   7447 :DESCRIPTION: Capturing new stuff.
   7448 :END:
   7449 #+cindex: capture
   7450 
   7451 Capture lets you quickly store notes with little interruption of your
   7452 work flow.  Org's method for capturing new items is heavily inspired
   7453 by John Wiegley's excellent Remember package.
   7454 
   7455 *** Setting up capture
   7456 :PROPERTIES:
   7457 :DESCRIPTION: Where notes will be stored.
   7458 :END:
   7459 
   7460 The following customization sets a default target file for notes.
   7461 
   7462 #+vindex: org-default-notes-file
   7463 #+begin_src emacs-lisp
   7464 (setq org-default-notes-file (concat org-directory "/notes.org"))
   7465 #+end_src
   7466 
   7467 You may also define a global key for capturing new material (see
   7468 [[*Activation]]).
   7469 
   7470 *** Using capture
   7471 :PROPERTIES:
   7472 :DESCRIPTION: Commands to invoke and terminate capture.
   7473 :END:
   7474 
   7475 - {{{kbd(M-x org-capture)}}} (~org-capture~) ::
   7476 
   7477   #+findex: org-capture
   7478   #+cindex: date tree
   7479   Display the capture templates menu.  If you have templates defined
   7480   (see [[*Capture templates]]), it offers these templates for selection or
   7481   use a new Org outline node as the default template.  It inserts the
   7482   template into the target file and switch to an indirect buffer
   7483   narrowed to this new node.  You may then insert the information you
   7484   want.
   7485 
   7486 - {{{kbd(C-c C-c)}}} (~org-capture-finalize~) ::
   7487 
   7488   #+kindex: C-c C-c @r{(Capture buffer)}
   7489   #+findex: org-capture-finalize
   7490   Once you have finished entering information into the capture buffer,
   7491   {{{kbd(C-c C-c)}}} returns you to the window configuration before
   7492   the capture process, so that you can resume your work without
   7493   further distraction.  When called with a prefix argument, finalize
   7494   and then jump to the captured item.
   7495 
   7496 - {{{kbd(C-c C-w)}}} (~org-capture-refile~) ::
   7497 
   7498   #+kindex: C-c C-w @r{(Capture buffer)}
   7499   #+findex: org-capture-refile
   7500   Finalize the capture process by refiling the note to a different
   7501   place (see [[*Refile and Copy]]).  Please realize that this is a normal
   7502   refiling command that will be executed---so point position at the
   7503   moment you run this command is important.  If you have inserted
   7504   a tree with a parent and children, first move point back to the
   7505   parent.  Any prefix argument given to this command is passed on to
   7506   the ~org-refile~ command.
   7507 
   7508 - {{{kbd(C-c C-k)}}} (~org-capture-kill~) ::
   7509 
   7510   #+kindex: C-c C-k @r{(Capture buffer)}
   7511   #+findex: org-capture-kill
   7512   Abort the capture process and return to the previous state.
   7513 
   7514 #+kindex: k c @r{(Agenda)}
   7515 You can also call ~org-capture~ in a special way from the agenda,
   7516 using the {{{kbd(k c)}}} key combination.  With this access, any
   7517 timestamps inserted by the selected capture template defaults to the
   7518 date at point in the agenda, rather than to the current date.
   7519 
   7520 To find the locations of the last stored capture, use ~org-capture~
   7521 with prefix commands:
   7522 
   7523 - {{{kbd(C-u M-x org-capture)}}} ::
   7524 
   7525   Visit the target location of a capture template.  You get to select
   7526   the template in the usual way.
   7527 
   7528 - {{{kbd(C-u C-u M-x org-capture)}}} ::
   7529 
   7530   Visit the last stored capture item in its buffer.
   7531 
   7532 #+vindex: org-capture-bookmark
   7533 #+vindex: org-capture-last-stored
   7534 You can also jump to the bookmark ~org-capture-last-stored~, which is
   7535 automatically created unless you set ~org-capture-bookmark~ to ~nil~.
   7536 
   7537 To insert the capture at point in an Org buffer, call ~org-capture~
   7538 with a {{{kbd(C-0)}}} prefix argument.
   7539 
   7540 *** Capture templates
   7541 :PROPERTIES:
   7542 :DESCRIPTION: Define the outline of different note types.
   7543 :END:
   7544 #+cindex: templates, for Capture
   7545 
   7546 You can use templates for different types of capture items, and for
   7547 different target locations.  The easiest way to create such templates
   7548 is through the customize interface.
   7549 
   7550 - {{{kbd(C)}}} ::
   7551 
   7552   #+kindex: C @r{(Capture menu}
   7553   #+vindex: org-capture-templates
   7554   Customize the variable ~org-capture-templates~.
   7555 
   7556 Before we give the formal description of template definitions, let's
   7557 look at an example.  Say you would like to use one template to create
   7558 general TODO entries, and you want to put these entries under the
   7559 heading =Tasks= in your file =~/org/gtd.org=.  Also, a date tree in
   7560 the file =journal.org= should capture journal entries.  A possible
   7561 configuration would look like:
   7562 
   7563 #+begin_src emacs-lisp
   7564 (setq org-capture-templates
   7565       '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
   7566          "* TODO %?\n  %i\n  %a")
   7567         ("j" "Journal" entry (file+datetree "~/org/journal.org")
   7568          "* %?\nEntered on %U\n  %i\n  %a")))
   7569 #+end_src
   7570 
   7571 If you then press {{{kbd(t)}}} from the capture menu, Org will prepare
   7572 the template for you like this:
   7573 
   7574 #+begin_example
   7575 ,* TODO
   7576   [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
   7577 #+end_example
   7578 
   7579 #+texinfo: @noindent
   7580 During expansion of the template, =%a= has been replaced by a link to
   7581 the location from where you called the capture command.  This can be
   7582 extremely useful for deriving tasks from emails, for example.  You
   7583 fill in the task definition, press {{{kbd(C-c C-c)}}} and Org returns
   7584 you to the same place where you started the capture process.
   7585 
   7586 To define special keys to capture to a particular template without
   7587 going through the interactive template selection, you can create your
   7588 key binding like this:
   7589 
   7590 #+begin_src emacs-lisp
   7591 (define-key global-map (kbd "C-c x")
   7592   (lambda () (interactive) (org-capture nil "x")))
   7593 #+end_src
   7594 
   7595 **** Template elements
   7596 :PROPERTIES:
   7597 :DESCRIPTION: What is needed for a complete template entry.
   7598 :END:
   7599 
   7600 Now lets look at the elements of a template definition.  Each entry in
   7601 ~org-capture-templates~ is a list with the following items:
   7602 
   7603 - keys ::
   7604 
   7605   The keys that selects the template, as a string, characters only,
   7606   for example ="a"=, for a template to be selected with a single key,
   7607   or ="bt"= for selection with two keys.  When using several keys,
   7608   keys using the same prefix key must be sequential in the list and
   7609   preceded by a 2-element entry explaining the prefix key, for
   7610   example:
   7611 
   7612   #+begin_src emacs-lisp
   7613   ("b" "Templates for marking stuff to buy")
   7614   #+end_src
   7615 
   7616   If you do not define a template for the {{{kbd(C)}}} key, this key
   7617   opens the Customize buffer for this complex variable.
   7618 
   7619 - description ::
   7620 
   7621   A short string describing the template, shown during selection.
   7622 
   7623 - type ::
   7624 
   7625   The type of entry, a symbol.  Valid values are:
   7626 
   7627   - ~entry~ ::
   7628 
   7629     An Org mode node, with a headline.  Will be filed as the child of
   7630     the target entry or as a top-level entry.  The target file should
   7631     be an Org file.
   7632 
   7633   - ~item~ ::
   7634 
   7635     A plain list item, placed in the first plain list at the target
   7636     location.  Again the target file should be an Org file.
   7637 
   7638   - ~checkitem~ ::
   7639 
   7640     A checkbox item.  This only differs from the plain list item by
   7641     the default template.
   7642 
   7643   - ~table-line~ ::
   7644 
   7645     A new line in the first table at the target location.  Where
   7646     exactly the line will be inserted depends on the properties
   7647     ~:prepend~ and ~:table-line-pos~ (see below).
   7648 
   7649   - ~plain~ ::
   7650 
   7651     Text to be inserted as it is.
   7652 
   7653 - target ::
   7654 
   7655   #+vindex: org-default-notes-file
   7656   #+vindex: org-directory
   7657   Specification of where the captured item should be placed.  In Org
   7658   files, targets usually define a node.  Entries will become children
   7659   of this node.  Other types will be added to the table or list in the
   7660   body of this node.  Most target specifications contain a file name.
   7661   If that file name is the empty string, it defaults to
   7662   ~org-default-notes-file~.  A file can also be given as a variable or
   7663   as a function called with no argument.  When an absolute path is not
   7664   specified for a target, it is taken as relative to ~org-directory~.
   7665 
   7666   Valid values are:
   7667 
   7668   - =(file "path/to/file")= ::
   7669 
   7670     Text will be placed at the beginning or end of that file.
   7671 
   7672   - =(id "id of existing org entry")= ::
   7673 
   7674     Filing as child of this entry, or in the body of the entry.
   7675 
   7676   - =(file+headline "filename" "node headline")= ::
   7677 
   7678     Fast configuration if the target heading is unique in the file.
   7679 
   7680   - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= ::
   7681 
   7682     For non-unique headings, the full path is safer.
   7683 
   7684   - =(file+regexp "filename" "regexp to find location")= ::
   7685 
   7686     Use a regular expression to position point.
   7687 
   7688   - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
   7689 
   7690     This target[fn:84] creates a heading in a date tree[fn:85] for
   7691     today's date.  If the optional outline path is given, the tree
   7692     will be built under the node it is pointing to, instead of at top
   7693     level.  Check out the ~:time-prompt~ and ~:tree-type~ properties
   7694     below for additional options.
   7695 
   7696   - =(file+function "filename" function-finding-location)= ::
   7697 
   7698     A function to find the right location in the file.
   7699 
   7700   - =(clock)= ::
   7701 
   7702     File to the entry that is currently being clocked.
   7703 
   7704   - =(function function-finding-location)= ::
   7705 
   7706     Most general way: write your own function which both visits the
   7707     file and moves point to the right location.
   7708 
   7709 - template ::
   7710 
   7711   The template for creating the capture item.  If you leave this
   7712   empty, an appropriate default template will be used.  Otherwise this
   7713   is a string with escape codes, which will be replaced depending on
   7714   time and context of the capture call.  You may also get this
   7715   template string from a file[fn:86], or dynamically, from a function
   7716   using either syntax:
   7717 
   7718   : (file "/path/to/template-file")
   7719   : (function FUNCTION-RETURNING-THE-TEMPLATE)
   7720 
   7721 - properties ::
   7722 
   7723   The rest of the entry is a property list of additional options.
   7724   Recognized properties are:
   7725 
   7726   - ~:prepend~ ::
   7727 
   7728     Normally new captured information will be appended at the target
   7729     location (last child, last table line, last list item, ...).
   7730     Setting this property changes that.
   7731 
   7732   - ~:immediate-finish~ ::
   7733 
   7734     When set, do not offer to edit the information, just file it away
   7735     immediately.  This makes sense if the template only needs
   7736     information that can be added automatically.
   7737 
   7738   - ~:jump-to-captured~ ::
   7739 
   7740     When set, jump to the captured entry when finished.
   7741 
   7742   - ~:empty-lines~ ::
   7743 
   7744     Set this to the number of lines to insert before and after the new
   7745     item.  Default 0, and the only other common value is 1.
   7746 
   7747   - ~:empty-lines-after~ ::
   7748 
   7749     Set this to the number of lines that should be inserted after the
   7750     new item.  Overrides ~:empty-lines~ for the number of lines
   7751     inserted after.
   7752 
   7753   - ~:empty-lines-before~ ::
   7754 
   7755     Set this to the number of lines that should be inserted before the
   7756     new item.  Overrides ~:empty-lines~ for the number lines inserted
   7757     before.
   7758 
   7759   - ~:clock-in~ ::
   7760 
   7761     Start the clock in this item.
   7762 
   7763   - ~:clock-keep~ ::
   7764 
   7765     Keep the clock running when filing the captured entry.
   7766 
   7767   - ~:clock-resume~ ::
   7768 
   7769     If starting the capture interrupted a clock, restart that clock
   7770     when finished with the capture.  Note that ~:clock-keep~ has
   7771     precedence over ~:clock-resume~.  When setting both to non-~nil~,
   7772     the current clock will run and the previous one will not be
   7773     resumed.
   7774 
   7775   - ~:time-prompt~ ::
   7776 
   7777     Prompt for a date/time to be used for date/week trees and when
   7778     filling the template.  Without this property, capture uses the
   7779     current date and time.  Even if this property has not been set,
   7780     you can force the same behavior by calling ~org-capture~ with
   7781     a {{{kbd(C-1)}}} prefix argument.
   7782 
   7783   - ~:tree-type~ ::
   7784 
   7785     Use ~week~ to make a week tree instead of the month-day tree,
   7786     i.e., place the headings for each day under a heading with the
   7787     current ISO week.  Use ~month~ to group entries by month
   7788     only.  Default is to group entries by day.
   7789 
   7790   - ~:unnarrowed~ ::
   7791 
   7792     Do not narrow the target buffer, simply show the full buffer.
   7793     Default is to narrow it so that you only see the new material.
   7794 
   7795   - ~:table-line-pos~ ::
   7796 
   7797     Specification of the location in the table where the new line
   7798     should be inserted.  It should be a string like =II-3= meaning
   7799     that the new line should become the third line before the second
   7800     horizontal separator line.
   7801 
   7802   - ~:kill-buffer~ ::
   7803 
   7804     If the target file was not yet visited when capture was invoked,
   7805     kill the buffer again after capture is completed.
   7806 
   7807   - ~:no-save~ ::
   7808 
   7809     Do not save the target file after finishing the capture.
   7810 
   7811   - ~:refile-targets :: Temporarily set ~org-refile-targets~ to the
   7812     value of this property.
   7813 
   7814 **** Template expansion
   7815 :PROPERTIES:
   7816 :DESCRIPTION: Filling in information about time and context.
   7817 :END:
   7818 
   7819 In the template itself, special "%-escapes"[fn:87] allow dynamic
   7820 insertion of content.  The templates are expanded in the order given
   7821 here:
   7822 
   7823 - =%[FILE]= ::
   7824 
   7825   Insert the contents of the file given by {{{var(FILE)}}}.
   7826 
   7827 - =%(EXP)= ::
   7828 
   7829   Evaluate Elisp expression {{{var(EXP)}}} and replace it with the
   7830   result.  The {{{var(EXP)}}} form must return a string.  Only
   7831   placeholders pre-existing within the template, or introduced with
   7832   =%[file]=, are expanded this way.  Since this happens after
   7833   expanding non-interactive "%-escapes", those can be used to fill the
   7834   expression.
   7835 
   7836 - =%<FORMAT>= ::
   7837 
   7838   The result of format-time-string on the {{{var(FORMAT)}}}
   7839   specification.
   7840 
   7841 - =%t= ::
   7842 
   7843   Timestamp, date only.
   7844 
   7845 - =%T= ::
   7846 
   7847   Timestamp, with date and time.
   7848 
   7849 - =%u=, =%U= ::
   7850 
   7851   Like =%t=, =%T= above, but inactive timestamps.
   7852 
   7853 - =%i= ::
   7854 
   7855   Initial content, the region when capture is called while the region
   7856   is active.  If there is text before =%i= on the same line, such as
   7857   indentation, and =%i= is not inside a =%(exp)= form, that prefix is
   7858   added before every line in the inserted text.
   7859 
   7860 - =%a= ::
   7861 
   7862   Annotation, normally the link created with ~org-store-link~.
   7863 
   7864 - =%A= ::
   7865 
   7866   Like =%a=, but prompt for the description part.
   7867 
   7868 - =%l= ::
   7869 
   7870   Like =%a=, but only insert the literal link.
   7871 
   7872 - =%L= ::
   7873 
   7874   Like =%l=, but without brackets (the link content itself).
   7875 
   7876 - =%c= ::
   7877 
   7878   Current kill ring head.
   7879 
   7880 - =%x= ::
   7881 
   7882   Content of the X clipboard.
   7883 
   7884 - =%k= ::
   7885 
   7886   Title of the currently clocked task.
   7887 
   7888 - =%K= ::
   7889 
   7890   Link to the currently clocked task.
   7891 
   7892 - =%n= ::
   7893 
   7894   User name (taken from ~user-full-name~).
   7895 
   7896 - =%f= ::
   7897 
   7898   File visited by current buffer when org-capture was called.
   7899 
   7900 - =%F= ::
   7901 
   7902   Full path of the file or directory visited by current buffer.
   7903 
   7904 - =%:keyword= ::
   7905 
   7906   Specific information for certain link types, see below.
   7907 
   7908 - =%^g= ::
   7909 
   7910   Prompt for tags, with completion on tags in target file.
   7911 
   7912 - =%^G= ::
   7913 
   7914   Prompt for tags, with completion all tags in all agenda files.
   7915 
   7916 - =%^t= ::
   7917 
   7918   Like =%t=, but prompt for date.  Similarly =%^T=, =%^u=, =%^U=.  You
   7919   may define a prompt like =%^{Birthday}t=.
   7920 
   7921 - =%^C= ::
   7922 
   7923   Interactive selection of which kill or clip to use.
   7924 
   7925 - =%^L= ::
   7926 
   7927   Like =%^C=, but insert as link.
   7928 
   7929 - =%^{PROP}p= ::
   7930 
   7931   Prompt the user for a value for property {{{var(PROP)}}}.  You may
   7932   specify a default value with =%^{PROP|default}=.
   7933 
   7934 - =%^{PROMPT}= ::
   7935 
   7936   Prompt the user for a string and replace this sequence with it.  You
   7937   may specify a default value and a completion table with
   7938   =%^{prompt|default|completion2|completion3...}=.  The arrow keys
   7939   access a prompt-specific history.
   7940 
   7941 - =%\N= ::
   7942 
   7943   Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}=, where
   7944   {{{var(N)}}} is a number, starting from 1.
   7945 
   7946 - =%?= ::
   7947 
   7948   After completing the template, position point here.
   7949 
   7950 #+vindex: org-store-link-props
   7951 For specific link types, the following keywords are defined[fn:88]:
   7952 
   7953 #+vindex: org-link-from-user-regexp
   7954 | Link type    | Available keywords                                       |
   7955 |--------------+----------------------------------------------------------|
   7956 | bbdb         | =%:name=, =%:company=                                    |
   7957 | irc          | =%:server=, =%:port=, =%:nick=                           |
   7958 | mh, rmail    | =%:type=, =%:subject=, =%:message-id=                    |
   7959 |              | =%:from=, =%:fromname=, =%:fromaddress=                  |
   7960 |              | =%:to=, =%:toname=, =%:toaddress=                        |
   7961 |              | =%:date= (message date header field)                     |
   7962 |              | =%:date-timestamp= (date as active timestamp)            |
   7963 |              | =%:date-timestamp-inactive= (date as inactive timestamp) |
   7964 |              | =%:fromto= (either "to NAME" or "from NAME")[fn:89]      |
   7965 | gnus         | =%:group=, for messages also all email fields            |
   7966 | w3, w3m      | =%:url=                                                  |
   7967 | info         | =%:file=, =%:node=                                       |
   7968 | calendar     | =%:date=                                                 |
   7969 | org-protocol | =%:link=, =%:description=, =%:annotation=                |
   7970 
   7971 **** Templates in contexts
   7972 :PROPERTIES:
   7973 :DESCRIPTION: Only show a template in a specific context.
   7974 :END:
   7975 
   7976 #+vindex: org-capture-templates-contexts
   7977 To control whether a capture template should be accessible from
   7978 a specific context, you can customize
   7979 ~org-capture-templates-contexts~.  Let's say, for example, that you
   7980 have a capture template "p" for storing Gnus emails containing
   7981 patches.  Then you would configure this option like this:
   7982 
   7983 #+begin_src emacs-lisp
   7984 (setq org-capture-templates-contexts
   7985       '(("p" (in-mode . "message-mode"))))
   7986 #+end_src
   7987 
   7988 You can also tell that the command key {{{kbd(p)}}} should refer to
   7989 another template.  In that case, add this command key like this:
   7990 
   7991 #+begin_src emacs-lisp
   7992 (setq org-capture-templates-contexts
   7993       '(("p" "q" (in-mode . "message-mode"))))
   7994 #+end_src
   7995 
   7996 See the docstring of the variable for more information.
   7997 
   7998 ** Attachments
   7999 :PROPERTIES:
   8000 :DESCRIPTION: Attach files to outlines.
   8001 :END:
   8002 #+cindex: attachments
   8003 
   8004 It is often useful to associate reference material with an outline
   8005 node.  Small chunks of plain text can simply be stored in the subtree
   8006 of a project.  Hyperlinks (see [[*Hyperlinks]]) can establish associations
   8007 with files that live elsewhere on a local, or even remote, computer,
   8008 like emails or source code files belonging to a project.
   8009 
   8010 Another method is /attachments/, which are files located in a
   8011 directory belonging to an outline node.  Org uses directories either
   8012 named by a unique ID of each entry, or by a =DIR= property.
   8013 
   8014 *** Attachment defaults and dispatcher
   8015 :PROPERTIES:
   8016 :DESCRIPTION: How to access attachment commands
   8017 :END:
   8018 
   8019 By default, Org attach uses ID properties when adding attachments to
   8020 outline nodes.  This makes working with attachments fully automated.
   8021 There is no decision needed for folder-name or location.  ID-based
   8022 directories are by default located in the =data/= directory, which
   8023 lives in the same directory where your Org file lives[fn:90].
   8024 
   8025 When attachments are made using ~org-attach~ a default tag =ATTACH= is
   8026 added to the node that gets the attachments.
   8027 
   8028 For more control over the setup, see [[*Attachment options]].
   8029 
   8030 The following commands deal with attachments:
   8031 
   8032 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
   8033 
   8034   #+kindex: C-c C-a
   8035   #+findex: org-attach
   8036   The dispatcher for commands related to the attachment system.  After
   8037   these keys, a list of commands is displayed and you must press an
   8038   additional key to select a command:
   8039 
   8040   - {{{kbd(a)}}} (~org-attach-attach~) ::
   8041 
   8042     #+kindex: C-c C-a a
   8043     #+findex: org-attach-attach
   8044     #+vindex: org-attach-method
   8045     Select a file and move it into the task's attachment directory.
   8046     The file is copied, moved, or linked, depending on
   8047     ~org-attach-method~.  Note that hard links are not supported on
   8048     all systems.
   8049 
   8050   - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
   8051 
   8052     #+kindex: C-c C-a c
   8053     #+kindex: C-c C-a m
   8054     #+kindex: C-c C-a l
   8055     Attach a file using the copy/move/link method.  Note that hard
   8056     links are not supported on all systems.
   8057 
   8058   - {{{kbd(b)}}} (~org-attach-buffer~) ::
   8059 
   8060     #+kindex: C-c C-a b
   8061     #+findex: org-attach-buffer
   8062     Select a buffer and save it as a file in the task's attachment
   8063     directory.
   8064 
   8065   - {{{kbd(n)}}} (~org-attach-new~) ::
   8066 
   8067     #+kindex: C-c C-a n
   8068     #+findex: org-attach-new
   8069     Create a new attachment as an Emacs buffer.
   8070 
   8071   - {{{kbd(z)}}} (~org-attach-sync~) ::
   8072 
   8073     #+kindex: C-c C-a z
   8074     #+findex: org-attach-sync
   8075     Synchronize the current task with its attachment directory, in
   8076     case you added attachments yourself.
   8077 
   8078   - {{{kbd(o)}}} (~org-attach-open~) ::
   8079 
   8080     #+kindex: C-c C-a o
   8081     #+findex: org-attach-open
   8082     #+vindex: org-file-apps
   8083     Open current task's attachment.  If there is more than one, prompt
   8084     for a file name first.  Opening follows the rules set by
   8085     ~org-file-apps~.  For more details, see the information on
   8086     following hyperlinks (see [[*Handling Links]]).
   8087 
   8088   - {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
   8089 
   8090     #+kindex: C-c C-a O
   8091     #+findex: org-attach-open-in-emacs
   8092     Also open the attachment, but force opening the file in Emacs.
   8093 
   8094   - {{{kbd(f)}}} (~org-attach-reveal~) ::
   8095 
   8096     #+kindex: C-c C-a f
   8097     #+findex: org-attach-reveal
   8098     Open the current task's attachment directory.
   8099 
   8100   - {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
   8101 
   8102     #+kindex: C-c C-a F
   8103     #+findex: org-attach-reveal-in-emacs
   8104     Also open the directory, but force using Dired in Emacs.
   8105 
   8106   - {{{kbd(d)}}} (~org-attach-delete-one~) ::
   8107 
   8108     #+kindex: C-c C-a d
   8109     Select and delete a single attachment.
   8110 
   8111   - {{{kbd(D)}}} (~org-attach-delete-all~) ::
   8112 
   8113     #+kindex: C-c C-a D
   8114     Delete all of a task's attachments.  A safer way is to open the
   8115     directory in Dired and delete from there.
   8116 
   8117   - {{{kbd(s)}}} (~org-attach-set-directory~) ::
   8118 
   8119     #+kindex: C-c C-a s
   8120     #+cindex: @samp{DIR}, property
   8121     Set a specific directory as the entry's attachment directory.
   8122     This works by putting the directory path into the =DIR=
   8123     property.
   8124 
   8125   - {{{kbd(S)}}} (~org-attach-unset-directory~) ::
   8126 
   8127     #+kindex: C-c C-a S
   8128     #+cindex: @samp{DIR}, property
   8129     Remove the attachment directory.  This command removes the =DIR=
   8130     property and asks the user to either move content inside that
   8131     folder, if an =ID= property is set, delete the content, or to
   8132     leave the attachment directory as is but no longer attached to the
   8133     outline node.
   8134 
   8135 *** Attachment options
   8136 :PROPERTIES:
   8137 :DESCRIPTION: Configuring the attachment system
   8138 :END:
   8139 
   8140 There are a couple of options for attachments that are worth
   8141 mentioning.
   8142 
   8143 - ~org-attach-id-dir~ ::
   8144   #+vindex: org-attach-id-dir
   8145   The directory where attachments are stored when =ID= is used as
   8146   method.
   8147 
   8148 - ~org-attach-dir-relative~ ::
   8149   #+vindex: org-attach-dir-relative
   8150   When setting the =DIR= property on a node using {{{kbd(C-c C-a s)}}}
   8151   (~org-attach-set-directory~), absolute links are entered by default.
   8152   This option changes that to relative links.
   8153 
   8154 - ~org-attach-use-inheritance~ ::
   8155   #+vindex: org-attach-use-inheritance
   8156   By default folders attached to an outline node are inherited from
   8157   parents according to ~org-use-property-inheritance~.  If one instead
   8158   want to set inheritance specifically for Org attach that can be done
   8159   using ~org-attach-use-inheritance~.  Inheriting documents through
   8160   the node hierarchy makes a lot of sense in most cases.  Especially
   8161   when using attachment links (see [[*Attachment links]]).  The following
   8162   example shows one use case for attachment inheritance:
   8163 
   8164   #+begin_example
   8165   ,* Chapter A ...
   8166     :PROPERTIES:
   8167     :DIR: Chapter A/
   8168     :END:
   8169   ,** Introduction
   8170   Some text
   8171 
   8172   #+NAME: Image 1
   8173   [[attachment:image 1.jpg]]
   8174   #+end_example
   8175 
   8176   Without inheritance one would not be able to resolve the link to
   8177   =image 1.jpg=, since the link is inside a sub-heading to =Chapter
   8178   A=.
   8179 
   8180   Inheritance works the same way for both =ID= and =DIR= property.  If
   8181   both properties are defined on the same headline then =DIR= takes
   8182   precedence.  This is also true if inheritance is enabled.  If =DIR=
   8183   is inherited from a parent node in the outline, that property still
   8184   takes precedence over an =ID= property defined on the node itself.
   8185 
   8186 - ~org-attach-method~ ::
   8187   #+vindex: org-attach-method
   8188   When attaching files using the dispatcher {{{kbd(C-c C-a)}}} it
   8189   defaults to copying files.  The behavior can be changed by
   8190   customizing ~org-attach-method~.  Options are Copy, Move/Rename,
   8191   Hard link or Symbolic link.
   8192 
   8193 - ~org-attach-preferred-new-method~ ::
   8194   #+vindex: org-attach-preferred-new-method
   8195   This customization lets you choose the default way to attach to
   8196   nodes without existing =ID= and =DIR= property.  It defaults to ~id~
   8197   but can also be set to ~dir~, ~ask~ or ~nil~.
   8198 
   8199 - ~org-attach-archive-delete~ ::
   8200   #+vindex: org-attach-archive-delete
   8201   Configure this to determine if attachments should be deleted or not
   8202   when a subtree that has attachments is archived.
   8203 
   8204 - ~org-attach-auto-tag~ ::
   8205   #+vindex: org-attach-auto-tag
   8206   When attaching files to a heading it will be assigned a tag
   8207   according to what is set here.
   8208 
   8209 - ~org-attach-id-to-path-function-list~ ::
   8210   #+vindex: org-attach-id-to-path-function-list
   8211   When =ID= is used for attachments, the ID is parsed into a part of a
   8212   directory-path.  See ~org-attach-id-uuid-folder-format~ for the
   8213   default function.  Define a new one and add it as first element in
   8214   ~org-attach-id-to-path-function-list~ if you want the folder
   8215   structure in any other way.  All functions in this list will be
   8216   tried when resolving existing ID's into paths, to maintain backward
   8217   compatibility with existing folders in your system.
   8218 
   8219 - ~org-attach-store-link-p~ ::
   8220   #+vindex: org-attach-store-link-p
   8221   Stores a link to the file that is being attached.  The link is
   8222   stored in ~org-stored-links~ for later insertion with {{{kbd(C-c
   8223   C-l)}}} (see [[*Handling Links]]).  Depending on what option is set in
   8224   ~org-attach-store-link-p~, the link is stored to either the original
   8225   location as a file link, the attachment location as an attachment
   8226   link or to the attachment location as a file link.
   8227 
   8228 - ~org-attach-commands~ ::
   8229   #+vindex: org-attach-commands
   8230   List of all commands used in the attach dispatcher.
   8231 
   8232 - ~org-attach-expert~ ::
   8233   #+vindex: org-attach-expert
   8234   Do not show the splash buffer with the attach dispatcher when
   8235   ~org-attach-expert~ is set to non-~nil~.
   8236 
   8237 See customization group =Org Attach= if you want to change the
   8238 default settings.
   8239 
   8240 *** Attachment links
   8241 :PROPERTIES:
   8242 :DESCRIPTION: Hyperlink access to attachments
   8243 :END:
   8244 
   8245 Attached files and folders can be referenced using attachment links.
   8246 This makes it easy to refer to the material added to an outline node.
   8247 Especially if it was attached using the unique ID of the entry!
   8248 
   8249 #+begin_example
   8250 ,* TODO Some task
   8251   :PROPERTIES:
   8252   :ID:       95d50008-c12e-479f-a4f2-cc0238205319
   8253   :END:
   8254 See attached document for more information: [[attachment:info.org]]
   8255 #+end_example
   8256 
   8257 See [[*External Links]] for more information about these links.
   8258 
   8259 *** Automatic version-control with Git
   8260 :PROPERTIES:
   8261 :DESCRIPTION: Everything safely stored away
   8262 :END:
   8263 
   8264 If the directory attached to an outline node is a Git repository, Org
   8265 can be configured to automatically commit changes to that repository
   8266 when it sees them.
   8267 
   8268 To make Org mode take care of versioning of attachments for you, add
   8269 the following to your Emacs config:
   8270 
   8271 #+begin_src emacs-lisp
   8272 (require 'org-attach-git)
   8273 #+end_src
   8274 
   8275 *** Attach from Dired
   8276 :PROPERTIES:
   8277 :DESCRIPTION: Using dired to select an attachment
   8278 :END:
   8279 #+cindex: attach from Dired
   8280 #+findex: org-attach-dired-to-subtree
   8281 
   8282 It is possible to attach files to a subtree from a Dired buffer.  To
   8283 use this feature, have one window in Dired mode containing the file(s)
   8284 to be attached and another window with point in the subtree that shall
   8285 get the attachments.  In the Dired window, with point on a file,
   8286 {{{kbd(M-x org-attach-dired-to-subtree)}}} attaches the file to the
   8287 subtree using the attachment method set by variable
   8288 ~org-attach-method~.  When files are marked in the Dired window then
   8289 all marked files get attached.
   8290 
   8291 Add the following lines to the Emacs init file to have {{{kbd(C-c C-x
   8292 a)}}} attach files in Dired buffers.
   8293 
   8294 #+begin_src emacs-lisp
   8295 (add-hook 'dired-mode-hook
   8296           (lambda ()
   8297             (define-key dired-mode-map
   8298               (kbd "C-c C-x a")
   8299               #'org-attach-dired-to-subtree)))
   8300 #+end_src
   8301 
   8302 The following code shows how to bind the previous command with
   8303 a specific attachment method.
   8304 
   8305 #+begin_src emacs-lisp
   8306 (add-hook 'dired-mode-hook
   8307           (lambda ()
   8308             (define-key dired-mode-map (kbd "C-c C-x c")
   8309               (lambda ()
   8310                 (interactive)
   8311                 (let ((org-attach-method 'cp))
   8312                   (call-interactively #'org-attach-dired-to-subtree))))))
   8313 #+end_src
   8314 
   8315 ** RSS Feeds
   8316 :PROPERTIES:
   8317 :DESCRIPTION: Getting input from RSS feeds.
   8318 :END:
   8319 #+cindex: RSS feeds
   8320 #+cindex: Atom feeds
   8321 
   8322 Org can add and change entries based on information found in RSS feeds
   8323 and Atom feeds.  You could use this to make a task out of each new
   8324 podcast in a podcast feed.  Or you could use a phone-based
   8325 note-creating service on the web to import tasks into Org.  To access
   8326 feeds, configure the variable ~org-feed-alist~.  The docstring of this
   8327 variable has detailed information.  With the following
   8328 
   8329 #+begin_src emacs-lisp
   8330 (setq org-feed-alist
   8331       '(("Slashdot"
   8332          "https://rss.slashdot.org/Slashdot/slashdot"
   8333          "~/txt/org/feeds.org" "Slashdot Entries")))
   8334 #+end_src
   8335 
   8336 #+texinfo: @noindent
   8337 new items from the feed provided by =rss.slashdot.org= result in new
   8338 entries in the file =~/org/feeds.org= under the heading =Slashdot
   8339 Entries=, whenever the following command is used:
   8340 
   8341 - {{{kbd(C-c C-x g)}}} (~org-feed-update-all~) ::
   8342 
   8343   #+kindex: C-c C-x g
   8344   Collect items from the feeds configured in ~org-feed-alist~ and act
   8345   upon them.
   8346 
   8347 - {{{kbd(C-c C-x G)}}} (~org-feed-goto-inbox~) ::
   8348 
   8349   #+kindex: C-c C-x G
   8350   Prompt for a feed name and go to the inbox configured for this feed.
   8351 
   8352 Under the same headline, Org creates a drawer =FEEDSTATUS= in which it
   8353 stores information about the status of items in the feed, to avoid
   8354 adding the same item several times.
   8355 
   8356 For more information, including how to read atom feeds, see
   8357 =org-feed.el= and the docstring of ~org-feed-alist~.
   8358 
   8359 * Agenda Views
   8360 :PROPERTIES:
   8361 :DESCRIPTION: Collecting information into views.
   8362 :END:
   8363 #+cindex: agenda views
   8364 
   8365 Due to the way Org works, TODO items, time-stamped items, and tagged
   8366 headlines can be scattered throughout a file or even a number of
   8367 files.  To get an overview of open action items, or of events that are
   8368 important for a particular date, this information must be collected,
   8369 sorted and displayed in an organized way.
   8370 
   8371 Org can select items based on various criteria and display them in
   8372 a separate buffer.  Six different view types are provided:
   8373 
   8374 - an /agenda/ that is like a calendar and shows information for
   8375   specific dates,
   8376 
   8377 - a /TODO list/ that covers all unfinished action items,
   8378 
   8379 - a /match view/, showings headlines based on the tags, properties,
   8380   and TODO state associated with them,
   8381 
   8382 - a /text search view/ that shows all entries from multiple files that
   8383   contain specified keywords,
   8384 
   8385 - a /stuck projects view/ showing projects that currently do not move
   8386   along, and
   8387 
   8388 - /custom views/ that are special searches and combinations of
   8389   different views.
   8390 
   8391 The extracted information is displayed in a special /agenda buffer/.
   8392 This buffer is read-only, but provides commands to visit the
   8393 corresponding locations in the original Org files, and even to edit
   8394 these files remotely.
   8395 
   8396 #+vindex: org-agenda-skip-comment-trees
   8397 #+vindex: org-agenda-skip-archived-trees
   8398 #+cindex: commented entries, in agenda views
   8399 #+cindex: archived entries, in agenda views
   8400 By default, the report ignores commented (see [[*Comment Lines]]) and
   8401 archived (see [[*Internal archiving]]) entries.  You can override this by
   8402 setting ~org-agenda-skip-comment-trees~ and
   8403 ~org-agenda-skip-archived-trees~ to ~nil~.
   8404 
   8405 #+vindex: org-agenda-window-setup
   8406 #+vindex: org-agenda-restore-windows-after-quit
   8407 Two variables control how the agenda buffer is displayed and whether
   8408 the window configuration is restored when the agenda exits:
   8409 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
   8410 
   8411 ** Agenda Files
   8412 :PROPERTIES:
   8413 :DESCRIPTION: Files being searched for agenda information.
   8414 :END:
   8415 #+cindex: agenda files
   8416 #+cindex: files for agenda
   8417 
   8418 #+vindex: org-agenda-files
   8419 The information to be shown is normally collected from all /agenda
   8420 files/, the files listed in the variable ~org-agenda-files~[fn:91].
   8421 If a directory is part of this list, all files with the extension
   8422 =.org= in this directory are part of the list.
   8423 
   8424 Thus, even if you only work with a single Org file, that file should
   8425 be put into the list[fn:92].  You can customize ~org-agenda-files~,
   8426 but the easiest way to maintain it is through the following commands
   8427 
   8428 #+attr_texinfo: :sep and
   8429 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
   8430 
   8431   #+kindex: C-c [
   8432   #+findex: org-agenda-file-to-front
   8433   #+cindex: files, adding to agenda list
   8434   Add current file to the list of agenda files.  The file is added to
   8435   the front of the list.  If it was already in the list, it is moved
   8436   to the front.  With a prefix argument, file is added/moved to the
   8437   end.
   8438 
   8439 - {{{kbd(C-c ])}}} (~org-remove-file~) ::
   8440 
   8441   #+kindex: C-c ]
   8442   #+findex: org-remove-file
   8443   Remove current file from the list of agenda files.
   8444 
   8445 - {{{kbd(C-')}}} and {{{kbd(C-\,)}}} (~org-cycle-agenda-files~) ::
   8446 
   8447   #+kindex: C-'
   8448   #+kindex: C-,
   8449   #+findex: org-cycle-agenda-files
   8450   #+cindex: cycling, of agenda files
   8451   Cycle through agenda file list, visiting one file after the other.
   8452 
   8453 - {{{kbd(M-x org-switchb)}}} ::
   8454 
   8455   #+findex: org-switchb
   8456   Command to use an Iswitchb-like interface to switch to and between
   8457   Org buffers.
   8458 
   8459 #+texinfo: @noindent
   8460 The Org menu contains the current list of files and can be used to
   8461 visit any of them.
   8462 
   8463 If you would like to focus the agenda temporarily on a file not in
   8464 this list, or on just one file in the list, or even on only a subtree
   8465 in a file, then this can be done in different ways.  For a single
   8466 agenda command, you may press {{{kbd(<)}}} once or several times in
   8467 the dispatcher (see [[*The Agenda Dispatcher]]).  To restrict the agenda
   8468 scope for an extended period, use the following commands:
   8469 
   8470 - {{{kbd(C-c C-x <)}}} (~org-agenda-set-restriction-lock~) ::
   8471 
   8472   #+kindex: C-c C-x <
   8473   #+findex: org-agenda-set-restriction-lock
   8474   Restrict the agenda to the current subtree.  If there already is
   8475   a restriction at point, remove it.  When called with a universal
   8476   prefix argument or with point before the first headline in a file,
   8477   set the agenda scope to the entire file.  This restriction remains
   8478   in effect until removed with {{{kbd(C-c C-x >)}}}, or by typing
   8479   either {{{kbd(<)}}} or {{{kbd(>)}}} in the agenda dispatcher.  If
   8480   there is a window displaying an agenda view, the new restriction
   8481   takes effect immediately.
   8482 
   8483 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
   8484 
   8485   #+kindex: C-c C-x >
   8486   #+findex: org-agenda-remove-restriction-lock
   8487   Remove the restriction created by {{{kbd(C-c C-x <)}}}.
   8488 
   8489 When working with Speedbar, you can use the following commands in the
   8490 Speedbar frame:
   8491 
   8492 - {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) ::
   8493 
   8494   #+findex: org-speedbar-set-agenda-restriction
   8495   Restrict the agenda to the item---either an Org file or a subtree in
   8496   such a file---at point in the Speedbar frame.  If agenda is already
   8497   restricted there, remove the restriction.  If there is a window
   8498   displaying an agenda view, the new restriction takes effect
   8499   immediately.
   8500 
   8501 - {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) ::
   8502 
   8503   #+findex: org-agenda-remove-restriction-lock
   8504   Remove the restriction.
   8505 
   8506 ** The Agenda Dispatcher
   8507 :PROPERTIES:
   8508 :DESCRIPTION: Keyboard access to agenda views.
   8509 :ALT_TITLE: Agenda Dispatcher
   8510 :END:
   8511 #+cindex: agenda dispatcher
   8512 #+cindex: dispatching agenda commands
   8513 
   8514 The views are created through a dispatcher, accessible with {{{kbd(M-x
   8515 org-agenda)}}}, or, better, bound to a global key (see [[*Activation]]).
   8516 It displays a menu from which an additional letter is required to
   8517 execute a command.  The dispatcher offers the following default
   8518 commands:
   8519 
   8520 #+attr_texinfo: :sep ,
   8521 - {{{kbd(a)}}} ::
   8522 
   8523   Create the calendar-like agenda (see [[*Weekly/daily agenda]]).
   8524 
   8525 - {{{kbd(t)}}}, {{{kbd(T)}}} ::
   8526 
   8527   Create a list of all TODO items (see [[*The global TODO list]]).
   8528 
   8529 - {{{kbd(m)}}}, {{{kbd(M)}}} ::
   8530 
   8531   Create a list of headlines matching a given expression (see
   8532   [[*Matching tags and properties]]).
   8533 
   8534 - {{{kbd(s)}}} ::
   8535 
   8536   #+kindex: s @r{(Agenda dispatcher)}
   8537   Create a list of entries selected by a boolean expression of
   8538   keywords and/or regular expressions that must or must not occur in
   8539   the entry.
   8540 
   8541 - {{{kbd(/)}}} ::
   8542 
   8543   #+kindex: / @r{(Agenda dispatcher)}
   8544   #+vindex: org-agenda-text-search-extra-files
   8545   Search for a regular expression in all agenda files and additionally
   8546   in the files listed in ~org-agenda-text-search-extra-files~.  This
   8547   uses the Emacs command ~multi-occur~.  A prefix argument can be used
   8548   to specify the number of context lines for each match, default is
   8549   1.
   8550 
   8551 - {{{kbd(#)}}} ::
   8552 
   8553   Create a list of stuck projects (see [[*Stuck projects]]).
   8554 
   8555 - {{{kbd(!)}}} ::
   8556 
   8557   Configure the list of stuck projects (see [[*Stuck projects]]).
   8558 
   8559 - {{{kbd(<)}}} ::
   8560 
   8561   #+kindex: < @r{(Agenda dispatcher)}
   8562   Restrict an agenda command to the current buffer[fn:93].  If
   8563   narrowing is in effect restrict to the narrowed part of the buffer.
   8564   After pressing {{{kbd(<)}}}, you still need to press the character
   8565   selecting the command.
   8566 
   8567 - {{{kbd(< <)}}} ::
   8568 
   8569   #+kindex: < < @r{(Agenda dispatcher)}
   8570   If there is an active region, restrict the following agenda command
   8571   to the region.  Otherwise, restrict it to the current
   8572   subtree[fn:94].  After pressing {{{kbd(< <)}}}, you still need to
   8573   press the character selecting the command.
   8574 
   8575 - {{{kbd(*)}}} ::
   8576 
   8577   #+kindex: * @r{(Agenda dispatcher)}
   8578   #+vindex: org-agenda-sticky
   8579   #+findex: org-toggle-sticky-agenda
   8580   Toggle sticky agenda views.  By default, Org maintains only a single
   8581   agenda buffer and rebuilds it each time you change the view, to make
   8582   sure everything is always up to date.  If you switch between views
   8583   often and the build time bothers you, you can turn on sticky agenda
   8584   buffers (make this the default by customizing the variable
   8585   ~org-agenda-sticky~).  With sticky agendas, the dispatcher only
   8586   switches to the selected view, you need to update it by hand with
   8587   {{{kbd(r)}}} or {{{kbd(g)}}}.  You can toggle sticky agenda view any
   8588   time with ~org-toggle-sticky-agenda~.
   8589 
   8590 You can also define custom commands that are accessible through the
   8591 dispatcher, just like the default commands.  This includes the
   8592 possibility to create extended agenda buffers that contain several
   8593 blocks together, for example the weekly agenda, the global TODO list
   8594 and a number of special tags matches.  See [[*Custom Agenda Views]].
   8595 
   8596 ** The Built-in Agenda Views
   8597 :PROPERTIES:
   8598 :DESCRIPTION: What is available out of the box?
   8599 :ALT_TITLE: Built-in Agenda Views
   8600 :END:
   8601 
   8602 In this section we describe the built-in views.
   8603 
   8604 *** Weekly/daily agenda
   8605 :PROPERTIES:
   8606 :DESCRIPTION: The calendar page with current tasks.
   8607 :END:
   8608 #+cindex: agenda
   8609 #+cindex: weekly agenda
   8610 #+cindex: daily agenda
   8611 
   8612 The purpose of the weekly/daily /agenda/ is to act like a page of
   8613 a paper agenda, showing all the tasks for the current week or day.
   8614 
   8615 - {{{kbd(M-x org-agenda a)}}} (~org-agenda-list~) ::
   8616 
   8617   #+kindex: a @r{(Agenda dispatcher)}
   8618   #+findex: org-agenda-list
   8619   #+cindex: org-agenda, command
   8620   Compile an agenda for the current week from a list of Org files.
   8621   The agenda shows the entries for each day.  With a numeric prefix
   8622   argument[fn:95]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
   8623   set the number of days to be displayed.
   8624 
   8625 #+vindex: org-agenda-span
   8626 #+vindex: org-agenda-start-day
   8627 #+vindex: org-agenda-start-on-weekday
   8628 The default number of days displayed in the agenda is set by the
   8629 variable ~org-agenda-span~.  This variable can be set to any number of
   8630 days you want to see by default in the agenda, or to a span name, such
   8631 a ~day~, ~week~, ~month~ or ~year~.  For weekly agendas, the default
   8632 is to start on the previous Monday (see
   8633 ~org-agenda-start-on-weekday~).  You can also set the start date using
   8634 a date shift: =(setq org-agenda-start-day "+10d")= starts the agenda
   8635 ten days from today in the future.
   8636 
   8637 Remote editing from the agenda buffer means, for example, that you can
   8638 change the dates of deadlines and appointments from the agenda buffer.
   8639 The commands available in the Agenda buffer are listed in [[*Commands in
   8640 the Agenda Buffer]].
   8641 
   8642 **** Calendar/Diary integration
   8643 :PROPERTIES:
   8644 :UNNUMBERED: notoc
   8645 :END:
   8646 #+cindex: calendar integration
   8647 #+cindex: diary integration
   8648 
   8649 Emacs contains the calendar and diary by Edward\nbsp{}M.\nbsp{}Reingold.  The
   8650 calendar displays a three-month calendar with holidays from different
   8651 countries and cultures.  The diary allows you to keep track of
   8652 anniversaries, lunar phases, sunrise/set, recurrent appointments
   8653 (weekly, monthly) and more.  In this way, it is quite complementary to
   8654 Org.  It can be very useful to combine output from Org with the diary.
   8655 
   8656 In order to include entries from the Emacs diary into Org mode's
   8657 agenda, you only need to customize the variable
   8658 
   8659 #+begin_src emacs-lisp
   8660 (setq org-agenda-include-diary t)
   8661 #+end_src
   8662 
   8663 #+texinfo: @noindent
   8664 After that, everything happens automatically.  All diary entries
   8665 including holidays, anniversaries, etc., are included in the agenda
   8666 buffer created by Org mode.  {{{kbd(SPC)}}}, {{{kbd(TAB)}}}, and
   8667 {{{kbd(RET)}}} can be used from the agenda buffer to jump to the diary
   8668 file in order to edit existing diary entries.  The {{{kbd(i)}}}
   8669 command to insert new entries for the current date works in the agenda
   8670 buffer, as well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and
   8671 {{{kbd(C)}}} to display Sunrise/Sunset times, show lunar phases and to
   8672 convert to other calendars, respectively.  {{{kbd(c)}}} can be used to
   8673 switch back and forth between calendar and agenda.
   8674 
   8675 If you are using the diary only for expression entries and holidays,
   8676 it is faster to not use the above setting, but instead to copy or even
   8677 move the entries into an Org file.  Org mode evaluates diary-style
   8678 expression entries, and does it faster because there is no overhead
   8679 for first creating the diary display.  Note that the expression
   8680 entries must start at the left margin, no whitespace is allowed before
   8681 them, as seen in the following segment of an Org file:[fn:96]
   8682 
   8683 #+begin_example
   8684 ,* Holidays
   8685   :PROPERTIES:
   8686   :CATEGORY: Holiday
   8687   :END:
   8688 %%(org-calendar-holiday)   ; special function for holiday names
   8689 
   8690 ,* Birthdays
   8691   :PROPERTIES:
   8692   :CATEGORY: Ann
   8693   :END:
   8694 %%(org-anniversary 1956  5 14) Arthur Dent is %d years old
   8695 %%(org-anniversary 1869 10  2) Mahatma Gandhi would be %d years old
   8696 #+end_example
   8697 
   8698 **** Anniversaries from BBDB
   8699 :PROPERTIES:
   8700 :UNNUMBERED: notoc
   8701 :END:
   8702 #+cindex: BBDB, anniversaries
   8703 #+cindex: anniversaries, from BBDB
   8704 
   8705 #+findex: org-bbdb-anniversaries
   8706 If you are using the Insidious Big Brother Database to store your
   8707 contacts, you very likely prefer to store anniversaries in BBDB rather
   8708 than in a separate Org or diary file.  Org supports this and can show
   8709 BBDB anniversaries as part of the agenda.  All you need to do is to
   8710 add the following to one of your agenda files:
   8711 
   8712 #+begin_example
   8713 ,* Anniversaries
   8714   :PROPERTIES:
   8715   :CATEGORY: Anniv
   8716   :END:
   8717 %%(org-bbdb-anniversaries)
   8718 #+end_example
   8719 
   8720 You can then go ahead and define anniversaries for a BBDB record.
   8721 Basically, you need a field named =anniversary= for the BBDB record
   8722 which contains the date in the format =YYYY-MM-DD= or =MM-DD=,
   8723 followed by a space and the class of the anniversary (=birthday=,
   8724 =wedding=, or a format string).  If you omit the class, it defaults to
   8725 =birthday=.  Here are a few examples, the header for the file
   8726 =ol-bbdb.el= contains more detailed information.
   8727 
   8728 #+begin_example
   8729 1973-06-22
   8730 06-22
   8731 1955-08-02 wedding
   8732 2008-04-14 %s released version 6.01 of Org mode, %d years ago
   8733 #+end_example
   8734 
   8735 After a change to BBDB, or for the first agenda display during an
   8736 Emacs session, the agenda display suffers a short delay as Org updates
   8737 its hash with anniversaries.  However, from then on things will be
   8738 very fast, much faster in fact than a long list of
   8739 =%%(diary-anniversary)= entries in an Org or Diary file.
   8740 
   8741 #+findex: org-bbdb-anniversaries-future
   8742 If you would like to see upcoming anniversaries with a bit of
   8743 forewarning, you can use the following instead:
   8744 
   8745 #+begin_example
   8746 ,* Anniversaries
   8747   :PROPERTIES:
   8748   :CATEGORY: Anniv
   8749   :END:
   8750 %%(org-bbdb-anniversaries-future 3)
   8751 #+end_example
   8752 
   8753 That will give you three days' warning: on the anniversary date itself
   8754 and the two days prior.  The argument is optional: if omitted, it
   8755 defaults to 7.
   8756 
   8757 **** Appointment reminders
   8758 :PROPERTIES:
   8759 :UNNUMBERED: notoc
   8760 :END:
   8761 #+cindex: @file{appt.el}
   8762 #+cindex: appointment reminders
   8763 #+cindex: appointment
   8764 #+cindex: reminders
   8765 
   8766 #+cindex: APPT_WARNTIME, keyword
   8767 Org can interact with Emacs appointments notification facility.  To
   8768 add the appointments of your agenda files, use the command
   8769 ~org-agenda-to-appt~.  This command lets you filter through the list
   8770 of your appointments and add only those belonging to a specific
   8771 category or matching a regular expression.  It also reads
   8772 a =APPT_WARNTIME= property which overrides the value of
   8773 ~appt-message-warning-time~ for this appointment.  See the docstring
   8774 for details.
   8775 
   8776 *** The global TODO list
   8777 :PROPERTIES:
   8778 :DESCRIPTION: All unfinished action items.
   8779 :ALT_TITLE: Global TODO list
   8780 :END:
   8781 #+cindex: global TODO list
   8782 #+cindex: TODO list, global
   8783 
   8784 The global TODO list contains all unfinished TODO items formatted and
   8785 collected into a single place.
   8786 
   8787 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
   8788 
   8789   #+kindex: t @r{(Agenda dispatcher)}
   8790   #+findex: org-todo-list
   8791   Show the global TODO list.  This collects the TODO items from all
   8792   agenda files (see [[*Agenda Views]]) into a single buffer.  By default,
   8793   this lists items with a state the is not a DONE state.  The buffer
   8794   is in Agenda mode, so there are commands to examine and manipulate
   8795   the TODO entries directly from that buffer (see [[*Commands in the
   8796   Agenda Buffer]]).
   8797 
   8798 - {{{kbd(M-x org-agenda T)}}} (~org-todo-list~) ::
   8799 
   8800   #+kindex: T @r{(Agenda dispatcher)}
   8801   #+findex: org-todo-list
   8802   #+cindex: TODO keyword matching
   8803   #+vindex: org-todo-keywords
   8804   Like the above, but allows selection of a specific TODO keyword.
   8805   You can also do this by specifying a prefix argument to
   8806   {{{kbd(t)}}}.  You are prompted for a keyword, and you may also
   8807   specify several keywords by separating them with =|= as the boolean
   8808   OR operator.  With a numeric prefix, the Nth keyword in
   8809   ~org-todo-keywords~ is selected.
   8810 
   8811   #+kindex: r
   8812   The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you
   8813   can give a prefix argument to this command to change the selected
   8814   TODO keyword, for example {{{kbd(3 r)}}}.  If you often need
   8815   a search for a specific keyword, define a custom command for it (see
   8816   [[*The Agenda Dispatcher]]).
   8817 
   8818   Matching specific TODO keywords can also be done as part of a tags
   8819   search (see [[*Tag Searches]]).
   8820 
   8821 Remote editing of TODO items means that you can change the state of
   8822 a TODO entry with a single key press.  The commands available in the
   8823 TODO list are described in [[*Commands in the Agenda Buffer]].
   8824 
   8825 #+cindex: sublevels, inclusion into TODO list
   8826 Normally the global TODO list simply shows all headlines with TODO
   8827 keywords.  This list can become very long.  There are two ways to keep
   8828 it more compact:
   8829 
   8830 -
   8831   #+vindex: org-agenda-todo-ignore-scheduled
   8832   #+vindex: org-agenda-todo-ignore-deadlines
   8833   #+vindex: org-agenda-todo-ignore-timestamp
   8834   #+vindex: org-agenda-todo-ignore-with-date
   8835   Some people view a TODO item that has been /scheduled/ for execution
   8836   or have a /deadline/ (see [[*Timestamps]]) as no longer /open/.
   8837   Configure the variables ~org-agenda-todo-ignore-scheduled~ to
   8838   exclude some or all scheduled items from the global TODO list,
   8839   ~org-agenda-todo-ignore-deadlines~ to exclude some or all items with
   8840   a deadline set, ~org-agenda-todo-ignore-timestamp~ to exclude some
   8841   or all items with an active timestamp other than a DEADLINE or
   8842   a SCHEDULED timestamp and/or ~org-agenda-todo-ignore-with-date~ to
   8843   exclude items with at least one active timestamp.
   8844 
   8845 -
   8846   #+vindex: org-agenda-todo-list-sublevels
   8847   TODO items may have sublevels to break up the task into subtasks.
   8848   In such cases it may be enough to list only the highest level TODO
   8849   headline and omit the sublevels from the global list.  Configure the
   8850   variable ~org-agenda-todo-list-sublevels~ to get this behavior.
   8851 
   8852 *** Matching tags and properties
   8853 :PROPERTIES:
   8854 :DESCRIPTION: Structured information with fine-tuned search.
   8855 :END:
   8856 #+cindex: matching, of tags
   8857 #+cindex: matching, of properties
   8858 #+cindex: tags view
   8859 #+cindex: match view
   8860 
   8861 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]),
   8862 or have properties (see [[*Properties and Columns]]), you can select
   8863 headlines based on this metadata and collect them into an agenda
   8864 buffer.  The match syntax described here also applies when creating
   8865 sparse trees with {{{kbd(C-c / m)}}}.
   8866 
   8867 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
   8868 
   8869   #+kindex: m @r{(Agenda dispatcher)}
   8870   #+findex: org-tags-view
   8871   Produce a list of all headlines that match a given set of tags.  The
   8872   command prompts for a selection criterion, which is a boolean logic
   8873   expression with tags, like =+work+urgent-withboss= or =work|home=
   8874   (see [[*Tags]]).  If you often need a specific search, define a custom
   8875   command for it (see [[*The Agenda Dispatcher]]).
   8876 
   8877 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
   8878 
   8879   #+kindex: M @r{(Agenda dispatcher)}
   8880   #+findex: org-tags-view
   8881   #+vindex: org-tags-match-list-sublevels
   8882   #+vindex: org-agenda-tags-todo-honor-ignore-options
   8883   Like {{{kbd(m)}}}, but only select headlines that are also TODO
   8884   items and force checking subitems (see the variable
   8885   ~org-tags-match-list-sublevels~).  To exclude scheduled/deadline
   8886   items, see the variable ~org-agenda-tags-todo-honor-ignore-options~.
   8887   Matching specific TODO keywords together with a tags match is also
   8888   possible, see [[*Tag Searches]].
   8889 
   8890 The commands available in the tags list are described in [[*Commands in
   8891 the Agenda Buffer]].
   8892 
   8893 #+cindex: boolean logic, for agenda searches
   8894 A search string can use Boolean operators =&= for AND and =|= for OR.
   8895 =&= binds more strongly than =|=.  Parentheses are currently not
   8896 implemented.  Each element in the search is either a tag, a regular
   8897 expression matching tags, or an expression like =PROPERTY OPERATOR
   8898 VALUE= with a comparison operator, accessing a property value.  Each
   8899 element may be preceded by =-= to select against it, and =+= is
   8900 syntactic sugar for positive selection.  The AND operator =&= is
   8901 optional when =+= or =-= is present.  Here are some examples, using
   8902 only tags.
   8903 
   8904 - =+work-boss= ::
   8905 
   8906   Select headlines tagged =work=, but discard those also tagged
   8907   =boss=.
   8908 
   8909 - =work|laptop= ::
   8910 
   8911   Selects lines tagged =work= or =laptop=.
   8912 
   8913 - =work|laptop+night= ::
   8914 
   8915   Like before, but require the =laptop= lines to be tagged also
   8916   =night=.
   8917 
   8918 #+cindex: regular expressions, with tags search
   8919 Instead of a tag, you may also specify a regular expression enclosed
   8920 in curly braces (see [[*Regular Expressions]]).  For example,
   8921 =work+{^boss.*}= matches headlines that contain the tag =:work:= and
   8922 any tag /starting/ with =boss=.
   8923 
   8924 #+cindex: group tags, as regular expressions
   8925 Group tags (see [[*Tag Hierarchy]]) are expanded as regular expressions.
   8926 E.g., if =work= is a group tag for the group =:work:lab:conf:=, then
   8927 searching for =work= also searches for ={\(?:work\|lab\|conf\)}= and
   8928 searching for =-work= searches for all headlines but those with one of
   8929 the tags in the group (i.e., =-{\(?:work\|lab\|conf\)}=).
   8930 
   8931 #+cindex: TODO keyword matching, with tags search
   8932 #+cindex: level, for tags/property match
   8933 #+cindex: category, for tags/property match
   8934 #+vindex: org-odd-levels-only
   8935 You may also test for properties (see [[*Properties and Columns]]) at the
   8936 same time as matching tags.  The properties may be real properties, or
   8937 special properties that represent other metadata (see [[*Special
   8938 Properties]]).  For example, the property =TODO= represents the TODO
   8939 keyword of the entry.  Or, the property =LEVEL= represents the level
   8940 of an entry.  So searching =+LEVEL=3+boss-TODO​="DONE"= lists all level
   8941 three headlines that have the tag =boss= and are /not/ marked with the
   8942 TODO keyword =DONE=.  In buffers with ~org-odd-levels-only~ set,
   8943 =LEVEL= does not count the number of stars, but =LEVEL=2= corresponds
   8944 to 3 stars etc.
   8945 
   8946 Here are more examples:
   8947 
   8948 - =work+TODO​="WAITING"= ::
   8949 
   8950   Select =work=-tagged TODO lines with the specific TODO keyword
   8951   =WAITING=.
   8952 
   8953 - =work+TODO​="WAITING"|home+TODO​="WAITING"= ::
   8954 
   8955   Waiting tasks both at work and at home.
   8956 
   8957 When matching properties, a number of different operators can be used
   8958 to test the value of a property.  Here is a complex example:
   8959 
   8960 #+begin_example
   8961 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
   8962          +With={Sarah\|Denny}+SCHEDULED>="<2008-10-11>"
   8963 #+end_example
   8964 
   8965 #+texinfo: @noindent
   8966 The type of comparison depends on how the comparison value is written:
   8967 
   8968 - If the comparison value is a plain number, a numerical comparison is
   8969   done, and the allowed operators are =<=, ===, =>=, =<==, =>==, and
   8970   =<>=.
   8971 
   8972 - If the comparison value is enclosed in double-quotes, a string
   8973   comparison is done, and the same operators are allowed.
   8974 
   8975 - If the comparison value is enclosed in double-quotes /and/ angular
   8976   brackets (like =DEADLINE<​="<2008-12-24 18:30>"=), both values are
   8977   assumed to be date/time specifications in the standard Org way, and
   8978   the comparison is done accordingly.  Valid values also include
   8979   ="<now>"= for now (including time), ="<today>"=, and ="<tomorrow>"=
   8980   for these days at 0:00 hours, i.e., without a time specification.
   8981   You can also use strings like ="<+5d>"= or ="<-2m>"= with units =d=,
   8982   =w=, =m=, and =y= for day, week, month, and year, respectively.
   8983 
   8984 - If the comparison value is enclosed in curly braces, a regexp match
   8985   is performed, with === meaning that the regexp matches the property
   8986   value, and =<>= meaning that it does not match.
   8987 
   8988 So the search string in the example finds entries tagged =work= but
   8989 not =boss=, which also have a priority value =A=, a =Coffee= property
   8990 with the value =unlimited=, an =EFFORT= property that is numerically
   8991 smaller than 2, a =With= property that is matched by the regular
   8992 expression =Sarah\|Denny=, and that are scheduled on or after October
   8993 11, 2008.
   8994 
   8995 You can configure Org mode to use property inheritance during
   8996 a search, but beware that this can slow down searches considerably.
   8997 See [[*Property Inheritance]], for details.
   8998 
   8999 For backward compatibility, and also for typing speed, there is also
   9000 a different way to test TODO states in a search.  For this, terminate
   9001 the tags/property part of the search string (which may include several
   9002 terms connected with =|=) with a =/= and then specify a Boolean
   9003 expression just for TODO keywords.  The syntax is then similar to that
   9004 for tags, but should be applied with care: for example, a positive
   9005 selection on several TODO keywords cannot meaningfully be combined
   9006 with boolean AND.  However, /negative selection/ combined with AND can
   9007 be meaningful.  To make sure that only lines are checked that actually
   9008 have any TODO keyword (resulting in a speed-up), use {{{kbd(M-x
   9009 org-agenda M)}}}, or equivalently start the TODO part after the slash
   9010 with =!=.  Using {{{kbd(M-x org-agenda M)}}} or =/!= does not match
   9011 TODO keywords in a DONE state.  Examples:
   9012 
   9013 - =work/WAITING= ::
   9014 
   9015   Same as =work+TODO​="WAITING"=.
   9016 
   9017 - =work/!-WAITING-NEXT= ::
   9018 
   9019   Select =work=-tagged TODO lines that are neither =WAITING= nor
   9020   =NEXT=.
   9021 
   9022 - =work/!+WAITING|+NEXT= ::
   9023 
   9024   Select =work=-tagged TODO lines that are either =WAITING= or =NEXT=.
   9025 
   9026 *** Search view
   9027 :PROPERTIES:
   9028 :DESCRIPTION: Find entries by searching for text.
   9029 :END:
   9030 #+cindex: search view
   9031 #+cindex: text search
   9032 #+cindex: searching, for text
   9033 
   9034 This agenda view is a general text search facility for Org mode
   9035 entries.  It is particularly useful to find notes.
   9036 
   9037 - {{{kbd(M-x org-agenda s)}}} (~org-search-view~) ::
   9038 
   9039   #+kindex: s @r{(Agenda dispatcher)}
   9040   #+findex: org-search-view
   9041   This is a special search that lets you select entries by matching
   9042   a substring or specific words using a boolean logic.
   9043 
   9044 For example, the search string =computer equipment= matches entries
   9045 that contain =computer equipment= as a substring, even if the two
   9046 words are separated by more space or a line break.
   9047 
   9048 Search view can also search for specific keywords in the entry, using
   9049 Boolean logic.  The search string =+computer
   9050 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the
   9051 keywords =computer= and =wifi=, but not the keyword =ethernet=, and
   9052 which are also not matched by the regular expression =8\.11[bg]=,
   9053 meaning to exclude both =8.11b= and =8.11g=.  The first =+= is
   9054 necessary to turn on boolean search, other =+= characters are
   9055 optional.  For more details, see the docstring of the command
   9056 ~org-search-view~.
   9057 
   9058 You can incrementally and conveniently adjust a boolean search from
   9059 the agenda search view with the following keys
   9060 
   9061 #+attr_texinfo: :columns 0.1 0.6
   9062 | {{{kbd([)}}} | Add a positive search word        |
   9063 | {{{kbd(])}}} | Add a negative search word        |
   9064 | {{{kbd({)}}} | Add a positive regular expression |
   9065 | {{{kbd(})}}} | Add a negative regular expression |
   9066 
   9067 #+vindex: org-agenda-text-search-extra-files
   9068 Note that in addition to the agenda files, this command also searches
   9069 the files listed in ~org-agenda-text-search-extra-files~.
   9070 
   9071 *** Stuck projects
   9072 :PROPERTIES:
   9073 :DESCRIPTION: Find projects you need to review.
   9074 :END:
   9075 #+pindex: GTD, Getting Things Done
   9076 
   9077 If you are following a system like David Allen's GTD to organize your
   9078 work, one of the "duties" you have is a regular review to make sure
   9079 that all projects move along.  A /stuck/ project is a project that has
   9080 no defined next actions, so it never shows up in the TODO lists Org
   9081 mode produces.  During the review, you need to identify such projects
   9082 and define next actions for them.
   9083 
   9084 - {{{kbd(M-x org-agenda #)}}} (~org-agenda-list-stuck-projects~) ::
   9085 
   9086   #+kindex: # @r{(Agenda dispatcher)}
   9087   #+findex: org-agenda-list-stuck-projects
   9088   List projects that are stuck.
   9089 
   9090 - {{{kbd(M-x org-agenda !)}}} ::
   9091 
   9092   #+kindex: ! @r{(Agenda dispatcher)}
   9093   #+vindex: org-stuck-projects
   9094   Customize the variable ~org-stuck-projects~ to define what a stuck
   9095   project is and how to find it.
   9096 
   9097 You almost certainly need to configure this view before it works for
   9098 you.  The built-in default assumes that all your projects are level-2
   9099 headlines, and that a project is not stuck if it has at least one
   9100 entry marked with a TODO keyword =TODO= or =NEXT= or =NEXTACTION=.
   9101 
   9102 Let's assume that you, in your own way of using Org mode, identify
   9103 projects with a tag =:PROJECT:=, and that you use a TODO keyword
   9104 =MAYBE= to indicate a project that should not be considered yet.
   9105 Let's further assume that the TODO keyword =DONE= marks finished
   9106 projects, and that =NEXT= and =TODO= indicate next actions.  The tag
   9107 =:@shop:= indicates shopping and is a next action even without the
   9108 NEXT tag.  Finally, if the project contains the special word =IGNORE=
   9109 anywhere, it should not be listed either.  In this case you would
   9110 start by identifying eligible projects with a tags/TODO match (see
   9111 [[*Tag Searches]]) =+PROJECT/-MAYBE-DONE=, and then check for =TODO=,
   9112 =NEXT=, =@shop=, and =IGNORE= in the subtree to identify projects that
   9113 are not stuck.  The correct customization for this is:
   9114 
   9115 #+begin_src emacs-lisp
   9116 (setq org-stuck-projects
   9117       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop")
   9118         "\\<IGNORE\\>"))
   9119 #+end_src
   9120 
   9121 Note that if a project is identified as non-stuck, the subtree of this
   9122 entry is searched for stuck projects.
   9123 
   9124 ** Presentation and Sorting
   9125 :PROPERTIES:
   9126 :DESCRIPTION: How agenda items are prepared for display.
   9127 :END:
   9128 #+cindex: presentation, of agenda items
   9129 
   9130 #+vindex: org-agenda-prefix-format
   9131 #+vindex: org-agenda-tags-column
   9132 Before displaying items in an agenda view, Org mode visually prepares
   9133 the items and sorts them.  Each item occupies a single line.  The line
   9134 starts with a /prefix/ that contains the /category/ (see [[*Categories]])
   9135 of the item and other important information.  You can customize in
   9136 which column tags are displayed through ~org-agenda-tags-column~.  You
   9137 can also customize the prefix using the option
   9138 ~org-agenda-prefix-format~.  This prefix is followed by a cleaned-up
   9139 version of the outline headline associated with the item.
   9140 
   9141 *** Categories
   9142 :PROPERTIES:
   9143 :DESCRIPTION: Not all tasks are equal.
   9144 :END:
   9145 #+cindex: category
   9146 #+cindex: @samp{CATEGORY}, keyword
   9147 
   9148 The category is a broad label assigned to each agenda item.  By
   9149 default, the category is simply derived from the file name, but you
   9150 can also specify it with a special line in the buffer, like
   9151 this:
   9152 
   9153 : #+CATEGORY: Thesis
   9154 
   9155 #+cindex: @samp{CATEGORY}, property
   9156 If you would like to have a special category for a single entry or
   9157 a (sub)tree, give the entry a =CATEGORY= property with the special
   9158 category you want to apply as the value.
   9159 
   9160 #+vindex: org-agenda-category-icon-alist
   9161 The display in the agenda buffer looks best if the category is not
   9162 longer than 10 characters.  You can set up icons for category by
   9163 customizing the ~org-agenda-category-icon-alist~ variable.
   9164 
   9165 *** Time-of-day specifications
   9166 :PROPERTIES:
   9167 :DESCRIPTION: How the agenda knows the time.
   9168 :END:
   9169 #+cindex: time-of-day specification
   9170 
   9171 Org mode checks each agenda item for a time-of-day specification.  The
   9172 time can be part of the timestamp that triggered inclusion into the
   9173 agenda, for example
   9174 
   9175 : <2005-05-10 Tue 19:00>
   9176 
   9177 #+texinfo: @noindent
   9178 Time ranges can be specified with two timestamps:
   9179 
   9180 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
   9181 
   9182 #+vindex: org-agenda-search-headline-for-time
   9183 In the headline of the entry itself, a time(range)---like =12:45= or
   9184 a =8:30-1pm=---may also appear as plain text[fn:97].
   9185 
   9186 If the agenda integrates the Emacs diary (see [[*Weekly/daily agenda]]),
   9187 time specifications in diary entries are recognized as well.
   9188 
   9189 For agenda display, Org mode extracts the time and displays it in
   9190 a standard 24 hour format as part of the prefix.  The example times in
   9191 the previous paragraphs would end up in the agenda like this:
   9192 
   9193 #+begin_example
   9194  8:30-13:00 Arthur Dent lies in front of the bulldozer
   9195 12:45...... Ford Prefect arrives and takes Arthur to the pub
   9196 19:00...... The Vogon reads his poem
   9197 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
   9198 #+end_example
   9199 
   9200 #+cindex: time grid
   9201 If the agenda is in single-day mode, or for the display of today, the
   9202 timed entries are embedded in a time grid, like
   9203 
   9204 #+begin_example
   9205  8:00...... ------------------
   9206  8:30-13:00 Arthur Dent lies in front of the bulldozer
   9207 10:00...... ------------------
   9208 12:00...... ------------------
   9209 12:45...... Ford Prefect arrives and takes Arthur to the pub
   9210 14:00...... ------------------
   9211 16:00...... ------------------
   9212 18:00...... ------------------
   9213 19:00...... The Vogon reads his poem
   9214 20:00...... ------------------
   9215 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
   9216 #+end_example
   9217 
   9218 #+vindex: org-agenda-use-time-grid
   9219 #+vindex: org-agenda-time-grid
   9220 The time grid can be turned on and off with the variable
   9221 ~org-agenda-use-time-grid~, and can be configured with
   9222 ~org-agenda-time-grid~.
   9223 
   9224 *** Sorting of agenda items
   9225 :PROPERTIES:
   9226 :DESCRIPTION: The order of things.
   9227 :END:
   9228 #+cindex: sorting, of agenda items
   9229 #+cindex: priorities, of agenda items
   9230 
   9231 Before being inserted into a view, the items are sorted.  How this is
   9232 done depends on the type of view.
   9233 
   9234 -
   9235   #+vindex: org-agenda-files
   9236   For the daily/weekly agenda, the items for each day are sorted.  The
   9237   default order is to first collect all items containing an explicit
   9238   time-of-day specification.  These entries are shown at the beginning
   9239   of the list, as a /schedule/ for the day.  After that, items remain
   9240   grouped in categories, in the sequence given by ~org-agenda-files~.
   9241   Within each category, items are sorted by priority (see
   9242   [[*Priorities]]), which is composed of the base priority (2000 for
   9243   priority =A=, 1000 for =B=, and 0 for =C=), plus additional
   9244   increments for overdue scheduled or deadline items.
   9245 
   9246 - For the TODO list, items remain in the order of categories, but
   9247   within each category, sorting takes place according to priority (see
   9248   [[*Priorities]]).  The priority used for sorting derives from the
   9249   priority cookie, with additions depending on how close an item is to
   9250   its due or scheduled date.
   9251 
   9252 - For tags matches, items are not sorted at all, but just appear in
   9253   the sequence in which they are found in the agenda files.
   9254 
   9255 #+vindex: org-agenda-sorting-strategy
   9256 Sorting can be customized using the variable
   9257 ~org-agenda-sorting-strategy~, and may also include criteria based on
   9258 the estimated effort of an entry (see [[*Effort Estimates]]).
   9259 
   9260 *** Filtering/limiting agenda items
   9261 :PROPERTIES:
   9262 :DESCRIPTION: Dynamically narrow the agenda.
   9263 :END:
   9264 
   9265 #+vindex: org-agenda-category-filter-preset
   9266 #+vindex: org-agenda-tag-filter-preset
   9267 #+vindex: org-agenda-effort-filter-preset
   9268 #+vindex: org-agenda-regexp-filter-preset
   9269 Agenda built-in or custom commands are statically defined.  Agenda
   9270 filters and limits allow to flexibly narrow down the list of agenda
   9271 entries.
   9272 
   9273 /Filters/ only change the visibility of items, are very fast and are
   9274 mostly used interactively[fn:98].  You can switch quickly between
   9275 different filters without having to recreate the agenda.  /Limits/ on
   9276 the other hand take effect before the agenda buffer is populated, so
   9277 they are mostly useful when defined as local variables within custom
   9278 agenda commands.
   9279 
   9280 **** Filtering in the agenda
   9281 :PROPERTIES:
   9282 :UNNUMBERED: notoc
   9283 :END:
   9284 #+cindex: agenda filtering
   9285 #+cindex: filtering entries, in agenda
   9286 #+cindex: tag filtering, in agenda
   9287 #+cindex: category filtering, in agenda
   9288 #+cindex: top headline filtering, in agenda
   9289 #+cindex: effort filtering, in agenda
   9290 #+cindex: query editing, in agenda
   9291 
   9292 The general filtering command is ~org-agenda-filter~, bound to
   9293 {{{kbd(/)}}}.  Before we introduce it, we describe commands for
   9294 individual filter types.  All filtering commands handle prefix
   9295 arguments in the same way:  A single {{{kbd(C-u)}}} prefix negates the
   9296 filter, so it removes lines selected by the filter.  A double prefix
   9297 adds the new filter condition to the one(s) already in place, so
   9298 filter elements are accumulated.
   9299 
   9300 - {{{kbd(\)}}} (~org-agenda-filter-by-tag~) ::
   9301 
   9302   #+findex: org-agenda-filter-by-tag
   9303   Filter the agenda view with respect to a tag.  You are prompted for
   9304   a tag selection letter; {{{kbd(SPC)}}} means any tag at all.
   9305   Pressing {{{kbd(TAB)}}} at that prompt offers completion to select a
   9306   tag, including any tags that do not have a selection character.  The
   9307   command then hides all entries that do not contain or inherit this
   9308   tag.  Pressing {{{kbd(+)}}} or {{{kbd(-)}}} at the prompt switches
   9309   between filtering for and against the next tag.  To clear the
   9310   filter, press {{{kbd(\)}}} twice (once to call the command again,
   9311   and once at the prompt).
   9312 
   9313 - {{{kbd(<)}}} (~org-agenda-filter-by-category~) ::
   9314 
   9315   #+findex: org-agenda-filter-by-category
   9316   Filter by category of the line at point, and show only entries with
   9317   this category.  When called with a prefix argument, hide all entries
   9318   with the category at point.  To clear the filter, call this command
   9319   again by pressing {{{kbd(<)}}}.
   9320 
   9321 - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) ::
   9322 
   9323   #+findex: org-agenda-filter-by-regexp
   9324   Filter the agenda view by a regular expression: only show agenda
   9325   entries matching the regular expression the user entered.  To clear
   9326   the filter, call the command again by pressing {{{kbd(=)}}}.
   9327 
   9328 - {{{kbd(_)}}} (~org-agenda-filter-by-effort~) ::
   9329 
   9330   #+findex: org-agenda-filter-by-effort
   9331   Filter the agenda view with respect to effort estimates, so select
   9332   tasks that take the right amount of time.  You first need to set up
   9333   a list of efforts globally, for example
   9334 
   9335   #+begin_src emacs-lisp
   9336   (setq org-global-properties
   9337         '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
   9338   #+end_src
   9339 
   9340   #+vindex: org-sort-agenda-noeffort-is-high
   9341   You can then filter for an effort by first typing an operator, one
   9342   of {{{kbd(<)}}}, {{{kbd(>)}}} and {{{kbd(=)}}}, and then the
   9343   one-digit index of an effort estimate in your array of allowed
   9344   values, where {{{kbd(0)}}} means the 10th value.  The filter then
   9345   restricts to entries with effort smaller-or-equal, equal, or
   9346   larger-or-equal than the selected value.  For application of the
   9347   operator, entries without a defined effort are treated according to
   9348   the value of ~org-sort-agenda-noeffort-is-high~.  To clear the
   9349   filter, press {{{kbd(_)}}} twice (once to call the command again,
   9350   and once at the first prompt).
   9351 
   9352 - {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) ::
   9353 
   9354   #+findex: org-agenda-filter-by-top-headline
   9355   Filter the current agenda view and only display items that fall
   9356   under the same top-level headline as the current entry.  To clear
   9357   the filter, call this command again by pressing {{{kbd(^)}}}.
   9358 
   9359 - {{{kbd(/)}}} (~org-agenda-filter~) ::
   9360 
   9361   #+findex: org-agenda-filter
   9362   This is the unified interface to four of the five filter methods
   9363   described above.  At the prompt, specify different filter elements
   9364   in a single string, with full completion support.  For example,
   9365 
   9366   : +work-John+<0:10-/plot/
   9367 
   9368   selects entries with category =work= and effort estimates below 10
   9369   minutes, and deselects entries with tag =John= or matching the
   9370   regexp =plot= (see [[*Regular Expressions]]).  You can leave =+= out if
   9371   that does not lead to ambiguities.  The sequence of elements is
   9372   arbitrary.  The filter syntax assumes that there is no overlap
   9373   between categories and tags.  Otherwise, tags take priority.  If you
   9374   reply to the prompt with the empty string, all filtering is removed.
   9375   If a filter is specified, it replaces all current filters.  But if
   9376   you call the command with a double prefix argument, or if you add an
   9377   additional =+= (e.g., =++work=) to the front of the string, the new
   9378   filter elements are added to the active ones.  A single prefix
   9379   argument applies the entire filter in a negative sense.
   9380 
   9381 - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) ::
   9382 
   9383   Remove all filters in the current agenda view.
   9384 
   9385 **** Computed tag filtering
   9386 :PROPERTIES:
   9387 :UNNUMBERED: notoc
   9388 :END:
   9389 
   9390 #+vindex: org-agenda-auto-exclude-function
   9391 If the variable ~org-agenda-auto-exclude-function~ is set to
   9392 a user-defined function, that function can select tags that should be
   9393 used as a tag filter when requested.  The function will be called with
   9394 lower-case versions of all tags represented in the current view.  The
   9395 function should return ="-tag"= if the filter should remove
   9396 entries with that tag, ="+tag"= if only entries with this tag should
   9397 be kept, or =nil= if that tag is irrelevant.  For example, let's say
   9398 you use a =Net= tag to identify tasks which need network access, an
   9399 =Errand= tag for errands in town, and a =Call= tag for making phone
   9400 calls.  You could auto-exclude these tags based on the availability of
   9401 the Internet, and outside of business hours, with something like this:
   9402 
   9403 #+begin_src emacs-lisp
   9404 (defun my-auto-exclude-fn (tag)
   9405   (when (cond ((string= tag "net")
   9406 	       (/= 0 (call-process "/sbin/ping" nil nil nil
   9407 			           "-c1" "-q" "-t1" "mail.gnu.org")))
   9408               ((member tag '("errand" "call"))
   9409 	       (let ((hr (nth 2 (decode-time))))
   9410 	         (or (< hr 8) (> hr 21)))))
   9411     (concat "-" tag)))
   9412 
   9413 (setq org-agenda-auto-exclude-function #'my-auto-exclude-fn)
   9414 #+end_src
   9415 
   9416 You can apply this self-adapting filter by using a triple prefix
   9417 argument to ~org-agenda-filter~, i.e.\nbsp{}press {{{kbd(C-u C-u C-u /)}}},
   9418 or by pressing {{{kbd(RET)}}} in ~org-agenda-filter-by-tag~.
   9419 
   9420 **** Setting limits for the agenda
   9421 :PROPERTIES:
   9422 :UNNUMBERED: notoc
   9423 :END:
   9424 #+cindex: limits, in agenda
   9425 
   9426 Here is a list of options that you can set, either globally, or
   9427 locally in your custom agenda views (see [[*Custom Agenda Views]]).
   9428 
   9429 - ~org-agenda-max-entries~ ::
   9430 
   9431   #+vindex: org-agenda-max-entries
   9432   Limit the number of entries.
   9433 
   9434 - ~org-agenda-max-effort~ ::
   9435 
   9436   #+vindex: org-agenda-max-effort
   9437   Limit the duration of accumulated efforts (as minutes).
   9438 
   9439 - ~org-agenda-max-todos~ ::
   9440 
   9441   #+vindex: org-agenda-max-todos
   9442   Limit the number of entries with TODO keywords.
   9443 
   9444 - ~org-agenda-max-tags~ ::
   9445 
   9446   #+vindex: org-agenda-max-tags
   9447   Limit the number of tagged entries.
   9448 
   9449 When set to a positive integer, each option excludes entries from
   9450 other categories: for example, =(setq org-agenda-max-effort 100)=
   9451 limits the agenda to 100 minutes of effort and exclude any entry that
   9452 has no effort property.  If you want to include entries with no effort
   9453 property, use a negative value for ~org-agenda-max-effort~.  One
   9454 useful setup is to use ~org-agenda-max-entries~ locally in a custom
   9455 command.  For example, this custom command displays the next five
   9456 entries with a =NEXT= TODO keyword.
   9457 
   9458 #+begin_src emacs-lisp
   9459 (setq org-agenda-custom-commands
   9460       '(("n" todo "NEXT"
   9461          ((org-agenda-max-entries 5)))))
   9462 #+end_src
   9463 
   9464 Once you mark one of these five entry as DONE, rebuilding the agenda
   9465 will again the next five entries again, including the first entry that
   9466 was excluded so far.
   9467 
   9468 You can also dynamically set temporary limits, which are lost when
   9469 rebuilding the agenda:
   9470 
   9471 - {{{kbd(~ )}}} (~org-agenda-limit-interactively~) ::
   9472 
   9473   #+findex: org-agenda-limit-interactively
   9474   This prompts for the type of limit to apply and its value.
   9475 
   9476 ** Commands in the Agenda Buffer
   9477 :PROPERTIES:
   9478 :DESCRIPTION: Remote editing of Org trees.
   9479 :ALT_TITLE: Agenda Commands
   9480 :END:
   9481 #+cindex: commands, in agenda buffer
   9482 
   9483 Entries in the agenda buffer are linked back to the Org file or diary
   9484 file where they originate.  You are not allowed to edit the agenda
   9485 buffer itself, but commands are provided to show and jump to the
   9486 original entry location, and to edit the Org files "remotely" from the
   9487 agenda buffer.  In this way, all information is stored only once,
   9488 removing the risk that your agenda and note files may diverge.
   9489 
   9490 Some commands can be executed with mouse clicks on agenda lines.  For
   9491 the other commands, point needs to be in the desired line.
   9492 
   9493 *** Motion
   9494 :PROPERTIES:
   9495 :UNNUMBERED: notoc
   9496 :END:
   9497 #+cindex: motion commands in agenda
   9498 
   9499 - {{{kbd(n)}}} (~org-agenda-next-line~) ::
   9500 
   9501   #+kindex: n
   9502   #+findex: org-agenda-next-line
   9503   Next line (same as {{{kbd(DOWN)}}} and {{{kbd(C-n)}}}).
   9504 
   9505 - {{{kbd(p)}}} (~org-agenda-previous-line~) ::
   9506 
   9507   #+kindex: p
   9508   #+findex: org-agenda-previous-line
   9509   Previous line (same as {{{kbd(UP)}}} and {{{kbd(C-p)}}}).
   9510 
   9511 *** View/Go to Org file
   9512 :PROPERTIES:
   9513 :UNNUMBERED: notoc
   9514 :END:
   9515 #+cindex: view file commands in agenda
   9516 
   9517 - {{{kbd(SPC)}}} or {{{kbd(mouse-3)}}} (~org-agenda-show-and-scroll-up~) ::
   9518 
   9519   #+kindex: SPC
   9520   #+kindex: mouse-3
   9521   #+findex: org-agenda-show-and-scroll-up
   9522   Display the original location of the item in another window.
   9523   With a prefix argument, make sure that drawers stay folded.
   9524 
   9525 - {{{kbd(L)}}} (~org-agenda-recenter~) ::
   9526 
   9527   #+findex: org-agenda-recenter
   9528   Display original location and recenter that window.
   9529 
   9530 - {{{kbd(TAB)}}} or {{{kbd(mouse-2)}}} (~org-agenda-goto~) ::
   9531 
   9532   #+kindex: TAB
   9533   #+kindex: mouse-2
   9534   #+findex: org-agenda-goto
   9535   Go to the original location of the item in another window.
   9536 
   9537 - {{{kbd(RET)}}} (~org-agenda-switch-to~) ::
   9538 
   9539   #+kindex: RET
   9540   #+findex: org-agenda-switch-to
   9541   Go to the original location of the item and delete other windows.
   9542 
   9543 - {{{kbd(F)}}} (~org-agenda-follow-mode~) ::
   9544 
   9545   #+kindex: F
   9546   #+findex: org-agenda-follow-mode
   9547   #+vindex: org-agenda-start-with-follow-mode
   9548   Toggle Follow mode.  In Follow mode, as you move point through the
   9549   agenda buffer, the other window always shows the corresponding
   9550   location in the Org file.  The initial setting for this mode in new
   9551   agenda buffers can be set with the variable
   9552   ~org-agenda-start-with-follow-mode~.
   9553 
   9554 - {{{kbd(C-c C-x b)}}} (~org-agenda-tree-to-indirect-buffer~) ::
   9555 
   9556   #+kindex: C-c C-x b
   9557   #+findex: org-agenda-tree-to-indirect-buffer
   9558   Display the entire subtree of the current item in an indirect
   9559   buffer.  With a numeric prefix argument N, go up to level N and then
   9560   take that tree.  If N is negative, go up that many levels.  With
   9561   a {{{kbd(C-u)}}} prefix, do not remove the previously used indirect
   9562   buffer.
   9563 
   9564 - {{{kbd(C-c C-o)}}} (~org-agenda-open-link~) ::
   9565 
   9566   #+kindex: C-c C-o
   9567   #+findex: org-agenda-open-link
   9568   Follow a link in the entry.  This offers a selection of any links in
   9569   the text belonging to the referenced Org node.  If there is only one
   9570   link, follow it without a selection prompt.
   9571 
   9572 *** Change display
   9573 :PROPERTIES:
   9574 :UNNUMBERED: notoc
   9575 :END:
   9576 #+cindex: change agenda display
   9577 #+cindex: display changing, in agenda
   9578 
   9579 #+attr_texinfo: :sep ,
   9580 - {{{kbd(A)}}} ::
   9581 
   9582   #+kindex: A
   9583   Interactively select another agenda view and append it to the
   9584   current view.
   9585 
   9586 - {{{kbd(o)}}} ::
   9587 
   9588   #+kindex: o
   9589   Delete other windows.
   9590 
   9591 - {{{kbd(v d)}}} or short {{{kbd(d)}}} (~org-agenda-day-view~) ::
   9592 
   9593   #+kindex: v d
   9594   #+kindex: d
   9595   #+findex: org-agenda-day-view
   9596   Switch to day view.  When switching to day view, this setting
   9597   becomes the default for subsequent agenda refreshes.  A numeric
   9598   prefix argument may be used to jump directly to a specific day of
   9599   the year.  For example, {{{kbd(32 d)}}} jumps to February 1st.  When
   9600   setting day view, a year may be encoded in the prefix argument as
   9601   well.  For example, {{{kbd(200712 d)}}} jumps to January 12, 2007.
   9602   If such a year specification has only one or two digits, it is
   9603   expanded into one of the 30 next years or the last 69 years.
   9604 
   9605 - {{{kbd(v w)}}} or short {{{kbd(w)}}} (~org-agenda-week-view~) ::
   9606 
   9607   #+kindex: v w
   9608   #+kindex: w
   9609   #+findex: org-agenda-week-view
   9610   Switch to week view.  When switching week view, this setting becomes
   9611   the default for subsequent agenda refreshes.  A numeric prefix
   9612   argument may be used to jump directly to a specific day of the ISO
   9613   week.  For example {{{kbd(9 w)}}} to ISO week number 9.  When
   9614   setting week view, a year may be encoded in the prefix argument as
   9615   well.  For example, {{{kbd(200712 w)}}} jumps to week 12 in 2007.
   9616   If such a year specification has only one or two digits, it is
   9617   expanded into one of the 30 next years or the last 69 years.
   9618 
   9619 - {{{kbd(v m)}}} (~org-agenda-month-view~) ::
   9620 
   9621   #+kindex: v m
   9622   #+findex: org-agenda-month-view
   9623   Switch to month view.  Because month views are slow to create, they
   9624   do not become the default for subsequent agenda refreshes.
   9625   A numeric prefix argument may be used to jump directly to a specific
   9626   day of the month.  When setting month view, a year may be encoded in
   9627   the prefix argument as well.  For example, {{{kbd(200712 m)}}} jumps
   9628   to December, 2007.  If such a year specification has only one or two
   9629   digits, it is expanded into one of the 30 next years or the last 69
   9630   years.
   9631 
   9632 - {{{kbd(v y)}}} (~org-agenda-year-view~) ::
   9633 
   9634   #+kindex: v y
   9635   #+findex: org-agenda-year-view
   9636   Switch to year view.  Because year views are slow to create, they do
   9637   not become the default for subsequent agenda refreshes.  A numeric
   9638   prefix argument may be used to jump directly to a specific day of
   9639   the year.
   9640 
   9641 - {{{kbd(v SPC)}}} (~org-agenda-reset-view~) ::
   9642 
   9643   #+kindex: v SPC
   9644   #+findex: org-agenda-reset-view
   9645   #+vindex: org-agenda-span
   9646   Reset the current view to ~org-agenda-span~.
   9647 
   9648 - {{{kbd(f)}}} (~org-agenda-later~) ::
   9649 
   9650   #+kindex: f
   9651   #+findex: org-agenda-later
   9652   Go forward in time to display the span following the current one.
   9653   For example, if the display covers a week, switch to the following
   9654   week.  With a prefix argument, repeat that many times.
   9655 
   9656 - {{{kbd(b)}}} (~org-agenda-earlier~) ::
   9657 
   9658   #+kindex: b
   9659   #+findex: org-agenda-earlier
   9660   Go backward in time to display earlier dates.
   9661 
   9662 - {{{kbd(.)}}} (~org-agenda-goto-today~) ::
   9663 
   9664   #+kindex: .
   9665   #+findex: org-agenda-goto-today
   9666   Go to today.
   9667 
   9668 - {{{kbd(j)}}} (~org-agenda-goto-date~) ::
   9669 
   9670   #+kindex: j
   9671   #+findex: org-agenda-goto-date
   9672   Prompt for a date and go there.
   9673 
   9674 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
   9675 
   9676   #+kindex: J
   9677   #+findex: org-agenda-clock-goto
   9678   Go to the currently clocked-in task /in the agenda buffer/.
   9679 
   9680 - {{{kbd(D)}}} (~org-agenda-toggle-diary~) ::
   9681 
   9682   #+kindex: D
   9683   #+findex: org-agenda-toggle-diary
   9684   Toggle the inclusion of diary entries.  See [[*Weekly/daily agenda]].
   9685 
   9686 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} (~org-agenda-log-mode~) ::
   9687 
   9688   #+kindex: v l
   9689   #+kindex: l
   9690   #+kindex: v L
   9691   #+findex: org-agenda-log-mode
   9692   #+vindex: org-log-done
   9693   #+vindex: org-agenda-log-mode-items
   9694   Toggle Logbook mode.  In Logbook mode, entries that were marked as
   9695   done while logging was on (see the variable ~org-log-done~) are
   9696   shown in the agenda, as are entries that have been clocked on that
   9697   day.  You can configure the entry types that should be included in
   9698   log mode using the variable ~org-agenda-log-mode-items~.  When
   9699   called with a {{{kbd(C-u)}}} prefix argument, show all possible
   9700   logbook entries, including state changes.  When called with two
   9701   prefix arguments {{{kbd(C-u C-u)}}}, show only logging information,
   9702   nothing else.  {{{kbd(v L)}}} is equivalent to {{{kbd(C-u v l)}}}.
   9703 
   9704 - {{{kbd(v [)}}} or short {{{kbd([)}}} (~org-agenda-manipulate-query-add~) ::
   9705 
   9706   #+kindex: v [
   9707   #+kindex: [
   9708   #+findex: org-agenda-manipulate-query-add
   9709   Include inactive timestamps into the current view.  Only for
   9710   weekly/daily agenda.
   9711 
   9712 - {{{kbd(v a)}}} (~org-agenda-archives-mode~) ::
   9713 
   9714   #+kindex: v a
   9715   #+findex: org-agenda-archives-mode
   9716   Toggle Archives mode.  In Archives mode, trees that are archived
   9717   (see [[*Internal archiving]]) are also scanned when producing the
   9718   agenda.  To exit archives mode, press {{{kbd(v a)}}} again.
   9719 
   9720 - {{{kbd(v A)}}} ::
   9721 
   9722   #+kindex: v A
   9723   Toggle Archives mode.  Include all archive files as well.
   9724 
   9725 - {{{kbd(v R)}}} or short {{{kbd(R)}}} (~org-agenda-clockreport-mode~) ::
   9726 
   9727   #+kindex: v R
   9728   #+kindex: R
   9729   #+findex: org-agenda-clockreport-mode
   9730   #+vindex: org-agenda-start-with-clockreport-mode
   9731   #+vindex: org-clock-report-include-clocking-task
   9732   Toggle Clockreport mode.  In Clockreport mode, the daily/weekly
   9733   agenda always shows a table with the clocked times for the time span
   9734   and file scope covered by the current agenda view.  The initial
   9735   setting for this mode in new agenda buffers can be set with the
   9736   variable ~org-agenda-start-with-clockreport-mode~.  By using
   9737   a prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}),
   9738   the clock table does not show contributions from entries that are
   9739   hidden by agenda filtering[fn:99].  See also the variable
   9740   ~org-clock-report-include-clocking-task~.
   9741 
   9742 - {{{kbd(v c)}}} ::
   9743 
   9744   #+kindex: v c
   9745   #+vindex: org-agenda-clock-consistency-checks
   9746   Show overlapping clock entries, clocking gaps, and other clocking
   9747   problems in the current agenda range.  You can then visit clocking
   9748   lines and fix them manually.  See the variable
   9749   ~org-agenda-clock-consistency-checks~ for information on how to
   9750   customize the definition of what constituted a clocking problem.  To
   9751   return to normal agenda display, press {{{kbd(l)}}} to exit Logbook
   9752   mode.
   9753 
   9754 - {{{kbd(v E)}}} or short {{{kbd(E)}}} (~org-agenda-entry-text-mode~) ::
   9755 
   9756   #+kindex: v E
   9757   #+kindex: E
   9758   #+findex: org-agenda-entry-text-mode
   9759   #+vindex: org-agenda-start-with-entry-text-mode
   9760   #+vindex: org-agenda-entry-text-maxlines
   9761   Toggle entry text mode.  In entry text mode, a number of lines from
   9762   the Org outline node referenced by an agenda line are displayed
   9763   below the line.  The maximum number of lines is given by the
   9764   variable ~org-agenda-entry-text-maxlines~.  Calling this command
   9765   with a numeric prefix argument temporarily modifies that number to
   9766   the prefix value.
   9767 
   9768 - {{{kbd(G)}}} (~org-agenda-toggle-time-grid~) ::
   9769 
   9770   #+kindex: G
   9771   #+vindex: org-agenda-use-time-grid
   9772   #+vindex: org-agenda-time-grid
   9773   Toggle the time grid on and off.  See also the variables
   9774   ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
   9775 
   9776 - {{{kbd(r)}}} (~org-agenda-redo~), {{{kbd(g)}}} ::
   9777 
   9778   #+kindex: r
   9779   #+kindex: g
   9780   #+findex: org-agenda-redo
   9781   Recreate the agenda buffer, for example to reflect the changes after
   9782   modification of the timestamps of items with {{{kbd(S-LEFT)}}} and
   9783   {{{kbd(S-RIGHT)}}}.  When the buffer is the global TODO list,
   9784   a prefix argument is interpreted to create a selective list for
   9785   a specific TODO keyword.
   9786 
   9787 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}} (~org-save-all-org-buffers~) ::
   9788 
   9789   #+kindex: C-x C-s
   9790   #+findex: org-save-all-org-buffers
   9791   #+kindex: s
   9792   Save all Org buffers in the current Emacs session, and also the
   9793   locations of IDs.
   9794 
   9795 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
   9796 
   9797   #+kindex: C-c C-x C-c
   9798   #+findex: org-agenda-columns
   9799   #+vindex: org-columns-default-format
   9800   Invoke column view (see [[*Column View]]) in the agenda buffer.  The
   9801   column view format is taken from the entry at point, or, if there is
   9802   no entry at point, from the first entry in the agenda view.  So
   9803   whatever the format for that entry would be in the original buffer
   9804   (taken from a property, from a =COLUMNS= keyword, or from the
   9805   default variable ~org-columns-default-format~) is used in the
   9806   agenda.
   9807 
   9808 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
   9809 
   9810   #+kindex: C-c C-x >
   9811   #+findex: org-agenda-remove-restriction-lock
   9812   Remove the restriction lock on the agenda, if it is currently
   9813   restricted to a file or subtree (see [[*Agenda Files]]).
   9814 
   9815 - {{{kbd(M-UP)}}} (~org-agenda-drag-line-backward~) ::
   9816 
   9817   #+kindex: M-UP
   9818   #+findex: org-agenda-drag-line-backward
   9819   Drag the line at point backward one line.  With a numeric prefix
   9820   argument, drag backward by that many lines.
   9821 
   9822   Moving agenda lines does not persist after an agenda refresh and
   9823   does not modify the contributing Org files.
   9824 
   9825 - {{{kbd(M-DOWN)}}} (~org-agenda-drag-line-forward~) ::
   9826 
   9827   #+kindex: M-DOWN
   9828   #+findex: org-agenda-drag-line-forward
   9829   Drag the line at point forward one line.  With a numeric prefix
   9830   argument, drag forward by that many lines.
   9831 
   9832 *** Remote editing
   9833 :PROPERTIES:
   9834 :UNNUMBERED: notoc
   9835 :END:
   9836 #+cindex: remote editing, from agenda
   9837 
   9838 - {{{kbd(0--9)}}} ::
   9839 
   9840   Digit argument.
   9841 
   9842 - {{{kbd(C-_)}}} (~org-agenda-undo~) ::
   9843 
   9844   #+kindex: C-_
   9845   #+findex: org-agenda-undo
   9846   #+cindex: undoing remote-editing events
   9847   #+cindex: remote editing, undo
   9848   Undo a change due to a remote editing command.  The change is undone
   9849   both in the agenda buffer and in the remote buffer.
   9850 
   9851 - {{{kbd(t)}}} (~org-agenda-todo~) ::
   9852 
   9853   #+kindex: t
   9854   #+findex: org-agenda-todo
   9855   Change the TODO state of the item, both in the agenda and in the
   9856   original Org file.  A prefix arg is passed through to the ~org-todo~
   9857   command, so for example a {{{kbd(C-u)}}} prefix are will trigger
   9858   taking a note to document the state change.
   9859 
   9860 - {{{kbd(C-S-RIGHT)}}} (~org-agenda-todo-nextset~) ::
   9861 
   9862   #+kindex: C-S-RIGHT
   9863   #+findex: org-agenda-todo-nextset
   9864   Switch to the next set of TODO keywords.
   9865 
   9866 - {{{kbd(C-S-LEFT)}}}, ~org-agenda-todo-previousset~ ::
   9867 
   9868   #+kindex: C-S-LEFT
   9869   Switch to the previous set of TODO keywords.
   9870 
   9871 - {{{kbd(C-k)}}} (~org-agenda-kill~) ::
   9872 
   9873   #+kindex: C-k
   9874   #+findex: org-agenda-kill
   9875   #+vindex: org-agenda-confirm-kill
   9876   Delete the current agenda item along with the entire subtree
   9877   belonging to it in the original Org file.  If the text to be deleted
   9878   remotely is longer than one line, the kill needs to be confirmed by
   9879   the user.  See variable ~org-agenda-confirm-kill~.
   9880 
   9881 - {{{kbd(C-c C-w)}}} (~org-agenda-refile~) ::
   9882 
   9883   #+kindex: C-c C-w
   9884   #+findex: org-agenda-refile
   9885   Refile the entry at point.
   9886 
   9887 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}} (~org-agenda-archive-default-with-confirmation~) ::
   9888 
   9889   #+kindex: C-c C-x C-a
   9890   #+kindex: a
   9891   #+findex: org-agenda-archive-default-with-confirmation
   9892   #+vindex: org-archive-default-command
   9893   Archive the subtree corresponding to the entry at point using the
   9894   default archiving command set in ~org-archive-default-command~.
   9895   When using the {{{kbd(a)}}} key, confirmation is required.
   9896 
   9897 - {{{kbd(C-c C-x a)}}} (~org-agenda-toggle-archive-tag~) ::
   9898 
   9899   #+kindex: C-c C-x a
   9900   #+findex: org-agenda-toggle-archive-tag
   9901   Toggle the archive tag (see [[*Internal archiving]]) for the current
   9902   headline.
   9903 
   9904 - {{{kbd(C-c C-x A)}}} (~org-agenda-archive-to-archive-sibling~) ::
   9905 
   9906   #+kindex: C-c C-x A
   9907   #+findex: org-agenda-archive-to-archive-sibling
   9908   Move the subtree corresponding to the current entry to its /archive
   9909   sibling/.
   9910 
   9911 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}} (~org-agenda-archive~) ::
   9912 
   9913   #+kindex: C-c C-x C-s
   9914   #+kindex: $
   9915   #+findex: org-agenda-archive
   9916   Archive the subtree corresponding to the current headline.  This
   9917   means the entry is moved to the configured archive location, most
   9918   likely a different file.
   9919 
   9920 - {{{kbd(T)}}} (~org-agenda-show-tags~) ::
   9921 
   9922   #+kindex: T
   9923   #+findex: org-agenda-show-tags
   9924   #+vindex: org-agenda-show-inherited-tags
   9925   Show all tags associated with the current item.  This is useful if
   9926   you have turned off ~org-agenda-show-inherited-tags~, but still want
   9927   to see all tags of a headline occasionally.
   9928 
   9929 - {{{kbd(:)}}} (~org-agenda-set-tags~) ::
   9930 
   9931   #+kindex: :
   9932   #+findex: org-agenda-set-tags
   9933   Set tags for the current headline.  If there is an active region in
   9934   the agenda, change a tag for all headings in the region.
   9935 
   9936 - {{{kbd(\,)}}} (~org-agenda-priority~) ::
   9937 
   9938   #+kindex: ,
   9939   #+findex: org-agenda-priority
   9940   Set the priority for the current item.  Org mode prompts for the
   9941   priority character.  If you reply with {{{kbd(SPC)}}}, the priority
   9942   cookie is removed from the entry.
   9943 
   9944 - {{{kbd(+)}}} or {{{kbd(S-UP)}}} (~org-agenda-priority-up~) ::
   9945 
   9946   #+kindex: +
   9947   #+kindex: S-UP
   9948   #+findex: org-agenda-priority-up
   9949   Increase the priority of the current item.  The priority is changed
   9950   in the original buffer, but the agenda is not resorted.  Use the
   9951   {{{kbd(r)}}} key for this.
   9952 
   9953 - {{{kbd(-)}}} or {{{kbd(S-DOWN)}}} (~org-agenda-priority-down~) ::
   9954 
   9955   #+kindex: -
   9956   #+kindex: S-DOWN
   9957   #+findex: org-agenda-priority-down
   9958   Decrease the priority of the current item.
   9959 
   9960 - {{{kbd(C-c C-x e)}}} or short {{{kbd(e)}}} (~org-agenda-set-effort~) ::
   9961 
   9962   #+kindex: e
   9963   #+kindex: C-c C-x e
   9964   #+findex: org-agenda-set-effort
   9965   Set the effort property for the current item.
   9966 
   9967 - {{{kbd(C-c C-z)}}} or short {{{kbd(z)}}} (~org-agenda-add-note~) ::
   9968 
   9969   #+kindex: z
   9970   #+kindex: C-c C-z
   9971   #+findex: org-agenda-add-note
   9972   #+vindex: org-log-into-drawer
   9973   Add a note to the entry.  This note is recorded, and then filed to
   9974   the same location where state change notes are put.  Depending on
   9975   ~org-log-into-drawer~, this may be inside a drawer.
   9976 
   9977 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
   9978 
   9979   #+kindex: C-c C-a
   9980   #+findex: org-attach
   9981   Dispatcher for all command related to attachments.
   9982 
   9983 - {{{kbd(C-c C-s)}}} (~org-agenda-schedule~) ::
   9984 
   9985   #+kindex: C-c C-s
   9986   #+findex: org-agenda-schedule
   9987   Schedule this item.  With a prefix argument, remove the
   9988   scheduling timestamp
   9989 
   9990 - {{{kbd(C-c C-d)}}} (~org-agenda-deadline~) ::
   9991 
   9992   #+kindex: C-c C-d
   9993   #+findex: org-agenda-deadline
   9994   Set a deadline for this item.  With a prefix argument, remove the
   9995   deadline.
   9996 
   9997 - {{{kbd(S-RIGHT)}}} (~org-agenda-do-date-later~) ::
   9998 
   9999   #+kindex: S-RIGHT
  10000   #+findex: org-agenda-do-date-later
  10001   Change the timestamp associated with the current line by one day
  10002   into the future.  If the date is in the past, the first call to this
  10003   command moves it to today.  With a numeric prefix argument, change
  10004   it by that many days.  For example, {{{kbd(3 6 5 S-RIGHT)}}} changes
  10005   it by a year.  With a {{{kbd(C-u)}}} prefix, change the time by one
  10006   hour.  If you immediately repeat the command, it will continue to
  10007   change hours even without the prefix argument.  With a double
  10008   {{{kbd(C-u C-u)}}} prefix, do the same for changing minutes.  The
  10009   stamp is changed in the original Org file, but the change is not
  10010   directly reflected in the agenda buffer.  Use {{{kbd(r)}}} or
  10011   {{{kbd(g)}}} to update the buffer.
  10012 
  10013 - {{{kbd(S-LEFT)}}} (~org-agenda-do-date-earlier~) ::
  10014 
  10015   #+kindex: S-LEFT
  10016   #+findex: org-agenda-do-date-earlier
  10017   Change the timestamp associated with the current line by one day
  10018   into the past.
  10019 
  10020 - {{{kbd(>)}}} (~org-agenda-date-prompt~) ::
  10021 
  10022   #+kindex: >
  10023   #+findex: org-agenda-date-prompt
  10024   Change the timestamp associated with the current line.  The key
  10025   {{{kbd(>)}}} has been chosen, because it is the same as
  10026   {{{kbd(S-.)}}}  on my keyboard.
  10027 
  10028 - {{{kbd(I)}}} (~org-agenda-clock-in~) ::
  10029 
  10030   #+kindex: I
  10031   #+findex: org-agenda-clock-in
  10032   Start the clock on the current item.  If a clock is running already,
  10033   it is stopped first.
  10034 
  10035 - {{{kbd(O)}}} (~org-agenda-clock-out~) ::
  10036 
  10037   #+kindex: O
  10038   #+findex: org-agenda-clock-out
  10039   Stop the previously started clock.
  10040 
  10041 - {{{kbd(X)}}} (~org-agenda-clock-cancel~) ::
  10042 
  10043   #+kindex: X
  10044   #+findex: org-agenda-clock-cancel
  10045   Cancel the currently running clock.
  10046 
  10047 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
  10048 
  10049   #+kindex: J
  10050   #+findex: org-agenda-clock-goto
  10051   Jump to the running clock in another window.
  10052 
  10053 - {{{kbd(k)}}} (~org-agenda-capture~) ::
  10054 
  10055   #+kindex: k
  10056   #+findex: org-agenda-capture
  10057   #+cindex: capturing, from agenda
  10058   #+vindex: org-capture-use-agenda-date
  10059   Like ~org-capture~, but use the date at point as the default date
  10060   for the capture template.  See ~org-capture-use-agenda-date~ to make
  10061   this the default behavior of ~org-capture~.
  10062 
  10063 *** Bulk remote editing selected entries
  10064 :PROPERTIES:
  10065 :UNNUMBERED: notoc
  10066 :END:
  10067 #+cindex: remote editing, bulk, from agenda
  10068 #+vindex: org-agenda-bulk-custom-functions
  10069 
  10070 - {{{kbd(m)}}} (~org-agenda-bulk-mark~) ::
  10071   #+kindex: m
  10072   #+findex: org-agenda-bulk-mark
  10073 
  10074   Mark the entry at point for bulk action.  If there is an active
  10075   region in the agenda, mark the entries in the region.  With numeric
  10076   prefix argument, mark that many successive entries.
  10077 
  10078 - {{{kbd(*)}}} (~org-agenda-bulk-mark-all~) ::
  10079   #+kindex: *
  10080   #+findex: org-agenda-bulk-mark-all
  10081 
  10082   Mark all visible agenda entries for bulk action.
  10083 
  10084 - {{{kbd(u)}}} (~org-agenda-bulk-unmark~) ::
  10085   #+kindex: u
  10086   #+findex: org-agenda-bulk-unmark
  10087 
  10088   Unmark entry for bulk action.
  10089 
  10090 - {{{kbd(U)}}} (~org-agenda-bulk-remove-all-marks~) ::
  10091   #+kindex: U
  10092   #+findex: org-agenda-bulk-remove-all-marks
  10093 
  10094   Unmark all marked entries for bulk action.
  10095 
  10096 - {{{kbd(M-m)}}} (~org-agenda-bulk-toggle~) ::
  10097   #+kindex: M-m
  10098   #+findex: org-agenda-bulk-toggle
  10099 
  10100   Toggle mark of the entry at point for bulk action.
  10101 
  10102 - {{{kbd(M-*)}}} (~org-agenda-bulk-toggle-all~) ::
  10103   #+kindex: M-*
  10104   #+findex: org-agenda-bulk-toggle-all
  10105 
  10106   Toggle mark of every entry for bulk action.
  10107 
  10108 - {{{kbd(%)}}} (~org-agenda-bulk-mark-regexp~) ::
  10109   #+kindex: %
  10110   #+findex: org-agenda-bulk-mark-regexp
  10111 
  10112   Mark entries matching a regular expression for bulk action.
  10113 
  10114 - {{{kbd(B)}}} (~org-agenda-bulk-action~) ::
  10115   #+kindex: B
  10116   #+findex: org-agenda-bulk-action
  10117   #+vindex: org-agenda-bulk-persistent-marks
  10118 
  10119   Bulk action: act on all marked entries in the agenda.  This prompts
  10120   for another key to select the action to be applied.  The prefix
  10121   argument to {{{kbd(B)}}} is passed through to the {{{kbd(s)}}} and
  10122   {{{kbd(d)}}} commands, to bulk-remove these special timestamps.  By
  10123   default, marks are removed after the bulk.  If you want them to
  10124   persist, set ~org-agenda-bulk-persistent-marks~ to ~t~ or hit
  10125   {{{kbd(p)}}} at the prompt.
  10126 
  10127   - {{{kbd(p)}}} ::
  10128 
  10129     Toggle persistent marks.
  10130 
  10131   - {{{kbd($)}}} ::
  10132 
  10133     Archive all selected entries.
  10134 
  10135   - {{{kbd(A)}}} ::
  10136 
  10137     Archive entries by moving them to their respective archive
  10138     siblings.
  10139 
  10140   - {{{kbd(t)}}} ::
  10141 
  10142     Change TODO state.  This prompts for a single TODO keyword and
  10143     changes the state of all selected entries, bypassing blocking and
  10144     suppressing logging notes---but not timestamps.
  10145 
  10146   - {{{kbd(+)}}} ::
  10147 
  10148     Add a tag to all selected entries.
  10149 
  10150   - {{{kbd(-)}}} ::
  10151 
  10152     Remove a tag from all selected entries.
  10153 
  10154   - {{{kbd(s)}}} ::
  10155 
  10156     Schedule all items to a new date.  To shift existing schedule
  10157     dates by a fixed number of days, use something starting with
  10158     double plus at the prompt, for example =++8d= or =++2w=.
  10159 
  10160   - {{{kbd(d)}}} ::
  10161 
  10162     Set deadline to a specific date.
  10163 
  10164   - {{{kbd(r)}}} ::
  10165 
  10166     Prompt for a single refile target and move all entries.  The
  10167     entries are no longer in the agenda; refresh ({{{kbd(g)}}}) to
  10168     bring them back.
  10169 
  10170   - {{{kbd(S)}}} ::
  10171 
  10172     Reschedule randomly into the coming N days.  N is prompted for.
  10173     With a prefix argument ({{{kbd(C-u B S)}}}), scatter only across
  10174     weekdays.
  10175 
  10176   - {{{kbd(f)}}} ::
  10177 
  10178     #+vindex: org-agenda-bulk-custom-functions
  10179     Apply a function[fn:100] to marked entries.  For example, the
  10180     function below sets the =CATEGORY= property of the entries to
  10181     =web=.
  10182 
  10183     #+begin_src emacs-lisp
  10184     (defun set-category ()
  10185       (interactive "P")
  10186       (let ((marker (or (org-get-at-bol 'org-hd-marker)
  10187                         (org-agenda-error))))
  10188         (org-with-point-at marker
  10189           (org-back-to-heading t)
  10190           (org-set-property "CATEGORY" "web"))))
  10191     #+end_src
  10192 
  10193 *** Calendar commands
  10194 :PROPERTIES:
  10195 :UNNUMBERED: notoc
  10196 :END:
  10197 #+cindex: calendar commands, from agenda
  10198 
  10199 - {{{kbd(c)}}} (~org-agenda-goto-calendar~) ::
  10200 
  10201   #+kindex: c
  10202   #+findex: org-agenda-goto-calendar
  10203   Open the Emacs calendar and go to the date at point in the agenda.
  10204 
  10205 - {{{kbd(c)}}} (~org-calendar-goto-agenda~) ::
  10206 
  10207   #+kindex: c
  10208   #+findex: org-calendar-goto-agenda
  10209   When in the calendar, compute and show the Org agenda for the date
  10210   at point.
  10211 
  10212 - {{{kbd(i)}}} (~org-agenda-diary-entry~) ::
  10213   #+kindex: i
  10214   #+findex: org-agenda-diary-entry
  10215 
  10216   #+cindex: diary entries, creating from agenda
  10217   Insert a new entry into the diary, using the date at point and (for
  10218   block entries) the date at the mark.  This adds to the Emacs diary
  10219   file[fn:101], in a way similar to the {{{kbd(i)}}} command in the
  10220   calendar.  The diary file pops up in another window, where you can
  10221   add the entry.
  10222 
  10223   #+vindex: org-agenda-diary-file
  10224   If you configure ~org-agenda-diary-file~ to point to an Org file,
  10225   Org creates entries in that file instead.  Most entries are stored
  10226   in a date-based outline tree that will later make it easy to archive
  10227   appointments from previous months/years.  The tree is built under an
  10228   entry with a =DATE_TREE= property, or else with years as top-level
  10229   entries.  Emacs prompts you for the entry text---if you specify it,
  10230   the entry is created in ~org-agenda-diary-file~ without further
  10231   interaction.  If you directly press {{{kbd(RET)}}} at the prompt
  10232   without typing text, the target file is shown in another window for
  10233   you to finish the entry there.  See also the {{{kbd(k r)}}} command.
  10234 
  10235 - {{{kbd(M)}}} (~org-agenda-phases-of-moon~) ::
  10236 
  10237   #+kindex: M
  10238   #+findex: org-agenda-phases-of-moon
  10239   Show the phases of the moon for the three months around current
  10240   date.
  10241 
  10242 - {{{kbd(S)}}} (~org-agenda-sunrise-sunset~) ::
  10243 
  10244   #+kindex: S
  10245   #+findex: org-agenda-sunrise-sunset
  10246   Show sunrise and sunset times.  The geographical location must be
  10247   set with calendar variables, see the documentation for the Emacs
  10248   calendar.
  10249 
  10250 - {{{kbd(C)}}} (~org-agenda-convert-date~) ::
  10251 
  10252   #+kindex: C
  10253   #+findex: org-agenda-convert-date
  10254   Convert the date at point into many other cultural and historic
  10255   calendars.
  10256 
  10257 - {{{kbd(H)}}} (~org-agenda-holidays~) ::
  10258 
  10259   #+kindex: H
  10260   #+findex: org-agenda-holidays
  10261   Show holidays for three months around point date.
  10262 
  10263 *** Quit and exit
  10264 :PROPERTIES:
  10265 :UNNUMBERED: notoc
  10266 :END:
  10267 
  10268 - {{{kbd(q)}}} (~org-agenda-quit~) ::
  10269   #+kindex: q
  10270   #+findex: org-agenda-quit
  10271 
  10272   Quit agenda, remove the agenda buffer.
  10273 
  10274 - {{{kbd(x)}}} (~org-agenda-exit~) ::
  10275   #+kindex: x
  10276   #+findex: org-agenda-exit
  10277 
  10278   #+cindex: agenda files, removing buffers
  10279   Exit agenda, remove the agenda buffer and all buffers loaded by
  10280   Emacs for the compilation of the agenda.  Buffers created by the
  10281   user to visit Org files are not removed.
  10282 
  10283 ** Custom Agenda Views
  10284 :PROPERTIES:
  10285 :DESCRIPTION: Defining special searches and views.
  10286 :END:
  10287 #+cindex: custom agenda views
  10288 #+cindex: agenda views, custom
  10289 
  10290 Custom agenda commands serve two purposes: to store and quickly access
  10291 frequently used TODO and tags searches, and to create special
  10292 composite agenda buffers.  Custom agenda commands are accessible
  10293 through the dispatcher (see [[*The Agenda Dispatcher]]), just like the
  10294 default commands.
  10295 
  10296 *** Storing searches
  10297 :PROPERTIES:
  10298 :DESCRIPTION: Type once, use often.
  10299 :END:
  10300 
  10301 The first application of custom searches is the definition of keyboard
  10302 shortcuts for frequently used searches, either creating an agenda
  10303 buffer, or a sparse tree (the latter covering of course only the
  10304 current buffer).
  10305 
  10306 #+kindex: C @r{(Agenda dispatcher)}
  10307 #+vindex: org-agenda-custom-commands
  10308 #+cindex: agenda views, main example
  10309 #+cindex: agenda, as an agenda views
  10310 #+cindex: agenda*, as an agenda views
  10311 #+cindex: tags, as an agenda view
  10312 #+cindex: todo, as an agenda view
  10313 #+cindex: tags-todo
  10314 #+cindex: todo-tree
  10315 #+cindex: occur-tree
  10316 #+cindex: tags-tree
  10317 Custom commands are configured in the variable
  10318 ~org-agenda-custom-commands~.  You can customize this variable, for
  10319 example by pressing {{{kbd(C)}}} from the agenda dispatcher (see [[*The
  10320 Agenda Dispatcher]]).  You can also directly set it with Emacs Lisp in
  10321 the Emacs init file.  The following example contains all valid agenda
  10322 views:
  10323 
  10324 #+begin_src emacs-lisp
  10325 (setq org-agenda-custom-commands
  10326       '(("x" agenda)
  10327         ("y" agenda*)
  10328         ("w" todo "WAITING")
  10329         ("W" todo-tree "WAITING")
  10330         ("u" tags "+boss-urgent")
  10331         ("v" tags-todo "+boss-urgent")
  10332         ("U" tags-tree "+boss-urgent")
  10333         ("f" occur-tree "\\<FIXME\\>")
  10334         ("h" . "HOME+Name tags searches") ;description for "h" prefix
  10335         ("hl" tags "+home+Lisa")
  10336         ("hp" tags "+home+Peter")
  10337         ("hk" tags "+home+Kim")))
  10338 #+end_src
  10339 
  10340 The initial string in each entry defines the keys you have to press
  10341 after the dispatcher command in order to access the command.  Usually
  10342 this is just a single character, but if you have many similar
  10343 commands, you can also define two-letter combinations where the first
  10344 character is the same in several combinations and serves as a prefix
  10345 key[fn:102].  The second parameter is the search type, followed by the
  10346 string or regular expression to be used for the matching.  The example
  10347 above will therefore define:
  10348 
  10349 - {{{kbd(x)}}} ::
  10350 
  10351   as a global search for agenda entries planned[fn:103] this week/day.
  10352 
  10353 - {{{kbd(y)}}} ::
  10354 
  10355   as the same search, but only for entries with an hour specification
  10356   like =[h]h:mm=---think of them as appointments.
  10357 
  10358 - {{{kbd(w)}}} ::
  10359 
  10360   as a global search for TODO entries with =WAITING= as the TODO
  10361   keyword.
  10362 
  10363 - {{{kbd(W)}}} ::
  10364 
  10365   as the same search, but only in the current buffer and displaying
  10366   the results as a sparse tree.
  10367 
  10368 - {{{kbd(u)}}} ::
  10369 
  10370   as a global tags search for headlines tagged =boss= but not
  10371   =urgent=.
  10372 
  10373 - {{{kbd(v)}}} ::
  10374 
  10375   The same search, but limiting it to headlines that are also TODO
  10376   items.
  10377 
  10378 - {{{kbd(U)}}} ::
  10379 
  10380   as the same search, but only in the current buffer and displaying
  10381   the result as a sparse tree.
  10382 
  10383 - {{{kbd(f)}}} ::
  10384 
  10385   to create a sparse tree (again, current buffer only) with all
  10386   entries containing the word =FIXME=.
  10387 
  10388 - {{{kbd(h)}}} ::
  10389 
  10390   as a prefix command for a =HOME= tags search where you have to press
  10391   an additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or {{{kbd(k)}}}) to
  10392   select a name (Lisa, Peter, or Kim) as additional tag to match.
  10393 
  10394 Note that ~*-tree~ agenda views need to be called from an Org buffer
  10395 as they operate on the current buffer only.
  10396 
  10397 *** Block agenda
  10398 :PROPERTIES:
  10399 :DESCRIPTION: All the stuff you need in a single buffer.
  10400 :END:
  10401 #+cindex: block agenda
  10402 #+cindex: agenda, with block views
  10403 
  10404 Another possibility is the construction of agenda views that comprise
  10405 the results of /several/ commands, each of which creates a block in
  10406 the agenda buffer.  The available commands include ~agenda~ for the
  10407 daily or weekly agenda (as created with {{{kbd(a)}}}) , ~alltodo~ for
  10408 the global TODO list (as constructed with {{{kbd(t)}}}), ~stuck~ for
  10409 the list of stuck projects (as obtained with {{{kbd(#)}}}) and the
  10410 matching commands discussed above: ~todo~, ~tags~, and ~tags-todo~.
  10411 
  10412 Here are two examples:
  10413 
  10414 #+begin_src emacs-lisp
  10415 (setq org-agenda-custom-commands
  10416       '(("h" "Agenda and Home-related tasks"
  10417          ((agenda "")
  10418           (tags-todo "home")
  10419           (tags "garden")))
  10420         ("o" "Agenda and Office-related tasks"
  10421          ((agenda "")
  10422           (tags-todo "work")
  10423           (tags "office")))))
  10424 #+end_src
  10425 
  10426 #+texinfo: @noindent
  10427 This defines {{{kbd(h)}}} to create a multi-block view for stuff you
  10428 need to attend to at home.  The resulting agenda buffer contains your
  10429 agenda for the current week, all TODO items that carry the tag =home=,
  10430 and also all lines tagged with =garden=.  Finally the command
  10431 {{{kbd(o)}}} provides a similar view for office tasks.
  10432 
  10433 *** Setting options for custom commands
  10434 :PROPERTIES:
  10435 :DESCRIPTION: Changing the rules.
  10436 :ALT_TITLE: Setting options
  10437 :END:
  10438 #+cindex: options, for custom agenda views
  10439 
  10440 #+vindex: org-agenda-custom-commands
  10441 Org mode contains a number of variables regulating agenda construction
  10442 and display.  The global variables define the behavior for all agenda
  10443 commands, including the custom commands.  However, if you want to
  10444 change some settings just for a single custom view, you can do so.
  10445 Setting options requires inserting a list of variable names and values
  10446 at the right spot in ~org-agenda-custom-commands~.  For example:
  10447 
  10448 #+begin_src emacs-lisp
  10449 (setq org-agenda-custom-commands
  10450       '(("w" todo "WAITING"
  10451          ((org-agenda-sorting-strategy '(priority-down))
  10452           (org-agenda-prefix-format "  Mixed: ")))
  10453         ("U" tags-tree "+boss-urgent"
  10454          ((org-show-context-detail 'minimal)))
  10455         ("N" search ""
  10456          ((org-agenda-files '("~org/notes.org"))
  10457           (org-agenda-text-search-extra-files nil)))))
  10458 #+end_src
  10459 
  10460 #+texinfo: @noindent
  10461 Now the {{{kbd(w)}}} command sorts the collected entries only by
  10462 priority, and the prefix format is modified to just say =Mixed:=
  10463 instead of giving the category of the entry.  The sparse tags tree of
  10464 {{{kbd(U)}}} now turns out ultra-compact, because neither the headline
  10465 hierarchy above the match, nor the headline following the match are
  10466 shown.  The command {{{kbd(N)}}} does a text search limited to only
  10467 a single file.
  10468 
  10469 For command sets creating a block agenda, ~org-agenda-custom-commands~
  10470 has two separate spots for setting options.  You can add options that
  10471 should be valid for just a single command in the set, and options that
  10472 should be valid for all commands in the set.  The former are just
  10473 added to the command entry; the latter must come after the list of
  10474 command entries.  Going back to the block agenda example (see [[*Block
  10475 agenda]]), let's change the sorting strategy for the {{{kbd(h)}}}
  10476 commands to ~priority-down~, but let's sort the results for =garden=
  10477 tags query in the opposite order, ~priority-up~.  This would look like
  10478 this:
  10479 
  10480 #+begin_src emacs-lisp
  10481 (setq org-agenda-custom-commands
  10482       '(("h" "Agenda and Home-related tasks"
  10483          ((agenda)
  10484           (tags-todo "home")
  10485           (tags "garden"
  10486                 ((org-agenda-sorting-strategy '(priority-up)))))
  10487          ((org-agenda-sorting-strategy '(priority-down))))
  10488         ("o" "Agenda and Office-related tasks"
  10489          ((agenda)
  10490           (tags-todo "work")
  10491           (tags "office")))))
  10492 #+end_src
  10493 
  10494 As you see, the values and parentheses setting is a little complex.
  10495 When in doubt, use the customize interface to set this variable---it
  10496 fully supports its structure.  Just one caveat: when setting options
  10497 in this interface, the /values/ are just Lisp expressions.  So if the
  10498 value is a string, you need to add the double-quotes around the value
  10499 yourself.
  10500 
  10501 #+vindex: org-agenda-custom-commands-contexts
  10502 To control whether an agenda command should be accessible from
  10503 a specific context, you can customize
  10504 ~org-agenda-custom-commands-contexts~.  Let's say for example that you
  10505 have an agenda command {{{kbd(o)}}} displaying a view that you only
  10506 need when reading emails.  Then you would configure this option like
  10507 this:
  10508 
  10509 #+begin_src emacs-lisp
  10510 (setq org-agenda-custom-commands-contexts
  10511       '(("o" (in-mode . "message-mode"))))
  10512 #+end_src
  10513 
  10514 You can also tell that the command key {{{kbd(o)}}} should refer to
  10515 another command key {{{kbd(r)}}}.  In that case, add this command key
  10516 like this:
  10517 
  10518 #+begin_src emacs-lisp
  10519 (setq org-agenda-custom-commands-contexts
  10520       '(("o" "r" (in-mode . "message-mode"))))
  10521 #+end_src
  10522 
  10523 See the docstring of the variable for more information.
  10524 
  10525 ** Exporting Agenda Views
  10526 :PROPERTIES:
  10527 :DESCRIPTION: Writing a view to a file.
  10528 :END:
  10529 #+cindex: agenda views, exporting
  10530 
  10531 If you are away from your computer, it can be very useful to have
  10532 a printed version of some agenda views to carry around.  Org mode can
  10533 export custom agenda views as plain text, HTML[fn:104], Postscript,
  10534 PDF[fn:105], and iCalendar files.  If you want to do this only
  10535 occasionally, use the following command:
  10536 
  10537 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
  10538   #+kindex: C-x C-w
  10539   #+findex: org-agenda-write
  10540   #+cindex: exporting agenda views
  10541   #+cindex: agenda views, exporting
  10542 
  10543   #+vindex: org-agenda-exporter-settings
  10544   Write the agenda view to a file.
  10545 
  10546 If you need to export certain agenda views frequently, you can
  10547 associate any custom agenda command with a list of output file
  10548 names[fn:106].  Here is an example that first defines custom commands
  10549 for the agenda and the global TODO list, together with a number of
  10550 files to which to export them.  Then we define two block agenda
  10551 commands and specify file names for them as well.  File names can be
  10552 relative to the current working directory, or absolute.
  10553 
  10554 #+begin_src emacs-lisp
  10555 (setq org-agenda-custom-commands
  10556       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  10557         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  10558         ("h" "Agenda and Home-related tasks"
  10559          ((agenda "")
  10560           (tags-todo "home")
  10561           (tags "garden"))
  10562          nil
  10563          ("~/views/home.html"))
  10564         ("o" "Agenda and Office-related tasks"
  10565          ((agenda)
  10566           (tags-todo "work")
  10567           (tags "office"))
  10568          nil
  10569          ("~/views/office.ps" "~/calendars/office.ics"))))
  10570 #+end_src
  10571 
  10572 The extension of the file name determines the type of export.  If it
  10573 is =.html=, Org mode uses the htmlize package to convert the buffer to
  10574 HTML and save it to this file name.  If the extension is =.ps=,
  10575 ~ps-print-buffer-with-faces~ is used to produce Postscript output.  If
  10576 the extension is =.ics=, iCalendar export is run export over all files
  10577 that were used to construct the agenda, and limit the export to
  10578 entries listed in the agenda.  Any other extension produces a plain
  10579 ASCII file.
  10580 
  10581 The export files are /not/ created when you use one of those
  10582 commands interactively because this might use too much overhead.
  10583 Instead, there is a special command to produce /all/ specified
  10584 files in one step:
  10585 
  10586 - {{{kbd(e)}}} (~org-store-agenda-views~) ::
  10587 
  10588   #+kindex: e @r{(Agenda dispatcher)}
  10589   #+findex: org-store-agenda-views
  10590   Export all agenda views that have export file names associated with
  10591   them.
  10592 
  10593 You can use the options section of the custom agenda commands to also
  10594 set options for the export commands.  For example:
  10595 
  10596 #+begin_src emacs-lisp
  10597 (setq org-agenda-custom-commands
  10598       '(("X" agenda ""
  10599          ((ps-number-of-columns 2)
  10600           (ps-landscape-mode t)
  10601           (org-agenda-prefix-format " [ ] ")
  10602           (org-agenda-with-colors nil)
  10603           (org-agenda-remove-tags t))
  10604          ("theagenda.ps"))))
  10605 #+end_src
  10606 
  10607 #+texinfo: @noindent
  10608 #+vindex: org-agenda-exporter-settings
  10609 This command sets two options for the Postscript exporter, to make it
  10610 print in two columns in landscape format---the resulting page can be
  10611 cut in two and then used in a paper agenda.  The remaining settings
  10612 modify the agenda prefix to omit category and scheduling information,
  10613 and instead include a checkbox to check off items.  We also remove the
  10614 tags to make the lines compact, and we do not want to use colors for
  10615 the black-and-white printer.  Settings specified in
  10616 ~org-agenda-exporter-settings~ also apply, e.g.,
  10617 
  10618 #+begin_src emacs-lisp
  10619 (setq org-agenda-exporter-settings
  10620       '((ps-number-of-columns 2)
  10621         (ps-landscape-mode t)
  10622         (org-agenda-add-entry-text-maxlines 5)
  10623         (htmlize-output-type 'css)))
  10624 #+end_src
  10625 
  10626 #+texinfo: @noindent
  10627 but the settings in ~org-agenda-custom-commands~ take precedence.
  10628 
  10629 From the command line you may also use:
  10630 
  10631 #+begin_src shell
  10632 emacs -eval (org-batch-store-agenda-views) -kill
  10633 #+end_src
  10634 
  10635 #+texinfo: @noindent
  10636 or, if you need to modify some parameters[fn:107]
  10637 
  10638 #+begin_src shell
  10639 emacs -eval '(org-batch-store-agenda-views                      \
  10640               org-agenda-span (quote month)                     \
  10641               org-agenda-start-day "2007-11-01"                 \
  10642               org-agenda-include-diary nil                      \
  10643               org-agenda-files (quote ("~/org/project.org")))'  \
  10644       -kill
  10645 #+end_src
  10646 
  10647 #+texinfo: @noindent
  10648 which creates the agenda views restricted to the file
  10649 =~/org/project.org=, without diary entries and with a 30-day extent.
  10650 
  10651 You can also extract agenda information in a way that allows further
  10652 processing by other programs.  See [[*Extracting Agenda Information]], for
  10653 more information.
  10654 
  10655 ** Using Column View in the Agenda
  10656 :PROPERTIES:
  10657 :DESCRIPTION: Using column view for collected entries.
  10658 :ALT_TITLE: Agenda Column View
  10659 :END:
  10660 #+cindex: column view, in agenda
  10661 #+cindex: agenda, column view
  10662 
  10663 Column view (see [[*Column View]]) is normally used to view and edit
  10664 properties embedded in the hierarchical structure of an Org file.  It
  10665 can be quite useful to use column view also from the agenda, where
  10666 entries are collected by certain criteria.
  10667 
  10668 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
  10669   #+kindex: C-c C-x C-c
  10670   #+findex: org-agenda-columns
  10671 
  10672   Turn on column view in the agenda.
  10673 
  10674 To understand how to use this properly, it is important to realize
  10675 that the entries in the agenda are no longer in their proper outline
  10676 environment.  This causes the following issues:
  10677 
  10678 1.
  10679    #+vindex: org-columns-default-format-for-agenda
  10680    #+vindex: org-columns-default-format
  10681    Org needs to make a decision which columns format to use.  Since
  10682    the entries in the agenda are collected from different files, and
  10683    different files may have different columns formats, this is a
  10684    non-trivial problem.  Org first checks if
  10685    ~org-overriding-columns-format~ is currently set, and if so, takes
  10686    the format from there.  You should set this variable only in the
  10687    /local settings section/ of a custom agenda command (see [[*Custom
  10688    Agenda Views]]) to make it valid for that specific agenda view.  If
  10689    no such binding exists, it checks, in sequence,
  10690    ~org-columns-default-format-for-agenda~, the format associated with
  10691    the first item in the agenda (through a property or a =#+COLUMNS=
  10692    setting in that buffer) and finally ~org-columns-default-format~.
  10693 
  10694 2.
  10695    #+cindex: @samp{CLOCKSUM}, special property
  10696    If any of the columns has a summary type defined (see [[*Column
  10697    attributes]]), turning on column view in the agenda visits all
  10698    relevant agenda files and make sure that the computations of this
  10699    property are up to date.  This is also true for the special
  10700    =CLOCKSUM= property.  Org then sums the values displayed in the
  10701    agenda.  In the daily/weekly agenda, the sums cover a single day;
  10702    in all other views they cover the entire block.
  10703 
  10704    It is important to realize that the agenda may show the same entry
  10705    /twice/---for example as scheduled and as a deadline---and it may
  10706    show two entries from the same hierarchy (for example a /parent/
  10707    and its /child/).  In these cases, the summation in the agenda
  10708    leads to incorrect results because some values count double.
  10709 
  10710 3. When the column view in the agenda shows the =CLOCKSUM= property,
  10711    that is always the entire clocked time for this item.  So even in
  10712    the daily/weekly agenda, the clocksum listed in column view may
  10713    originate from times outside the current view.  This has the
  10714    advantage that you can compare these values with a column listing
  10715    the planned total effort for a task---one of the major
  10716    applications for column view in the agenda.  If you want
  10717    information about clocked time in the displayed period use clock
  10718    table mode (press {{{kbd(R)}}} in the agenda).
  10719 
  10720 4.
  10721    #+cindex: @samp{CLOCKSUM_T}, special property
  10722    When the column view in the agenda shows the =CLOCKSUM_T= property,
  10723    that is always today's clocked time for this item.  So even in the
  10724    weekly agenda, the clocksum listed in column view only originates
  10725    from today.  This lets you compare the time you spent on a task for
  10726    today, with the time already spent---via =CLOCKSUM=---and with
  10727    the planned total effort for it.
  10728 
  10729 * Markup for Rich Contents
  10730 :PROPERTIES:
  10731 :DESCRIPTION: Compose beautiful documents.
  10732 :END:
  10733 
  10734 Org is primarily about organizing and searching through your
  10735 plain-text notes.  However, it also provides a lightweight yet robust
  10736 markup language for rich text formatting and more.  For instance, you
  10737 may want to center or emphasize text.  Or you may need to insert
  10738 a formula or image in your writing.  Org offers syntax for all of this
  10739 and more.  Used in conjunction with the export framework (see
  10740 [[*Exporting]]), you can author beautiful documents in Org---like the fine
  10741 manual you are currently reading.
  10742 
  10743 ** Paragraphs
  10744 :PROPERTIES:
  10745 :DESCRIPTION: The basic unit of text.
  10746 :END:
  10747 
  10748 #+cindex: paragraphs, markup rules
  10749 Paragraphs are separated by at least one empty line.  If you need to
  10750 enforce a line break within a paragraph, use =\\= at the end of
  10751 a line.
  10752 
  10753 #+cindex: line breaks, markup rules
  10754 To preserve the line breaks, indentation and blank lines in a region,
  10755 but otherwise use normal formatting, you can use this construct, which
  10756 can also be used to format poetry.
  10757 
  10758 #+cindex: @samp{BEGIN_VERSE}
  10759 #+cindex: verse blocks
  10760 #+begin_example
  10761 ,#+BEGIN_VERSE
  10762  Great clouds overhead
  10763  Tiny black birds rise and fall
  10764  Snow covers Emacs
  10765 
  10766     ---AlexSchroeder
  10767 ,#+END_VERSE
  10768 #+end_example
  10769 
  10770 When quoting a passage from another document, it is customary to
  10771 format this as a paragraph that is indented on both the left and the
  10772 right margin.  You can include quotations in Org documents like this:
  10773 
  10774 #+cindex: @samp{BEGIN_QUOTE}
  10775 #+cindex: quote blocks
  10776 #+begin_example
  10777 ,#+BEGIN_QUOTE
  10778 Everything should be made as simple as possible,
  10779 but not any simpler ---Albert Einstein
  10780 ,#+END_QUOTE
  10781 #+end_example
  10782 
  10783 If you would like to center some text, do it like this:
  10784 
  10785 #+cindex: @samp{BEGIN_CENTER}
  10786 #+cindex: center blocks
  10787 #+begin_example
  10788 ,#+BEGIN_CENTER
  10789 Everything should be made as simple as possible, \\
  10790 but not any simpler
  10791 ,#+END_CENTER
  10792 #+end_example
  10793 
  10794 ** Emphasis and Monospace
  10795 :PROPERTIES:
  10796 :DESCRIPTION: Bold, italic, etc.
  10797 :END:
  10798 #+cindex: underlined text, markup rules
  10799 #+cindex: bold text, markup rules
  10800 #+cindex: italic text, markup rules
  10801 #+cindex: verbatim text, markup rules
  10802 #+cindex: code text, markup rules
  10803 #+cindex: strike-through text, markup rules
  10804 
  10805 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
  10806 and =~code~=, and, if you must, =+strike-through+=.  Text in the code
  10807 and verbatim string is not processed for Org specific syntax; it is
  10808 exported verbatim.
  10809 
  10810 #+vindex: org-fontify-emphasized-text
  10811 To turn off fontification for marked up text, you can set
  10812 ~org-fontify-emphasized-text~ to ~nil~.  To narrow down the list of
  10813 available markup syntax, you can customize ~org-emphasis-alist~.
  10814 
  10815 ** Subscripts and Superscripts
  10816 :PROPERTIES:
  10817 :DESCRIPTION: Simple syntax for raising/lowering text.
  10818 :END:
  10819 #+cindex: subscript
  10820 #+cindex: superscript
  10821 
  10822 =^= and =_= are used to indicate super- and subscripts.  To increase
  10823 the readability of ASCII text, it is not necessary, but OK, to
  10824 surround multi-character sub- and superscripts with curly braces.  For
  10825 example
  10826 
  10827 #+begin_example
  10828 The radius of the sun is R_sun = 6.96 x 10^8 m.  On the other hand,
  10829 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
  10830 #+end_example
  10831 
  10832 #+vindex: org-use-sub-superscripts
  10833 If you write a text where the underscore is often used in a different
  10834 context, Org's convention to always interpret these as subscripts can
  10835 get in your way.  Configure the variable ~org-use-sub-superscripts~ to
  10836 change this convention.  For example, when setting this variable to
  10837 ~{}~, =a_b= is not interpreted as a subscript, but =a_{b}= is.
  10838 
  10839 You can set ~org-use-sub-superscripts~ in a file using the export
  10840 option =^:= (see [[*Export Settings][Export Settings]]).  For example, =#+OPTIONS: ^:{}=
  10841 sets ~org-use-sub-superscripts~ to ~{}~ and limits super- and
  10842 subscripts to the curly bracket notation.
  10843 
  10844 You can also toggle the visual display of super- and subscripts:
  10845 
  10846 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
  10847 
  10848   #+kindex: C-c C-x \
  10849   #+findex: org-toggle-pretty-entities
  10850   This command formats sub- and superscripts in a WYSIWYM way.
  10851 
  10852 #+vindex: org-pretty-entities
  10853 #+vindex: org-pretty-entities-include-sub-superscripts
  10854 Set both ~org-pretty-entities~ and
  10855 ~org-pretty-entities-include-sub-superscripts~ to ~t~ to start with
  10856 super- and subscripts /visually/ interpreted as specified by the
  10857 option ~org-use-sub-superscripts~.
  10858 
  10859 ** Special Symbols
  10860 :PROPERTIES:
  10861 :DESCRIPTION: Greek letters and other symbols.
  10862 :END:
  10863 #+cindex: math symbols
  10864 #+cindex: special symbols
  10865 #+cindex: entities
  10866 
  10867 You can use LaTeX-like syntax to insert special symbols---named
  10868 entities---like =\alpha= to indicate the Greek letter, or =\to= to indicate
  10869 an arrow.  Completion for these symbols is available, just type =\=
  10870 and maybe a few letters, and press {{{kbd(M-TAB)}}} to see possible
  10871 completions.  If you need such a symbol inside a word, terminate it
  10872 with a pair of curly brackets.  For example
  10873 
  10874 #+begin_example
  10875 Pro tip: Given a circle \Gamma of diameter d, the length of its
  10876 circumference is \pi{}d.
  10877 #+end_example
  10878 
  10879 #+findex: org-entities-help
  10880 #+vindex: org-entities-user
  10881 A large number of entities is provided, with names taken from both
  10882 HTML and LaTeX; you can comfortably browse the complete list from
  10883 a dedicated buffer using the command ~org-entities-help~.  It is also
  10884 possible to provide your own special symbols in the variable
  10885 ~org-entities-user~.
  10886 
  10887 During export, these symbols are transformed into the native format of
  10888 the exporter back-end.  Strings like =\alpha= are exported as =&alpha;= in
  10889 the HTML output, and as =\(\alpha\)= in the LaTeX output.  Similarly, =\nbsp=
  10890 becomes =&nbsp;= in HTML and =~= in LaTeX.
  10891 
  10892 #+cindex: special symbols, in-buffer display
  10893 If you would like to see entities displayed as UTF-8 characters, use
  10894 the following command[fn:108]:
  10895 
  10896 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
  10897   #+kindex: C-c C-x \
  10898   #+findex: org-toggle-pretty-entities
  10899 
  10900   Toggle display of entities as UTF-8 characters.  This does not
  10901   change the buffer content which remains plain ASCII, but it overlays
  10902   the UTF-8 character for display purposes only.
  10903 
  10904 #+cindex: shy hyphen, special symbol
  10905 #+cindex: dash, special symbol
  10906 #+cindex: ellipsis, special symbol
  10907 In addition to regular entities defined above, Org exports in
  10908 a special way[fn:109] the following commonly used character
  10909 combinations: =\-= is treated as a shy hyphen, =--= and =---= are
  10910 converted into dashes, and =...= becomes a compact set of dots.
  10911 
  10912 ** Embedded LaTeX
  10913 :PROPERTIES:
  10914 :DESCRIPTION: LaTeX can be freely used inside Org documents.
  10915 :END:
  10916 #+cindex: @TeX{} interpretation
  10917 #+cindex: @LaTeX{} interpretation
  10918 
  10919 Plain ASCII is normally sufficient for almost all note taking.
  10920 Exceptions include scientific notes, which often require mathematical
  10921 symbols and the occasional formula.  LaTeX[fn:110] is widely used to
  10922 typeset scientific documents.  Org mode supports embedding LaTeX code
  10923 into its files, because many academics are used to writing and reading
  10924 LaTeX source code, and because it can be readily processed to produce
  10925 pretty output for a number of export back-ends.
  10926 
  10927 *** LaTeX fragments
  10928 :PROPERTIES:
  10929 :DESCRIPTION: Complex formulas made easy.
  10930 :END:
  10931 #+cindex: @LaTeX{} fragments
  10932 
  10933 #+vindex: org-format-latex-header
  10934 Org mode can contain LaTeX math fragments, and it supports ways to
  10935 process these for several export back-ends.  When exporting to LaTeX,
  10936 the code is left as it is.  When exporting to HTML, Org can use either
  10937 [[https://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math
  10938 into images (see [[*Previewing LaTeX fragments]]).
  10939 
  10940 LaTeX fragments do not need any special marking at all.  The following
  10941 snippets are identified as LaTeX source code:
  10942 
  10943 - Environments of any kind[fn:111].  The only requirement is that the
  10944   =\begin= statement appears on a new line, preceded by only
  10945   whitespace.
  10946 
  10947 - Text within the usual LaTeX math delimiters.  To avoid conflicts
  10948   with currency specifications, single =$= characters are only
  10949   recognized as math delimiters if the enclosed text contains at most
  10950   two line breaks, is directly attached to the =$= characters with no
  10951   whitespace in between, and if the closing =$= is followed by
  10952   whitespace, punctuation or a dash.  For the other delimiters, there
  10953   is no such restriction, so when in doubt, use =\(...\)= as inline
  10954   math delimiters.
  10955 
  10956 #+texinfo: @noindent
  10957 For example:
  10958 
  10959 #+begin_example
  10960 \begin{equation}                        % arbitrary environments,
  10961 x=\sqrt{b}                              % even tables, figures
  10962 \end{equation}                          % etc
  10963 
  10964 If $a^2=b$ and \( b=2 \), then the solution must be
  10965 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
  10966 #+end_example
  10967 
  10968 #+vindex: org-export-with-latex
  10969 LaTeX processing can be configured with the variable
  10970 ~org-export-with-latex~.  The default setting is ~t~ which means
  10971 MathJax for HTML, and no processing for ASCII and LaTeX back-ends.
  10972 You can also set this variable on a per-file basis using one of these
  10973 lines:
  10974 
  10975 | =#+OPTIONS: tex:t=        | Do the right thing automatically (MathJax) |
  10976 | =#+OPTIONS: tex:nil=      | Do not process LaTeX fragments at all      |
  10977 | =#+OPTIONS: tex:verbatim= | Verbatim export, for jsMath or so          |
  10978 
  10979 *** Previewing LaTeX fragments
  10980 :PROPERTIES:
  10981 :DESCRIPTION: What will this snippet look like?
  10982 :END:
  10983 #+cindex: @LaTeX{} fragments, preview
  10984 
  10985 #+vindex: org-preview-latex-default-process
  10986 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
  10987 =convert= installed[fn:112], LaTeX fragments can be processed to
  10988 produce images of the typeset expressions to be used for inclusion
  10989 while exporting to HTML (see [[*LaTeX fragments]]), or for inline
  10990 previewing within Org mode.
  10991 
  10992 #+vindex: org-format-latex-options
  10993 #+vindex: org-format-latex-header
  10994 You can customize the variables ~org-format-latex-options~ and
  10995 ~org-format-latex-header~ to influence some aspects of the preview.
  10996 In particular, the ~:scale~ (and for HTML export, ~:html-scale~)
  10997 property of the former can be used to adjust the size of the preview
  10998 images.
  10999 
  11000 - {{{kbd(C-c C-x C-l)}}} (~org-latex-preview~) ::
  11001   #+kindex: C-c C-x C-l
  11002   #+findex: org-latex-preview
  11003 
  11004   Produce a preview image of the LaTeX fragment at point and overlay
  11005   it over the source code.  If there is no fragment at point, process
  11006   all fragments in the current entry---between two headlines.
  11007 
  11008   When called with a single prefix argument, clear all images in the
  11009   current entry.  Two prefix arguments produce a preview image for all
  11010   fragments in the buffer, while three of them clear all the images in
  11011   that buffer.
  11012 
  11013 #+vindex: org-startup-with-latex-preview
  11014 You can turn on the previewing of all LaTeX fragments in a file with
  11015 
  11016 : #+STARTUP: latexpreview
  11017 
  11018 To disable it, simply use
  11019 
  11020 : #+STARTUP: nolatexpreview
  11021 
  11022 *** Using CDLaTeX to enter math
  11023 :PROPERTIES:
  11024 :DESCRIPTION: Speed up entering of formulas.
  11025 :ALT_TITLE: CDLaTeX mode
  11026 :END:
  11027 #+cindex: CD@LaTeX{}
  11028 
  11029 CDLaTeX mode is a minor mode that is normally used in combination with
  11030 a major LaTeX mode like AUCTeX in order to speed-up insertion of
  11031 environments and math templates.  Inside Org mode, you can make use of
  11032 some of the features of CDLaTeX mode.  You need to install
  11033 =cdlatex.el= and =texmathp.el= (the latter comes also with AUCTeX)
  11034 using [[https://melpa.org/][MELPA]] with the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html][Emacs packaging system]] or alternatively from
  11035 [[https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/]].  Do not use
  11036 CDLaTeX mode itself under Org mode, but use the special version Org
  11037 CDLaTeX minor mode that comes as part of Org.  Turn it on for the
  11038 current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org
  11039 files with
  11040 
  11041 #+begin_src emacs-lisp
  11042 (add-hook 'org-mode-hook #'turn-on-org-cdlatex)
  11043 #+end_src
  11044 
  11045 When this mode is enabled, the following features are present (for
  11046 more details see the documentation of CDLaTeX mode):
  11047 
  11048 #+attr_texinfo: :sep ,
  11049 - {{{kbd(C-c {)}}} ::
  11050   #+kindex: C-c @{
  11051 
  11052   Insert an environment template.
  11053 
  11054 - {{{kbd(TAB)}}} ::
  11055   #+kindex: TAB
  11056 
  11057   The {{{kbd(TAB)}}} key expands the template if point is inside
  11058   a LaTeX fragment[fn:113].  For example, {{{kbd(TAB)}}} expands =fr=
  11059   to =\frac{}{}= and position point correctly inside the first brace.
  11060   Another {{{kbd(TAB)}}} gets you into the second brace.
  11061 
  11062   Even outside fragments, {{{kbd(TAB)}}} expands environment
  11063   abbreviations at the beginning of a line.  For example, if you write
  11064   =equ= at the beginning of a line and press {{{kbd(TAB)}}}, this
  11065   abbreviation is expanded to an =equation= environment.  To get
  11066   a list of all abbreviations, type {{{kbd(M-x
  11067   cdlatex-command-help)}}}.
  11068 
  11069 - {{{kbd(^)}}}, {{{kbd(_)}}} ::
  11070   #+kindex: _
  11071   #+kindex: ^
  11072   #+vindex: cdlatex-simplify-sub-super-scripts
  11073 
  11074   Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment
  11075   inserts these characters together with a pair of braces.  If you use
  11076   {{{kbd(TAB)}}} to move out of the braces, and if the braces surround
  11077   only a single character or macro, they are removed again (depending
  11078   on the variable ~cdlatex-simplify-sub-super-scripts~).
  11079 
  11080 - {{{kbd(`)}}} ::
  11081   #+kindex: `
  11082 
  11083   Pressing the backquote followed by a character inserts math macros,
  11084   also outside LaTeX fragments.  If you wait more than 1.5 seconds
  11085   after the backquote, a help window pops up.
  11086 
  11087 - {{{kbd(')}}} ::
  11088   #+kindex: '
  11089 
  11090   Pressing the single-quote followed by another character modifies the
  11091   symbol before point with an accent or a font.  If you wait more than
  11092   1.5 seconds after the single-quote, a help window pops up.
  11093   Character modification works only inside LaTeX fragments; outside
  11094   the quote is normal.
  11095 
  11096 ** Literal Examples
  11097 :PROPERTIES:
  11098 :DESCRIPTION: Source code examples with special formatting.
  11099 :END:
  11100 #+cindex: literal examples, markup rules
  11101 #+cindex: code line references, markup rules
  11102 
  11103 You can include literal examples that should not be subjected to
  11104 markup.  Such examples are typeset in monospace, so this is well
  11105 suited for source code and similar examples.
  11106 
  11107 #+cindex: @samp{BEGIN_EXAMPLE}
  11108 #+cindex: example block
  11109 #+begin_example
  11110 ,#+BEGIN_EXAMPLE
  11111   Some example from a text file.
  11112 ,#+END_EXAMPLE
  11113 #+end_example
  11114 
  11115 #+cindex: comma escape, in literal examples
  11116 There is one limitation, however.  You must insert a comma right
  11117 before lines starting with either =*=, =,*=, =#+= or =,#+=, as those
  11118 may be interpreted as outlines nodes or some other special syntax.
  11119 Org transparently strips these additional commas whenever it accesses
  11120 the contents of the block.
  11121 
  11122 #+begin_example
  11123 ,#+BEGIN_EXAMPLE
  11124 ,,* I am no real headline
  11125 ,#+END_EXAMPLE
  11126 #+end_example
  11127 
  11128 For simplicity when using small examples, you can also start the
  11129 example lines with a colon followed by a space.  There may also be
  11130 additional whitespace before the colon:
  11131 
  11132 #+begin_example
  11133 Here is an example
  11134    : Some example from a text file.
  11135 #+end_example
  11136 
  11137 #+cindex: formatting source code, markup rules
  11138 #+vindex: org-latex-listings
  11139 If the example is source code from a programming language, or any
  11140 other text that can be marked up by Font Lock in Emacs, you can ask
  11141 for the example to look like the fontified Emacs buffer[fn:114].  This
  11142 is done with the code block, where you also need to specify the name
  11143 of the major mode that should be used to fontify the example[fn:115],
  11144 see [[*Structure Templates]] for shortcuts to easily insert code blocks.
  11145 
  11146 #+cindex: @samp{BEGIN_SRC}
  11147 #+cindex: source block
  11148 #+begin_example
  11149 ,#+BEGIN_SRC emacs-lisp
  11150   (defun org-xor (a b)
  11151     "Exclusive or."
  11152     (if a (not b) b))
  11153  ,#+END_SRC
  11154 #+end_example
  11155 
  11156 Both in =example= and in =src= snippets, you can add a =-n= switch to
  11157 the end of the =#+BEGIN= line, to get the lines of the example
  11158 numbered.  The =-n= takes an optional numeric argument specifying the
  11159 starting line number of the block.  If you use a =+n= switch, the
  11160 numbering from the previous numbered snippet is continued in the
  11161 current one.  The =+n= switch can also take a numeric argument.  This
  11162 adds the value of the argument to the last line of the previous block
  11163 to determine the starting line number.
  11164 
  11165 #+begin_example
  11166 ,#+BEGIN_SRC emacs-lisp -n 20
  11167   ;; This exports with line number 20.
  11168   (message "This is line 21")
  11169 ,#+END_SRC
  11170 
  11171 ,#+BEGIN_SRC emacs-lisp +n 10
  11172   ;; This is listed as line 31.
  11173   (message "This is line 32")
  11174 ,#+END_SRC
  11175 #+end_example
  11176 
  11177 In literal examples, Org interprets strings like =(ref:name)= as
  11178 labels, and use them as targets for special hyperlinks like
  11179 =[[(name)]]=---i.e., the reference name enclosed in single parenthesis.
  11180 In HTML, hovering the mouse over such a link remote-highlights the
  11181 corresponding code line, which is kind of cool.
  11182 
  11183 You can also add a =-r= switch which /removes/ the labels from the
  11184 source code[fn:116].  With the =-n= switch, links to these references
  11185 are labeled by the line numbers from the code listing.  Otherwise
  11186 links use the labels with no parentheses.  Here is an example:
  11187 
  11188 #+begin_example -l "(dumb-reference:%s)"
  11189 ,#+BEGIN_SRC emacs-lisp -n -r
  11190   (save-excursion                 (ref:sc)
  11191      (goto-char (point-min))      (ref:jump)
  11192 ,#+END_SRC
  11193 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  11194 jumps to point-min.
  11195 #+end_example
  11196 
  11197 #+cindex: indentation, in source blocks
  11198 Source code and examples may be /indented/ in order to align nicely
  11199 with the surrounding text, and in particular with plain list structure
  11200 (see [[*Plain Lists]]).  By default, Org only retains the relative
  11201 indentation between lines, e.g., when exporting the contents of the
  11202 block.  However, you can use the =-i= switch to also preserve the
  11203 global indentation, if it does matter.  See [[*Editing Source Code]].
  11204 
  11205 #+vindex: org-coderef-label-format
  11206 If the syntax for the label format conflicts with the language syntax,
  11207 use a =-l= switch to change the format, for example
  11208 
  11209 : #+BEGIN_SRC pascal -n -r -l "((%s))"
  11210 
  11211 #+texinfo: @noindent
  11212 See also the variable ~org-coderef-label-format~.
  11213 
  11214 HTML export also allows examples to be published as text areas (see
  11215 [[*Text areas in HTML export]]).
  11216 
  11217 Because the =#+BEGIN= ... =#+END= patterns need to be added so often,
  11218 a shortcut is provided (see [[*Structure Templates]]).
  11219 
  11220 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
  11221 
  11222   #+kindex: C-c '
  11223   #+findex: org-edit-special
  11224   Edit the source code example at point in its native mode.  This
  11225   works by switching to a temporary buffer with the source code.  You
  11226   need to exit by pressing {{{kbd(C-c ')}}} again.  The edited version
  11227   then replaces the old version in the Org buffer.  Fixed-width
  11228   regions---where each line starts with a colon followed by
  11229   a space---are edited using Artist mode[fn:117] to allow creating
  11230   ASCII drawings easily.  Using this command in an empty line creates
  11231   a new fixed-width region.
  11232 
  11233 #+cindex: storing link, in a source code buffer
  11234 Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source
  11235 code example in a temporary buffer created with {{{kbd(C-c ')}}}
  11236 prompts for a label.  Make sure that it is unique in the current
  11237 buffer, and insert it with the proper formatting like =(ref:label)= at
  11238 the end of the current line.  Then the label is stored as a link
  11239 =(label)=, for retrieval with {{{kbd(C-c C-l)}}}.
  11240 
  11241 ** Images
  11242 :PROPERTIES:
  11243 :DESCRIPTION: Display an image.
  11244 :END:
  11245 
  11246 #+cindex: inlining images
  11247 #+cindex: images, markup rules
  11248 An image is a link to an image file[fn:118] that does not have
  11249 a description part, for example
  11250 
  11251 : ./img/cat.jpg
  11252 
  11253 If you wish to define a caption for the image (see [[*Captions]]) and
  11254 maybe a label for internal cross references (see [[*Internal Links]]),
  11255 make sure that the link is on a line by itself and precede it with
  11256 =CAPTION= and =NAME= keywords as follows:
  11257 
  11258 #+begin_example
  11259 ,#+CAPTION: This is the caption for the next figure link (or table)
  11260 ,#+NAME:   fig:SED-HR4049
  11261 [[./img/a.jpg]]
  11262 #+end_example
  11263 
  11264 Such images can be displayed within the buffer with the following
  11265 command:
  11266 
  11267 - {{{kbd(C-c C-x C-v)}}} (~org-toggle-inline-images~) ::
  11268 
  11269   #+kindex: C-c C-x C-v
  11270   #+findex: org-toggle-inline-images
  11271   #+vindex: org-startup-with-inline-images
  11272   Toggle the inline display of linked images.  When called with
  11273   a prefix argument, also display images that do have a link
  11274   description.  You can ask for inline images to be displayed at
  11275   startup by configuring the variable
  11276   ~org-startup-with-inline-images~[fn:119].
  11277 
  11278 ** Captions
  11279 :PROPERTIES:
  11280 :DESCRIPTION: Describe tables, images...
  11281 :END:
  11282 #+cindex: captions, markup rules
  11283 #+cindex: @samp{CAPTION}, keyword
  11284 
  11285 You can assign a caption to a specific part of a document by inserting
  11286 a =CAPTION= keyword immediately before it:
  11287 
  11288 #+begin_example
  11289 ,#+CAPTION: This is the caption for the next table (or link)
  11290 | ... | ... |
  11291 |-----+-----|
  11292 #+end_example
  11293 
  11294 Optionally, the caption can take the form:
  11295 
  11296 : #+CAPTION[Short caption]: Longer caption.
  11297 
  11298 Even though images and tables are prominent examples of captioned
  11299 structures, the same caption mechanism can apply to many
  11300 others---e.g., LaTeX equations, source code blocks.  Depending on the
  11301 export back-end, those may or may not be handled.
  11302 
  11303 ** Horizontal Rules
  11304 :PROPERTIES:
  11305 :DESCRIPTION: Make a line.
  11306 :END:
  11307 
  11308 #+cindex: horizontal rules, markup rules
  11309 A line consisting of only dashes, and at least 5 of them, is exported
  11310 as a horizontal line.
  11311 
  11312 ** Creating Footnotes
  11313 :PROPERTIES:
  11314 :DESCRIPTION: Edit and read footnotes.
  11315 :END:
  11316 #+cindex: footnotes
  11317 
  11318 A footnote is started by a footnote marker in square brackets in
  11319 column 0, no indentation allowed.  It ends at the next footnote
  11320 definition, headline, or after two consecutive empty lines.  The
  11321 footnote reference is simply the marker in square brackets, inside
  11322 text.  Markers always start with =fn:=.  For example:
  11323 
  11324 #+begin_example
  11325 The Org homepage[fn:1] now looks a lot better than it used to.
  11326 ...
  11327 [fn:1] The link is: https://orgmode.org
  11328 #+end_example
  11329 
  11330 Org mode extends the number-based syntax to /named/ footnotes and
  11331 optional inline definition.  Here are the valid references:
  11332 
  11333 - =[fn:NAME]= ::
  11334 
  11335   A named footnote reference, where {{{var(NAME)}}} is a unique
  11336   label word, or, for simplicity of automatic creation, a number.
  11337 
  11338 - =[fn:: This is the inline definition of this footnote]= ::
  11339 
  11340   An anonymous footnote where the definition is given directly at the
  11341   reference point.
  11342 
  11343 - =[fn:NAME: a definition]= ::
  11344 
  11345   An inline definition of a footnote, which also specifies a name for
  11346   the note.  Since Org allows multiple references to the same note,
  11347   you can then use =[fn:NAME]= to create additional references.
  11348 
  11349 #+vindex: org-footnote-auto-label
  11350 Footnote labels can be created automatically, or you can create names
  11351 yourself.  This is handled by the variable ~org-footnote-auto-label~
  11352 and its corresponding =STARTUP= keywords.  See the docstring of that
  11353 variable for details.
  11354 
  11355 The following command handles footnotes:
  11356 
  11357 - {{{kbd(C-c C-x f)}}} ::
  11358 
  11359   The footnote action command.
  11360 
  11361   #+kindex: C-c C-x f
  11362   When point is on a footnote reference, jump to the definition.  When
  11363   it is at a definition, jump to the---first---reference.
  11364 
  11365   #+vindex: org-footnote-define-inline
  11366   #+vindex: org-footnote-section
  11367   Otherwise, create a new footnote.  Depending on the variable
  11368   ~org-footnote-define-inline~[fn:120], the definition is placed right
  11369   into the text as part of the reference, or separately into the
  11370   location determined by the variable ~org-footnote-section~.
  11371 
  11372   When this command is called with a prefix argument, a menu of
  11373   additional options is offered:
  11374 
  11375   #+attr_texinfo: :columns 0.1 0.9
  11376   | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence.               |
  11377   | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes.                              |
  11378   | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action.                        |
  11379   | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence.            |
  11380   | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. |
  11381 
  11382   #+vindex: org-footnote-auto-adjust
  11383   Depending on the variable ~org-footnote-auto-adjust~[fn:121],
  11384   renumbering and sorting footnotes can be automatic after each
  11385   insertion or deletion.
  11386 
  11387 - {{{kbd(C-c C-c)}}} ::
  11388 
  11389   #+kindex: C-c C-c
  11390   If point is on a footnote reference, jump to the definition.  If it
  11391   is at the definition, jump back to the reference.  When called at
  11392   a footnote location with a prefix argument, offer the same menu as
  11393   {{{kbd(C-c C-x f)}}}.
  11394 
  11395 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} ::
  11396 
  11397   #+kindex: C-c C-o
  11398   #+kindex: mouse-1
  11399   #+kindex: mouse-2
  11400   Footnote labels are also links to the corresponding definition or
  11401   reference, and you can use the usual commands to follow these links.
  11402 
  11403 * Exporting
  11404 :PROPERTIES:
  11405 :DESCRIPTION: Sharing and publishing notes.
  11406 :END:
  11407 #+cindex: exporting
  11408 
  11409 At some point you might want to print your notes, publish them on the
  11410 web, or share them with people not using Org.  Org can convert and
  11411 export documents to a variety of other formats while retaining as much
  11412 structure (see [[*Document Structure]]) and markup (see [[*Markup for Rich
  11413 Contents]]) as possible.
  11414 
  11415 #+cindex: export back-end
  11416 The libraries responsible for translating Org files to other formats
  11417 are called /back-ends/.  Org ships with support for the following
  11418 back-ends:
  11419 
  11420 - /ascii/ (ASCII format)
  11421 - /beamer/ (LaTeX Beamer format)
  11422 - /html/ (HTML format)
  11423 - /icalendar/ (iCalendar format)
  11424 - /latex/ (LaTeX format)
  11425 - /md/ (Markdown format)
  11426 - /odt/ (OpenDocument Text format)
  11427 - /org/ (Org format)
  11428 - /texinfo/ (Texinfo format)
  11429 - /man/ (Man page format)
  11430 
  11431 Users can install libraries for additional formats from the Emacs
  11432 packaging system.  For easy discovery, these packages have a common
  11433 naming scheme: ~ox-NAME~, where {{{var(NAME)}}} is a format.  For
  11434 example, ~ox-koma-letter~ for /koma-letter/ back-end.  More libraries
  11435 can be found in the =org-contrib= repository (see [[*Installation]]).
  11436 
  11437 #+vindex: org-export-backends
  11438 Org only loads back-ends for the following formats by default: ASCII,
  11439 HTML, iCalendar, LaTeX, and ODT.  Additional back-ends can be loaded
  11440 in either of two ways: by configuring the ~org-export-backends~
  11441 variable, or by requiring libraries in the Emacs init file.  For
  11442 example, to load the Markdown back-end, add this to your Emacs config:
  11443 
  11444 #+begin_src emacs-lisp
  11445 (require 'ox-md)
  11446 #+end_src
  11447 
  11448 ** The Export Dispatcher
  11449 :PROPERTIES:
  11450 :DESCRIPTION: The main interface.
  11451 :END:
  11452 #+cindex: dispatcher, for export commands
  11453 #+cindex: export, dispatcher
  11454 
  11455 The export dispatcher is the main interface for Org's exports.
  11456 A hierarchical menu presents the currently configured export formats.
  11457 Options are shown as easy toggle switches on the same screen.
  11458 
  11459 #+vindex: org-export-dispatch-use-expert-ui
  11460 Org also has a minimal prompt interface for the export dispatcher.
  11461 When the variable ~org-export-dispatch-use-expert-ui~ is set to
  11462 a non-~nil~ value, Org prompts in the minibuffer.  To switch back to
  11463 the hierarchical menu, press {{{kbd(?)}}}.
  11464 
  11465 - {{{kbd(C-c C-e)}}} (~org-export~) ::
  11466   #+kindex: C-c C-e
  11467   #+findex: org-export
  11468 
  11469   Invokes the export dispatcher interface.  The options show default
  11470   settings.  The {{{kbd(C-u)}}} prefix argument preserves options from
  11471   the previous export, including any sub-tree selections.
  11472 
  11473 Org exports the entire buffer by default.  If the Org buffer has an
  11474 active region, then Org exports just that region.
  11475 
  11476 Within the dispatcher interface, the following key combinations can
  11477 further alter what is exported, and how.
  11478 
  11479 - {{{kbd(C-a)}}} ::
  11480   #+kindex: C-c C-e C-a
  11481 
  11482   Toggle asynchronous export.  Asynchronous export uses an external
  11483   Emacs process with a specially configured initialization file to
  11484   complete the exporting process in the background, without tying-up
  11485   Emacs.  This is particularly useful when exporting long documents.
  11486 
  11487   Output from an asynchronous export is saved on the /export stack/.
  11488   To view this stack, call the export dispatcher with a double
  11489   {{{kbd(C-u)}}} prefix argument.  If already in the export dispatcher
  11490   menu, {{{kbd(&)}}} displays the stack.
  11491 
  11492   #+vindex: org-export-in-background
  11493   You can make asynchronous export the default by setting
  11494   ~org-export-in-background~.
  11495 
  11496   #+vindex: org-export-async-init-file
  11497   You can set the initialization file used by the background process
  11498   by setting ~org-export-async-init-file~.
  11499 
  11500 - {{{kbd(C-b)}}} ::
  11501   #+kindex: C-c C-e C-b
  11502 
  11503   Toggle body-only export.  Useful for excluding headers and footers
  11504   in the export.  Affects only those back-end formats that have
  11505   sections like =<head>...</head>= in HTML.
  11506 
  11507 - {{{kbd(C-s)}}} ::
  11508   #+kindex: C-c C-e C-s
  11509 
  11510   Toggle sub-tree export.  When turned on, Org exports only the
  11511   sub-tree starting from point position at the time the export
  11512   dispatcher was invoked.  Org uses the top heading of this sub-tree
  11513   as the document's title.  If point is not on a heading, Org uses the
  11514   nearest enclosing header.  If point is in the document preamble, Org
  11515   signals an error and aborts export.
  11516 
  11517   #+vindex: org-export-initial-scope
  11518   To make sub-tree export the default, customize the variable
  11519   ~org-export-initial-scope~.
  11520 
  11521 - {{{kbd(C-v)}}} ::
  11522   #+kindex: C-c C-e C-v
  11523 
  11524   Toggle visible-only export.  This is useful for exporting only
  11525   certain parts of an Org document by adjusting the visibility of
  11526   particular headings.  See also [[*Sparse Trees]].
  11527 
  11528 ** Export Settings
  11529 :PROPERTIES:
  11530 :DESCRIPTION: Common export settings.
  11531 :END:
  11532 #+cindex: options, for export
  11533 #+cindex: Export, settings
  11534 
  11535 #+cindex: @samp{OPTIONS}, keyword
  11536 Export options can be set: globally with variables; for an individual
  11537 file by making variables buffer-local with in-buffer settings (see
  11538 [[*Summary of In-Buffer Settings]]); by setting individual keywords or
  11539 specifying them in compact form with the =OPTIONS= keyword; or for
  11540 a tree by setting properties (see [[*Properties and Columns]]).  Options
  11541 set at a specific level override options set at a more general level.
  11542 
  11543 #+cindex: @samp{SETUPFILE}, keyword
  11544 In-buffer settings may appear anywhere in the file, either directly or
  11545 indirectly through a file included using =#+SETUPFILE: filename or
  11546 URL= syntax.  Option keyword sets tailored to a particular back-end
  11547 can be inserted from the export dispatcher (see [[*The Export
  11548 Dispatcher]]) using the =Insert template= command by pressing
  11549 {{{kbd(#)}}}.  To insert keywords individually, a good way to make
  11550 sure the keyword is correct is to type =#+= and then to use
  11551 {{{kbd(M-TAB)}}}[fn:16] for completion.
  11552 
  11553 The export keywords available for every back-end, and their equivalent
  11554 global variables, include:
  11555 
  11556 - =AUTHOR= ::
  11557 
  11558   #+cindex: @samp{AUTHOR}, keyword
  11559   #+vindex: user-full-name
  11560   The document author (~user-full-name~).
  11561 
  11562 - =CREATOR= ::
  11563 
  11564   #+cindex: @samp{CREATOR}, keyword
  11565   #+vindex: org-expot-creator-string
  11566   Entity responsible for output generation
  11567   (~org-export-creator-string~).
  11568 
  11569 - =DATE= ::
  11570 
  11571   #+cindex: @samp{DATE}, keyword
  11572   #+vindex: org-export-date-timestamp-format
  11573   A date or a time-stamp[fn:122].
  11574 
  11575 - =EMAIL= ::
  11576 
  11577   #+cindex: @samp{EMAIL}, keyword
  11578   #+vindex: user-mail-address
  11579   The email address (~user-mail-address~).
  11580 
  11581 - =LANGUAGE= ::
  11582 
  11583   #+cindex: @samp{LANGUAGE}, keyword
  11584   #+vindex: org-export-default-language
  11585   Language to use for translating certain strings
  11586   (~org-export-default-language~).  With =#+LANGUAGE: fr=, for
  11587   example, Org translates =Table of contents= to the French =Table des
  11588   matières=[fn:123].
  11589 
  11590 - =SELECT_TAGS= ::
  11591 
  11592   #+cindex: @samp{SELECT_TAGS}, keyword
  11593   #+vindex: org-export-select-tags
  11594   The default value is =("export")=.  When a tree is tagged with
  11595   =export= (~org-export-select-tags~), Org selects that tree and its
  11596   sub-trees for export.  Org excludes trees with =noexport= tags, see
  11597   below.  When selectively exporting files with =export= tags set, Org
  11598   does not export any text that appears before the first headline.
  11599 
  11600 - =EXCLUDE_TAGS= ::
  11601 
  11602   #+cindex: @samp{EXCLUDE_TAGS}, keyword
  11603   #+vindex: org-export-exclude-tags
  11604   The default value is =("noexport")=.  When a tree is tagged with
  11605   =noexport= (~org-export-exclude-tags~), Org excludes that tree and
  11606   its sub-trees from export.  Entries tagged with =noexport= are
  11607   unconditionally excluded from the export, even if they have an
  11608   =export= tag.  Even if a sub-tree is not exported, Org executes any
  11609   code blocks contained there.
  11610 
  11611 - =TITLE= ::
  11612 
  11613   #+cindex: @samp{TITLE}, keyword
  11614   #+cindex: document title
  11615   Org displays this title.  For long titles, use multiple =#+TITLE=
  11616   lines.
  11617 
  11618 - =EXPORT_FILE_NAME= ::
  11619 
  11620   #+cindex: @samp{EXPORT_FILE_NAME}, keyword
  11621   The name of the output file to be generated.  Otherwise, Org
  11622   generates the file name based on the buffer name and the extension
  11623   based on the back-end format.
  11624 
  11625 The =OPTIONS= keyword is a compact form.  To configure multiple
  11626 options, use several =OPTIONS= lines.  =OPTIONS= recognizes the
  11627 following arguments.
  11628 
  11629 - ~'~ ::
  11630 
  11631   #+vindex: org-export-with-smart-quotes
  11632   Toggle smart quotes (~org-export-with-smart-quotes~).  Depending on
  11633   the language used, when activated, Org treats pairs of double quotes
  11634   as primary quotes, pairs of single quotes as secondary quotes, and
  11635   single quote marks as apostrophes.
  11636 
  11637 - ~*~ ::
  11638 
  11639   #+vindex: org-export-with-emphasize
  11640   Toggle emphasized text (~org-export-with-emphasize~).
  11641 
  11642 - ~-~ ::
  11643 
  11644   #+vindex: org-export-with-special-strings
  11645   Toggle conversion of special strings
  11646   (~org-export-with-special-strings~).
  11647 
  11648 - ~:~ ::
  11649 
  11650   #+vindex: org-export-with-fixed-width
  11651   Toggle fixed-width sections (~org-export-with-fixed-width~).
  11652 
  11653 - ~<~ ::
  11654 
  11655   #+vindex: org-export-with-timestamps
  11656   Toggle inclusion of time/date active/inactive stamps
  11657   (~org-export-with-timestamps~).
  11658 
  11659 - ~\n~ ::
  11660 
  11661   #+vindex: org-export-preserve-breaks
  11662   Toggles whether to preserve line breaks
  11663   (~org-export-preserve-breaks~).
  11664 
  11665 - ~^~ ::
  11666 
  11667   #+vindex: org-export-with-sub-superscripts
  11668   Toggle TeX-like syntax for sub- and superscripts.  If you write
  11669   =^:{}=, =a_{b}= is interpreted, but the simple =a_b= is left as it
  11670   is (~org-export-with-sub-superscripts~).
  11671 
  11672 - ~arch~ ::
  11673 
  11674   #+vindex: org-export-with-archived-trees
  11675   Configure how archived trees are exported.  When set to ~headline~,
  11676   the export process skips the contents and processes only the
  11677   headlines (~org-export-with-archived-trees~).
  11678 
  11679 - ~author~ ::
  11680 
  11681   #+vindex: org-export-with-author
  11682   Toggle inclusion of author name into exported file
  11683   (~org-export-with-author~).
  11684 
  11685 - ~broken-links~ ::
  11686 
  11687   #+vindex: org-export-with-broken-links
  11688   Toggles if Org should continue exporting upon finding a broken
  11689   internal link.  When set to ~mark~, Org clearly marks the problem
  11690   link in the output (~org-export-with-broken-links~).
  11691 
  11692 - ~c~ ::
  11693 
  11694   #+vindex: org-export-with-clocks
  11695   Toggle inclusion of =CLOCK= keywords (~org-export-with-clocks~).
  11696 
  11697 - ~creator~ ::
  11698 
  11699   #+vindex: org-export-with-creator
  11700   Toggle inclusion of creator information in the exported file
  11701   (~org-export-with-creator~).
  11702 
  11703 - ~d~ ::
  11704 
  11705   #+vindex: org-export-with-drawers
  11706   Toggles inclusion of drawers, or list of drawers to include, or list
  11707   of drawers to exclude (~org-export-with-drawers~).
  11708 
  11709 - ~date~ ::
  11710 
  11711   #+vindex: org-export-with-date
  11712   Toggle inclusion of a date into exported file
  11713   (~org-export-with-date~).
  11714 
  11715 - ~e~ ::
  11716 
  11717   #+vindex: org-export-with-entities
  11718   Toggle inclusion of entities (~org-export-with-entities~).
  11719 
  11720 - ~email~ ::
  11721 
  11722   #+vindex: org-export-with-email
  11723   Toggle inclusion of the author's e-mail into exported file
  11724   (~org-export-with-email~).
  11725 
  11726 - ~f~ ::
  11727 
  11728   #+vindex: org-export-with-footnotes
  11729   Toggle the inclusion of footnotes (~org-export-with-footnotes~).
  11730 
  11731 - ~H~ ::
  11732 
  11733   #+vindex: org-export-headline-levels
  11734   Set the number of headline levels for export
  11735   (~org-export-headline-levels~).  Below that level, headlines are
  11736   treated differently.  In most back-ends, they become list items.
  11737 
  11738 - ~inline~ ::
  11739 
  11740   #+vindex: org-export-with-inlinetasks
  11741   Toggle inclusion of inlinetasks (~org-export-with-inlinetasks~).
  11742 
  11743 - ~num~ ::
  11744 
  11745   #+vindex: org-export-with-section-numbers
  11746   #+cindex: @samp{UNNUMBERED}, property
  11747   Toggle section-numbers (~org-export-with-section-numbers~).  When
  11748   set to number N, Org numbers only those headlines at level N or
  11749   above.  Set =UNNUMBERED= property to non-~nil~ to disable numbering
  11750   of heading and subheadings entirely.  Moreover, when the value is
  11751   =notoc= the headline, and all its children, do not appear in the
  11752   table of contents either (see [[*Table of Contents]]).
  11753 
  11754 - ~p~ ::
  11755 
  11756   #+vindex: org-export-with-planning
  11757   Toggle export of planning information (~org-export-with-planning~).
  11758   "Planning information" comes from lines located right after the
  11759   headline and contain any combination of these cookies: =SCHEDULED=,
  11760   =DEADLINE=, or =CLOSED=.
  11761 
  11762 - ~pri~ ::
  11763 
  11764   #+vindex: org-export-with-priority
  11765   Toggle inclusion of priority cookies
  11766   (~org-export-with-priority~).
  11767 
  11768 - ~prop~ ::
  11769 
  11770   #+vindex: org-export-with-properties
  11771   Toggle inclusion of property drawers, or list the properties to
  11772   include (~org-export-with-properties~).
  11773 
  11774 - ~stat~ ::
  11775 
  11776   #+vindex: org-export-with-statistics-cookies
  11777   Toggle inclusion of statistics cookies
  11778   (~org-export-with-statistics-cookies~).
  11779 
  11780 - ~tags~ ::
  11781 
  11782   #+vindex: org-export-with-tags
  11783   Toggle inclusion of tags, may also be ~not-in-toc~
  11784   (~org-export-with-tags~).
  11785 
  11786 - ~tasks~ ::
  11787 
  11788   #+vindex: org-export-with-tasks
  11789   Toggle inclusion of tasks (TODO items); or ~nil~ to remove all
  11790   tasks; or ~todo~ to remove done tasks; or list the keywords to keep
  11791   (~org-export-with-tasks~).
  11792 
  11793 - ~tex~ ::
  11794 
  11795   #+vindex: org-export-with-latex
  11796   ~nil~ does not export; ~t~ exports; ~verbatim~ keeps everything in
  11797   verbatim (~org-export-with-latex~).
  11798 
  11799 - ~timestamp~ ::
  11800 
  11801   #+vindex: org-export-time-stamp-file
  11802   Toggle inclusion of the creation time in the exported file
  11803   (~org-export-time-stamp-file~).
  11804 
  11805 - ~title~ ::
  11806 
  11807   #+vindex: org-export-with-title
  11808   Toggle inclusion of title (~org-export-with-title~).
  11809 
  11810 - ~toc~ ::
  11811 
  11812   #+vindex: org-export-with-toc
  11813   Toggle inclusion of the table of contents, or set the level limit
  11814   (~org-export-with-toc~).
  11815 
  11816 - ~todo~ ::
  11817 
  11818   #+vindex: org-export-with-todo-keywords
  11819   Toggle inclusion of TODO keywords into exported text
  11820   (~org-export-with-todo-keywords~).
  11821 
  11822 - ~|~ ::
  11823 
  11824   #+vindex: org-export-with-tables
  11825   Toggle inclusion of tables (~org-export-with-tables~).
  11826 
  11827 When exporting sub-trees, special node properties can override the
  11828 above keywords.  These properties have an =EXPORT_= prefix.  For
  11829 example, =DATE= becomes, =EXPORT_DATE= when used for a specific
  11830 sub-tree.  Except for =SETUPFILE=, all other keywords listed above
  11831 have an =EXPORT_= equivalent.
  11832 
  11833 #+cindex: @samp{BIND}, keyword
  11834 #+vindex: org-export-allow-bind-keywords
  11835 If ~org-export-allow-bind-keywords~ is non-~nil~, Emacs variables can
  11836 become buffer-local during export by using the =BIND= keyword.  Its
  11837 syntax is =#+BIND: variable value=.  This is particularly useful for
  11838 in-buffer settings that cannot be changed using keywords.
  11839 
  11840 ** Table of Contents
  11841 :PROPERTIES:
  11842 :DESCRIPTION: The if and where of the table of contents.
  11843 :END:
  11844 #+cindex: table of contents
  11845 #+cindex: list of tables
  11846 #+cindex: list of listings
  11847 
  11848 #+cindex: @samp{toc}, in @samp{OPTIONS} keyword
  11849 #+vindex: org-export-with-toc
  11850 The table of contents includes all headlines in the document.  Its
  11851 depth is therefore the same as the headline levels in the file.  If
  11852 you need to use a different depth, or turn it off entirely, set the
  11853 ~org-export-with-toc~ variable accordingly.  You can achieve the same
  11854 on a per file basis, using the following =toc= item in =OPTIONS=
  11855 keyword:
  11856 
  11857 #+begin_example
  11858 ,#+OPTIONS: toc:2          (only include two levels in TOC)
  11859 ,#+OPTIONS: toc:nil        (no default TOC at all)
  11860 #+end_example
  11861 
  11862 #+cindex: excluding entries from table of contents
  11863 #+cindex: table of contents, exclude entries
  11864 Org includes both numbered and unnumbered headlines in the table of
  11865 contents[fn:124].  If you need to exclude an unnumbered headline,
  11866 along with all its children, set the =UNNUMBERED= property to =notoc=
  11867 value.
  11868 
  11869 #+begin_example
  11870 ,* Subtree not numbered, not in table of contents either
  11871   :PROPERTIES:
  11872   :UNNUMBERED: notoc
  11873   :END:
  11874 #+end_example
  11875 
  11876 #+cindex: @samp{TOC}, keyword
  11877 Org normally inserts the table of contents directly before the first
  11878 headline of the file.  To move the table of contents to a different
  11879 location, first turn off the default with ~org-export-with-toc~
  11880 variable or with =#+OPTIONS: toc:nil=.  Then insert =#+TOC: headlines
  11881 N= at the desired location(s).
  11882 
  11883 #+begin_example
  11884 ,#+OPTIONS: toc:nil
  11885 ...
  11886 ,#+TOC: headlines 2
  11887 #+end_example
  11888 
  11889 To adjust the table of contents depth for a specific section of the
  11890 Org document, append an additional =local= parameter.  This parameter
  11891 becomes a relative depth for the current level.  The following example
  11892 inserts a local table of contents, with direct children only.
  11893 
  11894 #+begin_example
  11895 ,* Section
  11896 ,#+TOC: headlines 1 local
  11897 #+end_example
  11898 
  11899 Note that for this feature to work properly in LaTeX export, the Org
  11900 file requires the inclusion of the titletoc package.  Because of
  11901 compatibility issues, titletoc has to be loaded /before/ hyperref.
  11902 Customize the ~org-latex-default-packages-alist~ variable.
  11903 
  11904 The following example inserts a table of contents that links to the
  11905 children of the specified target.
  11906 
  11907 #+begin_example
  11908 ,* Target
  11909   :PROPERTIES:
  11910   :CUSTOM_ID: TargetSection
  11911   :END:
  11912 ,** Heading A
  11913 ,** Heading B
  11914 ,* Another section
  11915 ,#+TOC: headlines 1 :target #TargetSection
  11916 #+end_example
  11917 
  11918 The =:target= attribute is supported in HTML, Markdown, ODT, and ASCII export.
  11919 
  11920 Use the =TOC= keyword to generate list of tables---respectively, all
  11921 listings---with captions.
  11922 
  11923 #+begin_example
  11924 ,#+TOC: listings
  11925 ,#+TOC: tables
  11926 #+end_example
  11927 
  11928 #+cindex: @samp{ALT_TITLE}, property
  11929 Normally Org uses the headline for its entry in the table of contents.
  11930 But with =ALT_TITLE= property, a different entry can be specified for
  11931 the table of contents.
  11932 
  11933 ** Include Files
  11934 :PROPERTIES:
  11935 :DESCRIPTION: Include additional files into a document.
  11936 :END:
  11937 #+cindex: include files, during export
  11938 #+cindex: export, include files
  11939 #+cindex: @samp{INCLUDE}, keyword
  11940 
  11941 During export, you can include the content of another file.  For
  11942 example, to include your =.emacs= file, you could use:
  11943 
  11944 : #+INCLUDE: "~/.emacs" src emacs-lisp
  11945 
  11946 #+texinfo: @noindent
  11947 The first parameter is the file name to include.  The optional second
  11948 parameter specifies the block type: =example=, =export= or =src=.  The
  11949 optional third parameter specifies the source code language to use for
  11950 formatting the contents.  This is relevant to both =export= and =src=
  11951 block types.
  11952 
  11953 If an included file is specified as having a markup language, Org
  11954 neither checks for valid syntax nor changes the contents in any way.
  11955 For example and source blocks, Org code-escapes the contents before
  11956 inclusion.
  11957 
  11958 #+cindex: @samp{minlevel}, include
  11959 If an included file is not specified as having any markup language,
  11960 Org assumes it be in Org format and proceeds as usual with a few
  11961 exceptions.  Org makes the footnote labels (see [[*Creating Footnotes]])
  11962 in the included file local to that file.  The contents of the included
  11963 file belong to the same structure---headline, item---containing the
  11964 =INCLUDE= keyword.  In particular, headlines within the file become
  11965 children of the current section.  That behavior can be changed by
  11966 providing an additional keyword parameter, =:minlevel=.  It shifts the
  11967 headlines in the included file to become the lowest level.  For
  11968 example, this syntax makes the included file a sibling of the current
  11969 top-level headline:
  11970 
  11971 : #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
  11972 
  11973 #+cindex: @samp{lines}, include
  11974 Inclusion of only portions of files are specified using ranges
  11975 parameter with =:lines= keyword.  The line at the upper end of the
  11976 range will not be included.  The start and/or the end of the range may
  11977 be omitted to use the obvious defaults.
  11978 
  11979 | =#+INCLUDE: "~/.emacs" :lines "5-10"= | Include lines 5 to 10, 10 excluded |
  11980 | =#+INCLUDE: "~/.emacs" :lines "-10"=  | Include lines 1 to 10, 10 excluded |
  11981 | =#+INCLUDE: "~/.emacs" :lines "10-"=  | Include lines from 10 to EOF       |
  11982 
  11983 Inclusions may specify a file-link to extract an object matched by
  11984 ~org-link-search~[fn:125] (see [[*Search Options in File Links]]).  The
  11985 ranges for =:lines= keyword are relative to the requested element.
  11986 Therefore,
  11987 
  11988 : #+INCLUDE: "./paper.org::*conclusion" :lines 1-20
  11989 
  11990 #+texinfo: @noindent
  11991 includes the first 20 lines of the headline named =conclusion=.
  11992 
  11993 #+cindex: @samp{only-contents}, include
  11994 To extract only the contents of the matched object, set
  11995 =:only-contents= property to non-~nil~.  This omits any planning lines
  11996 or property drawers.  For example, to include the body of the heading
  11997 with the custom ID =theory=, you can use
  11998 
  11999 : #+INCLUDE: "./paper.org::#theory" :only-contents t
  12000 
  12001 The following command allows navigating to the included document:
  12002 
  12003 - {{{kbd(C-c ')}}} (~org-edit~special~) ::
  12004   #+kindex: C-c '
  12005   #+findex: org-edit-special
  12006 
  12007   Visit the included file at point.
  12008 
  12009 ** Macro Replacement
  12010 :PROPERTIES:
  12011 :DESCRIPTION: Use macros to create templates.
  12012 :END:
  12013 #+cindex: macro replacement, during export
  12014 #+cindex: @samp{MACRO}, keyword
  12015 
  12016 #+vindex: org-export-global-macros
  12017 Macros replace text snippets during export.  Macros are defined
  12018 globally in ~org-export-global-macros~, or document-wise with the
  12019 following syntax:
  12020 
  12021 : #+MACRO: name   replacement text; $1, $2 are arguments
  12022 
  12023 #+texinfo: @noindent
  12024 which can be referenced using ={{{name(arg1, arg2)}}}=[fn:126].  For
  12025 example
  12026 
  12027 #+begin_example
  12028 ,#+MACRO: poem Rose is $1, violet's $2. Life's ordered: Org assists you.
  12029 {{{poem(red,blue)}}}
  12030 #+end_example
  12031 
  12032 #+texinfo: @noindent
  12033 becomes
  12034 
  12035 : Rose is red, violet's blue.  Life's ordered: Org assists you.
  12036 
  12037 As a special case, Org parses any replacement text starting with
  12038 =(eval= as an Emacs Lisp expression and evaluates it accordingly.
  12039 Within such templates, arguments become strings.  Thus, the following
  12040 macro
  12041 
  12042 : #+MACRO: gnustamp (eval (concat "GNU/" (capitalize $1)))
  12043 
  12044 #+texinfo: @noindent
  12045 turns ={{{gnustamp(linux)}}}= into =GNU/Linux= during export.
  12046 
  12047 Org recognizes macro references in following Org markup areas:
  12048 paragraphs, headlines, verse blocks, tables cells and lists.  Org also
  12049 recognizes macro references in keywords, such as =CAPTION=, =TITLE=,
  12050 =AUTHOR=, =DATE=, and for some back-end specific export options.
  12051 
  12052 Org comes with following pre-defined macros:
  12053 
  12054 #+attr_texinfo: :sep ;
  12055 - ={{{keyword(NAME)}}}=; ={{{title}}}=; ={{{author}}}=; ={{{email}}}= ::
  12056 
  12057   #+cindex: @samp{keyword}, macro
  12058   #+cindex: @samp{title}, macro
  12059   #+cindex: @samp{author}, macro
  12060   #+cindex: @samp{email}, macro
  12061   The =keyword= macro collects all values from {{{var(NAME)}}}
  12062   keywords throughout the buffer, separated with white space.
  12063   =title=, =author= and =email= macros are shortcuts for,
  12064   respectively, ={{{keyword(TITLE)}}}=, ={{{keyword(AUTHOR)}}}= and
  12065   ={{{keyword(EMAIL)}}}=.
  12066 
  12067 - ={{{date}}}=; ={{{date(FORMAT)}}}= ::
  12068 
  12069   #+cindex: @samp{date}, macro
  12070   This macro refers to the =DATE= keyword.  {{{var(FORMAT)}}} is an
  12071   optional argument to the =date= macro that is used only if =DATE= is
  12072   a single timestamp.  {{{var(FORMAT)}}} should be a format string
  12073   understood by ~format-time-string~.
  12074 
  12075 - ={{{time(FORMAT)}}}=; ={{{modification-time(FORMAT, VC)}}}= ::
  12076 
  12077   #+cindex: @samp{time}, macro
  12078   #+cindex: @samp{modification-time}, macro
  12079   These macros refer to the document's date and time of export and
  12080   date and time of modification.  {{{var(FORMAT)}}} is a string
  12081   understood by ~format-time-string~.  If the second argument to the
  12082   ~modification-time~ macro is non-~nil~, Org uses =vc.el= to retrieve
  12083   the document's modification time from the version control system.
  12084   Otherwise Org reads the file attributes.
  12085 
  12086 - ={{{input-file}}}= ::
  12087 
  12088   #+cindex: @samp{input-file}, macro
  12089   This macro refers to the filename of the exported file.
  12090 
  12091 - ={{{property(PROPERTY-NAME)}}}=; ={{{property(PROPERTY-NAME, SEARCH OPTION)}}}= ::
  12092 
  12093   #+cindex: @samp{property}, macro
  12094   This macro returns the value of property {{{var(PROPERTY-NAME)}}} in
  12095   the current entry.  If {{{var(SEARCH-OPTION)}}} (see [[*Search
  12096   Options in File Links]]) refers to a remote entry, use it instead.
  12097 
  12098 - ={{{n}}}=; ={{{n(NAME)}}}=; ={{{n(NAME, ACTION)}}}= ::
  12099 
  12100   #+cindex: @samp{n}, macro
  12101   #+cindex: counter, macro
  12102   This macro implements custom counters by returning the number of
  12103   times the macro has been expanded so far while exporting the buffer.
  12104   You can create more than one counter using different {{{var(NAME)}}}
  12105   values.  If {{{var(ACTION)}}} is =-=, previous value of the counter
  12106   is held, i.e., the specified counter is not incremented.  If the
  12107   value is a number, the specified counter is set to that value.  If
  12108   it is any other non-empty string, the specified counter is reset
  12109   to 1.  You may leave {{{var(NAME)}}} empty to reset the default
  12110   counter.
  12111 
  12112 #+cindex: @samp{results}, macro
  12113 Moreover, inline source blocks (see [[*Structure of Code Blocks]]) use the
  12114 special =results= macro to mark their output.  As such, you are
  12115 advised against re-defining it, unless you know what you are doing.
  12116 
  12117 #+vindex: org-hide-macro-markers
  12118 The surrounding brackets can be made invisible by setting
  12119 ~org-hide-macro-markers~ to a non-~nil~ value.
  12120 
  12121 Org expands macros at the very beginning of the export process.
  12122 
  12123 ** Comment Lines
  12124 :PROPERTIES:
  12125 :DESCRIPTION: What will not be exported.
  12126 :END:
  12127 #+cindex: exporting, not
  12128 
  12129 #+cindex: comment lines
  12130 Lines starting with zero or more whitespace characters followed by one
  12131 =#= and a whitespace are treated as comments and, as such, are not
  12132 exported.
  12133 
  12134 #+cindex: @samp{BEGIN_COMMENT}
  12135 #+cindex: comment block
  12136 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT=
  12137 are not exported.
  12138 
  12139 #+cindex: comment trees
  12140 Finally, a =COMMENT= keyword at the beginning of an entry, but after
  12141 any other keyword or priority cookie, comments out the entire subtree.
  12142 In this case, the subtree is not exported and no code block within it
  12143 is executed either[fn:127].  The command below helps changing the
  12144 comment status of a headline.
  12145 
  12146 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
  12147   #+kindex: C-c ;
  12148   #+findex: org-toggle-comment
  12149 
  12150   Toggle the =COMMENT= keyword at the beginning of an entry.
  12151 
  12152 ** ASCII/Latin-1/UTF-8 export
  12153 :PROPERTIES:
  12154 :DESCRIPTION: Exporting to flat files with encoding.
  12155 :END:
  12156 #+cindex: ASCII export
  12157 #+cindex: Latin-1 export
  12158 #+cindex: UTF-8 export
  12159 
  12160 ASCII export produces an output file containing only plain ASCII
  12161 characters.  This is the simplest and most direct text output.  It
  12162 does not contain any Org markup.  Latin-1 and UTF-8 export use
  12163 additional characters and symbols available in these encoding
  12164 standards.  All three of these export formats offer the most basic of
  12165 text output for maximum portability.
  12166 
  12167 #+vindex: org-ascii-text-width
  12168 On export, Org fills and justifies text according to the text width
  12169 set in ~org-ascii-text-width~.
  12170 
  12171 #+vindex: org-ascii-links-to-notes
  12172 Org exports links using a footnote-like style where the descriptive
  12173 part is in the text and the link is in a note before the next heading.
  12174 See the variable ~org-ascii-links-to-notes~ for details.
  12175 
  12176 *** ASCII export commands
  12177 :PROPERTIES:
  12178 :UNNUMBERED: notoc
  12179 :END:
  12180 
  12181 #+attr_texinfo: :sep ,
  12182 - {{{kbd(C-c C-e t a)}}} (~org-ascii-export-to-ascii~), {{{kbd(C-c C-e t l)}}}, {{{kbd(C-c C-e t u)}}} ::
  12183   #+kindex: C-c C-e t a
  12184   #+kindex: C-c C-e t l
  12185   #+kindex: C-c C-e t u
  12186   #+findex: org-ascii-export-to-ascii
  12187 
  12188   Export as an ASCII file with a =.txt= extension.  For =myfile.org=,
  12189   Org exports to =myfile.txt=, overwriting without warning.  For
  12190   =myfile.txt=, Org exports to =myfile.txt.txt= in order to prevent
  12191   data loss.
  12192 
  12193 - {{{kbd(C-c C-e t A)}}} (~org-ascii-export-to-ascii~), {{{kbd(C-c C-e t L)}}}, {{{kbd(C-c C-e t U)}}} ::
  12194   #+kindex: C-c C-e t A
  12195   #+kindex: C-c C-e t L
  12196   #+kindex: C-c C-e t U
  12197   #+findex: org-ascii-export-as-ascii
  12198 
  12199   Export to a temporary buffer.  Does not create a file.
  12200 
  12201 *** ASCII specific export settings
  12202 :PROPERTIES:
  12203 :UNNUMBERED: notoc
  12204 :END:
  12205 
  12206 The ASCII export back-end has one extra keyword for customizing ASCII
  12207 output.  Setting this keyword works similar to the general options
  12208 (see [[*Export Settings]]).
  12209 
  12210 - =SUBTITLE= ::
  12211 
  12212   #+cindex: @samp{SUBTITLE}, keyword
  12213   The document subtitle.  For long subtitles, use multiple
  12214   =#+SUBTITLE= lines in the Org file.  Org prints them on one
  12215   continuous line, wrapping into multiple lines if necessary.
  12216 
  12217 *** Header and sectioning structure
  12218 :PROPERTIES:
  12219 :UNNUMBERED: notoc
  12220 :END:
  12221 
  12222 Org converts the first three outline levels into headlines for ASCII
  12223 export.  The remaining levels are turned into lists.  To change this
  12224 cut-off point where levels become lists, see [[*Export Settings]].
  12225 
  12226 *** Quoting ASCII text
  12227 :PROPERTIES:
  12228 :UNNUMBERED: notoc
  12229 :END:
  12230 
  12231 To insert text within the Org file by the ASCII back-end, use one the
  12232 following constructs, inline, keyword, or export block:
  12233 
  12234 #+cindex: @samp{ASCII}, keyword
  12235 #+cindex: @samp{BEGIN_EXPORT ascii}
  12236 #+begin_example
  12237 Inline text @@ascii:and additional text@@ within a paragraph.
  12238 
  12239 ,#+ASCII: Some text
  12240 
  12241 ,#+BEGIN_EXPORT ascii
  12242 Org exports text in this block only when using ASCII back-end.
  12243 ,#+END_EXPORT
  12244 #+end_example
  12245 
  12246 *** ASCII specific attributes
  12247 :PROPERTIES:
  12248 :UNNUMBERED: notoc
  12249 :END:
  12250 #+cindex: @samp{ATTR_ASCII}, keyword
  12251 #+cindex: horizontal rules, in ASCII export
  12252 
  12253 ASCII back-end recognizes only one attribute, =:width=, which
  12254 specifies the width of a horizontal rule in number of characters.  The
  12255 keyword and syntax for specifying widths is:
  12256 
  12257 #+begin_example
  12258 ,#+ATTR_ASCII: :width 10
  12259 -----
  12260 #+end_example
  12261 
  12262 *** ASCII special blocks
  12263 :PROPERTIES:
  12264 :UNNUMBERED: notoc
  12265 :END:
  12266 #+cindex: special blocks, in ASCII export
  12267 #+cindex: @samp{BEGIN_JUSTIFYLEFT}
  12268 #+cindex: @samp{BEGIN_JUSTIFYRIGHT}
  12269 
  12270 Besides =#+BEGIN_CENTER= blocks (see [[*Paragraphs]]), ASCII back-end has
  12271 these two left and right justification blocks:
  12272 
  12273 #+begin_example
  12274 ,#+BEGIN_JUSTIFYLEFT
  12275 It's just a jump to the left...
  12276 ,#+END_JUSTIFYLEFT
  12277 
  12278 ,#+BEGIN_JUSTIFYRIGHT
  12279 ...and then a step to the right.
  12280 ,#+END_JUSTIFYRIGHT
  12281 #+end_example
  12282 
  12283 ** Beamer Export
  12284 :PROPERTIES:
  12285 :DESCRIPTION: Producing presentations and slides.
  12286 :END:
  12287 #+cindex: Beamer export
  12288 
  12289 Org uses Beamer export to convert an Org file tree structure into
  12290 high-quality interactive slides for presentations.  Beamer is a LaTeX
  12291 document class for creating presentations in PDF, HTML, and other
  12292 popular display formats.
  12293 
  12294 *** Beamer export commands
  12295 :PROPERTIES:
  12296 :DESCRIPTION: For creating Beamer documents.
  12297 :END:
  12298 
  12299 - {{{kbd(C-c C-e l b)}}} (~org-beamer-export-to-latex~) ::
  12300   #+kindex: C-c C-e l b
  12301   #+findex: org-beamer-export-to-latex
  12302 
  12303   Export as LaTeX file with a =.tex= extension.  For =myfile.org=, Org
  12304   exports to =myfile.tex=, overwriting without warning.
  12305 
  12306 - {{{kbd(C-c C-e l B)}}} (~org-beamer-export-as-latex~) ::
  12307   #+kindex: C-c C-e l B
  12308   #+findex: org-beamer-export-as-latex
  12309 
  12310   Export to a temporary buffer.  Does not create a file.
  12311 
  12312 - {{{kbd(C-c C-e l P)}}} (~org-beamer-export-to-pdf~) ::
  12313   #+kindex: C-c C-e l P
  12314   #+findex: org-beamer-export-to-pdf
  12315 
  12316   Export as LaTeX file and then convert it to PDF format.
  12317 
  12318 - {{{kbd(C-c C-e l O)}}} ::
  12319   #+kindex: C-c C-e l O
  12320 
  12321   Export as LaTeX file, convert it to PDF format, and then open the
  12322   PDF file.
  12323 
  12324 *** Beamer specific export settings
  12325 :PROPERTIES:
  12326 :DESCRIPTION: For customizing Beamer export.
  12327 :END:
  12328 
  12329 Beamer export back-end has several additional keywords for customizing
  12330 Beamer output.  These keywords work similar to the general options
  12331 settings (see [[*Export Settings]]).
  12332 
  12333 - =BEAMER_THEME= ::
  12334 
  12335   #+cindex: @samp{BEAMER_THEME}, keyword
  12336   #+vindex: org-beamer-theme
  12337   The Beamer layout theme (~org-beamer-theme~).  Use square brackets
  12338   for options.  For example:
  12339 
  12340   : #+BEAMER_THEME: Rochester [height=20pt]
  12341 
  12342 - =BEAMER_FONT_THEME= ::
  12343 
  12344   #+cindex: @samp{BEAMER_FONT_THEME}, keyword
  12345   The Beamer font theme.
  12346 
  12347 - =BEAMER_INNER_THEME= ::
  12348 
  12349   #+cindex: @samp{BEAMER_INNER_THEME}, keyword
  12350   The Beamer inner theme.
  12351 
  12352 - =BEAMER_OUTER_THEME= ::
  12353 
  12354   #+cindex: @samp{BEAMER_OUTER_THEME}, keyword
  12355   The Beamer outer theme.
  12356 
  12357 - =BEAMER_HEADER= ::
  12358 
  12359   #+cindex: @samp{BEAMER_HEADER}, keyword
  12360   Arbitrary lines inserted in the preamble, just before the =hyperref=
  12361   settings.
  12362 
  12363 - =DESCRIPTION= ::
  12364 
  12365   #+cindex: @samp{DESCRIPTION}, keyword
  12366   The document description.  For long descriptions, use multiple
  12367   =DESCRIPTION= keywords.  By default, =hyperref= inserts
  12368   =DESCRIPTION= as metadata.  Use ~org-latex-hyperref-template~ to
  12369   configure document metadata.  Use ~org-latex-title-command~ to
  12370   configure typesetting of description as part of front matter.
  12371 
  12372 - =KEYWORDS= ::
  12373 
  12374   #+cindex: @samp{KEYWORDS}, keyword
  12375   The keywords for defining the contents of the document.  Use
  12376   multiple =KEYWORDS= lines if necessary.  By default, =hyperref=
  12377   inserts =KEYWORDS= as metadata.  Use ~org-latex-hyperref-template~
  12378   to configure document metadata.  Use ~org-latex-title-command~ to
  12379   configure typesetting of keywords as part of front matter.
  12380 
  12381 - =SUBTITLE= ::
  12382 
  12383   #+cindex: @samp{SUBTITLE}, keyword
  12384   Document's subtitle.  For typesetting, use
  12385   ~org-beamer-subtitle-format~ string.  Use
  12386   ~org-latex-hyperref-template~ to configure document metadata.  Use
  12387   ~org-latex-title-command~ to configure typesetting of subtitle as
  12388   part of front matter.
  12389 
  12390 *** Frames and Blocks in Beamer
  12391 :PROPERTIES:
  12392 :DESCRIPTION: For composing Beamer slides.
  12393 :END:
  12394 
  12395 Org transforms heading levels into Beamer's sectioning elements,
  12396 frames and blocks.  Any Org tree with a not-too-deep-level nesting
  12397 should in principle be exportable as a Beamer presentation.
  12398 
  12399 -
  12400   #+vindex: org-beamer-frame-level
  12401   Org headlines become Beamer frames when the heading level in Org is
  12402   equal to ~org-beamer-frame-level~ or =H= value in a =OPTIONS= line
  12403   (see [[*Export Settings]]).
  12404 
  12405   #+cindex: @samp{BEAMER_ENV}, property
  12406   Org overrides headlines to frames conversion for the current tree of
  12407   an Org file if it encounters the =BEAMER_ENV= property set to
  12408   =frame= or =fullframe=.  Org ignores whatever
  12409   ~org-beamer-frame-level~ happens to be for that headline level in
  12410   the Org tree.  In Beamer terminology, a full frame is a frame
  12411   without its title.
  12412 
  12413 - Org exports a Beamer frame's objects as block environments.  Org can
  12414   enforce wrapping in special block types when =BEAMER_ENV= property
  12415   is set[fn:128].  For valid values see
  12416   ~org-beamer-environments-default~.  To add more values, see
  12417   ~org-beamer-environments-extra~.
  12418   #+vindex: org-beamer-environments-default
  12419   #+vindex: org-beamer-environments-extra
  12420 
  12421 -
  12422   #+cindex: @samp{BEAMER_REF}, property
  12423   If =BEAMER_ENV= is set to =appendix=, Org exports the entry as an
  12424   appendix.  When set to =note=, Org exports the entry as a note
  12425   within the frame or between frames, depending on the entry's heading
  12426   level.  When set to =noteNH=, Org exports the entry as a note
  12427   without its title.  When set to =againframe=, Org exports the entry
  12428   with =\againframe= command, which makes setting the =BEAMER_REF=
  12429   property mandatory because =\againframe= needs frame to resume.
  12430 
  12431   When =ignoreheading= is set, Org export ignores the entry's headline
  12432   but not its content.  This is useful for inserting content between
  12433   frames.  It is also useful for properly closing a =column=
  12434   environment.  @end itemize
  12435 
  12436   #+cindex: @samp{BEAMER_ACT}, property
  12437   #+cindex: @samp{BEAMER_OPT}, property
  12438   When =BEAMER_ACT= is set for a headline, Org export translates that
  12439   headline as an overlay or action specification.  When enclosed in
  12440   square brackets, Org export makes the overlay specification
  12441   a default.  Use =BEAMER_OPT= to set any options applicable to the
  12442   current Beamer frame or block.  The Beamer export back-end wraps
  12443   with appropriate angular or square brackets.  It also adds the
  12444   =fragile= option for any code that may require a verbatim block.
  12445 
  12446   #+cindex: @samp{BEAMER_COL}, property
  12447   To create a column on the Beamer slide, use the =BEAMER_COL=
  12448   property for its headline in the Org file.  Set the value of
  12449   =BEAMER_COL= to a decimal number representing the fraction of the
  12450   total text width.  Beamer export uses this value to set the column's
  12451   width and fills the column with the contents of the Org entry.  If
  12452   the Org entry has no specific environment defined, Beamer export
  12453   ignores the heading.  If the Org entry has a defined environment,
  12454   Beamer export uses the heading as title.  Behind the scenes, Beamer
  12455   export automatically handles LaTeX column separations for contiguous
  12456   headlines.  To manually adjust them for any unique configurations
  12457   needs, use the =BEAMER_ENV= property.
  12458 
  12459 *** Beamer specific syntax
  12460 :PROPERTIES:
  12461 :DESCRIPTION: For using in Org documents.
  12462 :END:
  12463 
  12464 Since Org's Beamer export back-end is an extension of the LaTeX
  12465 back-end, it recognizes other LaTeX specific syntax---for example,
  12466 =#+LATEX:= or =#+ATTR_LATEX:=.  See [[*LaTeX Export]], for details.
  12467 
  12468 Beamer export wraps the table of contents generated with =toc:t=
  12469 =OPTION= keyword in a =frame= environment.  Beamer export does not
  12470 wrap the table of contents generated with =TOC= keyword (see [[*Table of
  12471 Contents]]).  Use square brackets for specifying options.
  12472 
  12473 : #+TOC: headlines [currentsection]
  12474 
  12475 Insert Beamer-specific code using the following constructs:
  12476 
  12477 #+cindex: @samp{BEAMER}, keyword
  12478 #+cindex: @samp{BEGIN_EXPORT beamer}
  12479 #+begin_example
  12480 ,#+BEAMER: \pause
  12481 
  12482 ,#+BEGIN_EXPORT beamer
  12483   Only Beamer export back-end exports this.
  12484 ,#+END_BEAMER
  12485 
  12486 Text @@beamer:some code@@ within a paragraph.
  12487 #+end_example
  12488 
  12489 Inline constructs, such as the last one above, are useful for adding
  12490 overlay specifications to objects with ~bold~, ~item~, ~link~,
  12491 ~radio-target~ and ~target~ types.  Enclose the value in angular
  12492 brackets and place the specification at the beginning of the object as
  12493 shown in this example:
  12494 
  12495 :  A *@@beamer:<2->@@useful* feature
  12496 
  12497 #+cindex: @samp{ATTR_BEAMER}, keyword
  12498 Beamer export recognizes the =ATTR_BEAMER= keyword with the following
  12499 attributes from Beamer configurations: =:environment= for changing
  12500 local Beamer environment, =:overlay= for specifying Beamer overlays in
  12501 angular or square brackets, and =:options= for inserting optional
  12502 arguments.
  12503 
  12504 #+begin_example
  12505 ,#+ATTR_BEAMER: :environment nonindentlist
  12506 - item 1, not indented
  12507 - item 2, not indented
  12508 - item 3, not indented
  12509 #+end_example
  12510 
  12511 #+begin_example
  12512 ,#+ATTR_BEAMER: :overlay <+->
  12513 - item 1
  12514 - item 2
  12515 #+end_example
  12516 
  12517 #+begin_example
  12518 ,#+ATTR_BEAMER: :options [Lagrange]
  12519 Let $G$ be a finite group, and let $H$ be
  12520 a subgroup of $G$.  Then the order of $H$ divides the order of $G$.
  12521 #+end_example
  12522 
  12523 *** Editing support
  12524 :PROPERTIES:
  12525 :DESCRIPTION: Editing support.
  12526 :END:
  12527 
  12528 Org Beamer mode is a special minor mode for faster editing of Beamer
  12529 documents.
  12530 
  12531 : #+STARTUP: beamer
  12532 
  12533 - {{{kbd(C-c C-b)}}} (~org-beamer-select-environment~) ::
  12534   #+kindex: C-c C-b
  12535   #+findex: org-beamer-select-environment
  12536 
  12537   Org Beamer mode provides this key for quicker selections in Beamer
  12538   normal environments, and for selecting the =BEAMER_COL= property.
  12539 
  12540 *** A Beamer example
  12541 :PROPERTIES:
  12542 :DESCRIPTION: A complete presentation.
  12543 :END:
  12544 
  12545 Here is an example of an Org document ready for Beamer export.
  12546 
  12547 #+begin_example
  12548 ,#+TITLE: Example Presentation
  12549 ,#+AUTHOR: Carsten Dominik
  12550 ,#+OPTIONS: H:2 toc:t num:t
  12551 ,#+LATEX_CLASS: beamer
  12552 ,#+LATEX_CLASS_OPTIONS: [presentation]
  12553 ,#+BEAMER_THEME: Madrid
  12554 ,#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col)
  12555 
  12556 ,* This is the first structural section
  12557 
  12558 ,** Frame 1
  12559 ,*** Thanks to Eric Fraga                                           :B_block:
  12560     :PROPERTIES:
  12561     :BEAMER_COL: 0.48
  12562     :BEAMER_ENV: block
  12563     :END:
  12564     for the first viable Beamer setup in Org
  12565 ,*** Thanks to everyone else                                        :B_block:
  12566     :PROPERTIES:
  12567     :BEAMER_COL: 0.48
  12568     :BEAMER_ACT: <2->
  12569     :BEAMER_ENV: block
  12570     :END:
  12571     for contributing to the discussion
  12572 ,**** This will be formatted as a beamer note                       :B_note:
  12573      :PROPERTIES:
  12574      :BEAMER_env: note
  12575      :END:
  12576 ,** Frame 2 (where we will not use columns)
  12577 ,*** Request
  12578     Please test this stuff!
  12579 #+end_example
  12580 
  12581 ** HTML Export
  12582 :PROPERTIES:
  12583 :DESCRIPTION: Exporting to HTML.
  12584 :END:
  12585 #+cindex: HTML export
  12586 
  12587 Org mode contains an HTML exporter with extensive HTML formatting
  12588 compatible with XHTML 1.0 strict standard.
  12589 
  12590 *** HTML export commands
  12591 :PROPERTIES:
  12592 :DESCRIPTION: Invoking HTML export.
  12593 :END:
  12594 
  12595 - {{{kbd(C-c C-e h h)}}} (~org-html-export-to-html~) ::
  12596   #+kindex: C-c C-e h h
  12597   #+kindex: C-c C-e h o
  12598   #+findex: org-html-export-to-html
  12599 
  12600   Export as HTML file with a =.html= extension.  For =myfile.org=, Org
  12601   exports to =myfile.html=, overwriting without warning.  {{{kbd(C-c
  12602   C-e h o)}}} exports to HTML and opens it in a web browser.
  12603 
  12604 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) ::
  12605   #+kindex: C-c C-e h H
  12606   #+findex: org-html-export-as-html
  12607 
  12608   Exports to a temporary buffer.  Does not create a file.
  12609 
  12610 *** HTML specific export settings
  12611 :PROPERTIES:
  12612 :DESCRIPTION: Settings for HTML export.
  12613 :END:
  12614 
  12615 HTML export has a number of keywords, similar to the general options
  12616 settings described in [[*Export Settings]].
  12617 
  12618 - =DESCRIPTION= ::
  12619 
  12620   #+cindex: @samp{DESCRIPTION}, keyword
  12621   This is the document's description, which the HTML exporter inserts
  12622   it as a HTML meta tag in the HTML file.  For long descriptions, use
  12623   multiple =DESCRIPTION= lines.  The exporter takes care of wrapping
  12624   the lines properly.
  12625 
  12626   The exporter includes a number of other meta tags, which can be customized
  12627   by modifying ~org-html-meta-tags~.
  12628 
  12629 - =HTML_DOCTYPE= ::
  12630 
  12631   #+cindex: @samp{HTML_DOCTYPE}, keyword
  12632   #+vindex: org-html-doctype
  12633   Specify the document type, for example: HTML5 (~org-html-doctype~).
  12634 
  12635 - =HTML_CONTAINER= ::
  12636 
  12637   #+cindex: @samp{HTML_CONTAINER}, keyword
  12638   #+vindex: org-html-container-element
  12639   Specify the HTML container, such as =div=, for wrapping sections and
  12640   elements (~org-html-container-element~).
  12641 
  12642 - =HTML_LINK_HOME= ::
  12643 
  12644   #+cindex: @samp{HTML_LINK_HOME}, keyword
  12645   #+vindex: org-html-link-home
  12646   The URL for home link (~org-html-link-home~).
  12647 
  12648 - =HTML_LINK_UP= ::
  12649 
  12650   #+cindex: @samp{HTML_LINK_UP}, keyword
  12651   #+vindex: org-html-link-up
  12652   The URL for the up link of exported HTML pages (~org-html-link-up~).
  12653 
  12654 - =HTML_MATHJAX= ::
  12655 
  12656   #+cindex: @samp{HTML_MATHJAX}, keyword
  12657   #+vindex: org-html-mathjax-options
  12658   Options for MathJax (~org-html-mathjax-options~).  MathJax is used
  12659   to typeset LaTeX math in HTML documents.  See [[*Math formatting in
  12660   HTML export]], for an example.
  12661 
  12662 - =HTML_HEAD= ::
  12663 
  12664   #+cindex: @samp{HTML_HEAD}, keyword
  12665   #+vindex: org-html-head
  12666   Arbitrary lines for appending to the HTML document's head
  12667   (~org-html-head~).
  12668 
  12669 - =HTML_HEAD_EXTRA= ::
  12670 
  12671   #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
  12672   #+vindex: org-html-head-extra
  12673   More arbitrary lines for appending to the HTML document's head
  12674   (~org-html-head-extra~).
  12675 
  12676 - =KEYWORDS= ::
  12677 
  12678   #+cindex: @samp{KEYWORDS}, keyword
  12679   Keywords to describe the document's content.  HTML exporter inserts
  12680   these keywords as HTML meta tags.  For long keywords, use multiple
  12681   =KEYWORDS= lines.
  12682 
  12683 - =LATEX_HEADER= ::
  12684 
  12685   #+cindex: @samp{LATEX_HEADER}, keyword
  12686   Arbitrary lines for appending to the preamble; HTML exporter appends
  12687   when transcoding LaTeX fragments to images (see [[*Math formatting in
  12688   HTML export]]).
  12689 
  12690 - =SUBTITLE= ::
  12691 
  12692   #+cindex: @samp{SUBTITLE}, keyword
  12693   The document's subtitle.  HTML exporter formats subtitle if document
  12694   type is =HTML5= and the CSS has a =subtitle= class.
  12695 
  12696 Some of these keywords are explained in more detail in the following
  12697 sections of the manual.
  12698 
  12699 *** HTML doctypes
  12700 :PROPERTIES:
  12701 :DESCRIPTION: Exporting various (X)HTML flavors.
  12702 :END:
  12703 
  12704 Org can export to various (X)HTML flavors.
  12705 
  12706 #+vindex: org-html-doctype
  12707 #+vindex: org-html-doctype-alist
  12708 Set the ~org-html-doctype~ variable for different (X)HTML variants.
  12709 Depending on the variant, the HTML exporter adjusts the syntax of HTML
  12710 conversion accordingly.  Org includes the following ready-made
  12711 variants:
  12712 
  12713 - ~"html4-strict"~
  12714 - ~"html4-transitional"~
  12715 - ~"html4-frameset"~
  12716 - ~"xhtml-strict"~
  12717 - ~"xhtml-transitional"~
  12718 - ~"xhtml-frameset"~
  12719 - ~"xhtml-11"~
  12720 - ~"html5"~
  12721 - ~"xhtml5"~
  12722 
  12723 #+texinfo: @noindent
  12724 See the variable ~org-html-doctype-alist~ for details.  The default is
  12725 ~"xhtml-strict"~.
  12726 
  12727 #+vindex: org-html-html5-fancy
  12728 #+cindex: @samp{HTML5}, export new elements
  12729 Org's HTML exporter does not by default enable new block elements
  12730 introduced with the HTML5 standard.  To enable them, set
  12731 ~org-html-html5-fancy~ to non-~nil~.  Or use an =OPTIONS= line in the
  12732 file to set =html5-fancy=.
  12733 
  12734 HTML5 documents can now have arbitrary =#+BEGIN= ... =#+END= blocks.
  12735 For example:
  12736 
  12737 #+begin_example
  12738 ,#+BEGIN_aside
  12739   Lorem ipsum
  12740 ,#+END_aside
  12741 #+end_example
  12742 
  12743 #+texinfo: @noindent
  12744 exports to:
  12745 
  12746 #+begin_src html
  12747 <aside>
  12748   <p>Lorem ipsum</p>
  12749 </aside>
  12750 #+end_src
  12751 
  12752 #+texinfo: @noindent
  12753 while this:
  12754 
  12755 #+begin_example
  12756 ,#+ATTR_HTML: :controls controls :width 350
  12757 ,#+BEGIN_video
  12758 ,#+HTML: <source src="movie.mp4" type="video/mp4">
  12759 ,#+HTML: <source src="movie.ogg" type="video/ogg">
  12760 Your browser does not support the video tag.
  12761 ,#+END_video
  12762 #+end_example
  12763 
  12764 #+texinfo: @noindent
  12765 exports to:
  12766 
  12767 #+begin_src html
  12768 <video controls="controls" width="350">
  12769   <source src="movie.mp4" type="video/mp4">
  12770   <source src="movie.ogg" type="video/ogg">
  12771   <p>Your browser does not support the video tag.</p>
  12772 </video>
  12773 #+end_src
  12774 
  12775 #+vindex: org-html-html5-elements
  12776 When special blocks do not have a corresponding HTML5 element, the
  12777 HTML exporter reverts to standard translation (see
  12778 ~org-html-html5-elements~).  For example, =#+BEGIN_lederhosen= exports
  12779 to ~<div class="lederhosen">~.
  12780 
  12781 Special blocks cannot have headlines.  For the HTML exporter to wrap
  12782 the headline and its contents in ~<section>~ or ~<article>~ tags, set
  12783 the =HTML_CONTAINER= property for the headline.
  12784 
  12785 *** HTML preamble and postamble
  12786 :PROPERTIES:
  12787 :DESCRIPTION: Inserting preamble and postamble.
  12788 :END:
  12789 #+vindex: org-html-preamble
  12790 #+vindex: org-html-postamble
  12791 #+vindex: org-html-preamble-format
  12792 #+vindex: org-html-postamble-format
  12793 #+vindex: org-html-validation-link
  12794 #+vindex: org-export-creator-string
  12795 #+vindex: org-export-time-stamp-file
  12796 
  12797 The HTML exporter has delineations for preamble and postamble.  The
  12798 default value for ~org-html-preamble~ is ~t~, which makes the HTML
  12799 exporter insert the preamble.  See the variable
  12800 ~org-html-preamble-format~ for the format string.
  12801 
  12802 Set ~org-html-preamble~ to a string to override the default format
  12803 string.  If the string is a function, the HTML exporter expects the
  12804 function to return a string upon execution.  The HTML exporter inserts
  12805 this string in the preamble.  The HTML exporter does not insert
  12806 a preamble if ~org-html-preamble~ is set ~nil~.
  12807 
  12808 The default value for ~org-html-postamble~ is ~auto~, which makes the
  12809 HTML exporter build a postamble from looking up author's name, email
  12810 address, creator's name, and date.  Set ~org-html-postamble~ to ~t~ to
  12811 insert the postamble in the format specified in the
  12812 ~org-html-postamble-format~ variable.  The HTML exporter does not
  12813 insert a postamble if ~org-html-postamble~ is set to ~nil~.
  12814 
  12815 *** Quoting HTML tags
  12816 :PROPERTIES:
  12817 :DESCRIPTION: Using direct HTML in Org files.
  12818 :END:
  12819 
  12820 The HTML export back-end transforms =<= and =>= to =&lt;= and =&gt;=.
  12821 To include raw HTML code in the Org file so the HTML export back-end
  12822 can insert that HTML code in the output, use this inline syntax:
  12823 =@@html:...@@=.  For example:
  12824 
  12825 : @@html:<b>@@bold text@@html:</b>@@
  12826 
  12827 #+cindex: @samp{HTML}, keyword
  12828 #+cindex: @samp{BEGIN_EXPORT html}
  12829 For larger raw HTML code blocks, use these HTML export code blocks:
  12830 
  12831 #+begin_example
  12832 ,#+HTML: Literal HTML code for export
  12833 
  12834 ,#+BEGIN_EXPORT html
  12835   All lines between these markers are exported literally
  12836 ,#+END_EXPORT
  12837 #+end_example
  12838 
  12839 *** Headlines in HTML export
  12840 :PROPERTIES:
  12841 :DESCRIPTION: Formatting headlines.
  12842 :END:
  12843 #+cindex: headlines, in HTML export
  12844 
  12845 Headlines are exported to =<h1>=, =<h2>=, etc.  Each headline gets the
  12846 =id= attribute from =CUSTOM_ID= property, or a unique generated value,
  12847 see [[*Internal Links]].
  12848 
  12849 #+vindex: org-html-self-link-headlines
  12850 When ~org-html-self-link-headlines~ is set to a non-~nil~ value, the
  12851 text of the headlines is also wrapped in =<a>= tags.  These tags have
  12852 a =href= attribute making the headlines link to themselves.
  12853 
  12854 *** Links in HTML export
  12855 :PROPERTIES:
  12856 :DESCRIPTION: Inserting and formatting links.
  12857 :END:
  12858 #+cindex: links, in HTML export
  12859 #+cindex: internal links, in HTML export
  12860 #+cindex: external links, in HTML export
  12861 
  12862 The HTML export back-end transforms Org's internal links (see
  12863 [[*Internal Links]]) to equivalent HTML links in the output.  The back-end
  12864 similarly handles Org's automatic links created by radio targets (see
  12865 [[*Radio Targets]]) similarly.  For Org links to external files, the
  12866 back-end transforms the links to /relative/ paths.
  12867 
  12868 #+vindex: org-html-link-org-files-as-html
  12869 For Org links to other =.org= files, the back-end automatically
  12870 changes the file extension to =.html= and makes file paths relative.
  12871 If the =.org= files have an equivalent =.html= version at the same
  12872 location, then the converted links should work without any further
  12873 manual intervention.  However, to disable this automatic path
  12874 translation, set ~org-html-link-org-files-as-html~ to ~nil~.  When
  12875 disabled, the HTML export back-end substitutes the ID-based links in
  12876 the HTML output.  For more about linking files when publishing to
  12877 a directory, see [[*Publishing links]].
  12878 
  12879 Org files can also have special directives to the HTML export
  12880 back-end.  For example, by using =#+ATTR_HTML= lines to specify new
  12881 format attributes to ~<a>~ or ~<img>~ tags.  This example shows
  12882 changing the link's title and style:
  12883 
  12884 #+cindex: @samp{ATTR_HTML}, keyword
  12885 #+begin_example
  12886 ,#+ATTR_HTML: :title The Org mode homepage :style color:red;
  12887 [[https://orgmode.org]]
  12888 #+end_example
  12889 
  12890 *** Tables in HTML export
  12891 :PROPERTIES:
  12892 :DESCRIPTION: How to modify the formatting of tables.
  12893 :END:
  12894 #+cindex: tables, in HTML
  12895 #+vindex: org-export-html-table-tag
  12896 
  12897 The HTML export back-end uses ~org-html-table-default-attributes~ when
  12898 exporting Org tables to HTML.  By default, the exporter does not draw
  12899 frames and cell borders.  To change for this for a table, use the
  12900 following lines before the table in the Org file:
  12901 
  12902 #+cindex: @samp{CAPTION}, keyword
  12903 #+cindex: @samp{ATTR_HTML}, keyword
  12904 #+begin_example
  12905 ,#+CAPTION: This is a table with lines around and between cells
  12906 ,#+ATTR_HTML: :border 2 :rules all :frame border
  12907 #+end_example
  12908 
  12909 The HTML export back-end preserves column groupings in Org tables (see
  12910 [[*Column Groups]]) when exporting to HTML.
  12911 
  12912 Additional options for customizing tables for HTML export.
  12913 
  12914 - ~org-html-table-align-individual-fields~ ::
  12915 
  12916   #+vindex: org-html-table-align-individual-fields
  12917   Non-~nil~ attaches style attributes for alignment to each table
  12918   field.
  12919 
  12920 - ~org-html-table-caption-above~ ::
  12921 
  12922   #+vindex: org-html-table-caption-above
  12923   Non-~nil~ places caption string at the beginning of the table.
  12924 
  12925 - ~org-html-table-data-tags~ ::
  12926 
  12927   #+vindex: org-html-table-data-tags
  12928   Opening and ending tags for table data fields.
  12929 
  12930 - ~org-html-table-default-attributes~ ::
  12931 
  12932   #+vindex: org-html-table-default-attributes
  12933   Default attributes and values for table tags.
  12934 
  12935 - ~org-html-table-header-tags~ ::
  12936 
  12937   #+vindex: org-html-table-header-tags
  12938   Opening and ending tags for table's header fields.
  12939 
  12940 - ~org-html-table-row-tags~ ::
  12941 
  12942   #+vindex: org-html-table-row-tags
  12943   Opening and ending tags for table rows.
  12944 
  12945 - ~org-html-table-use-header-tags-for-first-column~ ::
  12946 
  12947   #+vindex: org-html-table-use-header-tags-for-first-column
  12948   Non-~nil~ formats column one in tables with header tags.
  12949 
  12950 *** Images in HTML export
  12951 :PROPERTIES:
  12952 :DESCRIPTION: How to insert figures into HTML output.
  12953 :END:
  12954 #+cindex: images, inline in HTML
  12955 #+cindex: inlining images in HTML
  12956 
  12957 The HTML export back-end has features to convert Org image links to
  12958 HTML inline images and HTML clickable image links.
  12959 
  12960 #+vindex: org-html-inline-images
  12961 When the link in the Org file has no description, the HTML export
  12962 back-end by default in-lines that image.  For example:
  12963 =[[file:myimg.jpg]]= is in-lined, while =[[file:myimg.jpg][the image]]= links to the text,
  12964 =the image=.  For more details, see the variable
  12965 ~org-html-inline-images~.
  12966 
  12967 On the other hand, if the description part of the Org link is itself
  12968 another link, such as =file:= or =http:= URL pointing to an image, the
  12969 HTML export back-end in-lines this image and links to the main image.
  12970 This Org syntax enables the back-end to link low-resolution thumbnail
  12971 to the high-resolution version of the image, as shown in this example:
  12972 
  12973 : [[file:highres.jpg][file:thumb.jpg]]
  12974 
  12975 To change attributes of in-lined images, use =#+ATTR_HTML= lines in
  12976 the Org file.  This example shows realignment to right, and adds ~alt~
  12977 and ~title~ attributes in support of text viewers and modern web
  12978 accessibility standards.
  12979 
  12980 #+cindex: @samp{CAPTION}, keyword
  12981 #+cindex: @samp{ATTR_HTML}, keyword
  12982 #+begin_example
  12983 ,#+CAPTION: A black cat stalking a spider
  12984 ,#+ATTR_HTML: :alt cat/spider image :title Action! :align right
  12985 [[./img/a.jpg]]
  12986 #+end_example
  12987 
  12988 The HTML export back-end copies the =http= links from the Org file
  12989 as-is.
  12990 
  12991 *** Math formatting in HTML export
  12992 :PROPERTIES:
  12993 :DESCRIPTION: Beautiful math also on the web.
  12994 :END:
  12995 #+cindex: MathJax
  12996 #+cindex: dvipng
  12997 #+cindex: dvisvgm
  12998 #+cindex: ImageMagick
  12999 
  13000 #+vindex: org-html-mathjax-options~
  13001 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
  13002 different ways on HTML pages.  The default is to use the [[https://www.mathjax.org][MathJax]],
  13003 which should work out of the box with Org[fn:129][fn:130].  Some MathJax
  13004 display options can be configured via ~org-html-mathjax-options~, or
  13005 in the buffer.  For example, with the following settings,
  13006 
  13007 #+begin_example
  13008 ,#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
  13009 ,#+HTML_MATHJAX: cancel.js noErrors.js
  13010 #+end_example
  13011 
  13012 #+texinfo: @noindent
  13013 equation labels are displayed on the left margin and equations are
  13014 five em from the left margin.  In addition, it loads the two MathJax
  13015 extensions =cancel.js= and =noErrors.js=[fn:131].
  13016 
  13017 #+vindex: org-html-mathjax-template
  13018 See the docstring of ~org-html-mathjax-options~ for all supported
  13019 variables.  The MathJax template can be configure via
  13020 ~org-html-mathjax-template~.
  13021 
  13022 If you prefer, you can also request that LaTeX fragments are processed
  13023 into small images that will be inserted into the browser page.  Before
  13024 the availability of MathJax, this was the default method for Org
  13025 files.  This method requires that the dvipng program, dvisvgm or
  13026 ImageMagick suite is available on your system.  You can still get this
  13027 processing with
  13028 
  13029 : #+OPTIONS: tex:dvipng
  13030 
  13031 : #+OPTIONS: tex:dvisvgm
  13032 
  13033 #+texinfo: @noindent
  13034 or
  13035 
  13036 : #+OPTIONS: tex:imagemagick
  13037 
  13038 *** Text areas in HTML export
  13039 :PROPERTIES:
  13040 :DESCRIPTION: An alternate way to show an example.
  13041 :END:
  13042 
  13043 #+cindex: text areas, in HTML
  13044 Before Org mode's Babel, one popular approach to publishing code in
  13045 HTML was by using =:textarea=.  The advantage of this approach was
  13046 that copying and pasting was built into browsers with simple
  13047 JavaScript commands.  Even editing before pasting was made simple.
  13048 
  13049 The HTML export back-end can create such text areas.  It requires an
  13050 =#+ATTR_HTML= line as shown in the example below with the =:textarea=
  13051 option.  This must be followed by either an example or a source code
  13052 block.  Other Org block types do not honor the =:textarea= option.
  13053 
  13054 By default, the HTML export back-end creates a text area 80 characters
  13055 wide and height just enough to fit the content.  Override these
  13056 defaults with =:width= and =:height= options on the =#+ATTR_HTML=
  13057 line.
  13058 
  13059 #+begin_example
  13060 ,#+ATTR_HTML: :textarea t :width 40
  13061 ,#+BEGIN_EXAMPLE
  13062   (defun org-xor (a b)
  13063      "Exclusive or."
  13064      (if a (not b) b))
  13065 ,#+END_EXAMPLE
  13066 #+end_example
  13067 
  13068 *** CSS support
  13069 :PROPERTIES:
  13070 :DESCRIPTION: Changing the appearance of the output.
  13071 :END:
  13072 #+cindex: CSS, for HTML export
  13073 #+cindex: HTML export, CSS
  13074 
  13075 #+vindex: org-export-html-todo-kwd-class-prefix
  13076 #+vindex: org-export-html-tag-class-prefix
  13077 You can modify the CSS style definitions for the exported file.  The
  13078 HTML exporter assigns the following special CSS classes[fn:132] to
  13079 appropriate parts of the document---your style specifications may
  13080 change these, in addition to any of the standard classes like for
  13081 headlines, tables, etc.
  13082 
  13083 | ~p.author~           | author information, including email                    |
  13084 | ~p.date~             | publishing date                                        |
  13085 | ~p.creator~          | creator info, about org mode version                   |
  13086 | ~.title~             | document title                                         |
  13087 | ~.subtitle~          | document subtitle                                      |
  13088 | ~.todo~              | TODO keywords, all not-done states                     |
  13089 | ~.done~              | the DONE keywords, all states that count as done       |
  13090 | ~.WAITING~           | each TODO keyword also uses a class named after itself |
  13091 | ~.timestamp~         | timestamp                                              |
  13092 | ~.timestamp-kwd~     | keyword associated with a timestamp, like =SCHEDULED=  |
  13093 | ~.timestamp-wrapper~ | span around keyword plus timestamp                     |
  13094 | ~.tag~               | tag in a headline                                      |
  13095 | ~._HOME~             | each tag uses itself as a class, "@" replaced by "_"   |
  13096 | ~.target~            | target for links                                       |
  13097 | ~.linenr~            | the line number in a code example                      |
  13098 | ~.code-highlighted~  | for highlighting referenced code lines                 |
  13099 | ~div.outline-N~      | div for outline level N (headline plus text)           |
  13100 | ~div.outline-text-N~ | extra div for text at outline level N                  |
  13101 | ~.section-number-N~  | section number in headlines, different for each level  |
  13102 | ~.figure-number~     | label like "Figure 1:"                                 |
  13103 | ~.table-number~      | label like "Table 1:"                                  |
  13104 | ~.listing-number~    | label like "Listing 1:"                                |
  13105 | ~div.figure~         | how to format an in-lined image                        |
  13106 | ~pre.src~            | formatted source code                                  |
  13107 | ~pre.example~        | normal example                                         |
  13108 | ~p.verse~            | verse paragraph                                        |
  13109 | ~div.footnotes~      | footnote section headline                              |
  13110 | ~p.footnote~         | footnote definition paragraph, containing a footnote   |
  13111 | ~.footref~           | a footnote reference number (always a <sup>)           |
  13112 | ~.footnum~           | footnote number in footnote definition (always <sup>)  |
  13113 | ~.org-svg~           | default class for a linked =.svg= image                |
  13114 
  13115 #+vindex: org-html-style-default
  13116 #+vindex: org-html-head
  13117 #+vindex: org-html-head-extra
  13118 #+cindex: @samp{HTML_INCLUDE_STYLE}, keyword
  13119 The HTML export back-end includes a compact default style in each
  13120 exported HTML file.  To override the default style with another style,
  13121 use these keywords in the Org file.  They will replace the global
  13122 defaults the HTML exporter uses.
  13123 
  13124 #+cindex: @samp{HTML_HEAD}, keyword
  13125 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
  13126 #+begin_example
  13127 ,#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
  13128 ,#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
  13129 #+end_example
  13130 
  13131 #+vindex: org-html-head-include-default-style
  13132 To just turn off the default style, customize
  13133 ~org-html-head-include-default-style~ variable, or use this option
  13134 line in the Org file.
  13135 
  13136 #+cindex: @samp{html-style}, @samp{OPTIONS} item
  13137 : #+OPTIONS: html-style:nil
  13138 
  13139 For longer style definitions, either use several =HTML_HEAD= and
  13140 =HTML_HEAD_EXTRA= keywords, or use ~<style> ... </style>~ blocks
  13141 around them.  Both of these approaches can avoid referring to an
  13142 external file.
  13143 
  13144 #+cindex: @samp{HTML_CONTAINER_CLASS}, property
  13145 #+cindex: @samp{HTML_HEADLINE_CLASS}, property
  13146 In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
  13147 property to assign a class to the tree.  In order to specify CSS
  13148 styles for a particular headline, you can use the ID specified in
  13149 a =CUSTOM_ID= property.  You can also assign a specific class to
  13150 a headline with the =HTML_HEADLINE_CLASS= property.
  13151 
  13152 Never change the ~org-html-style-default~ constant.  Instead use other
  13153 simpler ways of customizing as described above.
  13154 
  13155 *** JavaScript supported display of web pages
  13156 :PROPERTIES:
  13157 :DESCRIPTION: Info and folding in a web browser.
  13158 :ALT_TITLE: JavaScript support
  13159 :END:
  13160 
  13161 Sebastian Rose has written a JavaScript program especially designed to
  13162 allow two different ways of viewing HTML files created with Org.  One
  13163 is an /Info/-like mode where each section is displayed separately and
  13164 navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}} keys, and some other
  13165 keys as well, press {{{kbd(?)}}} for an overview of the available keys.  The
  13166 second one has a /folding/ view, much like Org provides inside Emacs.
  13167 The script is available at https://orgmode.org/org-info.js and the
  13168 documentation at https://orgmode.org/worg/code/org-info-js/.  The
  13169 script is hosted on https://orgmode.org, but for reliability, prefer
  13170 installing it on your own web server.
  13171 
  13172 To use this program, just add this line to the Org file:
  13173 
  13174 #+cindex: @samp{INFOJS_OPT}, keyword
  13175 : #+INFOJS_OPT: view:info toc:nil
  13176 
  13177 #+texinfo: @noindent
  13178 The HTML header now has the code needed to automatically invoke the
  13179 script.  For setting options, use the syntax from the above line for
  13180 options described below:
  13181 
  13182 - =path:= ::
  13183 
  13184   The path to the script.  The default is to grab the script from
  13185   [[https://orgmode.org/org-info.js]], but you might want to have a local
  13186   copy and use a path like =../scripts/org-info.js=.
  13187 
  13188 - =view:= ::
  13189 
  13190   Initial view when the website is first shown.  Possible values are:
  13191 
  13192   | =info=     | Info-like interface with one section per page          |
  13193   | =overview= | Folding interface, initially showing only top-level    |
  13194   | =content=  | Folding interface, starting with all headlines visible |
  13195   | =showall=  | Folding interface, all headlines and text visible      |
  13196 
  13197 - =sdepth:= ::
  13198 
  13199   Maximum headline level still considered as an independent section
  13200   for info and folding modes.  The default is taken from
  13201   ~org-export-headline-levels~, i.e., the =H= switch in =OPTIONS=.  If
  13202   this is smaller than in ~org-export-headline-levels~, each
  13203   info/folding section can still contain child headlines.
  13204 
  13205 - =toc:= ::
  13206 
  13207   Should the table of contents /initially/ be visible?  Even when
  13208   =nil=, you can always get to the "toc" with {{{kbd(i)}}}.
  13209 
  13210 - =tdepth:= ::
  13211 
  13212   The depth of the table of contents.  The defaults are taken from the
  13213   variables ~org-export-headline-levels~ and ~org-export-with-toc~.
  13214 
  13215 - =ftoc:= ::
  13216 
  13217   Does the CSS of the page specify a fixed position for the "toc"?  If
  13218   yes, the toc is displayed as a section.
  13219 
  13220 - =ltoc:= ::
  13221 
  13222   Should there be short contents (children) in each section?  Make
  13223   this =above= if the section should be above initial text.
  13224 
  13225 - =mouse:= ::
  13226 
  13227   Headings are highlighted when the mouse is over them.  Should be
  13228   =underline= (default) or a background color like =#cccccc=.
  13229 
  13230 - =buttons:= ::
  13231 
  13232   Should view-toggle buttons be everywhere?  When =nil= (the default),
  13233   only one such button is present.
  13234 
  13235 #+vindex: org-infojs-options
  13236 #+vindex: org-export-html-use-infojs
  13237 You can choose default values for these options by customizing the
  13238 variable ~org-infojs-options~.  If you always want to apply the script
  13239 to your pages, configure the variable ~org-export-html-use-infojs~.
  13240 
  13241 ** LaTeX Export
  13242 :PROPERTIES:
  13243 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF.
  13244 :END:
  13245 #+cindex: @LaTeX{} export
  13246 #+cindex: PDF export
  13247 
  13248 The LaTeX export back-end can handle complex documents, incorporate
  13249 standard or custom LaTeX document classes, generate documents using
  13250 alternate LaTeX engines, and produce fully linked PDF files with
  13251 indexes, bibliographies, and tables of contents, destined for
  13252 interactive online viewing or high-quality print publication.
  13253 
  13254 While the details are covered in-depth in this section, here are some
  13255 quick references to variables for the impatient: for engines, see
  13256 ~org-latex-compiler~; for build sequences, see
  13257 ~org-latex-pdf-process~; for packages, see
  13258 ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~.
  13259 
  13260 An important note about the LaTeX export back-end: it is sensitive to
  13261 blank lines in the Org document.  That's because LaTeX itself depends
  13262 on blank lines to tell apart syntactical elements, such as paragraphs.
  13263 
  13264 *** LaTeX/PDF export commands
  13265 :PROPERTIES:
  13266 :DESCRIPTION: For producing @LaTeX{} and PDF documents.
  13267 :END:
  13268 
  13269 - {{{kbd(C-c C-e l l)}}} (~org-latex-export-to-latex~) ::
  13270 
  13271   #+kindex: C-c C-e l l
  13272   #+findex: org-latex-export-to-latex~
  13273   Export to a LaTeX file with a =.tex= extension.  For =myfile.org=,
  13274   Org exports to =myfile.tex=, overwriting without warning.
  13275 
  13276 - {{{kbd(C-c C-e l L)}}} (~org-latex-export-as-latex~) ::
  13277 
  13278   #+kindex: C-c C-e l L
  13279   #+findex: org-latex-export-as-latex
  13280   Export to a temporary buffer.  Do not create a file.
  13281 
  13282 - {{{kbd(C-c C-e l p)}}} (~org-latex-export-to-pdf~) ::
  13283 
  13284   #+kindex: C-c C-e l p
  13285   #+findex: org-latex-export-to-pdf
  13286   Export as LaTeX file and convert it to PDF file.
  13287 
  13288 - {{{kbd(C-c C-e l o)}}} ::
  13289 
  13290   #+kindex: C-c C-e l o
  13291   Export as LaTeX file and convert it to PDF, then open the PDF using
  13292   the default viewer.
  13293 
  13294 - {{{kbd(M-x org-export-region-as-latex)}}} ::
  13295 
  13296   Convert the region to LaTeX under the assumption that it was in Org
  13297   mode syntax before.  This is a global command that can be invoked in
  13298   any buffer.
  13299 
  13300 #+vindex: org-latex-compiler
  13301 #+vindex: org-latex-bibtex-compiler
  13302 #+vindex: org-latex-default-packages-alist
  13303 #+cindex: pdflatex
  13304 #+cindex: xelatex
  13305 #+cindex: lualatex
  13306 #+cindex: @samp{LATEX_COMPILER}, keyword
  13307 The LaTeX export back-end can use any of these LaTeX engines:
  13308 =pdflatex=, =xelatex=, and =lualatex=.  These engines compile LaTeX
  13309 files with different compilers, packages, and output options.  The
  13310 LaTeX export back-end finds the compiler version to use from
  13311 ~org-latex-compiler~ variable or the =#+LATEX_COMPILER= keyword in the
  13312 Org file.  See the docstring for the
  13313 ~org-latex-default-packages-alist~ for loading packages with certain
  13314 compilers.  Also see ~org-latex-bibtex-compiler~ to set the
  13315 bibliography compiler[fn:133].
  13316 
  13317 *** LaTeX specific export settings
  13318 :PROPERTIES:
  13319 :DESCRIPTION: Unique to this @LaTeX{} back-end.
  13320 :END:
  13321 
  13322 The LaTeX export back-end has several additional keywords for
  13323 customizing LaTeX output.  Setting these keywords works similar to the
  13324 general options (see [[*Export Settings]]).
  13325 
  13326 #+attr_texinfo: :sep ,
  13327 - =DESCRIPTION= ::
  13328   #+cindex: @samp{DESCRIPTION}, keyword
  13329   #+vindex: org-latex-hyperref-template
  13330   #+vindex: org-latex-title-command
  13331   The document's description.  The description along with author name,
  13332   keywords, and related file metadata are inserted in the output file
  13333   by the hyperref package.  See ~org-latex-hyperref-template~ for
  13334   customizing metadata items.  See ~org-latex-title-command~ for
  13335   typesetting description into the document's front matter.  Use
  13336   multiple =DESCRIPTION= keywords for long descriptions.
  13337 
  13338 - =LANGUAGE= ::
  13339   #+cindex: @samp{LANGUAGE}, keyword
  13340   #+vindex: org-latex-packages-alist
  13341   In order to be effective, the =babel= or =polyglossia=
  13342   packages---according to the LaTeX compiler used---must be loaded
  13343   with the appropriate language as argument.  This can be accomplished
  13344   by modifying the ~org-latex-packages-alist~ variable, e.g., with the
  13345   following snippet:
  13346 
  13347   #+begin_src emacs-lisp
  13348   (add-to-list 'org-latex-packages-alist
  13349                '("AUTO" "babel" t ("pdflatex")))
  13350   (add-to-list 'org-latex-packages-alist
  13351                '("AUTO" "polyglossia" t ("xelatex" "lualatex")))
  13352   #+end_src
  13353 
  13354 - =LATEX_CLASS= ::
  13355 
  13356   #+cindex: @samp{LATEX_CLASS}, keyword
  13357   #+vindex: org-latex-default-class
  13358   #+vindex: org-latex-classes
  13359   This is LaTeX document class, such as /article/, /report/, /book/,
  13360   and so on, which contain predefined preamble and headline level
  13361   mapping that the LaTeX export back-end needs.  The back-end reads
  13362   the default class name from the ~org-latex-default-class~ variable.
  13363   Org has /article/ as the default class.  A valid default class must
  13364   be an element of ~org-latex-classes~.
  13365 
  13366 - =LATEX_CLASS_OPTIONS= ::
  13367 
  13368   #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
  13369   Options the LaTeX export back-end uses when calling the LaTeX
  13370   document class.
  13371 
  13372 - =LATEX_COMPILER= ::
  13373 
  13374   #+cindex: @samp{LATEX_COMPILER}, keyword
  13375   #+vindex: org-latex-compiler
  13376   The compiler, such as =pdflatex=, =xelatex=, =lualatex=, for
  13377   producing the PDF.  See ~org-latex-compiler~.
  13378 
  13379 - =LATEX_HEADER=, =LATEX_HEADER_EXTRA= ::
  13380 
  13381   #+cindex: @samp{LATEX_HEADER}, keyword
  13382   #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
  13383   #+vindex: org-latex-classes
  13384   Arbitrary lines to add to the document's preamble, before the
  13385   hyperref settings.  See ~org-latex-classes~ for adjusting the
  13386   structure and order of the LaTeX headers.
  13387 
  13388 - =KEYWORDS= ::
  13389 
  13390   #+cindex: @samp{KEYWORDS}, keyword
  13391   #+vindex: org-latex-hyperref-template
  13392   #+vindex: org-latex-title-command
  13393   The keywords for the document.  The description along with author
  13394   name, keywords, and related file metadata are inserted in the output
  13395   file by the hyperref package.  See ~org-latex-hyperref-template~ for
  13396   customizing metadata items.  See ~org-latex-title-command~ for
  13397   typesetting description into the document's front matter.  Use
  13398   multiple =KEYWORDS= lines if necessary.
  13399 
  13400 - =SUBTITLE= ::
  13401 
  13402   #+cindex: @samp{SUBTITLE}, keyword
  13403   #+vindex: org-latex-subtitle-separate
  13404   #+vindex: org-latex-subtitle-format
  13405   The document's subtitle.  It is typeset as per
  13406   ~org-latex-subtitle-format~.  If ~org-latex-subtitle-separate~ is
  13407   non-~nil~, it is typed outside of the ~\title~ macro.  See
  13408   ~org-latex-hyperref-template~ for customizing metadata items.  See
  13409   ~org-latex-title-command~ for typesetting description into the
  13410   document's front matter.
  13411 
  13412 The following sections have further details.
  13413 
  13414 *** LaTeX header and sectioning structure
  13415 :PROPERTIES:
  13416 :DESCRIPTION: Setting up the export file structure.
  13417 :ALT_TITLE: LaTeX header and sectioning
  13418 :END:
  13419 #+cindex: @LaTeX{} class
  13420 #+cindex: @LaTeX{} sectioning structure
  13421 #+cindex: @LaTeX{} header
  13422 #+cindex: header, for @LaTeX{} files
  13423 #+cindex: sectioning structure, for @LaTeX{} export
  13424 
  13425 The LaTeX export back-end converts the first three of Org's outline
  13426 levels into LaTeX headlines.  The remaining Org levels are exported as
  13427 lists.  To change this globally for the cut-off point between levels
  13428 and lists, (see [[*Export Settings]]).
  13429 
  13430 By default, the LaTeX export back-end uses the /article/ class.
  13431 
  13432 #+vindex: org-latex-default-class
  13433 #+vindex: org-latex-classes
  13434 #+vindex: org-latex-default-packages-alist
  13435 #+vindex: org-latex-packages-alist
  13436 To change the default class globally, edit ~org-latex-default-class~.
  13437 To change the default class locally in an Org file, add option lines
  13438 =#+LATEX_CLASS: myclass=.  To change the default class for just a part
  13439 of the Org file, set a sub-tree property, =EXPORT_LATEX_CLASS=.  The
  13440 class name entered here must be valid member of ~org-latex-classes~.
  13441 This variable defines a header template for each class into which the
  13442 exporter splices the values of ~org-latex-default-packages-alist~ and
  13443 ~org-latex-packages-alist~.  Use the same three variables to define
  13444 custom sectioning or custom classes.
  13445 
  13446 #+cindex: @samp{LATEX_CLASS}, keyword
  13447 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
  13448 #+cindex: @samp{EXPORT_LATEX_CLASS}, property
  13449 #+cindex: @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
  13450 The LaTeX export back-end sends the =LATEX_CLASS_OPTIONS= keyword and
  13451 =EXPORT_LATEX_CLASS_OPTIONS= property as options to the LaTeX
  13452 ~\documentclass~ macro.  The options and the syntax for specifying
  13453 them, including enclosing them in square brackets, follow LaTeX
  13454 conventions.
  13455 
  13456 : #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
  13457 
  13458 #+cindex: @samp{LATEX_HEADER}, keyword
  13459 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
  13460 The LaTeX export back-end appends values from =LATEX_HEADER= and
  13461 =LATEX_HEADER_EXTRA= keywords to the LaTeX header.  The docstring for
  13462 ~org-latex-classes~ explains in more detail.  Also note that LaTeX
  13463 export back-end does not append =LATEX_HEADER_EXTRA= to the header
  13464 when previewing LaTeX snippets (see [[*Previewing LaTeX fragments]]).
  13465 
  13466 A sample Org file with the above headers:
  13467 
  13468 #+begin_example
  13469 ,#+LATEX_CLASS: article
  13470 ,#+LATEX_CLASS_OPTIONS: [a4paper]
  13471 ,#+LATEX_HEADER: \usepackage{xyz}
  13472 
  13473 ,* Headline 1
  13474   some text
  13475 ,* Headline 2
  13476   some more text
  13477 #+end_example
  13478 
  13479 *** Quoting LaTeX code
  13480 :PROPERTIES:
  13481 :DESCRIPTION: Incorporating literal @LaTeX{} code.
  13482 :END:
  13483 
  13484 The LaTeX export back-end can insert any arbitrary LaTeX code, see
  13485 [[*Embedded LaTeX]].  There are three ways to embed such code in the Org
  13486 file and they all use different quoting syntax.
  13487 
  13488 #+cindex: inline, in @LaTeX{} export
  13489 Inserting in-line quoted with @ symbols:
  13490 
  13491 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph.
  13492 
  13493 #+cindex: @samp{LATEX}, keyword
  13494 Inserting as one or more keyword lines in the Org file:
  13495 
  13496 : #+LATEX: any arbitrary LaTeX code
  13497 
  13498 #+cindex: @samp{BEGIN_EXPORT latex}
  13499 Inserting as an export block in the Org file, where the back-end
  13500 exports any code between begin and end markers:
  13501 
  13502 #+begin_example
  13503 ,#+BEGIN_EXPORT latex
  13504   any arbitrary LaTeX code
  13505 ,#+END_EXPORT
  13506 #+end_example
  13507 
  13508 *** Tables in LaTeX export
  13509 :PROPERTIES:
  13510 :DESCRIPTION: Options for exporting tables to @LaTeX{}.
  13511 :END:
  13512 #+cindex: tables, in @LaTeX{} export
  13513 
  13514 The LaTeX export back-end can pass several LaTeX attributes for table
  13515 contents and layout.  Besides specifying a label (see [[*Internal Links]])
  13516 and a caption (see [[*Captions]]), the other valid LaTeX attributes
  13517 include:
  13518 
  13519 #+attr_texinfo: :sep ,
  13520 - =:mode= ::
  13521 
  13522   #+vindex: org-latex-default-table-mode
  13523   The LaTeX export back-end wraps the table differently depending on
  13524   the mode for accurate rendering of math symbols.  Mode is either
  13525   =table=, =math=, =inline-math= or =verbatim=.
  13526 
  13527   For =math= or =inline-math= mode, LaTeX export back-end wraps the
  13528   table in a math environment, but every cell in it is exported as-is.
  13529   The LaTeX export back-end determines the default mode from
  13530   ~org-latex-default-table-mode~.  The LaTeX export back-end merges
  13531   contiguous tables in the same mode into a single environment.
  13532 
  13533 - =:environment= ::
  13534 
  13535   #+vindex: org-latex-default-table-environment
  13536   Set the default LaTeX table environment for the LaTeX export
  13537   back-end to use when exporting Org tables.  Common LaTeX table
  13538   environments are provided by these packages: tabularx, longtable,
  13539   array, tabu, and bmatrix.  For packages, such as tabularx and tabu,
  13540   or any newer replacements, include them in the
  13541   ~org-latex-packages-alist~ variable so the LaTeX export back-end can
  13542   insert the appropriate load package headers in the converted LaTeX
  13543   file.  Look in the docstring for the ~org-latex-packages-alist~
  13544   variable for configuring these packages for LaTeX snippet previews,
  13545   if any.
  13546 
  13547 - =:caption= ::
  13548 
  13549   Use =CAPTION= keyword to set a simple caption for a table (see
  13550   [[*Captions]]).  For custom captions, use =:caption= attribute, which
  13551   accepts raw LaTeX code.  =:caption= value overrides =CAPTION= value.
  13552 
  13553 - =:float=, =:placement= ::
  13554 
  13555   The table environments by default are not floats in LaTeX.  To make
  13556   them floating objects use =:float= with one of the following
  13557   options: =sideways=, =multicolumn=, =t=, and =nil=.
  13558 
  13559   LaTeX floats can also have additional layout =:placement=
  13560   attributes.  These are the usual =[h t b p ! H]= permissions
  13561   specified in square brackets.  Note that for =:float sideways=
  13562   tables, the LaTeX export back-end ignores =:placement= attributes.
  13563 
  13564 - =:align=, =:font=, =:width= ::
  13565 
  13566   The LaTeX export back-end uses these attributes for regular tables
  13567   to set their alignments, fonts, and widths.
  13568 
  13569 - =:spread= ::
  13570 
  13571   When =:spread= is non-~nil~, the LaTeX export back-end spreads or
  13572   shrinks the table by the =:width= for tabu and longtabu
  13573   environments.  =:spread= has no effect if =:width= is not set.
  13574 
  13575 - =:booktabs=, =:center=, =:rmlines= ::
  13576 
  13577   #+vindex: org-latex-tables-booktabs
  13578   #+vindex: org-latex-tables-centered
  13579   All three commands are toggles.  =:booktabs= brings in modern
  13580   typesetting enhancements to regular tables.  The booktabs package
  13581   has to be loaded through ~org-latex-packages-alist~.  =:center= is
  13582   for centering the table.  =:rmlines= removes all but the very first
  13583   horizontal line made of ASCII characters from "table.el" tables
  13584   only.
  13585 
  13586 - =:math-prefix=, =:math-suffix=, =:math-arguments= ::
  13587 
  13588   The LaTeX export back-end inserts =:math-prefix= string value in
  13589   a math environment before the table.  The LaTeX export back-end
  13590   inserts =:math-suffix= string value in a math environment after the
  13591   table.  The LaTeX export back-end inserts =:math-arguments= string
  13592   value between the macro name and the table's contents.
  13593   =:math-arguments= comes in use for matrix macros that require more
  13594   than one argument, such as =qbordermatrix=.
  13595 
  13596 LaTeX table attributes help formatting tables for a wide range of
  13597 situations, such as matrix product or spanning multiple pages:
  13598 
  13599 #+begin_example
  13600 ,#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
  13601 | ... | ... |
  13602 | ... | ... |
  13603 
  13604 ,#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
  13605 | a | b |
  13606 | c | d |
  13607 ,#+ATTR_LATEX: :mode math :environment bmatrix
  13608 | 1 | 2 |
  13609 | 3 | 4 |
  13610 #+end_example
  13611 
  13612 Set the caption with the LaTeX command
  13613 =\bicaption{HeadingA}{HeadingB}=:
  13614 
  13615 #+begin_example
  13616 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
  13617 | ... | ... |
  13618 | ... | ... |
  13619 #+end_example
  13620 
  13621 *** Images in LaTeX export
  13622 :PROPERTIES:
  13623 :DESCRIPTION: How to insert figures into @LaTeX{} output.
  13624 :END:
  13625 #+cindex: images, inline in LaTeX
  13626 #+cindex: inlining images in LaTeX
  13627 #+cindex: @samp{ATTR_LATEX}, keyword
  13628 
  13629 The LaTeX export back-end processes image links in Org files that do
  13630 not have descriptions, such as these links =[[file:img.jpg]]= or
  13631 =[[./img.jpg]]=, as direct image insertions in the final PDF output.  In
  13632 the PDF, they are no longer links but actual images embedded on the
  13633 page.  The LaTeX export back-end uses =\includegraphics= macro to
  13634 insert the image.  But for TikZ (http://sourceforge.net/projects/pgf/)
  13635 images, the back-end uses an ~\input~ macro wrapped within
  13636 a ~tikzpicture~ environment.
  13637 
  13638 For specifying image =:width=, =:height=, =:scale= and other =:options=,
  13639 use this syntax:
  13640 
  13641 #+begin_example
  13642 ,#+ATTR_LATEX: :width 5cm :options angle=90
  13643 [[./img/sed-hr4049.pdf]]
  13644 #+end_example
  13645 
  13646 A =:scale= attribute overrides both =:width= and =:height= attributes.
  13647 
  13648 For custom commands for captions, use the =:caption= attribute.  It
  13649 overrides the default =#+CAPTION= value:
  13650 
  13651 #+begin_example
  13652 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
  13653 [[./img/sed-hr4049.pdf]]
  13654 #+end_example
  13655 
  13656 When captions follow the method as described in [[*Captions]], the LaTeX
  13657 export back-end wraps the picture in a floating =figure= environment.
  13658 To float an image without specifying a caption, set the =:float=
  13659 attribute to one of the following:
  13660 
  13661 - =t= ::
  13662 
  13663   For a standard =figure= environment; used by default whenever an
  13664   image has a caption.
  13665 
  13666 - =multicolumn= ::
  13667 
  13668   To span the image across multiple columns of a page; the back-end
  13669   wraps the image in a =figure*= environment.
  13670 
  13671 - =wrap= ::
  13672 
  13673   For text to flow around the image on the right; the figure occupies
  13674   the left half of the page.
  13675 
  13676 - =sideways= ::
  13677 
  13678   For a new page with the image sideways, rotated ninety degrees, in
  13679   a =sidewaysfigure= environment; overrides =:placement= setting.
  13680 
  13681 - =nil= ::
  13682 
  13683   To avoid a =:float= even if using a caption.
  13684 
  13685 Use the =placement= attribute to modify a floating environment's
  13686 placement.
  13687 
  13688 #+begin_example
  13689 ,#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth}
  13690 [[./img/hst.png]]
  13691 #+end_example
  13692 
  13693 #+vindex: org-latex-images-centered
  13694 #+cindex: center image in LaTeX export
  13695 #+cindex: image, centering in LaTeX export
  13696 The LaTeX export back-end centers all images by default.  Setting
  13697 =:center= to =nil= disables centering.  To disable centering globally,
  13698 set ~org-latex-images-centered~ to =nil=.
  13699 
  13700 Set the =:comment-include= attribute to non-~nil~ value for the LaTeX
  13701 export back-end to comment out the =\includegraphics= macro.
  13702 
  13703 *** Plain lists in LaTeX export
  13704 :PROPERTIES:
  13705 :DESCRIPTION: Attributes specific to lists.
  13706 :END:
  13707 
  13708 #+cindex: plain lists, in @LaTeX{} export
  13709 #+cindex: @samp{ATTR_LATEX}, keyword
  13710 The LaTeX export back-end accepts the =environment= and =options=
  13711 attributes for plain lists.  Both attributes work together for
  13712 customizing lists, as shown in the examples:
  13713 
  13714 #+begin_example
  13715 ,#+LATEX_HEADER: \usepackage[inline]{enumitem}
  13716 Some ways to say "Hello":
  13717 ,#+ATTR_LATEX: :environment itemize*
  13718 ,#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}]
  13719 - Hola
  13720 - Bonjour
  13721 - Guten Tag.
  13722 #+end_example
  13723 
  13724 Since LaTeX supports only four levels of nesting for lists, use an
  13725 external package, such as =enumitem= in LaTeX, for levels deeper than
  13726 four:
  13727 
  13728 #+begin_example
  13729 ,#+LATEX_HEADER: \usepackage{enumitem}
  13730 ,#+LATEX_HEADER: \renewlist{itemize}{itemize}{9}
  13731 ,#+LATEX_HEADER: \setlist[itemize]{label=$\circ$}
  13732 - One
  13733   - Two
  13734     - Three
  13735       - Four
  13736         - Five
  13737 #+end_example
  13738 
  13739 *** Source blocks in LaTeX export
  13740 :PROPERTIES:
  13741 :DESCRIPTION: Attributes specific to source code blocks.
  13742 :END:
  13743 #+cindex: source blocks, in @LaTeX{} export
  13744 #+cindex: @samp{ATTR_LATEX}, keyword
  13745 
  13746 The LaTeX export back-end can make source code blocks into floating
  13747 objects through the attributes =:float= and =:options=.  For =:float=:
  13748 
  13749 - =t= ::
  13750 
  13751   Makes a source block float; by default floats any source block with
  13752   a caption.
  13753 
  13754 - =multicolumn= ::
  13755 
  13756   Spans the source block across multiple columns of a page.
  13757 
  13758 - =nil= ::
  13759 
  13760   Avoids a =:float= even if using a caption; useful for source code
  13761   blocks that may not fit on a page.
  13762 
  13763 #+begin_example
  13764 ,#+ATTR_LATEX: :float nil
  13765 ,#+BEGIN_SRC emacs-lisp
  13766   Lisp code that may not fit in a single page.
  13767 ,#+END_SRC
  13768 #+end_example
  13769 
  13770 #+vindex: org-latex-listings-options
  13771 #+vindex: org-latex-minted-options
  13772 The LaTeX export back-end passes string values in =:options= to LaTeX
  13773 packages for customization of that specific source block.  In the
  13774 example below, the =:options= are set for Minted.  Minted is a source
  13775 code highlighting LaTeX package with many configurable options[fn:134].
  13776 
  13777 #+begin_example
  13778 ,#+ATTR_LATEX: :options commentstyle=\bfseries
  13779 ,#+BEGIN_SRC emacs-lisp
  13780   (defun Fib (n)
  13781     (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
  13782 ,#+END_SRC
  13783 #+end_example
  13784 
  13785 To apply similar configuration options for all source blocks in
  13786 a file, use the ~org-latex-listings-options~ and
  13787 ~org-latex-minted-options~ variables.
  13788 
  13789 *** Example blocks in LaTeX export
  13790 :PROPERTIES:
  13791 :DESCRIPTION: Attributes specific to example blocks.
  13792 :END:
  13793 #+cindex: example blocks, in @LaTeX{} export
  13794 #+cindex: verbatim blocks, in @LaTeX{} export
  13795 #+cindex: @samp{ATTR_LATEX}, keyword
  13796 
  13797 The LaTeX export back-end wraps the contents of example blocks in
  13798 a =verbatim= environment.  To change this behavior to use another
  13799 environment globally, specify an appropriate export filter (see
  13800 [[*Advanced Export Configuration]]).  To change this behavior to use
  13801 another environment for each block, use the =:environment= parameter
  13802 to specify a custom environment.
  13803 
  13804 #+begin_example
  13805 ,#+ATTR_LATEX: :environment myverbatim
  13806 ,#+BEGIN_EXAMPLE
  13807   This sentence is false.
  13808 ,#+END_EXAMPLE
  13809 #+end_example
  13810 
  13811 *** Special blocks in LaTeX export
  13812 :PROPERTIES:
  13813 :DESCRIPTION: Attributes specific to special blocks.
  13814 :END:
  13815 
  13816 #+cindex: special blocks, in @LaTeX{} export
  13817 #+cindex: abstract, in @LaTeX{} export
  13818 #+cindex: proof, in @LaTeX{} export
  13819 #+cindex: @samp{ATTR_LATEX}, keyword
  13820 
  13821 For other special blocks in the Org file, the LaTeX export back-end
  13822 makes a special environment of the same name.  The back-end also takes
  13823 =:options=, if any, and appends as-is to that environment's opening
  13824 string.  For example:
  13825 
  13826 #+begin_example
  13827 ,#+BEGIN_abstract
  13828   We demonstrate how to solve the Syracuse problem.
  13829 ,#+END_abstract
  13830 
  13831 ,#+ATTR_LATEX: :options [Proof of important theorem]
  13832 ,#+BEGIN_proof
  13833   ...
  13834   Therefore, any even number greater than 2 is the sum of two primes.
  13835 ,#+END_proof
  13836 #+end_example
  13837 
  13838 #+texinfo: @noindent
  13839 exports to
  13840 
  13841 #+begin_example
  13842 \begin{abstract}
  13843   We demonstrate how to solve the Syracuse problem.
  13844 \end{abstract}
  13845 
  13846 \begin{proof}[Proof of important theorem]
  13847   ...
  13848   Therefore, any even number greater than 2 is the sum of two primes.
  13849 \end{proof}
  13850 #+end_example
  13851 
  13852 If you need to insert a specific caption command, use =:caption=
  13853 attribute.  It overrides standard =CAPTION= value, if any.  For
  13854 example:
  13855 
  13856 #+begin_example
  13857 ,#+ATTR_LATEX: :caption \MyCaption{HeadingA}
  13858 ,#+BEGIN_proof
  13859   ...
  13860 ,#+END_proof
  13861 #+end_example
  13862 
  13863 *** Horizontal rules in LaTeX export
  13864 :PROPERTIES:
  13865 :DESCRIPTION: Attributes specific to horizontal rules.
  13866 :END:
  13867 #+cindex: horizontal rules, in @LaTeX{} export
  13868 #+cindex: @samp{ATTR_LATEX}, keyword
  13869 
  13870 The LaTeX export back-end converts horizontal rules by the specified
  13871 =:width= and =:thickness= attributes.  For example:
  13872 
  13873 #+begin_example
  13874 ,#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
  13875 -----
  13876 #+end_example
  13877 
  13878 *** Verse blocks in LaTeX export
  13879 :PROPERTIES:
  13880 :DESCRIPTION: Attributes specific to special blocks.
  13881 :END:
  13882 
  13883 #+cindex: verse blocks, in @LaTeX{} export
  13884 #+cindex: @samp{ATTR_LATEX}, keyword
  13885 
  13886 The LaTeX export back-end accepts four attributes for verse blocks:
  13887 =:lines=, =:center=, =:versewidth= and =:latexcode=.  The three first
  13888 require the external LaTeX package =verse.sty=, which is an extension
  13889 of the standard LaTeX environment.
  13890 
  13891 - =:lines= :: To add marginal verse numbering.  Its value is an
  13892   integer, the sequence in which the verses should be numbered.
  13893 - =:center= :: With value =t= all the verses on the page are optically
  13894   centered (a typographic convention for poetry), taking as a
  13895   reference the longest verse, which must be indicated by the
  13896   attribute =:versewidth=.
  13897 - =:versewidth= :: Its value is a literal text string with the longest
  13898   verse.
  13899 - =:latexcode= :: It accepts any arbitrary LaTeX code that can be
  13900   included within a LaTeX =verse= environment.
  13901 
  13902 A complete example with Shakespeare's first sonnet:
  13903 
  13904 #+begin_src org
  13905 ,#+ATTR_LATEX: :center t :latexcode \color{red} :lines 5
  13906 ,#+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel,
  13907 ,#+BEGIN_VERSE
  13908 From fairest creatures we desire increase,
  13909 That thereby beauty’s rose might never die,
  13910 But as the riper should by time decease
  13911 His tender heir might bear his memory
  13912 But thou, contracted to thine own bright eyes,
  13913 Feed’st thy light’s flame with self-substantial fuel,
  13914 Making a famine where abundance lies,
  13915 Thyself thy foe, to thy sweet self too cruel.
  13916 Thou that art now the world’s fresh ornament,
  13917 And only herald to the gaudy spring,
  13918 Within thine own bud buriest thy content,
  13919 And, tender churl, mak’st waste in niggardly.
  13920 Pity the world, or else this glutton be,
  13921 To eat the world’s due, by the grave and thee.
  13922 ,#+END_VERSE
  13923 #+end_src
  13924 
  13925 *** Quote blocks in LaTeX export
  13926 :PROPERTIES:
  13927 :DESCRIPTION: Attributes specific to quote blocks.
  13928 :END:
  13929 
  13930 #+cindex: quote blocks, in @LaTeX{} export
  13931 #+cindex: @samp{ATTR_LATEX}, keyword
  13932 #+cindex: org-latex-default-quote-environment
  13933 
  13934 The LaTeX export back-end accepts two attributes for quote blocks:
  13935 =:environment=, for an arbitrary quoting environment (the default
  13936 value is that of ~org-latex-default-quote-environment~: ~"quote"~) and
  13937 =:options=.  For example, to choose the environment =quotation=,
  13938 included as an alternative to =quote= in standard LaTeX classes:
  13939 
  13940 #+begin_example
  13941 ,#+ATTR_LATEX: :environment quotation
  13942 ,#+BEGIN_QUOTE
  13943 some text...
  13944 ,#+END_QUOTE
  13945 #+end_example
  13946 
  13947 To choose the =foreigndisplayquote= environment, included in the LaTeX
  13948 package =csquotes=, with the =german= option, use this syntax:
  13949 
  13950 #+begin_example
  13951 ,#+LATEX_HEADER:\usepackage[autostyle=true]{csquotes}
  13952 ,#+ATTR_LATEX: :environment foreigndisplayquote :options {german}
  13953 ,#+BEGIN_QUOTE
  13954 some text in German...
  13955 ,#+END_QUOTE
  13956 #+end_example
  13957 
  13958 #+texinfo: @noindent
  13959 which is exported to LaTeX as
  13960 
  13961 #+begin_example
  13962 \begin{foreigndisplayquote}{german}
  13963 some text in German...
  13964 \end{foreigndisplayquote}
  13965 #+end_example
  13966 
  13967 ** Markdown Export
  13968 :PROPERTIES:
  13969 :DESCRIPTION: Exporting to Markdown.
  13970 :END:
  13971 #+cindex: Markdown export
  13972 
  13973 The Markdown export back-end, "md", converts an Org file to Markdown
  13974 format, as defined at http://daringfireball.net/projects/markdown/.
  13975 
  13976 Since it is built on top of the HTML back-end (see [[*HTML Export]]), it
  13977 converts every Org construct not defined in Markdown syntax, such as
  13978 tables, to HTML.
  13979 
  13980 *** Markdown export commands
  13981 :PROPERTIES:
  13982 :UNNUMBERED: notoc
  13983 :END:
  13984 
  13985 - {{{kbd(C-c C-e m m)}}} (~org-md-export-to-markdown~) ::
  13986 
  13987   #+kindex: C-c C-c m m
  13988   #+findex: org-md-export-to-markdown
  13989   Export to a text file with Markdown syntax.  For =myfile.org=, Org
  13990   exports to =myfile.md=, overwritten without warning.
  13991 
  13992 - {{{kbd(C-c C-e m M)}}} (~org-md-export-as-markdown~) ::
  13993 
  13994   #+kindex: C-c C-c m M
  13995   #+findex: org-md-export-as-markdown
  13996   Export to a temporary buffer.  Does not create a file.
  13997 
  13998 - {{{kbd(C-c C-e m o)}}} ::
  13999 
  14000   #+kindex: C-c C-e m o
  14001   Export as a text file with Markdown syntax, then open it.
  14002 
  14003 *** Header and sectioning structure
  14004 :PROPERTIES:
  14005 :UNNUMBERED: notoc
  14006 :END:
  14007 
  14008 #+vindex: org-md-headline-style
  14009 Based on ~org-md-headline-style~, Markdown export can generate
  14010 headlines of both /atx/ and /setext/ types.  /atx/ limits headline
  14011 levels to two whereas /setext/ limits headline levels to six.  Beyond
  14012 these limits, the export back-end converts headlines to lists.  To set
  14013 a limit to a level before the absolute limit (see [[*Export Settings]]).
  14014 
  14015 ** OpenDocument Text Export
  14016 :PROPERTIES:
  14017 :DESCRIPTION: Exporting to OpenDocument Text.
  14018 :END:
  14019 #+cindex: ODT
  14020 #+cindex: OpenDocument
  14021 #+cindex: export, OpenDocument
  14022 #+cindex: LibreOffice
  14023 
  14024 The ODT export back-end handles creating of OpenDocument Text (ODT)
  14025 format.  Documents created by this exporter use the
  14026 {{{cite(OpenDocument-v1.2 specification)}}}[fn:135] and are compatible
  14027 with LibreOffice 3.4.
  14028 
  14029 *** Pre-requisites for ODT export
  14030 :PROPERTIES:
  14031 :DESCRIPTION: Required packages.
  14032 :END:
  14033 #+cindex: zip
  14034 
  14035 The ODT export back-end relies on the zip program to create the final
  14036 compressed ODT output.  Check if =zip= is locally available and
  14037 executable.  Without it, export cannot finish.
  14038 
  14039 *** ODT export commands
  14040 :PROPERTIES:
  14041 :DESCRIPTION: Invoking export.
  14042 :END:
  14043 
  14044 - {{{kbd(C-c C-e o o)}}} (~org-export-to-odt~) ::
  14045 
  14046   #+kindex: C-c C-e o o
  14047   #+findex: org-export-to-odt
  14048   Export as OpenDocument Text file.
  14049 
  14050   #+cindex: @samp{EXPORT_FILE_NAME}, property
  14051   #+vindex: org-odt-preferred-output-format
  14052 
  14053   If ~org-odt-preferred-output-format~ is specified, the ODT export
  14054   back-end automatically converts the exported file to that format.
  14055 
  14056   For =myfile.org=, Org exports to =myfile.odt=, overwriting without
  14057   warning.  The ODT export back-end exports a region only if a region
  14058   was active.
  14059 
  14060   If the selected region is a single tree, the ODT export back-end
  14061   makes the tree head the document title.  Incidentally, {{{kbd(C-c
  14062   @)}}} selects the current sub-tree.  If the tree head entry has, or
  14063   inherits, an =EXPORT_FILE_NAME= property, the ODT export back-end
  14064   uses that for file name.
  14065 
  14066 - {{{kbd(C-c C-e o O)}}} ::
  14067 
  14068   #+kindex: C-c C-e o O
  14069   Export as an OpenDocument Text file and open the resulting file.
  14070 
  14071   #+vindex: org-export-odt-preferred-output-format
  14072   If ~org-export-odt-preferred-output-format~ is specified, open the
  14073   converted file instead.  See [[*Automatically exporting to other
  14074   formats]].
  14075 
  14076 *** ODT specific export settings
  14077 :PROPERTIES:
  14078 :DESCRIPTION: Configuration options.
  14079 :END:
  14080 
  14081 The ODT export back-end has several additional keywords for
  14082 customizing ODT output.  Setting these keywords works similar to the
  14083 general options (see [[*Export Settings]]).
  14084 
  14085 - =DESCRIPTION= ::
  14086 
  14087   #+cindex: @samp{DESCRIPTION}, keyword
  14088   This is the document's description, which the ODT export back-end
  14089   inserts as document metadata.  For long descriptions, use multiple
  14090   lines, prefixed with =DESCRIPTION=.
  14091 
  14092 - =KEYWORDS= ::
  14093 
  14094   #+cindex: @samp{KEYWORDS}, keyword
  14095   The keywords for the document.  The ODT export back-end inserts the
  14096   description along with author name, keywords, and related file
  14097   metadata as metadata in the output file.  Use multiple =KEYWORDS= if
  14098   necessary.
  14099 
  14100 - =ODT_STYLES_FILE= ::
  14101 
  14102   #+cindex: @samp{ODT_STYLES_FILE}, keyword
  14103   #+vindex: org-odt-styles-file
  14104   The ODT export back-end uses the ~org-odt-styles-file~ by default.
  14105   See [[*Applying custom styles]] for details.
  14106 
  14107 - =SUBTITLE= ::
  14108 
  14109   #+cindex: @samp{SUBTITLE}, keyword
  14110   The document subtitle.
  14111 
  14112 *** Extending ODT export
  14113 :PROPERTIES:
  14114 :DESCRIPTION: Producing DOC, PDF files.
  14115 :END:
  14116 
  14117 The ODT export back-end can produce documents in other formats besides
  14118 ODT using a specialized ODT converter process.  Its common interface
  14119 works with popular converters to produce formats such as =doc=, or
  14120 convert a document from one format, say =csv=, to another format, say
  14121 =xls=.
  14122 
  14123 #+cindex: @file{unoconv}
  14124 #+vindex: org-odt-convert-process
  14125 Customize ~org-odt-convert-process~ variable to point to =unoconv=,
  14126 which is the ODT's preferred converter.  Working installations of
  14127 LibreOffice would already have =unoconv= installed.  Alternatively,
  14128 other converters may be substituted here.  See [[*Configuring
  14129 a document converter]].
  14130 
  14131 **** Automatically exporting to other formats
  14132 :PROPERTIES:
  14133 :UNNUMBERED: notoc
  14134 :END:
  14135 
  14136 #+vindex: org-odt-preferred-output-format
  14137 If ODT format is just an intermediate step to get to other formats,
  14138 such as =doc=, =docx=, =rtf=, or =pdf=, etc., then extend the ODT
  14139 export back-end to directly produce that format.  Specify the final
  14140 format in the ~org-odt-preferred-output-format~ variable.  This is one
  14141 way to extend (see [[*ODT export commands]]).
  14142 
  14143 **** Converting between document formats
  14144 :PROPERTIES:
  14145 :UNNUMBERED: notoc
  14146 :END:
  14147 
  14148 The Org export back-end is made to be inter-operable with a wide range
  14149 of text document format converters.  Newer generation converters, such
  14150 as LibreOffice and Pandoc, can handle hundreds of formats at once.
  14151 Org provides a consistent interaction with whatever converter is
  14152 installed.  Here are some generic commands:
  14153 
  14154 - {{{kbd(M-x org-odt-convert)}}} ::
  14155 
  14156   #+findex: org-odt-convert
  14157   Convert an existing document from one format to another.  With
  14158   a prefix argument, opens the newly produced file.
  14159 
  14160 *** Applying custom styles
  14161 :PROPERTIES:
  14162 :DESCRIPTION: Styling the output.
  14163 :END:
  14164 #+cindex: styles, custom
  14165 #+cindex: template, custom
  14166 
  14167 The ODT export back-end comes with many OpenDocument styles (see
  14168 [[*Working with OpenDocument style files]]).  To expand or further
  14169 customize these built-in style sheets, either edit the style sheets
  14170 directly or generate them using an application such as LibreOffice.
  14171 The example here shows creating a style using LibreOffice.
  14172 
  14173 **** Applying custom styles: the easy way
  14174 :PROPERTIES:
  14175 :UNNUMBERED: notoc
  14176 :END:
  14177 
  14178 1. Create a sample =example.org= file with settings as shown below,
  14179    and export it to ODT format.
  14180 
  14181    : #+OPTIONS: H:10 num:t
  14182 
  14183 2. Open the above =example.odt= using LibreOffice.  Use the /Stylist/
  14184    to locate the target styles, which typically have the "Org" prefix.
  14185    Open one, modify, and save as either OpenDocument Text (ODT) or
  14186    OpenDocument Template (OTT) file.
  14187 
  14188 3.
  14189    #+vindex: org-odt-styles-file
  14190    Customize the variable ~org-odt-styles-file~ and point it to the
  14191    newly created file.  For additional configuration options, see
  14192    [[x-overriding-factory-styles][Overriding factory styles]].
  14193 
  14194    #+cindex: @samp{ODT_STYLES_FILE}, keyword
  14195    To apply an ODT style to a particular file, use the
  14196    =ODT_STYLES_FILE= keyword as shown in the example below:
  14197 
  14198    : #+ODT_STYLES_FILE: "/path/to/example.ott"
  14199 
  14200    #+texinfo: @noindent
  14201    or
  14202 
  14203    : #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
  14204 
  14205 **** Using third-party styles and templates
  14206 :PROPERTIES:
  14207 :UNNUMBERED: notoc
  14208 :END:
  14209 
  14210 The ODT export back-end relies on many templates and style names.
  14211 Using third-party styles and templates can lead to mismatches.
  14212 Templates derived from built in ODT templates and styles seem to have
  14213 fewer problems.
  14214 
  14215 *** Links in ODT export
  14216 :PROPERTIES:
  14217 :DESCRIPTION: Handling and formatting links.
  14218 :END:
  14219 #+cindex: links, in ODT export
  14220 
  14221 ODT exporter creates native cross-references for internal links.  It
  14222 creates Internet-style links for all other links.
  14223 
  14224 A link with no description and pointing to a regular, un-itemized,
  14225 outline heading is replaced with a cross-reference and section number
  14226 of the heading.
  14227 
  14228 A =\ref{label}=-style reference to an image, table etc., is replaced
  14229 with a cross-reference and sequence number of the labeled entity.  See
  14230 [[*Labels and captions in ODT export]].
  14231 
  14232 *** Tables in ODT export
  14233 :PROPERTIES:
  14234 :DESCRIPTION: Org tables conversions.
  14235 :END:
  14236 
  14237 #+cindex: tables, in ODT export
  14238 
  14239 The ODT export back-end handles native Org mode tables (see [[*Tables]])
  14240 and simple =table.el= tables.  Complex =table.el= tables having column
  14241 or row spans are not supported.  Such tables are stripped from the
  14242 exported document.
  14243 
  14244 By default, the ODT export back-end exports a table with top and
  14245 bottom frames and with ruled lines separating row and column groups
  14246 (see [[*Column Groups]]).  All tables are typeset to occupy the same
  14247 width.  The ODT export back-end honors any table alignments and
  14248 relative widths for columns (see [[*Column Width and Alignment]]).
  14249 
  14250 Note that the ODT export back-end interprets column widths as weighted
  14251 ratios, the default weight being 1.
  14252 
  14253 #+cindex: @samp{ATTR_ODT}, keyword
  14254 Specifying =:rel-width= property on an =ATTR_ODT= line controls the
  14255 width of the table.  For example:
  14256 
  14257 #+begin_example
  14258 ,#+ATTR_ODT: :rel-width 50
  14259 | Area/Month    |   Jan |   Feb |   Mar |   Sum |
  14260 |---------------+-------+-------+-------+-------|
  14261 | /             |     < |       |       |     < |
  14262 | <l13>         |  <r5> |  <r5> |  <r5> |  <r6> |
  14263 | North America |     1 |    21 |   926 |   948 |
  14264 | Middle East   |     6 |    75 |   844 |   925 |
  14265 | Asia Pacific  |     9 |    27 |   790 |   826 |
  14266 |---------------+-------+-------+-------+-------|
  14267 | Sum           |    16 |   123 |  2560 |  2699 |
  14268 #+end_example
  14269 
  14270 On export, the above table takes 50% of text width area.  The exporter
  14271 sizes the columns in the ratio: 13:5:5:5:6.  The first column is
  14272 left-aligned and rest of the columns, right-aligned.  Vertical rules
  14273 separate the header and the last column.  Horizontal rules separate
  14274 the header and the last row.
  14275 
  14276 For even more customization, create custom table styles and associate
  14277 them with a table using the =ATTR_ODT= keyword.  See [[*Customizing
  14278 tables in ODT export]].
  14279 
  14280 *** Images in ODT export
  14281 :PROPERTIES:
  14282 :DESCRIPTION: Inserting images.
  14283 :END:
  14284 #+cindex: images, embedding in ODT
  14285 #+cindex: embedding images in ODT
  14286 
  14287 **** Embedding images
  14288 :PROPERTIES:
  14289 :UNNUMBERED: notoc
  14290 :END:
  14291 
  14292 The ODT export back-end processes image links in Org files that do not
  14293 have descriptions, such as these links =[[file:img.jpg]]= or =[[./img.jpg]]=,
  14294 as direct image insertions in the final output.  Either of these
  14295 examples works:
  14296 
  14297 : [[file:img.png]]
  14298 
  14299 : [[./img.png]]
  14300 
  14301 **** Embedding clickable images
  14302 :PROPERTIES:
  14303 :UNNUMBERED: notoc
  14304 :END:
  14305 
  14306 For clickable images, provide a link whose description is another link
  14307 to an image file.  For example, to embed an image
  14308 =org-mode-unicorn.png= which when clicked jumps to https://orgmode.org
  14309 website, do the following
  14310 
  14311 : [[https://orgmode.org][./org-mode-unicorn.png]]
  14312 
  14313 **** Sizing and scaling of embedded images
  14314 :PROPERTIES:
  14315 :UNNUMBERED: notoc
  14316 :END:
  14317 
  14318 #+cindex: @samp{ATTR_ODT}, keyword
  14319 
  14320 Control the size and scale of the embedded images with the =ATTR_ODT=
  14321 attribute.
  14322 
  14323 #+cindex: identify, ImageMagick
  14324 #+vindex: org-odt-pixels-per-inch
  14325 The ODT export back-end starts with establishing the size of the image
  14326 in the final document.  The dimensions of this size are measured in
  14327 centimeters.  The back-end then queries the image file for its
  14328 dimensions measured in pixels.  For this measurement, the back-end
  14329 relies on ImageMagick's identify program or Emacs ~create-image~ and
  14330 ~image-size~ API.  ImageMagick is the preferred choice for large file
  14331 sizes or frequent batch operations.  The back-end then converts the
  14332 pixel dimensions using ~org-odt-pixels-per-inch~ into the familiar 72
  14333 dpi or 96 dpi.  The default value for this is in
  14334 ~display-pixels-per-inch~, which can be tweaked for better results
  14335 based on the capabilities of the output device.  Here are some common
  14336 image scaling operations:
  14337 
  14338 - Explicitly size the image ::
  14339 
  14340   To embed =img.png= as a 10 cm x 10 cm image, do the following:
  14341 
  14342   #+begin_example
  14343   ,#+ATTR_ODT: :width 10 :height 10
  14344   [[./img.png]]
  14345   #+end_example
  14346 
  14347 - Scale the image ::
  14348 
  14349   To embed =img.png= at half its size, do the following:
  14350 
  14351   #+begin_example
  14352   ,#+ATTR_ODT: :scale 0.5
  14353   [[./img.png]]
  14354   #+end_example
  14355 
  14356 - Scale the image to a specific width ::
  14357 
  14358   To embed =img.png= with a width of 10 cm while retaining the
  14359   original height:width ratio, do the following:
  14360 
  14361   #+begin_example
  14362   ,#+ATTR_ODT: :width 10
  14363   [[./img.png]]
  14364   #+end_example
  14365 
  14366 - Scale the image to a specific height ::
  14367 
  14368   To embed =img.png= with a height of 10 cm while retaining the
  14369   original height:width ratio, do the following:
  14370 
  14371   #+begin_example
  14372   ,#+ATTR_ODT: :height 10
  14373   [[./img.png]]
  14374   #+end_example
  14375 
  14376 **** Anchoring of images
  14377 :PROPERTIES:
  14378 :UNNUMBERED: notoc
  14379 :END:
  14380 
  14381 #+cindex: @samp{ATTR_ODT}, keyword
  14382 The ODT export back-end can anchor images to =as-char=, =paragraph=,
  14383 or =page=.  Set the preferred anchor using the =:anchor= property of
  14384 the =ATTR_ODT= line.
  14385 
  14386 To create an image that is anchored to a page:
  14387 
  14388 #+begin_example
  14389 ,#+ATTR_ODT: :anchor page
  14390 [[./img.png]]
  14391 #+end_example
  14392 
  14393 *** Math formatting in ODT export
  14394 :PROPERTIES:
  14395 :DESCRIPTION: Formatting @LaTeX{} fragments.
  14396 :END:
  14397 
  14398 The ODT exporter has special support for handling math.
  14399 
  14400 **** LaTeX math snippets
  14401 :PROPERTIES:
  14402 :DESCRIPTION: Embedding in @LaTeX{} format.
  14403 :END:
  14404 
  14405 LaTeX math snippets (see [[*LaTeX fragments]]) can be embedded in the ODT
  14406 document in one of the following ways:
  14407 
  14408 - MathML ::
  14409 
  14410   #+cindex: MathML
  14411   Add this line to the Org file.  This option is activated on
  14412   a per-file basis.
  14413 
  14414   : #+OPTIONS: tex:t
  14415 
  14416   With this option, LaTeX fragments are first converted into MathML
  14417   fragments using an external LaTeX-to-MathML converter program.  The
  14418   resulting MathML fragments are then embedded as an OpenDocument
  14419   Formula in the exported document.
  14420 
  14421   #+vindex: org-latex-to-mathml-convert-command
  14422   #+vindex: org-latex-to-mathml-jar-file
  14423   You can specify the LaTeX-to-MathML converter by customizing the
  14424   variables ~org-latex-to-mathml-convert-command~ and
  14425   ~org-latex-to-mathml-jar-file~.
  14426 
  14427   If you prefer to use MathToWeb[fn:136] as your converter, you can
  14428   configure the above variables as shown below.
  14429 
  14430   #+begin_src emacs-lisp
  14431   (setq org-latex-to-mathml-convert-command
  14432         "java -jar %j -unicode -force -df %o %I"
  14433         org-latex-to-mathml-jar-file
  14434         "/path/to/mathtoweb.jar")
  14435   #+end_src
  14436 
  14437   #+texinfo: @noindent
  14438   or, to use LaTeX​ML[fn:137] instead,
  14439 
  14440   #+begin_src emacs-lisp
  14441   (setq org-latex-to-mathml-convert-command
  14442         "latexmlmath \"%i\" --presentationmathml=%o")
  14443   #+end_src
  14444 
  14445   To quickly verify the reliability of the LaTeX-to-MathML
  14446   converter, use the following commands:
  14447 
  14448   - {{{kbd(M-x org-export-as-odf)}}} ::
  14449 
  14450     Convert a LaTeX math snippet to an OpenDocument formula (=.odf=)
  14451     file.
  14452 
  14453   - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
  14454 
  14455     Convert a LaTeX math snippet to an OpenDocument formula (=.odf=)
  14456     file and open the formula file with the system-registered
  14457     application.
  14458 
  14459 - PNG images ::
  14460 
  14461   #+cindex: dvipng
  14462   #+cindex: dvisvgm
  14463   #+cindex: ImageMagick
  14464   Add this line to the Org file.  This option is activated on
  14465   a per-file basis.
  14466 
  14467   : #+OPTIONS: tex:dvipng
  14468 
  14469   : #+OPTIONS: tex:dvisvgm
  14470 
  14471   #+texinfo: @noindent
  14472   or
  14473 
  14474   : #+OPTIONS: tex:imagemagick
  14475 
  14476   Under this option, LaTeX fragments are processed into PNG or SVG
  14477   images and the resulting images are embedded in the exported
  14478   document.  This method requires dvipng program, dvisvgm or
  14479   ImageMagick programs.
  14480 
  14481 **** MathML and OpenDocument formula files
  14482 :PROPERTIES:
  14483 :DESCRIPTION: Embedding in native format.
  14484 :END:
  14485 
  14486 When embedding LaTeX math snippets in ODT documents is not reliable,
  14487 there is one more option to try.  Embed an equation by linking to its
  14488 MathML (=.mml=) source or its OpenDocument formula (=.odf=) file as
  14489 shown below:
  14490 
  14491 : [[./equation.mml]]
  14492 
  14493 #+texinfo: @noindent
  14494 or
  14495 
  14496 : [[./equation.odf]]
  14497 
  14498 *** Labels and captions in ODT export
  14499 :PROPERTIES:
  14500 :DESCRIPTION: Rendering objects.
  14501 :END:
  14502 
  14503 ODT format handles labeling and captioning of objects based on their
  14504 types.  Inline images, tables, LaTeX fragments, and Math formulas are
  14505 numbered and captioned separately.  Each object also gets a unique
  14506 sequence number based on its order of first appearance in the Org
  14507 file.  Each category has its own sequence.  A caption is just a label
  14508 applied to these objects.
  14509 
  14510 #+begin_example
  14511 ,#+CAPTION: Bell curve
  14512 ,#+NAME:   fig:SED-HR4049
  14513 [[./img/a.png]]
  14514 #+end_example
  14515 
  14516 When rendered, it may show as follows in the exported document:
  14517 
  14518 : Figure 2: Bell curve
  14519 
  14520 #+vindex: org-odt-category-map-alist
  14521 To modify the category component of the caption, customize the option
  14522 ~org-odt-category-map-alist~.  For example, to tag embedded images
  14523 with the string "Illustration" instead of the default string "Figure",
  14524 use the following setting:
  14525 
  14526 #+begin_src emacs-lisp
  14527 (setq org-odt-category-map-alist
  14528       '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
  14529 #+end_src
  14530 
  14531 With the above modification, the previous example changes to:
  14532 
  14533 : Illustration 2: Bell curve
  14534 
  14535 *** Literal examples in ODT export
  14536 :PROPERTIES:
  14537 :DESCRIPTION: For source code and example blocks.
  14538 :END:
  14539 
  14540 The ODT export back-end supports literal examples (see [[*Literal
  14541 Examples]]) with full fontification.  Internally, the ODT export
  14542 back-end relies on =htmlfontify.el= to generate the style definitions
  14543 needed for fancy listings.  The auto-generated styles get =OrgSrc=
  14544 prefix and inherit colors from the faces used by Emacs Font Lock
  14545 library for that source language.
  14546 
  14547 #+vindex: org-odt-fontify-srcblocks
  14548 For custom fontification styles, customize the
  14549 ~org-odt-create-custom-styles-for-srcblocks~ option.
  14550 
  14551 #+vindex: org-odt-create-custom-styles-for-srcblocks
  14552 To turn off fontification of literal examples, customize the
  14553 ~org-odt-fontify-srcblocks~ option.
  14554 
  14555 *** Advanced topics in ODT export
  14556 :PROPERTIES:
  14557 :DESCRIPTION: For power users.
  14558 :END:
  14559 
  14560 The ODT export back-end has extensive features useful for power users
  14561 and frequent uses of ODT formats.
  14562 
  14563 **** Configuring a document converter
  14564 :PROPERTIES:
  14565 :DESCRIPTION: Registering a document converter.
  14566 :UNNUMBERED: notoc
  14567 :END:
  14568 #+cindex: convert
  14569 #+cindex: doc, docx, rtf
  14570 #+cindex: converter
  14571 
  14572 The ODT export back-end works with popular converters with little or
  14573 no extra configuration.  See [[*Extending ODT export]].  The following is
  14574 for unsupported converters or tweaking existing defaults.
  14575 
  14576 - Register the converter ::
  14577 
  14578   #+vindex: org-export-odt-convert-processes
  14579   Add the name of the converter to the ~org-odt-convert-processes~
  14580   variable.  Note that it also requires how the converter is invoked
  14581   on the command line.  See the variable's docstring for details.
  14582 
  14583 - Configure its capabilities ::
  14584 
  14585   #+vindex: org-export-odt-convert-capabilities
  14586   Specify which formats the converter can handle by customizing the
  14587   variable ~org-odt-convert-capabilities~.  Use the entry for the
  14588   default values in this variable for configuring the new converter.
  14589   Also see its docstring for details.
  14590 
  14591 - Choose the converter ::
  14592 
  14593   #+vindex: org-export-odt-convert-process
  14594   Select the newly added converter as the preferred one by customizing
  14595   the option ~org-odt-convert-process~.
  14596 
  14597 **** Working with OpenDocument style files
  14598 :PROPERTIES:
  14599 :DESCRIPTION: Exploring internals.
  14600 :UNNUMBERED: notoc
  14601 :END:
  14602 #+cindex: styles, custom
  14603 #+cindex: template, custom
  14604 
  14605 This section explores the internals of the ODT exporter; the means by which
  14606 it produces styled documents; the use of automatic and custom OpenDocument
  14607 styles.
  14608 
  14609 The ODT exporter relies on two files for generating its output.  These
  14610 files are bundled with the distribution under the directory pointed to
  14611 by the variable ~org-odt-styles-dir~.  The two files are:
  14612 
  14613 - =OrgOdtStyles.xml= <<x-orgodtstyles-xml>> ::
  14614 
  14615   This file contributes to the =styles.xml= file of the final ODT
  14616   document.  This file gets modified for the following purposes:
  14617 
  14618   1. To control outline numbering based on user settings;
  14619 
  14620   2. To add styles generated by =htmlfontify.el= for fontification of
  14621      code blocks.
  14622 
  14623 - =OrgOdtContentTemplate.xml= <<x-orgodtcontenttemplate-xml>> ::
  14624 
  14625   This file contributes to the =content.xml= file of the final ODT
  14626   document.  The contents of the Org outline are inserted between the
  14627   =<office:text>= ... =</office:text>= elements of this file.
  14628 
  14629   Apart from serving as a template file for the final =content.xml=,
  14630   the file serves the following purposes:
  14631 
  14632   1. It contains automatic styles for formatting of tables which are
  14633      referenced by the exporter;
  14634 
  14635   2. It contains =<text:sequence-decl>= ... =</text:sequence-decl>=
  14636      elements that control numbering of tables, images, equations, and
  14637      similar entities.
  14638 
  14639 <<x-overriding-factory-styles>> The following two variables control
  14640 the location from where the ODT exporter picks up the custom styles
  14641 and content template files.  Customize these variables to override the
  14642 factory styles used by the exporter.
  14643 
  14644 - ~org-odt-styles-file~ ::
  14645 
  14646   The ODT export back-end uses the file pointed to by this variable,
  14647   such as =styles.xml=, for the final output.  It can take one of the
  14648   following values:
  14649 
  14650   - =FILE.xml= ::
  14651 
  14652     Use this file instead of the default =styles.xml=
  14653 
  14654   - =FILE.odt= or =FILE.ott= ::
  14655 
  14656     Use the =styles.xml= contained in the specified OpenDocument
  14657     Text or Template file
  14658 
  14659   - =FILE.odt= or =FILE.ott= and a subset of included files ::
  14660 
  14661     Use the =styles.xml= contained in the specified OpenDocument Text
  14662     or Template file.  Additionally extract the specified member files
  14663     and embed those within the final ODT document.
  14664 
  14665     Use this option if the =styles.xml= file references additional
  14666     files like header and footer images.
  14667 
  14668   - ~nil~ ::
  14669 
  14670     Use the default =styles.xml=.
  14671 
  14672 - ~org-odt-content-template-file~ ::
  14673 
  14674   Use this variable to specify the blank =content.xml= used in the
  14675   final output.
  14676 
  14677 **** Creating one-off styles
  14678 :PROPERTIES:
  14679 :DESCRIPTION: Customizing styles, highlighting...
  14680 :UNNUMBERED: notoc
  14681 :END:
  14682 
  14683 The ODT export back-end can read embedded raw OpenDocument XML from
  14684 the Org file.  Such direct formatting is useful for one-off instances.
  14685 
  14686 - Embedding ODT tags as part of regular text ::
  14687 
  14688   Enclose OpenDocument syntax in =@@odt:...@@= for inline markup.  For
  14689   example, to highlight a region of text do the following:
  14690 
  14691   #+begin_example
  14692   @@odt:<text:span text:style-name="Highlight">This is highlighted
  14693   text</text:span>@@.  But this is regular text.
  14694   #+end_example
  14695 
  14696   *Hint:* To see the above example in action, edit the =styles.xml=
  14697   (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom /Highlight/ style as shown
  14698   below:
  14699 
  14700   #+begin_example
  14701   <style:style style:name="Highlight" style:family="text">
  14702     <style:text-properties fo:background-color="#ff0000"/>
  14703   </style:style>
  14704   #+end_example
  14705 
  14706 - Embedding a one-line OpenDocument XML ::
  14707 
  14708   #+cindex: @samp{ODT}, keyword
  14709   The ODT export back-end can read one-liner options with =#+ODT:= in
  14710   the Org file.  For example, to force a page break:
  14711 
  14712   #+begin_example
  14713   ,#+ODT: <text:p text:style-name="PageBreak"/>
  14714   #+end_example
  14715 
  14716   *Hint:* To see the above example in action, edit your
  14717   =styles.xml= (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom =PageBreak=
  14718   style as shown below.
  14719 
  14720   #+begin_example
  14721   <style:style style:name="PageBreak" style:family="paragraph"
  14722                style:parent-style-name="Text_20_body">
  14723     <style:paragraph-properties fo:break-before="page"/>
  14724   </style:style>
  14725   #+end_example
  14726 
  14727 - Embedding a block of OpenDocument XML ::
  14728 
  14729   The ODT export back-end can also read ODT export blocks for
  14730   OpenDocument XML.  Such blocks use the =#+BEGIN_EXPORT odt=
  14731   ... =#+END_EXPORT= constructs.
  14732 
  14733   For example, to create a one-off paragraph that uses bold text, do
  14734   the following:
  14735 
  14736   #+begin_example
  14737   ,#+BEGIN_EXPORT odt
  14738     <text:p text:style-name="Text_20_body_20_bold">
  14739     This paragraph is specially formatted and uses bold text.
  14740     </text:p>
  14741   ,#+END_EXPORT
  14742   #+end_example
  14743 
  14744 **** Customizing tables in ODT export
  14745 :PROPERTIES:
  14746 :DESCRIPTION: Defining table templates.
  14747 :UNNUMBERED: notoc
  14748 :END:
  14749 #+cindex: tables, in ODT export
  14750 #+cindex: @samp{ATTR_ODT}, keyword
  14751 
  14752 Override the default table format by specifying a custom table style
  14753 with the =#+ATTR_ODT= line.  For a discussion on default formatting of
  14754 tables, see [[*Tables in ODT export]].
  14755 
  14756 This feature closely mimics the way table templates are defined in the
  14757 OpenDocument-v1.2 specification[fn:138].
  14758 
  14759 #+vindex: org-odt-table-styles
  14760 For quick preview of this feature, install the settings below and export the
  14761 table that follows:
  14762 
  14763 #+begin_src emacs-lisp
  14764 (setq org-export-odt-table-styles
  14765       (append org-export-odt-table-styles
  14766               '(("TableWithHeaderRowAndColumn" "Custom"
  14767                  ((use-first-row-styles . t)
  14768                   (use-first-column-styles . t)))
  14769                 ("TableWithFirstRowandLastRow" "Custom"
  14770                  ((use-first-row-styles . t)
  14771                   (use-last-row-styles . t))))))
  14772 #+end_src
  14773 
  14774 #+begin_example
  14775 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
  14776 | Name  | Phone | Age |
  14777 | Peter |  1234 |  17 |
  14778 | Anna  |  4321 |  25 |
  14779 #+end_example
  14780 
  14781 The example above used =Custom= template and installed two table
  14782 styles =TableWithHeaderRowAndColumn= and
  14783 =TableWithFirstRowandLastRow=.  *Important:* The OpenDocument styles
  14784 needed for producing the above template were pre-defined.  They are
  14785 available in the section marked =Custom Table Template= in
  14786 =OrgOdtContentTemplate.xml= (see [[x-orgodtcontenttemplate-xml][Factory styles]]).  For adding new
  14787 templates, define new styles there.
  14788 
  14789 To use this feature proceed as follows:
  14790 
  14791 1. Create a table template[fn:139].
  14792 
  14793    A table template is set of =table-cell= and =paragraph= styles for
  14794    each of the following table cell categories:
  14795 
  14796    - Body
  14797    - First column
  14798    - Last column
  14799    - First row
  14800    - Last row
  14801    - Even row
  14802    - Odd row
  14803    - Even column
  14804    - Odd Column
  14805 
  14806    The names for the above styles must be chosen based on the name of
  14807    the table template using a well-defined convention.
  14808 
  14809    The naming convention is better illustrated with an example.  For
  14810    a table template with the name =Custom=, the needed style names are
  14811    listed in the following table.
  14812 
  14813    | Cell type    | Cell style                   | Paragraph style                   |
  14814    |--------------+------------------------------+-----------------------------------|
  14815    | Body         | =CustomTableCell=            | =CustomTableParagraph=            |
  14816    | First column | =CustomFirstColumnTableCell= | =CustomFirstColumnTableParagraph= |
  14817    | Last column  | =CustomLastColumnTableCell=  | =CustomLastColumnTableParagraph=  |
  14818    | First row    | =CustomFirstRowTableCell=    | =CustomFirstRowTableParagraph=    |
  14819    | Last row     | =CustomLastRowTableCell=     | =CustomLastRowTableParagraph=     |
  14820    | Even row     | =CustomEvenRowTableCell=     | =CustomEvenRowTableParagraph=     |
  14821    | Odd row      | =CustomOddRowTableCell=      | =CustomOddRowTableParagraph=      |
  14822    | Even column  | =CustomEvenColumnTableCell=  | =CustomEvenColumnTableParagraph=  |
  14823    | Odd column   | =CustomOddColumnTableCell=   | =CustomOddColumnTableParagraph=   |
  14824 
  14825    To create a table template with the name =Custom=, define the above
  14826    styles in the =<office:automatic-styles>= ...
  14827    =</office:automatic-styles>= element of the content template file
  14828    (see [[x-orgodtcontenttemplate-xml][Factory styles]]).
  14829 
  14830 2. Define a table style[fn:140].
  14831 
  14832    #+vindex: org-odt-table-styles
  14833    To define a table style, create an entry for the style in the
  14834    variable ~org-odt-table-styles~ and specify the following:
  14835 
  14836    - the name of the table template created in step (1),
  14837    - the set of cell styles in that template that are to be activated.
  14838 
  14839    For example, the entry below defines two different table styles
  14840    =TableWithHeaderRowAndColumn= and =TableWithFirstRowandLastRow=
  14841    based on the same template =Custom=.  The styles achieve their
  14842    intended effect by selectively activating the individual cell
  14843    styles in that template.
  14844 
  14845    #+begin_src emacs-lisp
  14846    (setq org-export-odt-table-styles
  14847          (append org-export-odt-table-styles
  14848                  '(("TableWithHeaderRowAndColumn" "Custom"
  14849                     ((use-first-row-styles . t)
  14850                      (use-first-column-styles . t)))
  14851                    ("TableWithFirstRowandLastRow" "Custom"
  14852                     ((use-first-row-styles . t)
  14853                      (use-last-row-styles . t))))))
  14854    #+end_src
  14855 
  14856 3. Associate a table with the table style.
  14857 
  14858    To do this, specify the table style created in step (2) as part of
  14859    the =ATTR_ODT= line as shown below.
  14860 
  14861    #+begin_example
  14862    ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
  14863    | Name  | Phone | Age |
  14864    | Peter |  1234 |  17 |
  14865    | Anna  |  4321 |  25 |
  14866    #+end_example
  14867 
  14868 **** Validating OpenDocument XML
  14869 :PROPERTIES:
  14870 :DESCRIPTION: Debugging corrupted OpenDocument files.
  14871 :UNNUMBERED: notoc
  14872 :END:
  14873 
  14874 Sometimes ODT format files may not open due to =.odt= file corruption.
  14875 To verify if such a file is corrupt, validate it against the
  14876 OpenDocument Relax NG Compact (RNC) syntax schema.  But first the
  14877 =.odt= files have to be decompressed using =zip=.  Note that =.odt=
  14878 files are ZIP archives: [[info:emacs::File Archives]].  The contents of
  14879 ODT files are in XML.  For general help with validation---and
  14880 schema-sensitive editing---of XML files: [[info:nxml-mode::Introduction]].
  14881 
  14882 #+vindex: org-export-odt-schema-dir
  14883 Customize ~org-odt-schema-dir~ to point to a directory with
  14884 OpenDocument RNC files and the needed schema-locating rules.  The ODT
  14885 export back-end takes care of updating the
  14886 ~rng-schema-locating-files~.
  14887 
  14888 ** Org Export
  14889 :PROPERTIES:
  14890 :DESCRIPTION: Exporting to Org.
  14891 :END:
  14892 
  14893 #+cindex: Org export
  14894 /org/ export back-end creates a normalized version of the Org document
  14895 in current buffer.  The exporter evaluates Babel code (see [[*Evaluating
  14896 Code Blocks]]) and removes content specific to other back-ends.
  14897 
  14898 *** Org export commands
  14899 :PROPERTIES:
  14900 :UNNUMBERED: notoc
  14901 :END:
  14902 
  14903 - {{{kbd(C-c C-e O o)}}} (~org-org-export-to-org~) ::
  14904 
  14905   #+kindex: C-c C-e O o
  14906   #+findex: org-org-export-to-org
  14907   Export as an Org file with a =.org= extension.  For =myfile.org=,
  14908   Org exports to =myfile.org.org=, overwriting without warning.
  14909 
  14910 - {{{kbd(C-c C-e O v)}}} (~~) ::
  14911 
  14912   #+kindex: C-c C-e O v
  14913   Export to an Org file, then open it.
  14914 
  14915 ** Texinfo Export
  14916 :PROPERTIES:
  14917 :DESCRIPTION: Exporting to Texinfo.
  14918 :END:
  14919 
  14920 *** Texinfo export commands
  14921 :PROPERTIES:
  14922 :DESCRIPTION: Invoking commands.
  14923 :END:
  14924 
  14925 - {{{kbd(C-c C-e i t)}}} (~org-texinfo-export-to-texinfo~) ::
  14926 
  14927   #+kindex: C-c C-e i t
  14928   #+findex: org-texinfo-export-to-texinfo
  14929   Export as a Texinfo file with =.texi= extension.  For =myfile.org=,
  14930   Org exports to =myfile.texi=, overwriting without warning.
  14931 
  14932 - {{{kbd(C-c C-e i i)}}} (~org-texinfo-export-to-info~) ::
  14933 
  14934   #+kindex: C-c C-e i i
  14935   #+findex: org-texinfo-export-to-info
  14936   #+vindex: org-texinfo-info-process
  14937   Export to Texinfo format first and then process it to make an Info
  14938   file.  To generate other formats, such as DocBook, customize the
  14939   ~org-texinfo-info-process~ variable.
  14940 
  14941 *** Texinfo specific export settings
  14942 :PROPERTIES:
  14943 :DESCRIPTION: Setting the environment.
  14944 :END:
  14945 
  14946 The Texinfo export back-end has several additional keywords for
  14947 customizing Texinfo output.  Setting these keywords works similar to
  14948 the general options (see [[*Export Settings]]).
  14949 
  14950 - =SUBTITLE= ::
  14951 
  14952   #+cindex: @samp{SUBTITLE}, keyword
  14953   The document subtitle.
  14954 
  14955 - =SUBAUTHOR= ::
  14956 
  14957   #+cindex: @samp{SUBAUTHOR}, keyword
  14958   Additional authors for the document.
  14959 
  14960 - =TEXINFO_FILENAME= ::
  14961 
  14962   #+cindex: @samp{TEXINFO_FILENAME}, keyword
  14963   The Texinfo filename.
  14964 
  14965 - =TEXINFO_CLASS= ::
  14966 
  14967   #+cindex: @samp{TEXINFO_CLASS}, keyword
  14968   #+vindex: org-texinfo-default-class
  14969   The default document class (~org-texinfo-default-class~), which must
  14970   be a member of ~org-texinfo-classes~.
  14971 
  14972 - =TEXINFO_HEADER= ::
  14973 
  14974   #+cindex: @samp{TEXINFO_HEADER}, keyword
  14975   Arbitrary lines inserted at the end of the header.
  14976 
  14977 - =TEXINFO_POST_HEADER= ::
  14978 
  14979   #+cindex: @samp{TEXINFO_POST_HEADER}, keyword
  14980   Arbitrary lines inserted after the end of the header.
  14981 
  14982 - =TEXINFO_DIR_CATEGORY= ::
  14983 
  14984   #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
  14985   The directory category of the document.
  14986 
  14987 - =TEXINFO_DIR_TITLE= ::
  14988 
  14989   #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword
  14990   The directory title of the document.
  14991 
  14992 - =TEXINFO_DIR_DESC= ::
  14993 
  14994   #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
  14995   The directory description of the document.
  14996 
  14997 - =TEXINFO_PRINTED_TITLE= ::
  14998 
  14999   #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
  15000   The printed title of the document.
  15001 
  15002 *** Texinfo file header
  15003 :PROPERTIES:
  15004 :DESCRIPTION: Generating the header.
  15005 :END:
  15006 
  15007 #+cindex: @samp{TEXINFO_FILENAME}, keyword
  15008 After creating the header for a Texinfo file, the Texinfo back-end
  15009 automatically generates a name and destination path for the Info file.
  15010 To override this default with a more sensible path and name, specify
  15011 the =TEXINFO_FILENAME= keyword.
  15012 
  15013 #+vindex: org-texinfo-coding-system
  15014 #+cindex: @samp{TEXINFO_HEADER}, keyword
  15015 Along with the output's file name, the Texinfo header also contains
  15016 language details (see [[*Export Settings]]) and encoding system as set in
  15017 the ~org-texinfo-coding-system~ variable.  Insert =TEXINFO_HEADER=
  15018 keywords for each additional command in the header, for example:
  15019 
  15020 : #+TEXINFO_HEADER: @synindex
  15021 
  15022 #+cindex: @samp{TEXINFO_CLASS}, keyword
  15023 #+vindex: org-texinfo-classes
  15024 Instead of repeatedly installing the same set of commands, define
  15025 a class in ~org-texinfo-classes~ once, and then activate it in the
  15026 document by setting the =TEXINFO_CLASS= keyword to that class.
  15027 
  15028 *** Texinfo title and copyright page
  15029 :PROPERTIES:
  15030 :DESCRIPTION: Creating preamble pages.
  15031 :END:
  15032 
  15033 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
  15034 The default template for hard copy output has a title page with
  15035 =TITLE= and =AUTHOR= keywords (see [[*Export Settings]]).  To replace the
  15036 regular title with something different for the printed version, use
  15037 the =TEXINFO_PRINTED_TITLE= and =SUBTITLE= keywords.  Both expect raw
  15038 Texinfo code for setting their values.
  15039 
  15040 #+cindex: @samp{SUBAUTHOR}, keyword
  15041 If one =AUTHOR= line is not sufficient, add multiple =SUBAUTHOR=
  15042 keywords.  They have to be set in raw Texinfo code.
  15043 
  15044 #+begin_example
  15045 ,#+AUTHOR: Jane Smith
  15046 ,#+SUBAUTHOR: John Doe
  15047 ,#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{}
  15048 #+end_example
  15049 
  15050 #+cindex: @samp{COPYING}, property
  15051 Copying material is defined in a dedicated headline with a non-~nil~
  15052 =COPYING= property.  The back-end inserts the contents within
  15053 a =@copying= command at the beginning of the document.  The heading
  15054 itself does not appear in the structure of the document.
  15055 
  15056 Copyright information is printed on the back of the title page.
  15057 
  15058 #+begin_example
  15059 ,* Legalese
  15060   :PROPERTIES:
  15061   :COPYING: t
  15062   :END:
  15063 
  15064   This is a short example of a complete Texinfo file, version 1.0.
  15065 
  15066   Copyright \copy 2016 Free Software Foundation, Inc.
  15067 #+end_example
  15068 
  15069 *** Info directory file
  15070 :PROPERTIES:
  15071 :DESCRIPTION: Installing a manual in Info file hierarchy.
  15072 :END:
  15073 
  15074 #+cindex: @samp{dir} file, in Texinfo export
  15075 #+cindex: Info directory file, in Texinfo export
  15076 #+cindex: @code{install-info}, in Texinfo export
  15077 
  15078 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
  15079 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword
  15080 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
  15081 The end result of the Texinfo export process is the creation of an
  15082 Info file.  This Info file's metadata has variables for category,
  15083 title, and description: =TEXINFO_DIR_CATEGORY=, =TEXINFO_DIR_TITLE=,
  15084 and =TEXINFO_DIR_DESC= keywords that establish where in the Info
  15085 hierarchy the file fits.
  15086 
  15087 Here is an example that writes to the Info directory file:
  15088 
  15089 #+begin_example
  15090 ,#+TEXINFO_DIR_CATEGORY: Emacs
  15091 ,#+TEXINFO_DIR_TITLE: Org Mode: (org)
  15092 ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer
  15093 #+end_example
  15094 
  15095 *** Headings and sectioning structure
  15096 :PROPERTIES:
  15097 :DESCRIPTION: Building document structure.
  15098 :END:
  15099 
  15100 #+vindex: org-texinfo-classes
  15101 #+vindex: org-texinfo-default-class
  15102 #+cindex: @samp{TEXINFO_CLASS}, keyword
  15103 The Texinfo export back-end uses a pre-defined scheme to convert Org
  15104 headlines to equivalent Texinfo structuring commands.  A scheme like
  15105 this maps top-level headlines to numbered chapters tagged as
  15106 ~@chapter~ and lower-level headlines to unnumbered chapters tagged as
  15107 ~@unnumbered~.  To override such mappings to introduce ~@part~ or
  15108 other Texinfo structuring commands, define a new class in
  15109 ~org-texinfo-classes~.  Activate the new class with the
  15110 =TEXINFO_CLASS= keyword.  When no new class is defined and activated,
  15111 the Texinfo export back-end defaults to the
  15112 ~org-texinfo-default-class~.
  15113 
  15114 If an Org headline's level has no associated Texinfo structuring
  15115 command, or is below a certain threshold (see [[*Export Settings]]), then
  15116 the Texinfo export back-end makes it into a list item.
  15117 
  15118 #+cindex: @samp{APPENDIX}, property
  15119 The Texinfo export back-end makes any headline with a non-~nil~
  15120 =APPENDIX= property into an appendix.  This happens independent of the
  15121 Org headline level or the =TEXINFO_CLASS= keyword.
  15122 
  15123 #+cindex: @samp{ALT_TITLE}, property
  15124 #+cindex: @samp{DESCRIPTION}, property
  15125 The Texinfo export back-end creates a menu entry after the Org
  15126 headline for each regular sectioning structure.  To override this with
  15127 a shorter menu entry, use the =ALT_TITLE= property (see [[*Table of
  15128 Contents]]).  Texinfo menu entries also have an option for a longer
  15129 =DESCRIPTION= property.  Here's an example that uses both to override
  15130 the default menu entry:
  15131 
  15132 #+begin_example
  15133 ,* Controlling Screen Display
  15134   :PROPERTIES:
  15135   :ALT_TITLE: Display
  15136   :DESCRIPTION: Controlling Screen Display
  15137   :END:
  15138 #+end_example
  15139 
  15140 #+cindex: Top node, in Texinfo export
  15141 The text before the first headline belongs to the /Top/ node, i.e.,
  15142 the node in which a reader enters an Info manual.  As such, it is
  15143 expected not to appear in printed output generated from the =.texi=
  15144 file.  See [[info:texinfo::The Top Node]], for more information.
  15145 
  15146 *** Indices
  15147 :PROPERTIES:
  15148 :DESCRIPTION: Creating indices.
  15149 :END:
  15150 
  15151 #+cindex: @samp{CINDEX}, keyword
  15152 #+cindex: concept index, in Texinfo export
  15153 #+cindex: @samp{FINDEX}, keyword
  15154 #+cindex: function index, in Texinfo export
  15155 #+cindex: @samp{KINDEX}, keyword
  15156 #+cindex: keystroke index, in Texinfo export
  15157 #+cindex: @samp{PINDEX}, keyword
  15158 #+cindex: program index, in Texinfo export
  15159 #+cindex: @samp{TINDEX}, keyword
  15160 #+cindex: data type index, in Texinfo export
  15161 #+cindex: @samp{VINDEX}, keyword
  15162 #+cindex: variable index, in Texinfo export
  15163 The Texinfo export back-end recognizes these indexing keywords if used
  15164 in the Org file: =CINDEX=, =FINDEX=, =KINDEX=, =PINDEX=, =TINDEX= and
  15165 =VINDEX=.  Write their value as verbatim Texinfo code; in particular,
  15166 ={=, =}= and =@= characters need to be escaped with =@= if they do not
  15167 belong to a Texinfo command.
  15168 
  15169 : #+CINDEX: Defining indexing entries
  15170 
  15171 #+cindex: @samp{INDEX}, property
  15172 For the back-end to generate an index entry for a headline, set the
  15173 =INDEX= property to =cp= or =vr=.  These abbreviations come from
  15174 Texinfo that stand for concept index and variable index.  The Texinfo
  15175 manual has abbreviations for all other kinds of indexes.  The back-end
  15176 exports the headline as an unnumbered chapter or section command, and
  15177 then inserts the index after its contents.
  15178 
  15179 #+begin_example
  15180 ,* Concept Index
  15181   :PROPERTIES:
  15182   :INDEX: cp
  15183   :END:
  15184 #+end_example
  15185 
  15186 *** Quoting Texinfo code
  15187 :PROPERTIES:
  15188 :DESCRIPTION: Incorporating literal Texinfo code.
  15189 :END:
  15190 
  15191 Use any of the following three methods to insert or escape raw Texinfo
  15192 code:
  15193 
  15194 #+cindex: @samp{TEXINFO}, keyword
  15195 #+cindex: @samp{BEGIN_EXPORT texinfo}
  15196 #+begin_example
  15197 Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU.
  15198 
  15199 ,#+TEXINFO: @need800
  15200 This paragraph is preceded by...
  15201 
  15202 ,#+BEGIN_EXPORT texinfo
  15203   @auindex Johnson, Mark
  15204   @auindex Lakoff, George
  15205 ,#+END_EXPORT
  15206 #+end_example
  15207 
  15208 *** Plain lists in Texinfo export
  15209 :PROPERTIES:
  15210 :DESCRIPTION: List attributes.
  15211 :END:
  15212 
  15213 #+cindex: @samp{ATTR_TEXINFO}, keyword
  15214 #+cindex: two-column tables, in Texinfo export
  15215 #+cindex: table-type, Texinfo attribute
  15216 The Texinfo export back-end by default converts description lists in
  15217 the Org file using the default command =@table=, which results in
  15218 a table with two columns.  To change this behavior, set =:table-type=
  15219 attribute to either =ftable= or =vtable= value.  For more information,
  15220 see [[info:texinfo::Two-column Tables]].
  15221 
  15222 #+vindex: org-texinfo-table-default-markup
  15223 #+cindex: indic, Texinfo attribute
  15224 The Texinfo export back-end by default also applies a text highlight
  15225 based on the defaults stored in ~org-texinfo-table-default-markup~.
  15226 To override the default highlight command, specify another one with
  15227 the =:indic= attribute.
  15228 
  15229 #+cindex: multiple items in Texinfo lists
  15230 #+cindex: sep, Texinfo attribute
  15231 Org syntax is limited to one entry per list item.  Nevertheless, the
  15232 Texinfo export back-end can split that entry according to any text
  15233 provided through the =:sep= attribute.  Each part then becomes a new
  15234 entry in the first column of the table.
  15235 
  15236 The following example illustrates all the attributes above:
  15237 
  15238 #+begin_example
  15239 ,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
  15240 - foo, bar :: This is the common text for variables foo and bar.
  15241 #+end_example
  15242 
  15243 #+texinfo: @noindent
  15244 becomes
  15245 
  15246 #+begin_example
  15247 @vtable @asis
  15248 @item foo
  15249 @itemx bar
  15250 This is the common text for variables foo and bar.
  15251 @end table
  15252 #+end_example
  15253 
  15254 #+cindex: lettered lists, in Texinfo export
  15255 #+cindex: enum, Texinfo attribute
  15256 Ordered lists are numbered when exported to Texinfo format.  Such
  15257 numbering obeys any counter (see [[*Plain Lists]]) in the first item of
  15258 the list.  The =:enum= attribute also let you start the list at
  15259 a specific number, or switch to a lettered list, as illustrated here
  15260 
  15261 #+begin_example
  15262 #+ATTR_TEXINFO: :enum A
  15263 1. Alpha
  15264 2. Bravo
  15265 3. Charlie
  15266 #+end_example
  15267 
  15268 *** Tables in Texinfo export
  15269 :PROPERTIES:
  15270 :DESCRIPTION: Table attributes.
  15271 :END:
  15272 
  15273 #+cindex: @samp{ATTR_TEXINFO}, keyword
  15274 When exporting tables, the Texinfo export back-end uses the widest
  15275 cell width in each column.  To override this and instead specify as
  15276 fractions of line length, use the =:columns= attribute.  See example
  15277 below.
  15278 
  15279 #+begin_example
  15280 ,#+ATTR_TEXINFO: :columns .5 .5
  15281 | a cell | another cell |
  15282 #+end_example
  15283 
  15284 *** Images in Texinfo export
  15285 :PROPERTIES:
  15286 :DESCRIPTION: Image attributes.
  15287 :END:
  15288 
  15289 #+cindex: @samp{ATTR_TEXINFO}, keyword
  15290 Insert a file link to the image in the Org file, and the Texinfo
  15291 export back-end inserts the image.  These links must have the usual
  15292 supported image extensions and no descriptions.  To scale the image,
  15293 use =:width= and =:height= attributes.  For alternate text, use =:alt=
  15294 and specify the text using Texinfo code, as shown in the example:
  15295 
  15296 #+begin_example
  15297 ,#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text}
  15298 [[ridt.pdf]]
  15299 #+end_example
  15300 
  15301 *** Quotations in Texinfo export
  15302 :PROPERTIES:
  15303 :DESCRIPTION: Quote block attributes.
  15304 :END:
  15305 
  15306 #+cindex: @samp{ATTR_TEXINFO}, keyword
  15307 You can write the text of a quotation within a quote block (see
  15308 [[*Paragraphs]]).  You may also emphasize some text at the beginning of
  15309 the quotation with the =:tag= attribute.
  15310 
  15311 #+begin_example
  15312 ,#+ATTR_TEXINFO: :tag Warning
  15313 ,#+BEGIN_QUOTE
  15314 Striking your thumb with a hammer may cause severe pain and discomfort.
  15315 ,#+END_QUOTE
  15316 #+end_example
  15317 
  15318 To specify the author of the quotation, use the =:author= attribute.
  15319 
  15320 #+begin_example
  15321 ,#+ATTR_TEXINFO: :author King Arthur
  15322 ,#+BEGIN_QUOTE
  15323 The Lady of the Lake, her arm clad in the purest shimmering samite,
  15324 held aloft Excalibur from the bosom of the water, signifying by divine
  15325 providence that I, Arthur, was to carry Excalibur.  That is why I am
  15326 your king.
  15327 ,#+END_QUOTE
  15328 #+end_example
  15329 
  15330 *** Special blocks in Texinfo export
  15331 :PROPERTIES:
  15332 :DESCRIPTION: Special block attributes.
  15333 :END:
  15334 
  15335 #+cindex: @samp{ATTR_TEXINFO}, keyword
  15336 
  15337 The Texinfo export back-end converts special blocks to commands with
  15338 the same name.  It also adds any =:options= attributes to the end of
  15339 the command, as shown in this example:
  15340 
  15341 #+begin_example
  15342 ,#+ATTR_TEXINFO: :options org-org-export-to-org ...
  15343 ,#+BEGIN_defun
  15344   A somewhat obsessive function name.
  15345 ,#+END_defun
  15346 #+end_example
  15347 
  15348 #+texinfo: @noindent
  15349 becomes
  15350 
  15351 #+begin_example
  15352 @defun org-org-export-to-org ...
  15353   A somewhat obsessive function name.
  15354 @end defun
  15355 #+end_example
  15356 
  15357 *** A Texinfo example
  15358 :PROPERTIES:
  15359 :DESCRIPTION: Processing Org to Texinfo.
  15360 :END:
  15361 
  15362 Here is a more detailed example Org file.  See
  15363 [[info:texinfo::GNU Sample Texts]] for an equivalent example using
  15364 Texinfo code.
  15365 
  15366 #+begin_example
  15367 ,#+TITLE: GNU Sample {{{version}}}
  15368 ,#+SUBTITLE: for version {{{version}}}, {{{updated}}}
  15369 ,#+AUTHOR: A.U. Thor
  15370 ,#+EMAIL: bug-sample@gnu.org
  15371 
  15372 ,#+OPTIONS: ':t toc:t author:t email:t
  15373 ,#+LANGUAGE: en
  15374 
  15375 ,#+MACRO: version 2.0
  15376 ,#+MACRO: updated last updated 4 March 2014
  15377 
  15378 ,#+TEXINFO_FILENAME: sample.info
  15379 ,#+TEXINFO_HEADER: @syncodeindex pg cp
  15380 
  15381 ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system
  15382 ,#+TEXINFO_DIR_TITLE: sample: (sample)
  15383 ,#+TEXINFO_DIR_DESC: Invoking sample
  15384 
  15385 ,#+TEXINFO_PRINTED_TITLE: GNU Sample
  15386 
  15387 This manual is for GNU Sample (version {{{version}}},
  15388 {{{updated}}}).
  15389 
  15390 ,* Copying
  15391   :PROPERTIES:
  15392   :COPYING:  t
  15393   :END:
  15394 
  15395   This manual is for GNU Sample (version {{{version}}},
  15396   {{{updated}}}), which is an example in the Texinfo documentation.
  15397 
  15398   Copyright \copy 2016 Free Software Foundation, Inc.
  15399 
  15400   ,#+BEGIN_QUOTE
  15401   Permission is granted to copy, distribute and/or modify this
  15402   document under the terms of the GNU Free Documentation License,
  15403   Version 1.3 or any later version published by the Free Software
  15404   Foundation; with no Invariant Sections, with no Front-Cover Texts,
  15405   and with no Back-Cover Texts.  A copy of the license is included in
  15406   the section entitled "GNU Free Documentation License".
  15407   ,#+END_QUOTE
  15408 
  15409 ,* Invoking sample
  15410 
  15411   ,#+PINDEX: sample
  15412   ,#+CINDEX: invoking @command{sample}
  15413 
  15414   This is a sample manual.  There is no sample program to invoke, but
  15415   if there were, you could see its basic usage and command line
  15416   options here.
  15417 
  15418 ,* GNU Free Documentation License
  15419   :PROPERTIES:
  15420   :APPENDIX: t
  15421   :END:
  15422 
  15423   ,#+INCLUDE: fdl.org
  15424 
  15425 ,* Index
  15426   :PROPERTIES:
  15427   :INDEX:    cp
  15428   :END:
  15429 #+end_example
  15430 
  15431 ** iCalendar Export
  15432 :PROPERTIES:
  15433 :DESCRIPTION: Exporting to iCalendar.
  15434 :END:
  15435 #+cindex: iCalendar export
  15436 
  15437 A large part of Org mode's interoperability success is its ability to
  15438 easily export to or import from external applications.  The iCalendar
  15439 export back-end takes calendar data from Org files and exports to the
  15440 standard iCalendar format.
  15441 
  15442 #+vindex: org-icalendar-include-todo
  15443 #+vindex: org-icalendar-use-deadline
  15444 #+vindex: org-icalendar-use-scheduled
  15445 The iCalendar export back-end can also incorporate TODO entries based
  15446 on the configuration of the ~org-icalendar-include-todo~ variable.
  15447 The back-end exports plain timestamps as =VEVENT=, TODO items as
  15448 =VTODO=, and also create events from deadlines that are in non-TODO
  15449 items.  The back-end uses the deadlines and scheduling dates in Org
  15450 TODO items for setting the start and due dates for the iCalendar TODO
  15451 entry.  Consult the ~org-icalendar-use-deadline~ and
  15452 ~org-icalendar-use-scheduled~ variables for more details.
  15453 
  15454 #+vindex: org-icalendar-categories
  15455 #+vindex: org-icalendar-alarm-time
  15456 For tags on the headline, the iCalendar export back-end makes them
  15457 into iCalendar categories.  To tweak the inheritance of tags and TODO
  15458 states, configure the variable ~org-icalendar-categories~.  To assign
  15459 clock alarms based on time, configure the ~org-icalendar-alarm-time~
  15460 variable.
  15461 
  15462 #+vindex: org-icalendar-store-UID
  15463 #+cindex: @samp{ID}, property
  15464 The iCalendar format standard requires globally unique identifier---or
  15465 UID---for each entry.  The iCalendar export back-end creates UIDs
  15466 during export.  To save a copy of the UID in the Org file set the
  15467 variable ~org-icalendar-store-UID~.  The back-end looks for the =ID=
  15468 property of the entry for re-using the same UID for subsequent
  15469 exports.
  15470 
  15471 Since a single Org entry can result in multiple iCalendar
  15472 entries---timestamp, deadline, scheduled item, or TODO item---Org adds
  15473 prefixes to the UID, depending on which part of the Org entry
  15474 triggered the creation of the iCalendar entry.  Prefixing ensures UIDs
  15475 remains unique, yet enable synchronization programs trace the
  15476 connections.
  15477 
  15478 - {{{kbd(C-c C-e c f)}}} (~org-icalendar-export-to-ics~) ::
  15479 
  15480   #+kindex: C-c C-e c f
  15481   #+findex: org-icalendar-export-to-ics
  15482   Create iCalendar entries from the current Org buffer and store them
  15483   in the same directory, using a file extension =.ics=.
  15484 
  15485 - {{{kbd(C-c C-e c a)}}} (~org-icalendar-export-agenda-files~) ::
  15486 
  15487   #+kindex: C-c C-e c a
  15488   #+findex: org-icalendar-export-agenda-files
  15489   Create iCalendar entries from Org files in ~org-agenda-files~ and
  15490   store in a separate iCalendar file for each Org file.
  15491 
  15492 - {{{kbd(C-c C-e c c)}}} (~org-icalendar-combine-agenda-files~) ::
  15493 
  15494   #+kindex: C-c C-e c c
  15495   #+findex: org-icalendar-combine-agenda-files
  15496   #+vindex: org-icalendar-combined-agenda-file
  15497   Create a combined iCalendar file from Org files in
  15498   ~org-agenda-files~ and write it to
  15499   ~org-icalendar-combined-agenda-file~ file name.
  15500 
  15501 #+cindex: @samp{SUMMARY}, property
  15502 #+cindex: @samp{DESCRIPTION}, property
  15503 #+cindex: @samp{LOCATION}, property
  15504 #+cindex: @samp{TIMEZONE}, property
  15505 #+cindex: @samp{CLASS}, property
  15506 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
  15507 =LOCATION=, =TIMEZONE= and =CLASS= properties from the Org entries
  15508 when exporting.  To force the back-end to inherit the =LOCATION=,
  15509 =TIMEZONE= and =CLASS= properties, configure the
  15510 ~org-use-property-inheritance~ variable.
  15511 
  15512 #+vindex: org-icalendar-include-body
  15513 When Org entries do not have =SUMMARY=, =DESCRIPTION=, =LOCATION= and
  15514 =CLASS= properties, the iCalendar export back-end derives the summary
  15515 from the headline, and derives the description from the body of the
  15516 Org item.  The ~org-icalendar-include-body~ variable limits the
  15517 maximum number of characters of the content are turned into its
  15518 description.
  15519 
  15520 The =TIMEZONE= property can be used to specify a per-entry time zone,
  15521 and is applied to any entry with timestamp information.  Time zones
  15522 should be specified as per the IANA time zone database format, e.g.,
  15523 =Asia/Almaty=.  Alternately, the property value can be =UTC=, to force
  15524 UTC time for this entry only.
  15525 
  15526 The =CLASS= property can be used to specify a per-entry visibility
  15527 class or access restrictions, and is applied to any entry with class
  15528 information.  The iCalendar standard defines three visibility classes:
  15529 - =PUBLIC= :: The entry is publicly visible (this is the default).
  15530 - =CONFIDENTIAL= :: Only a limited group of clients get access to the
  15531   event.
  15532 - =PRIVATE= :: The entry can be retrieved only by its owner.
  15533 The server should treat unknown class properties the same as
  15534 =PRIVATE=.
  15535 
  15536 Exporting to iCalendar format depends in large part on the
  15537 capabilities of the destination application.  Some are more lenient
  15538 than others.  Consult the Org mode FAQ for advice on specific
  15539 applications.
  15540 
  15541 ** Other Built-in Back-ends
  15542 :PROPERTIES:
  15543 :DESCRIPTION: Exporting to a man page.
  15544 :END:
  15545 
  15546 Other export back-ends included with Org are:
  15547 
  15548 - =ox-man.el=: Export to a man page.
  15549 
  15550 To activate such back-ends, either customize ~org-export-backends~ or
  15551 load directly with =(require 'ox-man)=.  On successful load, the
  15552 back-end adds new keys in the export dispatcher (see [[*The Export
  15553 Dispatcher]]).
  15554 
  15555 Follow the comment section of such files, for example, =ox-man.el=,
  15556 for usage and configuration details.
  15557 
  15558 ** Advanced Export Configuration
  15559 :PROPERTIES:
  15560 :DESCRIPTION: Fine-tuning the export output.
  15561 :END:
  15562 
  15563 *** Hooks
  15564 :PROPERTIES:
  15565 :UNNUMBERED: notoc
  15566 :END:
  15567 
  15568 #+vindex: org-export-before-processing-hook
  15569 #+vindex: org-export-before-parsing-hook
  15570 The export process executes two hooks before the actual exporting
  15571 begins.  The first hook, ~org-export-before-processing-hook~, runs
  15572 before any expansions of macros, Babel code, and include keywords in
  15573 the buffer.  The second hook, ~org-export-before-parsing-hook~, runs
  15574 before the buffer is parsed.
  15575 
  15576 Functions added to these hooks are called with a single argument: the
  15577 export back-end actually used, as a symbol.  You may use them for
  15578 heavy duty structural modifications of the document.  For example, you
  15579 can remove every headline in the buffer during export like this:
  15580 
  15581 #+begin_src emacs-lisp
  15582 (defun my-headline-removal (backend)
  15583   "Remove all headlines in the current buffer.
  15584 BACKEND is the export back-end being used, as a symbol."
  15585   (org-map-entries
  15586    (lambda () (delete-region (point) (line-beginning-position 2)))))
  15587 
  15588 (add-hook 'org-export-before-parsing-hook #'my-headline-removal)
  15589 #+end_src
  15590 
  15591 *** Filters
  15592 :PROPERTIES:
  15593 :UNNUMBERED: notoc
  15594 :END:
  15595 
  15596 #+cindex: Filters, exporting
  15597 Filters are lists of functions to be applied to certain parts for
  15598 a given back-end.  The output from the first function in the filter is
  15599 passed on to the next function in the filter.  The final output is the
  15600 output from the final function in the filter.
  15601 
  15602 The Org export process has many filter sets applicable to different
  15603 types of objects, plain text, parse trees, export options, and final
  15604 output formats.  The filters are named after the element type or
  15605 object type: ~org-export-filter-TYPE-functions~, where {{{var(TYPE)}}}
  15606 is the type targeted by the filter.  Valid types are:
  15607 
  15608 #+attr_texinfo: :columns 0.33 0.33 0.33
  15609 | body                | bold               | babel-call       |
  15610 | center-block        | clock              | code             |
  15611 | diary-sexp          | drawer             | dynamic-block    |
  15612 | entity              | example-block      | export-block     |
  15613 | export-snippet      | final-output       | fixed-width      |
  15614 | footnote-definition | footnote-reference | headline         |
  15615 | horizontal-rule     | inline-babel-call  | inline-src-block |
  15616 | inlinetask          | italic             | item             |
  15617 | keyword             | latex-environment  | latex-fragment   |
  15618 | line-break          | link               | node-property    |
  15619 | options             | paragraph          | parse-tree       |
  15620 | plain-list          | plain-text         | planning         |
  15621 | property-drawer     | quote-block        | radio-target     |
  15622 | section             | special-block      | src-block        |
  15623 | statistics-cookie   | strike-through     | subscript        |
  15624 | superscript         | table              | table-cell       |
  15625 | table-row           | target             | timestamp        |
  15626 | underline           | verbatim           | verse-block      |
  15627 
  15628 Here is an example filter that replaces non-breaking spaces ~ ~ in the
  15629 Org buffer with =~= for the LaTeX back-end.
  15630 
  15631 #+begin_src emacs-lisp
  15632 (defun my-latex-filter-nobreaks (text backend info)
  15633   "Ensure \" \" are properly handled in LaTeX export."
  15634   (when (org-export-derived-backend-p backend 'latex)
  15635     (replace-regexp-in-string " " "~" text)))
  15636 
  15637 (add-to-list 'org-export-filter-plain-text-functions
  15638              'my-latex-filter-nobreaks)
  15639 #+end_src
  15640 
  15641 A filter requires three arguments: the code to be transformed, the
  15642 name of the back-end, and some optional information about the export
  15643 process.  The third argument can be safely ignored.  Note the use of
  15644 ~org-export-derived-backend-p~ predicate that tests for /latex/
  15645 back-end or any other back-end, such as /beamer/, derived from
  15646 /latex/.
  15647 
  15648 *** Defining filters for individual files
  15649 :PROPERTIES:
  15650 :UNNUMBERED: notoc
  15651 :END:
  15652 
  15653 The Org export can filter not just for back-ends, but also for
  15654 specific files through the =BIND= keyword.  Here is an example with
  15655 two filters; one removes brackets from time stamps, and the other
  15656 removes strike-through text.  The filter functions are defined in
  15657 a code block in the same Org file, which is a handy location for
  15658 debugging.
  15659 
  15660 #+begin_example
  15661 ,#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
  15662 ,#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
  15663 ,#+BEGIN_SRC emacs-lisp :exports results :results none
  15664   (defun tmp-f-timestamp (s backend info)
  15665     (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
  15666   (defun tmp-f-strike-through (s backend info) "")
  15667 ,#+END_SRC
  15668 #+end_example
  15669 
  15670 *** Extending an existing back-end
  15671 :PROPERTIES:
  15672 :UNNUMBERED: notoc
  15673 :END:
  15674 
  15675 Some parts of the conversion process can be extended for certain
  15676 elements so as to introduce a new or revised translation.  That is how
  15677 the HTML export back-end was extended to handle Markdown format.  The
  15678 extensions work seamlessly so any aspect of filtering not done by the
  15679 extended back-end is handled by the original back-end.  Of all the
  15680 export customization in Org, extending is very powerful as it operates
  15681 at the parser level.
  15682 
  15683 For this example, make the /ascii/ back-end display the language used
  15684 in a source code block.  Also make it display only when some attribute
  15685 is non-~nil~, like the following:
  15686 
  15687 : #+ATTR_ASCII: :language t
  15688 
  15689 Then extend ASCII back-end with a custom "my-ascii" back-end.
  15690 
  15691 #+begin_src emacs-lisp
  15692 (defun my-ascii-src-block (src-block contents info)
  15693   "Transcode a SRC-BLOCK element from Org to ASCII.
  15694 CONTENTS is nil.  INFO is a plist used as a communication
  15695 channel."
  15696   (if (not (org-export-read-attribute :attr_ascii src-block :language))
  15697       (org-export-with-backend 'ascii src-block contents info)
  15698     (concat
  15699      (format ",--[ %s ]--\n%s`----"
  15700              (org-element-property :language src-block)
  15701              (replace-regexp-in-string
  15702               "^" "| "
  15703               (org-element-normalize-string
  15704                (org-export-format-code-default src-block info)))))))
  15705 
  15706 (org-export-define-derived-backend 'my-ascii 'ascii
  15707   :translate-alist '((src-block . my-ascii-src-block)))
  15708 #+end_src
  15709 
  15710 The ~my-ascii-src-block~ function looks at the attribute above the
  15711 current element.  If not true, hands over to /ascii/ back-end.  If
  15712 true, which it is in this example, it creates a box around the code
  15713 and leaves room for the inserting a string for language.  The last
  15714 form creates the new back-end that springs to action only when
  15715 translating ~src-block~ type elements.
  15716 
  15717 To use the newly defined back-end, evaluate the following from an Org
  15718 buffer:
  15719 
  15720 #+begin_src emacs-lisp
  15721 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
  15722 #+end_src
  15723 
  15724 Further steps to consider would be an interactive function,
  15725 self-installing an item in the export dispatcher menu, and other
  15726 user-friendly improvements.
  15727 
  15728 ** Export in Foreign Buffers
  15729 :PROPERTIES:
  15730 :DESCRIPTION: Author tables and lists in Org syntax.
  15731 :END:
  15732 
  15733 The export back-ends in Org often include commands to convert selected
  15734 regions.  A convenient feature of this in-place conversion is that the
  15735 exported output replaces the original source.  Here are such
  15736 functions:
  15737 
  15738 - ~org-ascii-convert-region-to-ascii~ ::
  15739 
  15740   #+findex: org-ascii-convert-region-to-ascii
  15741   Convert the selected region into ASCII.
  15742 
  15743 - ~org-ascii-convert-region-to-utf8~ ::
  15744 
  15745   #+findex: org-ascii-convert-region-to-utf8
  15746   Convert the selected region into UTF-8.
  15747 
  15748 - ~org-html-convert-region-to-html~ ::
  15749 
  15750   #+findex: org-html-convert-region-to-html
  15751   Convert the selected region into HTML.
  15752 
  15753 - ~org-latex-convert-region-to-latex~ ::
  15754 
  15755   #+findex: org-latex-convert-region-to-latex
  15756   Convert the selected region into LaTeX.
  15757 
  15758 - ~org-texinfo-convert-region-to-texinfo~ ::
  15759 
  15760   #+findex: org-texinfo-convert-region-to-texinfo
  15761   Convert the selected region into Texinfo.
  15762 
  15763 - ~org-md-convert-region-to-md~ ::
  15764 
  15765   #+findex: org-md-convert-region-to-md
  15766   Convert the selected region into Markdown.
  15767 
  15768 In-place conversions are particularly handy for quick conversion of
  15769 tables and lists in foreign buffers.  For example, in an HTML buffer,
  15770 write a list in Org syntax, select it, and convert it to HTML with
  15771 {{{kbd(M-x org-html-convert-region-to-html)}}}.
  15772 
  15773 *** Exporting to minimal HTML
  15774 :PROPERTIES:
  15775 :DESCRIPTION: Exporting HTML without CSS, Javascript, etc.
  15776 :ALT_TITLE: Bare HTML
  15777 :END:
  15778 
  15779 If you want to output a minimal HTML file, with no CSS, no Javascript,
  15780 no preamble or postamble, here are the variable you would need to set:
  15781 
  15782 #+vindex: org-html-head
  15783 #+vindex: org-html-head-extra
  15784 #+vindex: org-html-head-include-default-style
  15785 #+vindex: org-html-head-include-scripts
  15786 #+vindex: org-html-preamble
  15787 #+vindex: org-html-postamble
  15788 #+vindex: org-html-use-infojs
  15789 #+begin_src emacs-lisp
  15790 (setq org-html-head ""
  15791       org-html-head-extra ""
  15792       org-html-head-include-default-style nil
  15793       org-html-head-include-scripts nil
  15794       org-html-preamble nil
  15795       org-html-postamble nil
  15796       org-html-use-infojs nil)
  15797 #+end_src
  15798 
  15799 * Publishing
  15800 :PROPERTIES:
  15801 :DESCRIPTION: Create a web site of linked Org files.
  15802 :END:
  15803 #+cindex: publishing
  15804 
  15805 Org includes a publishing management system that allows you to
  15806 configure automatic HTML conversion of /projects/ composed of
  15807 interlinked Org files.  You can also configure Org to automatically
  15808 upload your exported HTML pages and related attachments, such as
  15809 images and source code files, to a web server.
  15810 
  15811 You can also use Org to convert files into PDF, or even combine HTML
  15812 and PDF conversion so that files are available in both formats on the
  15813 server.
  15814 
  15815 Publishing has been contributed to Org by David O'Toole.
  15816 
  15817 ** Configuration
  15818 :PROPERTIES:
  15819 :DESCRIPTION: Defining projects.
  15820 :END:
  15821 Publishing needs significant configuration to specify files,
  15822 destination and many other properties of a project.
  15823 
  15824 *** The variable ~org-publish-project-alist~
  15825 :PROPERTIES:
  15826 :DESCRIPTION: The central configuration variable.
  15827 :ALT_TITLE: Project alist
  15828 :END:
  15829 #+cindex: projects, for publishing
  15830 
  15831 #+vindex: org-publish-project-alist
  15832 Publishing is configured almost entirely through setting the value of
  15833 one variable, called ~org-publish-project-alist~.  Each element of the
  15834 list configures one project, and may be in one of the two following
  15835 forms:
  15836 
  15837 #+begin_src emacs-lisp
  15838 ("project-name" :property value :property value ...)
  15839 #+end_src
  15840 
  15841 #+texinfo: @noindent
  15842 i.e., a well-formed property list with alternating keys and values,
  15843 or:
  15844 
  15845 #+begin_src emacs-lisp
  15846 ("project-name" :components ("project-name" "project-name" ...))
  15847 #+end_src
  15848 
  15849 In both cases, projects are configured by specifying property values.
  15850 A project defines the set of files that are to be published, as well
  15851 as the publishing configuration to use when publishing those files.
  15852 When a project takes the second form listed above, the individual
  15853 members of the ~:components~ property are taken to be sub-projects,
  15854 which group together files requiring different publishing options.
  15855 When you publish such a "meta-project", all the components are also
  15856 published, in the sequence given.
  15857 
  15858 *** Sources and destinations for files
  15859 :PROPERTIES:
  15860 :DESCRIPTION: From here to there.
  15861 :ALT_TITLE: Sources and destinations
  15862 :END:
  15863 #+cindex: directories, for publishing
  15864 
  15865 Most properties are optional, but some should always be set.  In
  15866 particular, Org needs to know where to look for source files, and
  15867 where to put published files.
  15868 
  15869 - ~:base-directory~ ::
  15870 
  15871   Directory containing publishing source files.
  15872 
  15873 - ~:publishing-directory~ ::
  15874 
  15875   Directory where output files are published.  You can directly
  15876   publish to a webserver using a file name syntax appropriate for the
  15877   Emacs tramp package.  Or you can publish to a local directory and
  15878   use external tools to upload your website (see [[*Uploading Files]]).
  15879 
  15880 - ~:preparation-function~ ::
  15881 
  15882   Function or list of functions to be called before starting the
  15883   publishing process, for example, to run =make= for updating files to
  15884   be published.  Each preparation function is called with a single
  15885   argument, the project property list.
  15886 
  15887 - ~:completion-function~ ::
  15888 
  15889   Function or list of functions called after finishing the publishing
  15890   process, for example, to change permissions of the resulting files.
  15891   Each completion function is called with a single argument, the
  15892   project property list.
  15893 
  15894 *** Selecting files
  15895 :PROPERTIES:
  15896 :DESCRIPTION: What files are part of the project?
  15897 :END:
  15898 #+cindex: files, selecting for publishing
  15899 
  15900 By default, all files with extension =.org= in the base directory are
  15901 considered part of the project.  This can be modified by setting the
  15902 following properties
  15903 
  15904 - ~:base-extension~ ::
  15905 
  15906   Extension---without the dot---of source files.  This actually is
  15907   a regular expression.  Set this to the symbol ~any~ if you want to
  15908   get all files in ~:base-directory~, even without extension.
  15909 
  15910 - ~:exclude~ ::
  15911 
  15912   Regular expression to match file names that should not be published,
  15913   even though they have been selected on the basis of their extension.
  15914 
  15915 - ~:include~ ::
  15916 
  15917   List of files to be included regardless of ~:base-extension~ and
  15918   ~:exclude~.
  15919 
  15920 - ~:recursive~ ::
  15921 
  15922   Non-~nil~ means, check base-directory recursively for files to
  15923   publish.
  15924 
  15925 *** Publishing action
  15926 :PROPERTIES:
  15927 :DESCRIPTION: Setting the function doing the publishing.
  15928 :END:
  15929 #+cindex: action, for publishing
  15930 
  15931 Publishing means that a file is copied to the destination directory
  15932 and possibly transformed in the process.  The default transformation
  15933 is to export Org files as HTML files, and this is done by the function
  15934 ~org-html-publish-to-html~ which calls the HTML exporter (see [[*HTML
  15935 Export]]).  But you can also publish your content as PDF files using
  15936 ~org-latex-publish-to-pdf~, or as ASCII, Texinfo, etc., using the
  15937 corresponding functions.
  15938 
  15939 If you want to publish the Org file as an =.org= file but with
  15940 /archived/, /commented/, and /tag-excluded/ trees removed, use
  15941 ~org-org-publish-to-org~.  This produces =file.org= and puts it in the
  15942 publishing directory.  If you want a htmlized version of this file,
  15943 set the parameter ~:htmlized-source~ to ~t~.  It produces
  15944 =file.org.html= in the publishing directory[fn:141].
  15945 
  15946 Other files like images only need to be copied to the publishing
  15947 destination; for this you can use ~org-publish-attachment~.  For
  15948 non-Org files, you always need to specify the publishing function:
  15949 
  15950 - ~:publishing-function~ ::
  15951 
  15952   Function executing the publication of a file.  This may also be
  15953   a list of functions, which are all called in turn.
  15954 
  15955 - ~:htmlized-source~ ::
  15956 
  15957   Non-~nil~ means, publish htmlized source.
  15958 
  15959 The function must accept three arguments: a property list containing
  15960 at least a ~:publishing-directory~ property, the name of the file to
  15961 be published, and the path to the publishing directory of the output
  15962 file.  It should take the specified file, make the necessary
  15963 transformation, if any, and place the result into the destination
  15964 folder.
  15965 
  15966 *** Options for the exporters
  15967 :PROPERTIES:
  15968 :DESCRIPTION: Tweaking HTML/@LaTeX{} export.
  15969 :ALT_TITLE: Publishing options
  15970 :END:
  15971 #+cindex: options, for publishing
  15972 #+cindex: publishing options
  15973 
  15974 The property list can be used to set many export options for the HTML
  15975 and LaTeX exporters.  In most cases, these properties correspond to
  15976 user variables in Org.  The table below lists these properties along
  15977 with the variable they belong to.  See the documentation string for
  15978 the respective variable for details.
  15979 
  15980 #+vindex: org-publish-project-alist
  15981 When a property is given a value in ~org-publish-project-alist~, its
  15982 setting overrides the value of the corresponding user variable, if
  15983 any, during publishing.  Options set within a file (see [[*Export
  15984 Settings]]), however, override everything.
  15985 
  15986 **** Generic properties
  15987 :PROPERTIES:
  15988 :UNNUMBERED: notoc
  15989 :END:
  15990 
  15991 | ~:archived-trees~       | ~org-export-with-archived-trees~   |
  15992 | ~:exclude-tags~         | ~org-export-exclude-tags~          |
  15993 | ~:headline-levels~      | ~org-export-headline-levels~       |
  15994 | ~:language~             | ~org-export-default-language~      |
  15995 | ~:preserve-breaks~      | ~org-export-preserve-breaks~       |
  15996 | ~:section-numbers~      | ~org-export-with-section-numbers~  |
  15997 | ~:select-tags~          | ~org-export-select-tags~           |
  15998 | ~:with-author~          | ~org-export-with-author~           |
  15999 | ~:with-broken-links~    | ~org-export-with-broken-links~     |
  16000 | ~:with-clocks~          | ~org-export-with-clocks~           |
  16001 | ~:with-creator~         | ~org-export-with-creator~          |
  16002 | ~:with-date~            | ~org-export-with-date~             |
  16003 | ~:with-drawers~         | ~org-export-with-drawers~          |
  16004 | ~:with-email~           | ~org-export-with-email~            |
  16005 | ~:with-emphasize~       | ~org-export-with-emphasize~        |
  16006 | ~:with-fixed-width~     | ~org-export-with-fixed-width~      |
  16007 | ~:with-footnotes~       | ~org-export-with-footnotes~        |
  16008 | ~:with-latex~           | ~org-export-with-latex~            |
  16009 | ~:with-planning~        | ~org-export-with-planning~         |
  16010 | ~:with-priority~        | ~org-export-with-priority~         |
  16011 | ~:with-properties~      | ~org-export-with-properties~       |
  16012 | ~:with-special-strings~ | ~org-export-with-special-strings~  |
  16013 | ~:with-sub-superscript~ | ~org-export-with-sub-superscripts~ |
  16014 | ~:with-tables~          | ~org-export-with-tables~           |
  16015 | ~:with-tags~            | ~org-export-with-tags~             |
  16016 | ~:with-tasks~           | ~org-export-with-tasks~            |
  16017 | ~:with-timestamps~      | ~org-export-with-timestamps~       |
  16018 | ~:with-title~           | ~org-export-with-title~            |
  16019 | ~:with-toc~             | ~org-export-with-toc~              |
  16020 | ~:with-todo-keywords~   | ~org-export-with-todo-keywords~    |
  16021 
  16022 **** ASCII specific properties
  16023 :PROPERTIES:
  16024 :UNNUMBERED: notoc
  16025 :END:
  16026 
  16027 | ~:ascii-bullets~                       | ~org-ascii-bullets~                       |
  16028 | ~:ascii-caption-above~                 | ~org-ascii-caption-above~                 |
  16029 | ~:ascii-charset~                       | ~org-ascii-charset~                       |
  16030 | ~:ascii-global-margin~                 | ~org-ascii-global-margin~                 |
  16031 | ~:ascii-format-drawer-function~        | ~org-ascii-format-drawer-function~        |
  16032 | ~:ascii-format-inlinetask-function~    | ~org-ascii-format-inlinetask-function~    |
  16033 | ~:ascii-headline-spacing~              | ~org-ascii-headline-spacing~              |
  16034 | ~:ascii-indented-line-width~           | ~org-ascii-indented-line-width~           |
  16035 | ~:ascii-inlinetask-width~              | ~org-ascii-inlinetask-width~              |
  16036 | ~:ascii-inner-margin~                  | ~org-ascii-inner-margin~                  |
  16037 | ~:ascii-links-to-notes~                | ~org-ascii-links-to-notes~                |
  16038 | ~:ascii-list-margin~                   | ~org-ascii-list-margin~                   |
  16039 | ~:ascii-paragraph-spacing~             | ~org-ascii-paragraph-spacing~             |
  16040 | ~:ascii-quote-margin~                  | ~org-ascii-quote-margin~                  |
  16041 | ~:ascii-table-keep-all-vertical-lines~ | ~org-ascii-table-keep-all-vertical-lines~ |
  16042 | ~:ascii-table-use-ascii-art~           | ~org-ascii-table-use-ascii-art~           |
  16043 | ~:ascii-table-widen-columns~           | ~org-ascii-table-widen-columns~           |
  16044 | ~:ascii-text-width~                    | ~org-ascii-text-width~                    |
  16045 | ~:ascii-underline~                     | ~org-ascii-underline~                     |
  16046 | ~:ascii-verbatim-format~               | ~org-ascii-verbatim-format~               |
  16047 
  16048 **** Beamer specific properties
  16049 :PROPERTIES:
  16050 :UNNUMBERED: notoc
  16051 :END:
  16052 
  16053 | ~:beamer-theme~                 | ~org-beamer-theme~                 |
  16054 | ~:beamer-column-view-format~    | ~org-beamer-column-view-format~    |
  16055 | ~:beamer-environments-extra~    | ~org-beamer-environments-extra~    |
  16056 | ~:beamer-frame-default-options~ | ~org-beamer-frame-default-options~ |
  16057 | ~:beamer-outline-frame-options~ | ~org-beamer-outline-frame-options~ |
  16058 | ~:beamer-outline-frame-title~   | ~org-beamer-outline-frame-title~   |
  16059 | ~:beamer-subtitle-format~       | ~org-beamer-subtitle-format~       |
  16060 
  16061 **** HTML specific properties
  16062 :PROPERTIES:
  16063 :UNNUMBERED: notoc
  16064 :END:
  16065 
  16066 | ~:html-allow-name-attribute-in-anchors~        | ~org-html-allow-name-attribute-in-anchors~        |
  16067 | ~:html-checkbox-type~                          | ~org-html-checkbox-type~                          |
  16068 | ~:html-container~                              | ~org-html-container-element~                      |
  16069 | ~:html-divs~                                   | ~org-html-divs~                                   |
  16070 | ~:html-doctype~                                | ~org-html-doctype~                                |
  16071 | ~:html-extension~                              | ~org-html-extension~                              |
  16072 | ~:html-footnote-format~                        | ~org-html-footnote-format~                        |
  16073 | ~:html-footnote-separator~                     | ~org-html-footnote-separator~                     |
  16074 | ~:html-footnotes-section~                      | ~org-html-footnotes-section~                      |
  16075 | ~:html-format-drawer-function~                 | ~org-html-format-drawer-function~                 |
  16076 | ~:html-format-headline-function~               | ~org-html-format-headline-function~               |
  16077 | ~:html-format-inlinetask-function~             | ~org-html-format-inlinetask-function~             |
  16078 | ~:html-head-extra~                             | ~org-html-head-extra~                             |
  16079 | ~:html-head-include-default-style~             | ~org-html-head-include-default-style~             |
  16080 | ~:html-head-include-scripts~                   | ~org-html-head-include-scripts~                   |
  16081 | ~:html-head~                                   | ~org-html-head~                                   |
  16082 | ~:html-home/up-format~                         | ~org-html-home/up-format~                         |
  16083 | ~:html-html5-fancy~                            | ~org-html-html5-fancy~                            |
  16084 | ~:html-indent~                                 | ~org-html-indent~                                 |
  16085 | ~:html-infojs-options~                         | ~org-html-infojs-options~                         |
  16086 | ~:html-infojs-template~                        | ~org-html-infojs-template~                        |
  16087 | ~:html-inline-image-rules~                     | ~org-html-inline-image-rules~                     |
  16088 | ~:html-inline-images~                          | ~org-html-inline-images~                          |
  16089 | ~:html-link-home~                              | ~org-html-link-home~                              |
  16090 | ~:html-link-org-files-as-html~                 | ~org-html-link-org-files-as-html~                 |
  16091 | ~:html-link-up~                                | ~org-html-link-up~                                |
  16092 | ~:html-link-use-abs-url~                       | ~org-html-link-use-abs-url~                       |
  16093 | ~:html-mathjax-options~                        | ~org-html-mathjax-options~                        |
  16094 | ~:html-mathjax-template~                       | ~org-html-mathjax-template~                       |
  16095 | ~:html-equation-reference-format~              | ~org-html-equation-reference-format~              |
  16096 | ~:html-metadata-timestamp-format~              | ~org-html-metadata-timestamp-format~              |
  16097 | ~:html-postamble-format~                       | ~org-html-postamble-format~                       |
  16098 | ~:html-postamble~                              | ~org-html-postamble~                              |
  16099 | ~:html-preamble-format~                        | ~org-html-preamble-format~                        |
  16100 | ~:html-preamble~                               | ~org-html-preamble~                               |
  16101 | ~:html-self-link-headlines~                    | ~org-html-self-link-headlines~                    |
  16102 | ~:html-table-align-individual-field~           | ~de{org-html-table-align-individual-fields~       |
  16103 | ~:html-table-attributes~                       | ~org-html-table-default-attributes~               |
  16104 | ~:html-table-caption-above~                    | ~org-html-table-caption-above~                    |
  16105 | ~:html-table-data-tags~                        | ~org-html-table-data-tags~                        |
  16106 | ~:html-table-header-tags~                      | ~org-html-table-header-tags~                      |
  16107 | ~:html-table-row-tags~                         | ~org-html-table-row-tags~                         |
  16108 | ~:html-table-use-header-tags-for-first-column~ | ~org-html-table-use-header-tags-for-first-column~ |
  16109 | ~:html-tag-class-prefix~                       | ~org-html-tag-class-prefix~                       |
  16110 | ~:html-text-markup-alist~                      | ~org-html-text-markup-alist~                      |
  16111 | ~:html-todo-kwd-class-prefix~                  | ~org-html-todo-kwd-class-prefix~                  |
  16112 | ~:html-toplevel-hlevel~                        | ~org-html-toplevel-hlevel~                        |
  16113 | ~:html-use-infojs~                             | ~org-html-use-infojs~                             |
  16114 | ~:html-validation-link~                        | ~org-html-validation-link~                        |
  16115 | ~:html-viewport~                               | ~org-html-viewport~                               |
  16116 | ~:html-wrap-src-lines~                         | ~org-html-wrap-src-lines~                         |
  16117 | ~:html-xml-declaration~                        | ~org-html-xml-declaration~                        |
  16118 
  16119 **** LaTeX specific properties
  16120 :PROPERTIES:
  16121 :UNNUMBERED: notoc
  16122 :END:
  16123 
  16124 | ~:latex-active-timestamp-format~       | ~org-latex-active-timestamp-format~       |
  16125 | ~:latex-caption-above~                 | ~org-latex-caption-above~                 |
  16126 | ~:latex-classes~                       | ~org-latex-classes~                       |
  16127 | ~:latex-class~                         | ~org-latex-default-class~                 |
  16128 | ~:latex-compiler~                      | ~org-latex-compiler~                      |
  16129 | ~:latex-default-figure-position~       | ~org-latex-default-figure-position~       |
  16130 | ~:latex-default-table-environment~     | ~org-latex-default-table-environment~     |
  16131 | ~:latex-default-table-mode~            | ~org-latex-default-table-mode~            |
  16132 | ~:latex-diary-timestamp-format~        | ~org-latex-diary-timestamp-format~        |
  16133 | ~:latex-footnote-defined-format~       | ~org-latex-footnote-defined-format~       |
  16134 | ~:latex-footnote-separator~            | ~org-latex-footnote-separator~            |
  16135 | ~:latex-format-drawer-function~        | ~org-latex-format-drawer-function~        |
  16136 | ~:latex-format-headline-function~      | ~org-latex-format-headline-function~      |
  16137 | ~:latex-format-inlinetask-function~    | ~org-latex-format-inlinetask-function~    |
  16138 | ~:latex-hyperref-template~             | ~org-latex-hyperref-template~             |
  16139 | ~:latex-image-default-height~          | ~org-latex-image-default-height~          |
  16140 | ~:latex-image-default-option~          | ~org-latex-image-default-option~          |
  16141 | ~:latex-image-default-width~           | ~org-latex-image-default-width~           |
  16142 | ~:latex-images-centered~               | ~org-latex-images-centered~               |
  16143 | ~:latex-inactive-timestamp-format~     | ~org-latex-inactive-timestamp-format~     |
  16144 | ~:latex-inline-image-rules~            | ~org-latex-inline-image-rules~            |
  16145 | ~:latex-link-with-unknown-path-format~ | ~org-latex-link-with-unknown-path-format~ |
  16146 | ~:latex-listings-langs~                | ~org-latex-listings-langs~                |
  16147 | ~:latex-listings-options~              | ~org-latex-listings-options~              |
  16148 | ~:latex-listings~                      | ~org-latex-listings~                      |
  16149 | ~:latex-minted-langs~                  | ~org-latex-minted-langs~                  |
  16150 | ~:latex-minted-options~                | ~org-latex-minted-options~                |
  16151 | ~:latex-prefer-user-labels~            | ~org-latex-prefer-user-labels~            |
  16152 | ~:latex-subtitle-format~               | ~org-latex-subtitle-format~               |
  16153 | ~:latex-subtitle-separate~             | ~org-latex-subtitle-separate~             |
  16154 | ~:latex-table-scientific-notation~     | ~org-latex-table-scientific-notation~     |
  16155 | ~:latex-tables-booktabs~               | ~org-latex-tables-booktabs~               |
  16156 | ~:latex-tables-centered~               | ~org-latex-tables-centered~               |
  16157 | ~:latex-text-markup-alist~             | ~org-latex-text-markup-alist~             |
  16158 | ~:latex-title-command~                 | ~org-latex-title-command~                 |
  16159 | ~:latex-toc-command~                   | ~org-latex-toc-command~                   |
  16160 
  16161 **** Markdown specific properties
  16162 :PROPERTIES:
  16163 :UNNUMBERED: notoc
  16164 :END:
  16165 
  16166 | ~:md-footnote-format~   | ~org-md-footnote-format~   |
  16167 | ~:md-footnotes-section~ | ~org-md-footnotes-section~ |
  16168 | ~:md-headline-style~    | ~org-md-headline-style~    |
  16169 
  16170 **** ODT specific properties
  16171 :PROPERTIES:
  16172 :UNNUMBERED: notoc
  16173 :END:
  16174 
  16175 | ~:odt-content-template-file~      | ~org-odt-content-template-file~      |
  16176 | ~:odt-display-outline-level~      | ~org-odt-display-outline-level~      |
  16177 | ~:odt-fontify-srcblocks~          | ~org-odt-fontify-srcblocks~          |
  16178 | ~:odt-format-drawer-function~     | ~org-odt-format-drawer-function~     |
  16179 | ~:odt-format-headline-function~   | ~org-odt-format-headline-function~   |
  16180 | ~:odt-format-inlinetask-function~ | ~org-odt-format-inlinetask-function~ |
  16181 | ~:odt-inline-formula-rules~       | ~org-odt-inline-formula-rules~       |
  16182 | ~:odt-inline-image-rules~         | ~org-odt-inline-image-rules~         |
  16183 | ~:odt-pixels-per-inch~            | ~org-odt-pixels-per-inch~            |
  16184 | ~:odt-styles-file~                | ~org-odt-styles-file~                |
  16185 | ~:odt-table-styles~               | ~org-odt-table-styles~               |
  16186 | ~:odt-use-date-fields~            | ~org-odt-use-date-fields~            |
  16187 
  16188 **** Texinfo specific properties
  16189 :PROPERTIES:
  16190 :UNNUMBERED: notoc
  16191 :END:
  16192 
  16193 | ~:texinfo-active-timestamp-format~       | ~org-texinfo-active-timestamp-format~       |
  16194 | ~:texinfo-classes~                       | ~org-texinfo-classes~                       |
  16195 | ~:texinfo-class~                         | ~org-texinfo-default-class~                 |
  16196 | ~:texinfo-table-default-markup~          | ~org-texinfo-table-default-markup~          |
  16197 | ~:texinfo-diary-timestamp-format~        | ~org-texinfo-diary-timestamp-format~        |
  16198 | ~:texinfo-filename~                      | ~org-texinfo-filename~                      |
  16199 | ~:texinfo-format-drawer-function~        | ~org-texinfo-format-drawer-function~        |
  16200 | ~:texinfo-format-headline-function~      | ~org-texinfo-format-headline-function~      |
  16201 | ~:texinfo-format-inlinetask-function~    | ~org-texinfo-format-inlinetask-function~    |
  16202 | ~:texinfo-inactive-timestamp-format~     | ~org-texinfo-inactive-timestamp-format~     |
  16203 | ~:texinfo-link-with-unknown-path-format~ | ~org-texinfo-link-with-unknown-path-format~ |
  16204 | ~:texinfo-node-description-column~       | ~org-texinfo-node-description-column~       |
  16205 | ~:texinfo-table-scientific-notation~     | ~org-texinfo-table-scientific-notation~     |
  16206 | ~:texinfo-tables-verbatim~               | ~org-texinfo-tables-verbatim~               |
  16207 | ~:texinfo-text-markup-alist~             | ~org-texinfo-text-markup-alist~             |
  16208 
  16209 *** Publishing links
  16210 :PROPERTIES:
  16211 :DESCRIPTION: Which links keep working after publishing?
  16212 :END:
  16213 #+cindex: links, publishing
  16214 
  16215 To create a link from one Org file to another, you would use something
  16216 like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see [[*External Links]]).  When
  16217 published, this link becomes a link to =foo.html=.  You can thus
  16218 interlink the pages of your "Org web" project and the links will work
  16219 as expected when you publish them to HTML.  If you also publish the
  16220 Org source file and want to link to it, use an =http= link instead of
  16221 a =file:= link, because =file= links are converted to link to the
  16222 corresponding =.html= file.
  16223 
  16224 You may also link to related files, such as images.  Provided you are
  16225 careful with relative file names, and provided you have also
  16226 configured Org to upload the related files, these links will work too.
  16227 See [[*Example: complex publishing configuration]], for an example of this
  16228 usage.
  16229 
  16230 Eventually, links between published documents can contain some search
  16231 options (see [[*Search Options in File Links]]), which will be resolved to
  16232 the appropriate location in the linked file.  For example, once
  16233 published to HTML, the following links all point to a dedicated anchor
  16234 in =foo.html=.
  16235 
  16236 #+begin_example
  16237 [[file:foo.org::*heading]]
  16238 [[file:foo.org::#custom-id]]
  16239 [[file:foo.org::target]]
  16240 #+end_example
  16241 
  16242 *** Generating a sitemap
  16243 :PROPERTIES:
  16244 :DESCRIPTION: Generating a list of all pages.
  16245 :ALT_TITLE: Site map
  16246 :END:
  16247 #+cindex: sitemap, of published pages
  16248 
  16249 The following properties may be used to control publishing of
  16250 a map of files for a given project.
  16251 
  16252 - ~:auto-sitemap~ ::
  16253 
  16254   When non-~nil~, publish a sitemap during
  16255   ~org-publish-current-project~ or ~org-publish-all~.
  16256 
  16257 - ~:sitemap-filename~ ::
  16258 
  16259   Filename for output of sitemap.  Defaults to =sitemap.org=, which
  16260   becomes =sitemap.html=.
  16261 
  16262 - ~:sitemap-title~ ::
  16263 
  16264   Title of sitemap page.  Defaults to name of file.
  16265 
  16266 - ~:sitemap-format-entry~ ::
  16267 
  16268   #+findex: org-publish-find-date
  16269   #+findex: org-publish-find-property
  16270   #+findex: org-publish-find-title
  16271   With this option one can tell how a site-map entry is formatted in
  16272   the site-map.  It is a function called with three arguments: the
  16273   file or directory name relative to base directory of the project,
  16274   the site-map style and the current project.  It is expected to
  16275   return a string.  Default value turns file names into links and use
  16276   document titles as descriptions.  For specific formatting needs, one
  16277   can use ~org-publish-find-date~, ~org-publish-find-title~ and
  16278   ~org-publish-find-property~, to retrieve additional information
  16279   about published documents.
  16280 
  16281 - ~:sitemap-function~ ::
  16282 
  16283   Plug-in function to use for generation of the sitemap.  It is called
  16284   with two arguments: the title of the site-map and a representation
  16285   of the files and directories involved in the project as a nested
  16286   list, which can further be transformed using ~org-list-to-generic~,
  16287   ~org-list-to-subtree~ and alike.  Default value generates a plain
  16288   list of links to all files in the project.
  16289 
  16290 - ~:sitemap-sort-folders~ ::
  16291 
  16292   Where folders should appear in the sitemap.  Set this to ~first~
  16293   (default) or ~last~ to display folders first or last, respectively.
  16294   When set to ~ignore~, folders are ignored altogether.  Any other
  16295   value mixes files and folders.  This variable has no effect when
  16296   site-map style is ~tree~.
  16297 
  16298 - ~:sitemap-sort-files~ ::
  16299 
  16300   How the files are sorted in the site map.  Set this to
  16301   ~alphabetically~ (default), ~chronologically~ or
  16302   ~anti-chronologically~.  ~chronologically~ sorts the files with
  16303   older date first while ~anti-chronologically~ sorts the files with
  16304   newer date first.  ~alphabetically~ sorts the files alphabetically.
  16305   The date of a file is retrieved with ~org-publish-find-date~.
  16306 
  16307 - ~:sitemap-ignore-case~ ::
  16308 
  16309   Should sorting be case-sensitive?  Default ~nil~.
  16310 
  16311 - ~:sitemap-file-entry-format~ ::
  16312 
  16313   With this option one can tell how a sitemap's entry is formatted in
  16314   the sitemap.  This is a format string with some escape sequences:
  16315   ~%t~ stands for the title of the file, ~%a~ stands for the author of
  16316   the file and ~%d~ stands for the date of the file.  The date is
  16317   retrieved with the ~org-publish-find-date~ function and formatted
  16318   with ~org-publish-sitemap-date-format~.  Default ~%t~.
  16319 
  16320 - ~:sitemap-date-format~ ::
  16321 
  16322   Format string for the ~format-time-string~ function that tells how
  16323   a sitemap entry's date is to be formatted.  This property bypasses
  16324   ~org-publish-sitemap-date-format~ which defaults to ~%Y-%m-%d~.
  16325 
  16326 *** Generating an index
  16327 :PROPERTIES:
  16328 :DESCRIPTION: An index that reaches across pages.
  16329 :END:
  16330 #+cindex: index, in a publishing project
  16331 
  16332 Org mode can generate an index across the files of a publishing project.
  16333 
  16334 - ~:makeindex~ ::
  16335 
  16336   When non-~nil~, generate in index in the file =theindex.org= and
  16337   publish it as =theindex.html=.
  16338 
  16339 The file is created when first publishing a project with the
  16340 ~:makeindex~ set.  The file only contains a statement =#+INCLUDE:
  16341 "theindex.inc"=.  You can then build around this include statement by
  16342 adding a title, style information, etc.
  16343 
  16344 #+cindex: @samp{INDEX}, keyword
  16345 Index entries are specified with =INDEX= keyword.  An entry that
  16346 contains an exclamation mark creates a sub item.
  16347 
  16348 #+begin_example
  16349 ,*** Curriculum Vitae
  16350 ,#+INDEX: CV
  16351 ,#+INDEX: Application!CV
  16352 #+end_example
  16353 
  16354 ** Uploading Files
  16355 :PROPERTIES:
  16356 :DESCRIPTION: How to get files up on the server.
  16357 :END:
  16358 #+cindex: rsync
  16359 #+cindex: unison
  16360 
  16361 For those people already utilizing third party sync tools such as
  16362 Rsync or Unison, it might be preferable not to use the built-in remote
  16363 publishing facilities of Org mode which rely heavily on Tramp.  Tramp,
  16364 while very useful and powerful, tends not to be so efficient for
  16365 multiple file transfer and has been known to cause problems under
  16366 heavy usage.
  16367 
  16368 Specialized synchronization utilities offer several advantages.  In
  16369 addition to timestamp comparison, they also do content and
  16370 permissions/attribute checks.  For this reason you might prefer to
  16371 publish your web to a local directory---possibly even /in place/ with
  16372 your Org files---and then use Unison or Rsync to do the
  16373 synchronization with the remote host.
  16374 
  16375 Since Unison, for example, can be configured as to which files to
  16376 transfer to a certain remote destination, it can greatly simplify the
  16377 project publishing definition.  Simply keep all files in the correct
  16378 location, process your Org files with ~org-publish~ and let the
  16379 synchronization tool do the rest.  You do not need, in this scenario,
  16380 to include attachments such as JPG, CSS or PNG files in the project
  16381 definition since the third-party tool syncs them.
  16382 
  16383 Publishing to a local directory is also much faster than to a remote
  16384 one, so that you can afford more easily to republish entire projects.
  16385 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
  16386 main benefit of re-including any changed external files such as source
  16387 example files you might include with =INCLUDE= keyword.  The timestamp
  16388 mechanism in Org is not smart enough to detect if included files have
  16389 been modified.
  16390 
  16391 ** Sample Configuration
  16392 :PROPERTIES:
  16393 :DESCRIPTION: Example projects.
  16394 :END:
  16395 
  16396 Below we provide two example configurations.  The first one is
  16397 a simple project publishing only a set of Org files.  The second
  16398 example is more complex, with a multi-component project.
  16399 
  16400 *** Example: simple publishing configuration
  16401 :PROPERTIES:
  16402 :DESCRIPTION: One-component publishing.
  16403 :ALT_TITLE: Simple example
  16404 :END:
  16405 
  16406 This example publishes a set of Org files to the =public_html=
  16407 directory on the local machine.
  16408 
  16409 #+begin_src emacs-lisp
  16410 (setq org-publish-project-alist
  16411       '(("org"
  16412          :base-directory "~/org/"
  16413          :publishing-function org-html-publish-to-html
  16414          :publishing-directory "~/public_html"
  16415          :section-numbers nil
  16416          :with-toc nil
  16417          :html-head "<link rel=\"stylesheet\"
  16418                     href=\"../other/mystyle.css\"
  16419                     type=\"text/css\"/>")))
  16420 #+end_src
  16421 
  16422 *** Example: complex publishing configuration
  16423 :PROPERTIES:
  16424 :DESCRIPTION: A multi-component publishing example.
  16425 :ALT_TITLE: Complex example
  16426 :END:
  16427 
  16428 This more complicated example publishes an entire website, including
  16429 Org files converted to HTML, image files, Emacs Lisp source code, and
  16430 style sheets.  The publishing directory is remote and private files
  16431 are excluded.
  16432 
  16433 To ensure that links are preserved, care should be taken to replicate
  16434 your directory structure on the web server, and to use relative file
  16435 paths.  For example, if your Org files are kept in =~/org/= and your
  16436 publishable images in =~/images/=, you would link to an image with
  16437 
  16438 : file:../images/myimage.png
  16439 
  16440 On the web server, the relative path to the image should be the same.
  16441 You can accomplish this by setting up an =images/= folder in the right
  16442 place on the web server, and publishing images to it.
  16443 
  16444 #+begin_src emacs-lisp
  16445 (setq org-publish-project-alist
  16446       '(("orgfiles"
  16447          :base-directory "~/org/"
  16448          :base-extension "org"
  16449          :publishing-directory "/ssh:user@host:~/html/notebook/"
  16450          :publishing-function org-html-publish-to-html
  16451          :exclude "PrivatePage.org" ;; regexp
  16452          :headline-levels 3
  16453          :section-numbers nil
  16454          :with-toc nil
  16455          :html-head "<link rel=\"stylesheet\"
  16456                   href=\"../other/mystyle.css\" type=\"text/css\"/>"
  16457          :html-preamble t)
  16458 
  16459         ("images"
  16460          :base-directory "~/images/"
  16461          :base-extension "jpg\\|gif\\|png"
  16462          :publishing-directory "/ssh:user@host:~/html/images/"
  16463          :publishing-function org-publish-attachment)
  16464 
  16465         ("other"
  16466          :base-directory "~/other/"
  16467          :base-extension "css\\|el"
  16468          :publishing-directory "/ssh:user@host:~/html/other/"
  16469          :publishing-function org-publish-attachment)
  16470         ("website" :components ("orgfiles" "images" "other"))))
  16471 #+end_src
  16472 
  16473 ** Triggering Publication
  16474 :PROPERTIES:
  16475 :DESCRIPTION: Publication commands.
  16476 :END:
  16477 
  16478 Once properly configured, Org can publish with the following commands:
  16479 
  16480 - {{{kbd(C-c C-e P x)}}} (~org-publish~) ::
  16481 
  16482   #+kindex: C-c C-e P x
  16483   #+findex: org-publish
  16484   Prompt for a specific project and publish all files that belong to
  16485   it.
  16486 
  16487 - {{{kbd(C-c C-e P p)}}} (~org-publish-current-project~) ::
  16488 
  16489   #+kindex: C-c C-e P p
  16490   #+findex: org-publish-current-project
  16491   Publish the project containing the current file.
  16492 
  16493 - {{{kbd(C-c C-e P f)}}} (~org-publish-current-file~) ::
  16494 
  16495   #+kindex: C-c C-e P f
  16496   #+findex: org-publish-current-file
  16497   Publish only the current file.
  16498 
  16499 - {{{kbd(C-c C-e P a)}}} (~org-publish-all~) ::
  16500 
  16501   #+kindex: C-c C-e P a
  16502   #+findex: org-publish-all
  16503   Publish every project.
  16504 
  16505 #+vindex: org-publish-use-timestamps-flag
  16506 Org uses timestamps to track when a file has changed.  The above
  16507 functions normally only publish changed files.  You can override this
  16508 and force publishing of all files by giving a prefix argument to any
  16509 of the commands above, or by customizing the variable
  16510 ~org-publish-use-timestamps-flag~.  This may be necessary in
  16511 particular if files include other files via =SETUPFILE= or =INCLUDE=
  16512 keywords.
  16513 
  16514 * Citation handling
  16515 :PROPERTIES:
  16516 :DESCRIPTION: create, follow and export citations.
  16517 :END:
  16518 #+cindex: citation
  16519 
  16520 As of Org 9.5, a new library =oc.el= provides tooling to handle
  16521 citations in Org via "citation processors" that offer some or all of
  16522 the following capabilities:
  16523 
  16524 - "activate" :: Fontification, tooltip preview, etc.
  16525 - "follow" :: At-point actions on citations via ~org-open-at-point~.
  16526 - "insert" :: Add and edit citations via ~org-cite-insert~.
  16527 - "export" :: Via different libraries for different target formats.
  16528 
  16529 The user can configure these with ~org-cite-active-processor~,
  16530 ~org-cite-follow-processor~, ~org-cite-insert-processor~, and
  16531 ~org-cite-export-processors~ respectively.
  16532 
  16533 The included "basic" processor provides all four capabilities.
  16534 
  16535 ** Citations
  16536 
  16537 Before adding citations, first set one-or-more bibliographies, either
  16538 globally with ~org-cite-global-bibliography~, or locally using one or
  16539 more "bibliography" keywords.
  16540 
  16541 #+begin_example
  16542 #+bibliography: SomeFile.bib
  16543 #+bibliography: /some/other/file.json
  16544 #+bibliography: "/some/file/with spaces/in its name.bib"
  16545 #+end_example
  16546 
  16547 One can then insert and edit citations using ~org-cite-insert~, called
  16548 with {{{kbd(M-x org-cite-insert)}}}.
  16549 
  16550 A /citation/ requires one or more citation /key(s)/, elements
  16551 identifying a reference in the bibliography.
  16552 
  16553 - Each citation is surrounded by brackets and uses the =cite= type.
  16554 
  16555 - Each key starts with the character =@=.
  16556 
  16557 - Each key can be qualified by a /prefix/ (e.g. "see ") and/or a
  16558   /suffix/ (e.g. "p. 123"), giving informations useful or necessary fo
  16559   the comprehension of the citation but not included in the reference.
  16560 
  16561 - A single citation can cite more than one reference ; the keys are
  16562   separated by semicolons ; the formatting of such citation groups is
  16563   specified by the style.
  16564 
  16565 - One can also specify a stylistic variation for the citations by
  16566   inserting a =/= and a style name between the =cite= keyword and the
  16567   colon ; this usially makes sense only for the author-year styles.
  16568 
  16569 #+begin_example
  16570 [cite/style:common prefix ;prefix @key suffix; ... ; common suffix]
  16571 #+end_example
  16572 
  16573 The only mandatory elements are:
  16574 
  16575 - The =cite= keyword and the colon.
  16576 - The =@= character immediately preceding each key.
  16577 - The brackets surrounding the citation(s) (group).
  16578 
  16579 ** Citation export processors
  16580 
  16581 Org currently includes the following export processors:
  16582 
  16583 - Two processors can export to a variety of formats, including =latex=
  16584   (and therefore =pdf=), =html=, =odt= and plain (UTF8) text:
  16585 
  16586   - basic :: a basic export processors, well adapted to situations
  16587     where backward compatibility is not a requirement and formatting
  16588     needs are minimal;
  16589 
  16590   - csl :: this export processor uses format files written in [[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation
  16591     Style Language]] via [[https://github.com/andras-simonyi/citeproc-el][citeproc-el]];
  16592 
  16593 - In contrast, two other processors target LaTeX and LaTeX-derived
  16594   formats exclusively:
  16595 
  16596   - natbib :: this export processor uses =bibtex=, the historical
  16597     bibliographic processor used with LaTeX, thus allowing the use of
  16598     data and style files compatible with this processor (including a
  16599     large number of publishers' styles).  It uses citation commands
  16600     implemented in the LaTeX package =natbib=, allowing more stylistic
  16601     variants that LaTeX's =\cite= command.
  16602 
  16603   - biblatex :: this backend allows the use of data and formats
  16604     prepared for =biblatex=, an alternate bibliographic processor used
  16605     with LaTeX, which overcomes some serious =bibtex= limitations, but
  16606     has not (yet?) been widely adopted by publishers.
  16607 
  16608 The =#+cite_export:= keyword specifies the export processor and the
  16609 citation (and possibly reference) style(s); for example (all arguments
  16610 are optional)
  16611 
  16612 #+begin_example
  16613 #+cite_export: basic author author-year
  16614 #+end_example
  16615 
  16616 specifies the "basic" export processor with citations inserted as
  16617 author's name and references indexed by author's names and year;
  16618 
  16619 #+begin_example
  16620 #+cite_export: csl /some/path/to/vancouver-brackets.csl
  16621 #+end_example
  16622 
  16623 specifies the "csl" processor and CSL style, which in this case
  16624 defines numeric citations and numeric references according to the
  16625 =Vancouver= specification (as style used in many medical journals),
  16626 following a typesetting variation putting citations between brackets;
  16627 
  16628 #+begin_example
  16629 #+cite_export: natbib kluwer
  16630 #+end_example
  16631 
  16632 specifies the "natbib" export processor with a label citation style
  16633 conformant to the Harvard style and the specification of the
  16634 Wolkers-Kluwer publisher; since it relies on the =bibtex= processor of
  16635 your LaTeX installation, it won't export to anything but PDF.
  16636 
  16637 * Working with Source Code
  16638 :PROPERTIES:
  16639 :DESCRIPTION: Export, evaluate, and tangle code blocks.
  16640 :END:
  16641 #+cindex: source code, working with
  16642 
  16643 Source code here refers to any plain text collection of computer
  16644 instructions, possibly with comments, written using a human-readable
  16645 programming language.  Org can manage source code in an Org document
  16646 when the source code is identified with begin and end markers.
  16647 Working with source code begins with identifying source code blocks.
  16648 A source code block can be placed almost anywhere in an Org document;
  16649 it is not restricted to the preamble or the end of the document.
  16650 However, Org cannot manage a source code block if it is placed inside
  16651 an Org comment or within a fixed width section.
  16652 
  16653 Here is an example source code block in the Emacs Lisp language:
  16654 
  16655 #+begin_example
  16656 ,#+BEGIN_SRC emacs-lisp
  16657   (defun org-xor (a b)
  16658      "Exclusive or."
  16659      (if a (not b) b))
  16660 ,#+END_SRC
  16661 #+end_example
  16662 
  16663 Source code blocks are one of many Org block types, which also include
  16664 "center", "comment", "dynamic", "example", "export", "quote",
  16665 "special", and "verse".  This section pertains to blocks between
  16666 =#+BEGIN_SRC= and =#+END_SRC=.
  16667 
  16668 Details of Org's facilities for working with source code are described
  16669 in the following sections.
  16670 
  16671 ** Features Overview
  16672 :PROPERTIES:
  16673 :DESCRIPTION: Enjoy the versatility of source blocks.
  16674 :END:
  16675 
  16676 Org can manage the source code in the block delimited by =#+BEGIN_SRC=
  16677 ... =#+END_SRC= in several ways that can simplify housekeeping tasks
  16678 essential to modern source code maintenance.  Org can edit, format,
  16679 extract, export, and publish source code blocks.  Org can also compile
  16680 and execute a source code block, then capture the results.  The Org
  16681 mode literature sometimes refers to source code blocks as /live code/
  16682 blocks because they can alter the content of the Org document or the
  16683 material that it exports.  Users can control the "liveliness" of each
  16684 source code block by tweaking the header arguments (see [[*Using Header
  16685 Arguments]]) for compiling, execution, extraction, and exporting.
  16686 
  16687 For editing and formatting a source code block, Org uses an
  16688 appropriate Emacs major mode that includes features specifically
  16689 designed for source code in that language.
  16690 
  16691 Org can extract one or more source code blocks and write them to one
  16692 or more source files---a process known as /tangling/ in literate
  16693 programming terminology.
  16694 
  16695 For exporting and publishing, Org's back-ends can format a source code
  16696 block appropriately, often with native syntax highlighting.
  16697 
  16698 For executing and compiling a source code block, the user can
  16699 configure Org to select the appropriate compiler.  Org provides
  16700 facilities to collect the result of the execution or compiler output,
  16701 insert it into the Org document, and/or export it.  In addition to
  16702 text results, Org can insert links to other data types, including
  16703 audio, video, and graphics.  Org can also link a compiler error
  16704 message to the appropriate line in the source code block.
  16705 
  16706 An important feature of Org's management of source code blocks is the
  16707 ability to pass variables, functions, and results to one another using
  16708 a common syntax for source code blocks in any language.  Although most
  16709 literate programming facilities are restricted to one language or
  16710 another, Org's language-agnostic approach lets the literate programmer
  16711 match each programming task with the appropriate computer language and
  16712 to mix them all together in a single Org document.  This
  16713 interoperability among languages explains why Org's source code
  16714 management facility was named /Org Babel/ by its originators, Eric
  16715 Schulte and Dan Davison.
  16716 
  16717 Org mode fulfills the promise of easy verification and maintenance of
  16718 publishing reproducible research by keeping text, data, code,
  16719 configuration settings of the execution environment, the results of
  16720 the execution, and associated narratives, claims, references, and
  16721 internal and external links in a single Org document.
  16722 
  16723 ** Structure of Code Blocks
  16724 :PROPERTIES:
  16725 :DESCRIPTION: Code block syntax described.
  16726 :END:
  16727 #+cindex: code block, structure
  16728 #+cindex: source code, block structure
  16729 #+cindex: @samp{NAME} keyword, in source blocks
  16730 #+cindex: @samp{BEGIN_SRC}
  16731 
  16732 Org offers two ways to structure source code in Org documents: in
  16733 a source code block, and directly inline.  Both specifications are
  16734 shown below.
  16735 
  16736 A source code block conforms to this structure:
  16737 
  16738 #+begin_example
  16739 ,#+NAME: <name>
  16740 ,#+BEGIN_SRC <language> <switches> <header arguments>
  16741   <body>
  16742 ,#+END_SRC
  16743 #+end_example
  16744 
  16745 Do not be put-off by having to remember the source block syntax.  Org
  16746 mode offers a command for wrapping existing text in a block (see
  16747 [[*Structure Templates]]).  Org also works with other completion systems
  16748 in Emacs, some of which predate Org and have custom domain-specific
  16749 languages for defining templates.  Regular use of templates reduces
  16750 errors, increases accuracy, and maintains consistency.
  16751 
  16752 #+cindex: source code, inline
  16753 An inline code block conforms to this structure:
  16754 
  16755 : src_<language>{<body>}
  16756 
  16757 #+texinfo: @noindent
  16758 or
  16759 
  16760 : src_<language>[<header arguments>]{<body>}
  16761 
  16762 - =#+NAME: <name>= ::
  16763 
  16764   Optional.  Names the source block so it can be called, like
  16765   a function, from other source blocks or inline code to evaluate or
  16766   to capture the results.  Code from other blocks, other files, and
  16767   from table formulas (see [[*The Spreadsheet]]) can use the name to
  16768   reference a source block.  This naming serves the same purpose as
  16769   naming Org tables.  Org mode requires unique names.  For duplicate
  16770   names, Org mode's behavior is undefined.
  16771 
  16772 - =#+BEGIN_SRC= ... =#+END_SRC= ::
  16773 
  16774   Mandatory.  They mark the start and end of a block that Org
  16775   requires.  The =#+BEGIN_SRC= line takes additional arguments, as
  16776   described next.
  16777 
  16778 - =<language>= ::
  16779 
  16780   #+cindex: language, in code blocks
  16781   Mandatory.  It is the identifier of the source code language in the
  16782   block.  See [[*Languages]], for identifiers of supported languages.
  16783 
  16784 - =<switches>= ::
  16785 
  16786   #+cindex: switches, in code blocks
  16787   Optional.  Switches provide finer control of the code execution,
  16788   export, and format (see the discussion of switches in [[*Literal
  16789   Examples]]).
  16790 
  16791 - =<header arguments>= ::
  16792 
  16793   #+cindex: header arguments, in code blocks
  16794   Optional.  Heading arguments control many aspects of evaluation,
  16795   export and tangling of code blocks (see [[*Using Header Arguments]]).
  16796   Using Org's properties feature, header arguments can be selectively
  16797   applied to the entire buffer or specific sub-trees of the Org
  16798   document.
  16799 
  16800 - =<body>= ::
  16801 
  16802   Source code in the dialect of the specified language identifier.
  16803 
  16804 ** Using Header Arguments
  16805 :PROPERTIES:
  16806 :DESCRIPTION: Different ways to set header arguments.
  16807 :END:
  16808 
  16809 Org comes with many header arguments common to all languages.  New
  16810 header arguments are added for specific languages as they become
  16811 available for use in source code blocks.  A header argument is
  16812 specified with an initial colon followed by the argument's name in
  16813 lowercase.
  16814 
  16815 Since header arguments can be set in several ways, Org prioritizes
  16816 them in case of overlaps or conflicts by giving local settings
  16817 a higher priority.  Header values in function calls, for example,
  16818 override header values from global defaults.
  16819 
  16820 *** System-wide header arguments
  16821 :PROPERTIES:
  16822 :UNNUMBERED: notoc
  16823 :END:
  16824 #+vindex: org-babel-default-header-args
  16825 
  16826 #+vindex: org-babel-default-header-args
  16827 System-wide values of header arguments can be specified by customizing
  16828 the ~org-babel-default-header-args~ variable, which defaults to the
  16829 following values:
  16830 
  16831 #+begin_example
  16832 :session    => "none"
  16833 :results    => "replace"
  16834 :exports    => "code"
  16835 :cache      => "no"
  16836 :noweb      => "no"
  16837 #+end_example
  16838 
  16839 The example below sets =:noweb= header arguments to =yes=, which makes
  16840 Org expand =:noweb= references by default.
  16841 
  16842 #+begin_src emacs-lisp
  16843 (setq org-babel-default-header-args
  16844       (cons '(:noweb . "yes")
  16845             (assq-delete-all :noweb org-babel-default-header-args)))
  16846 #+end_src
  16847 
  16848 #+cindex: language specific default header arguments
  16849 #+cindex: default header arguments per language
  16850 Each language can have separate default header arguments by
  16851 customizing the variable ~org-babel-default-header-args:<LANG>~, where
  16852 {{{var(<LANG>)}}} is the name of the language.  For details, see the
  16853 language-specific online documentation at
  16854 https://orgmode.org/worg/org-contrib/babel/.
  16855 
  16856 *** Header arguments in Org mode properties
  16857 :PROPERTIES:
  16858 :UNNUMBERED: notoc
  16859 :END:
  16860 
  16861 For header arguments applicable to the buffer, use =PROPERTY= keyword
  16862 anywhere in the Org file (see [[*Property Syntax]]).
  16863 
  16864 The following example makes all the R code blocks execute in the same
  16865 session.  Setting =:results= to =silent= ignores the results of
  16866 executions for all blocks, not just R code blocks; no results inserted
  16867 for any block.
  16868 
  16869 #+begin_example
  16870 ,#+PROPERTY: header-args:R  :session *R*
  16871 ,#+PROPERTY: header-args    :results silent
  16872 #+end_example
  16873 
  16874 #+vindex: org-use-property-inheritance
  16875 Header arguments set through Org's property drawers (see [[*Property
  16876 Syntax]]) apply at the sub-tree level on down.  Since these property
  16877 drawers can appear anywhere in the file hierarchy, Org uses outermost
  16878 call or source block to resolve the values.  Org ignores
  16879 ~org-use-property-inheritance~ setting.
  16880 
  16881 In this example, =:cache= defaults to =yes= for all code blocks in the
  16882 sub-tree.
  16883 
  16884 #+begin_example
  16885 ,* sample header
  16886   :PROPERTIES:
  16887   :header-args:    :cache yes
  16888   :END:
  16889 #+end_example
  16890 
  16891 #+kindex: C-c C-x p
  16892 #+findex: org-set-property
  16893 Properties defined through ~org-set-property~ function, bound to
  16894 {{{kbd(C-c C-x p)}}}, apply to all active languages.  They override
  16895 properties set in ~org-babel-default-header-args~.
  16896 
  16897 #+cindex: language specific header arguments properties
  16898 #+cindex: header arguments per language
  16899 Language-specific header arguments are also read from properties
  16900 =header-args:<LANG>= where {{{var(<LANG>)}}} is the language
  16901 identifier.  For example,
  16902 
  16903 #+begin_example
  16904 ,* Heading
  16905   :PROPERTIES:
  16906   :header-args:clojure:    :session *clojure-1*
  16907   :header-args:R:          :session *R*
  16908   :END:
  16909 ,** Subheading
  16910   :PROPERTIES:
  16911   :header-args:clojure:    :session *clojure-2*
  16912   :END:
  16913 #+end_example
  16914 
  16915 #+texinfo: @noindent
  16916 would force separate sessions for Clojure blocks in =Heading= and
  16917 =Subheading=, but use the same session for all R blocks.  Blocks in
  16918 =Subheading= inherit settings from =Heading=.
  16919 
  16920 *** Code block specific header arguments
  16921 :PROPERTIES:
  16922 :UNNUMBERED: notoc
  16923 :END:
  16924 
  16925 Header arguments are most commonly set at the source code block level,
  16926 on the =#+BEGIN_SRC= line.  Arguments set at this level take
  16927 precedence over those set in the ~org-babel-default-header-args~
  16928 variable, and also those set as header properties.
  16929 
  16930 In the following example, setting =:results= to =silent= makes it
  16931 ignore results of the code execution.  Setting =:exports= to =code=
  16932 exports only the body of the code block to HTML or LaTeX.
  16933 
  16934 #+begin_example
  16935 ,#+NAME: factorial
  16936 ,#+BEGIN_SRC haskell :results silent :exports code :var n=0
  16937   fac 0 = 1
  16938   fac n = n * fac (n-1)
  16939 ,#+END_SRC
  16940 #+end_example
  16941 
  16942 The same header arguments in an inline code block:
  16943 
  16944 : src_haskell[:exports both]{fac 5}
  16945 
  16946 #+cindex: @samp{HEADER}, keyword
  16947 Code block header arguments can span multiple lines using =#+HEADER:=
  16948 on each line.  Note that Org currently accepts the plural spelling of
  16949 =#+HEADER:= only as a convenience for backward-compatibility.  It may
  16950 be removed at some point.
  16951 
  16952 Multi-line header arguments on an unnamed code block:
  16953 
  16954 #+begin_example
  16955 ,#+HEADER: :var data1=1
  16956 ,#+BEGIN_SRC emacs-lisp :var data2=2
  16957    (message "data1:%S, data2:%S" data1 data2)
  16958 ,#+END_SRC
  16959 
  16960 ,#+RESULTS:
  16961 : data1:1, data2:2
  16962 #+end_example
  16963 
  16964 Multi-line header arguments on a named code block:
  16965 
  16966 #+begin_example
  16967 ,#+NAME: named-block
  16968 ,#+HEADER: :var data=2
  16969 ,#+BEGIN_SRC emacs-lisp
  16970   (message "data:%S" data)
  16971 ,#+END_SRC
  16972 
  16973 ,#+RESULTS: named-block
  16974   : data:2
  16975 #+end_example
  16976 
  16977 *** Header arguments in function calls
  16978 :PROPERTIES:
  16979 :UNNUMBERED: notoc
  16980 :END:
  16981 
  16982 Header arguments in function calls are the most specific and override
  16983 all other settings in case of an overlap.  They get the highest
  16984 priority.  Two =#+CALL:= examples are shown below.  For the complete
  16985 syntax of =CALL= keyword, see [[*Evaluating Code Blocks]].
  16986 
  16987 In this example, =:exports results= header argument is applied to the
  16988 evaluation of the =#+CALL:= line.
  16989 
  16990 : #+CALL: factorial(n=5) :exports results
  16991 
  16992 In this example, =:session special= header argument is applied to the
  16993 evaluation of =factorial= code block.
  16994 
  16995 : #+CALL: factorial[:session special](n=5)
  16996 
  16997 ** Environment of a Code Block
  16998 :PROPERTIES:
  16999 :DESCRIPTION: Arguments, sessions, working directory...
  17000 :END:
  17001 
  17002 *** Passing arguments
  17003 :PROPERTIES:
  17004 :UNNUMBERED: notoc
  17005 :END:
  17006 
  17007 #+cindex: passing arguments to code blocks
  17008 #+cindex: arguments, in code blocks
  17009 #+cindex: @samp{var}, header argument
  17010 Use =var= for passing arguments to source code blocks.  The specifics
  17011 of variables in code blocks vary by the source language and are
  17012 covered in the language-specific documentation.  The syntax for =var=,
  17013 however, is the same for all languages.  This includes declaring
  17014 a variable, and assigning a default value.
  17015 
  17016 The following syntax is used to pass arguments to code blocks using
  17017 the =var= header argument.
  17018 
  17019 : :var NAME=ASSIGN
  17020 
  17021 #+texinfo: @noindent
  17022 {{{var(NAME)}}} is the name of the variable bound in the code block
  17023 body.  {{{var(ASSIGN)}}} is a literal value, such as a string,
  17024 a number, a reference to a table, a list, a literal example, another
  17025 code block---with or without arguments---or the results of evaluating
  17026 a code block.  {{{var(ASSIGN)}}} may specify a filename for references
  17027 to elements in a different file, using a =:= to separate the filename
  17028 from the reference.
  17029 
  17030 : :var NAME=FILE:REFERENCE
  17031 
  17032 Here are examples of passing values by reference:
  17033 
  17034 - table ::
  17035 
  17036   A table named with a =NAME= keyword.
  17037 
  17038   #+begin_example
  17039   ,#+NAME: example-table
  17040   | 1 |
  17041   | 2 |
  17042   | 3 |
  17043   | 4 |
  17044 
  17045   ,#+NAME: table-length
  17046   ,#+BEGIN_SRC emacs-lisp :var table=example-table
  17047     (length table)
  17048   ,#+END_SRC
  17049 
  17050   ,#+RESULTS: table-length
  17051   : 4
  17052   #+end_example
  17053 
  17054   When passing a table, you can treat specially the row, or the
  17055   column, containing labels for the columns, or the rows, in the
  17056   table.
  17057 
  17058   #+cindex: @samp{colnames}, header argument
  17059   The =colnames= header argument accepts =yes=, =no=, or =nil= values.
  17060   The default value is =nil=: if an input table has column
  17061   names---because the second row is a horizontal rule---then Org
  17062   removes the column names, processes the table, puts back the column
  17063   names, and then writes the table to the results block.  Using =yes=,
  17064   Org does the same to the first row, even if the initial table does
  17065   not contain any horizontal rule.  When set to =no=, Org does not
  17066   pre-process column names at all.
  17067 
  17068   #+begin_example
  17069   ,#+NAME: less-cols
  17070   | a |
  17071   |---|
  17072   | b |
  17073   | c |
  17074 
  17075   ,#+BEGIN_SRC python :var tab=less-cols :colnames nil
  17076     return [[val + '*' for val in row] for row in tab]
  17077   ,#+END_SRC
  17078 
  17079   ,#+RESULTS:
  17080   | a  |
  17081   |----|
  17082   | b* |
  17083   | c* |
  17084   #+end_example
  17085 
  17086   #+cindex: @samp{rownames}, header argument
  17087   Similarly, the =rownames= header argument can take two values: =yes=
  17088   or =no=.  When set to =yes=, Org removes the first column, processes
  17089   the table, puts back the first column, and then writes the table to
  17090   the results block.  The default is =no=, which means Org does not
  17091   pre-process the first column.  Note that Emacs Lisp code blocks
  17092   ignore =rownames= header argument because of the ease of
  17093   table-handling in Emacs.
  17094 
  17095   #+begin_example
  17096   ,#+NAME: with-rownames
  17097   | one | 1 | 2 | 3 | 4 |  5 |
  17098   | two | 6 | 7 | 8 | 9 | 10 |
  17099 
  17100   ,#+BEGIN_SRC python :var tab=with-rownames :rownames yes
  17101     return [[val + 10 for val in row] for row in tab]
  17102   ,#+END_SRC
  17103 
  17104   ,#+RESULTS:
  17105   | one | 11 | 12 | 13 | 14 | 15 |
  17106   | two | 16 | 17 | 18 | 19 | 20 |
  17107   #+end_example
  17108 
  17109 To refer to a table in another file, join the filename and table name with
  17110 a colon, for example: =:var table=other-file.org:example-table=.
  17111 
  17112 - list ::
  17113 
  17114   A simple named list.
  17115 
  17116   #+begin_example
  17117   ,#+NAME: example-list
  17118   - simple
  17119     - not
  17120     - nested
  17121   - list
  17122 
  17123   ,#+BEGIN_SRC emacs-lisp :var x=example-list
  17124     (print x)
  17125   ,#+END_SRC
  17126 
  17127   ,#+RESULTS:
  17128   | simple | list |
  17129   #+end_example
  17130 
  17131   Note that only the top level list items are passed along.  Nested
  17132   list items are ignored.
  17133 
  17134 - code block without arguments ::
  17135 
  17136   A code block name, as assigned by =NAME= keyword from the example
  17137   above, optionally followed by parentheses.
  17138 
  17139   #+begin_example
  17140   ,#+BEGIN_SRC emacs-lisp :var length=table-length()
  17141     (* 2 length)
  17142   ,#+END_SRC
  17143 
  17144   ,#+RESULTS:
  17145   : 8
  17146   #+end_example
  17147 
  17148 - code block with arguments ::
  17149 
  17150   A code block name, as assigned by =NAME= keyword, followed by
  17151   parentheses and optional arguments passed within the parentheses.
  17152 
  17153   #+begin_example
  17154   ,#+NAME: double
  17155   ,#+BEGIN_SRC emacs-lisp :var input=8
  17156     (* 2 input)
  17157   ,#+END_SRC
  17158 
  17159   ,#+RESULTS: double
  17160   : 16
  17161 
  17162   ,#+NAME: squared
  17163   ,#+BEGIN_SRC emacs-lisp :var input=double(input=1)
  17164     (* input input)
  17165   ,#+END_SRC
  17166 
  17167   ,#+RESULTS: squared
  17168   : 4
  17169   #+end_example
  17170 
  17171 - literal example ::
  17172 
  17173   A literal example block named with a =NAME= keyword.
  17174 
  17175   #+begin_example
  17176   ,#+NAME: literal-example
  17177   ,#+BEGIN_EXAMPLE
  17178     A literal example
  17179     on two lines
  17180   ,#+END_EXAMPLE
  17181 
  17182   ,#+NAME: read-literal-example
  17183   ,#+BEGIN_SRC emacs-lisp :var x=literal-example
  17184     (concatenate #'string x " for you.")
  17185   ,#+END_SRC
  17186 
  17187   ,#+RESULTS: read-literal-example
  17188   : A literal example
  17189   : on two lines for you.
  17190   #+end_example
  17191 
  17192 Indexing variable values enables referencing portions of a variable.
  17193 Indexes are 0 based with negative values counting backwards from the
  17194 end.  If an index is separated by commas then each subsequent section
  17195 indexes as the next dimension.  Note that this indexing occurs
  17196 /before/ other table-related header arguments are applied, such as
  17197 =hlines=, =colnames= and =rownames=.  The following example assigns
  17198 the last cell of the first row the table =example-table= to the
  17199 variable =data=:
  17200 
  17201 #+begin_example
  17202 ,#+NAME: example-table
  17203 | 1 | a |
  17204 | 2 | b |
  17205 | 3 | c |
  17206 | 4 | d |
  17207 
  17208 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
  17209   data
  17210 ,#+END_SRC
  17211 
  17212 ,#+RESULTS:
  17213 : a
  17214 #+end_example
  17215 
  17216 Two integers separated by a colon reference a range of variable
  17217 values.  In that case the entire inclusive range is referenced.  For
  17218 example the following assigns the middle three rows of =example-table=
  17219 to =data=.
  17220 
  17221 #+begin_example
  17222 ,#+NAME: example-table
  17223 | 1 | a |
  17224 | 2 | b |
  17225 | 3 | c |
  17226 | 4 | d |
  17227 | 5 | 3 |
  17228 
  17229 ,#+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
  17230   data
  17231 ,#+END_SRC
  17232 
  17233 ,#+RESULTS:
  17234 | 2 | b |
  17235 | 3 | c |
  17236 | 4 | d |
  17237 #+end_example
  17238 
  17239 To pick the entire range, use an empty index, or the single character
  17240 =*=.  =0:-1= does the same thing.  Example below shows how to
  17241 reference the first column only.
  17242 
  17243 #+begin_example
  17244 ,#+NAME: example-table
  17245 | 1 | a |
  17246 | 2 | b |
  17247 | 3 | c |
  17248 | 4 | d |
  17249 
  17250 ,#+BEGIN_SRC emacs-lisp :var data=example-table[,0]
  17251   data
  17252 ,#+END_SRC
  17253 
  17254 ,#+RESULTS:
  17255 | 1 | 2 | 3 | 4 |
  17256 #+end_example
  17257 
  17258 Index referencing can be used for tables and code blocks.  Index
  17259 referencing can handle any number of dimensions.  Commas delimit
  17260 multiple dimensions, as shown below.
  17261 
  17262 #+begin_example
  17263 ,#+NAME: 3D
  17264 ,#+BEGIN_SRC emacs-lisp
  17265   '(((1  2  3)  (4  5  6)  (7  8  9))
  17266     ((10 11 12) (13 14 15) (16 17 18))
  17267     ((19 20 21) (22 23 24) (25 26 27)))
  17268 ,#+END_SRC
  17269 
  17270 ,#+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
  17271   data
  17272 ,#+END_SRC
  17273 
  17274 ,#+RESULTS:
  17275 | 11 | 14 | 17 |
  17276 #+end_example
  17277 
  17278 Note that row names and column names are not removed prior to variable
  17279 indexing.  You need to take them into account, even when =colnames= or
  17280 =rownames= header arguments remove them.
  17281 
  17282 Emacs lisp code can also set the values for variables.  To
  17283 differentiate a value from Lisp code, Org interprets any value
  17284 starting with =(=, =[=, ='= or =`= as Emacs Lisp code.  The result of
  17285 evaluating that code is then assigned to the value of that variable.
  17286 The following example shows how to reliably query and pass the file
  17287 name of the Org mode buffer to a code block using headers.  We need
  17288 reliability here because the file's name could change once the code in
  17289 the block starts executing.
  17290 
  17291 #+begin_example
  17292 ,#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
  17293   wc -w $filename
  17294 ,#+END_SRC
  17295 #+end_example
  17296 
  17297 Note that values read from tables and lists are not mistakenly
  17298 evaluated as Emacs Lisp code, as illustrated in the following example.
  17299 
  17300 #+begin_example
  17301 ,#+NAME: table
  17302 | (a b c) |
  17303 
  17304 ,#+HEADER: :var data=table[0,0]
  17305 ,#+BEGIN_SRC perl
  17306   $data
  17307 ,#+END_SRC
  17308 
  17309 ,#+RESULTS:
  17310 : (a b c)
  17311 #+end_example
  17312 
  17313 *** Using sessions
  17314 :PROPERTIES:
  17315 :UNNUMBERED: notoc
  17316 :END:
  17317 
  17318 #+cindex: using sessions in code blocks
  17319 #+cindex: @samp{session}, header argument
  17320 Two code blocks can share the same environment.  The =session= header
  17321 argument is for running multiple source code blocks under one session.
  17322 Org runs code blocks with the same session name in the same
  17323 interpreter process.
  17324 
  17325 - =none= ::
  17326 
  17327   Default.  Each code block gets a new interpreter process to execute.
  17328   The process terminates once the block is evaluated.
  17329 
  17330 - {{{var(STRING)}}} ::
  17331 
  17332   Any string besides =none= turns that string into the name of that
  17333   session.  For example, =:session STRING= names it =STRING=.  If
  17334   =session= has no value, then the session name is derived from the
  17335   source language identifier.  Subsequent blocks with the same source
  17336   code language use the same session.  Depending on the language,
  17337   state variables, code from other blocks, and the overall interpreted
  17338   environment may be shared.  Some interpreted languages support
  17339   concurrent sessions when subsequent source code language blocks
  17340   change session names.
  17341 
  17342 Only languages that provide interactive evaluation can have session
  17343 support.  Not all languages provide this support, such as C and ditaa.
  17344 Even languages, such as Python and Haskell, that do support
  17345 interactive evaluation impose limitations on allowable language
  17346 constructs that can run interactively.  Org inherits those limitations
  17347 for those code blocks running in a session.
  17348 
  17349 *** Choosing a working directory
  17350 :PROPERTIES:
  17351 :UNNUMBERED: notoc
  17352 :END:
  17353 
  17354 #+cindex: working directory, in a code block
  17355 #+cindex: @samp{dir}, header argument
  17356 #+cindex: @samp{mkdirp}, header argument
  17357 The =dir= header argument specifies the default directory during code
  17358 block execution.  If it is absent, then the directory associated with
  17359 the current buffer is used.  In other words, supplying =:dir
  17360 DIRECTORY= temporarily has the same effect as changing the current
  17361 directory with {{{kbd(M-x cd RET DIRECTORY)}}}, and then not setting
  17362 =dir=.  Under the surface, =dir= simply sets the value of the Emacs
  17363 variable ~default-directory~.  Setting =mkdirp= header argument to
  17364 a non-~nil~ value creates the directory, if necessary.
  17365 
  17366 For example, to save the plot file in the =Work/= folder of the home
  17367 directory---notice tilde is expanded:
  17368 
  17369 #+begin_example
  17370 ,#+BEGIN_SRC R :file myplot.png :dir ~/Work
  17371   matplot(matrix(rnorm(100), 10), type="l")
  17372 ,#+END_SRC
  17373 #+end_example
  17374 
  17375 To evaluate the code block on a remote machine, supply a remote
  17376 directory name using Tramp syntax.  For example:
  17377 
  17378 #+begin_example
  17379 ,#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu:
  17380   plot(1:10, main=system("hostname", intern=TRUE))
  17381 ,#+END_SRC
  17382 #+end_example
  17383 
  17384 Org first captures the text results as usual for insertion in the Org
  17385 file.  Then Org also inserts a link to the remote file, thanks to
  17386 Emacs Tramp.  Org constructs the remote path to the file name from
  17387 =dir= and ~default-directory~, as illustrated here:
  17388 
  17389 : [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
  17390 
  17391 When =dir= is used with =session=, Org sets the starting directory for
  17392 a new session.  But Org does not alter the directory of an already
  17393 existing session.
  17394 
  17395 Do not use =dir= with =:exports results= or with =:exports both= to
  17396 avoid Org inserting incorrect links to remote files.  That is because
  17397 Org does not expand ~default directory~ to avoid some underlying
  17398 portability issues.
  17399 
  17400 *** Inserting headers and footers
  17401 :PROPERTIES:
  17402 :UNNUMBERED: notoc
  17403 :END:
  17404 
  17405 #+cindex: headers, in code blocks
  17406 #+cindex: footers, in code blocks
  17407 #+cindex: @samp{prologue}, header argument
  17408 The =prologue= header argument is for appending to the top of the code
  17409 block for execution, like a reset instruction.  For example, you may
  17410 use =:prologue "reset"= in a Gnuplot code block or, for every such
  17411 block:
  17412 
  17413 #+begin_src emacs-lisp
  17414 (add-to-list 'org-babel-default-header-args:gnuplot
  17415              '((:prologue . "reset")))
  17416 
  17417 #+end_src
  17418 
  17419 #+cindex: @samp{epilogue}, header argument
  17420 Likewise, the value of the =epilogue= header argument is for appending
  17421 to the end of the code block for execution.
  17422 
  17423 ** Evaluating Code Blocks
  17424 :PROPERTIES:
  17425 :DESCRIPTION: Place results of evaluation in the Org buffer.
  17426 :END:
  17427 #+cindex: code block, evaluating
  17428 #+cindex: source code, evaluating
  17429 #+cindex: @samp{RESULTS}, keyword
  17430 
  17431 A note about security: With code evaluation comes the risk of harm.
  17432 Org safeguards by prompting for user's permission before executing any
  17433 code in the source block.  To customize this safeguard, or disable it,
  17434 see [[*Code Evaluation and Security Issues]].
  17435 
  17436 *** How to evaluate source code
  17437 :PROPERTIES:
  17438 :UNNUMBERED: notoc
  17439 :END:
  17440 
  17441 Org captures the results of the code block evaluation and inserts them
  17442 in the Org file, right after the code block.  The insertion point is
  17443 after a newline and the =RESULTS= keyword.  Org creates the =RESULTS=
  17444 keyword if one is not already there.
  17445 
  17446 By default, Org enables only Emacs Lisp code blocks for execution.
  17447 See [[*Languages]] to enable other languages.
  17448 
  17449 #+kindex: C-c C-c
  17450 #+kindex: C-c C-v e
  17451 #+findex: org-babel-execute-src-block
  17452 Org provides many ways to execute code blocks.  {{{kbd(C-c C-c)}}} or
  17453 {{{kbd(C-c C-v e)}}} with the point on a code block[fn:142] calls the
  17454 ~org-babel-execute-src-block~ function, which executes the code in the
  17455 block, collects the results, and inserts them in the buffer.
  17456 
  17457 #+cindex: @samp{CALL}, keyword
  17458 #+vindex: org-babel-inline-result-wrap
  17459 By calling a named code block[fn:143] from an Org mode buffer or
  17460 a table.  Org can call the named code blocks from the current Org mode
  17461 buffer or from the "Library of Babel" (see [[*Library of Babel]]).
  17462 
  17463 The syntax for =CALL= keyword is:
  17464 
  17465 #+begin_example
  17466 ,#+CALL: <name>(<arguments>)
  17467 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
  17468 #+end_example
  17469 
  17470 The syntax for inline named code blocks is:
  17471 
  17472 #+begin_example
  17473 ... call_<name>(<arguments>) ...
  17474 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
  17475 #+end_example
  17476 
  17477 When inline syntax is used, the result is wrapped based on the
  17478 variable ~org-babel-inline-result-wrap~, which by default is set to
  17479 ~"=%s="~ to produce verbatim text suitable for markup.
  17480 
  17481 - =<name>= ::
  17482 
  17483   This is the name of the code block (see [[*Structure of Code Blocks]])
  17484   to be evaluated in the current document.  If the block is located in
  17485   another file, start =<name>= with the file name followed by
  17486   a colon.  For example, in order to execute a block named =clear-data=
  17487   in =file.org=, you can write the following:
  17488 
  17489   : #+CALL: file.org:clear-data()
  17490 
  17491 - =<arguments>= ::
  17492 
  17493   Org passes arguments to the code block using standard function call
  17494   syntax.  For example, a =#+CALL:= line that passes =4= to a code
  17495   block named =double=, which declares the header argument =:var n=2=,
  17496   would be written as:
  17497 
  17498   : #+CALL: double(n=4)
  17499 
  17500   #+texinfo: @noindent
  17501   Note how this function call syntax is different from the header
  17502   argument syntax.
  17503 
  17504 - =<inside header arguments>= ::
  17505 
  17506   Org passes inside header arguments to the named code block using the
  17507   header argument syntax.  Inside header arguments apply to code block
  17508   evaluation.  For example, =[:results output]= collects results
  17509   printed to stdout during code execution of that block.  Note how
  17510   this header argument syntax is different from the function call
  17511   syntax.
  17512 
  17513 - =<end header arguments>= ::
  17514 
  17515   End header arguments affect the results returned by the code block.
  17516   For example, =:results html= wraps the results in a =#+BEGIN_EXPORT
  17517   html= block before inserting the results in the Org buffer.
  17518 
  17519 *** Limit code block evaluation
  17520 :PROPERTIES:
  17521 :UNNUMBERED: notoc
  17522 :END:
  17523 
  17524 #+cindex: @samp{eval}, header argument
  17525 #+cindex: control code block evaluation
  17526 The =eval= header argument can limit evaluation of specific code
  17527 blocks and =CALL= keyword.  It is useful for protection against
  17528 evaluating untrusted code blocks by prompting for a confirmation.
  17529 
  17530 - =never= or =no= ::
  17531 
  17532   Org never evaluates the source code.
  17533 
  17534 - =query= ::
  17535 
  17536   Org prompts the user for permission to evaluate the source code.
  17537 
  17538 - =never-export= or =no-export= ::
  17539 
  17540   Org does not evaluate the source code when exporting, yet the user
  17541   can evaluate it interactively.
  17542 
  17543 - =query-export= ::
  17544 
  17545   Org prompts the user for permission to evaluate the source code
  17546   during export.
  17547 
  17548 If =eval= header argument is not set, then Org determines whether to
  17549 evaluate the source code from the ~org-confirm-babel-evaluate~
  17550 variable (see [[*Code Evaluation and Security Issues]]).
  17551 
  17552 *** Cache results of evaluation
  17553 :PROPERTIES:
  17554 :UNNUMBERED: notoc
  17555 :END:
  17556 
  17557 #+cindex: @samp{cache}, header argument
  17558 #+cindex: cache results of code evaluation
  17559 The =cache= header argument is for caching results of evaluating code
  17560 blocks.  Caching results can avoid re-evaluating a code block that
  17561 have not changed since the previous run.  To benefit from the cache
  17562 and avoid redundant evaluations, the source block must have a result
  17563 already present in the buffer, and neither the header
  17564 arguments---including the value of =var= references---nor the text of
  17565 the block itself has changed since the result was last computed.  This
  17566 feature greatly helps avoid long-running calculations.  For some edge
  17567 cases, however, the cached results may not be reliable.
  17568 
  17569 The caching feature is best for when code blocks are pure functions,
  17570 that is functions that return the same value for the same input
  17571 arguments (see [[*Environment of a Code Block]]), and that do not have
  17572 side effects, and do not rely on external variables other than the
  17573 input arguments.  Functions that depend on a timer, file system
  17574 objects, and random number generators are clearly unsuitable for
  17575 caching.
  17576 
  17577 A note of warning: when =cache= is used in a session, caching may
  17578 cause unexpected results.
  17579 
  17580 When the caching mechanism tests for any source code changes, it does
  17581 not expand noweb style references (see [[*Noweb Reference Syntax]]).
  17582 
  17583 The =cache= header argument can have one of two values: =yes= or =no=.
  17584 
  17585 - =no= ::
  17586 
  17587   Default.  No caching of results; code block evaluated every time.
  17588 
  17589 - =yes= ::
  17590 
  17591   Whether to run the code or return the cached results is determined
  17592   by comparing the SHA1 hash value of the combined code block and
  17593   arguments passed to it.  This hash value is packed on the
  17594   =#+RESULTS:= line from previous evaluation.  When hash values match,
  17595   Org does not evaluate the code block.  When hash values mismatch,
  17596   Org evaluates the code block, inserts the results, recalculates the
  17597   hash value, and updates =#+RESULTS:= line.
  17598 
  17599 In this example, both functions are cached.  But =caller= runs only if
  17600 the result from =random= has changed since the last run.
  17601 
  17602 #+begin_example
  17603 ,#+NAME: random
  17604 ,#+BEGIN_SRC R :cache yes
  17605   runif(1)
  17606 ,#+END_SRC
  17607 
  17608 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
  17609 0.4659510825295
  17610 
  17611 ,#+NAME: caller
  17612 ,#+BEGIN_SRC emacs-lisp :var x=random :cache yes
  17613   x
  17614 ,#+END_SRC
  17615 
  17616 ,#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  17617 0.254227238707244
  17618 #+end_example
  17619 
  17620 ** Results of Evaluation
  17621 :PROPERTIES:
  17622 :DESCRIPTION: Choosing a results type, post-processing...
  17623 :END:
  17624 #+cindex: code block, results of evaluation
  17625 #+cindex: source code, results of evaluation
  17626 
  17627 #+cindex: @samp{results}, header argument
  17628 How Org handles results of a code block execution depends on many
  17629 header arguments working together.  The primary determinant, however,
  17630 is the =results= header argument.  It accepts four classes of options.
  17631 Each code block can take only one option per class:
  17632 
  17633 - Collection ::
  17634 
  17635   For how the results should be collected from the code block;
  17636 
  17637 - Type ::
  17638 
  17639   For which type of result the code block will return; affects how Org
  17640   processes and inserts results in the Org buffer;
  17641 
  17642 - Format ::
  17643 
  17644   For the result; affects how Org processes results;
  17645 
  17646 - Handling ::
  17647 
  17648   For inserting results once they are properly formatted.
  17649 
  17650 *** Collection
  17651 :PROPERTIES:
  17652 :UNNUMBERED: notoc
  17653 :END:
  17654 
  17655 Collection options specify the results.  Choose one of the options;
  17656 they are mutually exclusive.
  17657 
  17658 - =value= ::
  17659 
  17660   Default for most Babel libraries[fn:143].  Functional mode.  Org
  17661   gets the value by wrapping the code in a function definition in the
  17662   language of the source block.  That is why when using =:results
  17663   value=, code should execute like a function and return a value.  For
  17664   languages like Python, an explicit ~return~ statement is mandatory
  17665   when using =:results value=.  Result is the value returned by the
  17666   last statement in the code block.
  17667 
  17668   When evaluating the code block in a session (see [[*Environment of
  17669   a Code Block]]), Org passes the code to an interpreter running as an
  17670   interactive Emacs inferior process.  Org gets the value from the
  17671   source code interpreter's last statement output.  Org has to use
  17672   language-specific methods to obtain the value.  For example, from
  17673   the variable ~_~ in Ruby, and the value of ~.Last.value~ in R.
  17674 
  17675 - =output= ::
  17676 
  17677   Scripting mode.  Org passes the code to an external process running
  17678   the interpreter.  Org returns the contents of the standard output
  17679   stream as text results.
  17680 
  17681   When using a session, Org passes the code to the interpreter running
  17682   as an interactive Emacs inferior process.  Org concatenates any text
  17683   output from the interpreter and returns the collection as a result.
  17684 
  17685 *** Type
  17686 :PROPERTIES:
  17687 :UNNUMBERED: notoc
  17688 :END:
  17689 
  17690 Type tells what result types to expect from the execution of the code
  17691 block.  Choose one of the options; they are mutually exclusive.  The
  17692 default behavior is to automatically determine the result type.
  17693 
  17694 #+attr_texinfo: :sep ,
  17695 - =table=, =vector= ::
  17696 
  17697   Interpret the results as an Org table.  If the result is a single
  17698   value, create a table with one row and one column.  Usage example:
  17699   =:results value table=.
  17700 
  17701   #+cindex: @samp{hlines}, header argument
  17702   In-between each table row or below the table headings, sometimes
  17703   results have horizontal lines, which are also known as "hlines".
  17704   The =hlines= argument with the default =no= value strips such lines
  17705   from the input table.  For most code, this is desirable, or else
  17706   those =hline= symbols raise unbound variable errors.  A =yes=
  17707   accepts such lines, as demonstrated in the following example.
  17708 
  17709   #+begin_example
  17710   ,#+NAME: many-cols
  17711   | a | b | c |
  17712   |---+---+---|
  17713   | d | e | f |
  17714   |---+---+---|
  17715   | g | h | i |
  17716 
  17717   ,#+NAME: no-hline
  17718   ,#+BEGIN_SRC python :var tab=many-cols :hlines no
  17719     return tab
  17720   ,#+END_SRC
  17721 
  17722   ,#+RESULTS: no-hline
  17723   | a | b | c |
  17724   | d | e | f |
  17725   | g | h | i |
  17726 
  17727   ,#+NAME: hlines
  17728   ,#+BEGIN_SRC python :var tab=many-cols :hlines yes
  17729     return tab
  17730   ,#+END_SRC
  17731 
  17732   ,#+RESULTS: hlines
  17733   | a | b | c |
  17734   |---+---+---|
  17735   | d | e | f |
  17736   |---+---+---|
  17737   | g | h | i |
  17738   #+end_example
  17739 
  17740 - =list= ::
  17741 
  17742   Interpret the results as an Org list.  If the result is a single
  17743   value, create a list of one element.
  17744 
  17745 - =scalar=, =verbatim= ::
  17746 
  17747   Interpret literally and insert as quoted text.  Do not create
  17748   a table.  Usage example: =:results value verbatim=.
  17749 
  17750 - =file= ::
  17751 
  17752   Interpret as a filename.  Save the results of execution of the code
  17753   block to that file, then insert a link to it.  You can control both
  17754   the filename and the description associated to the link.
  17755 
  17756   #+cindex: @samp{file}, header argument
  17757   #+cindex: @samp{output-dir}, header argument
  17758   Org first tries to generate the filename from the value of the
  17759   =file= header argument and the directory specified using the
  17760   =output-dir= header arguments.  If =output-dir= is not specified,
  17761   Org assumes it is the current directory.
  17762 
  17763   #+begin_example
  17764   ,#+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
  17765     size(2cm);
  17766     draw(unitcircle);
  17767   ,#+END_SRC
  17768   #+end_example
  17769 
  17770   #+cindex: @samp{file-ext}, header argument
  17771   If =file= header argument is missing, Org generates the base name of
  17772   the output file from the name of the code block, and its extension
  17773   from the =file-ext= header argument.  In that case, both the name
  17774   and the extension are mandatory.
  17775 
  17776   #+begin_example
  17777   ,#+name: circle
  17778   ,#+BEGIN_SRC asymptote :results value file :file-ext pdf
  17779     size(2cm);
  17780     draw(unitcircle);
  17781   ,#+END_SRC
  17782   #+end_example
  17783 
  17784   #+cindex: @samp{file-desc}, header argument
  17785   The =file-desc= header argument defines the description (see [[*Link
  17786   Format]]) for the link.  If =file-desc= is present but has no value,
  17787   the =file= value is used as the link description.  When this
  17788   argument is not present, the description is omitted.  If you want to
  17789   provide the =file-desc= argument but omit the description, you can
  17790   provide it with an empty vector (i.e., :file-desc []).
  17791 
  17792   #+cindex: @samp{sep}, header argument
  17793   By default, Org assumes that a table written to a file has
  17794   TAB-delimited output.  You can choose a different separator with
  17795   the =sep= header argument.
  17796 
  17797   #+cindex: @samp{file-mode}, header argument
  17798   The =file-mode= header argument defines the file permissions.  To
  17799   make it executable, use =:file-mode (identity #o755)=.
  17800 
  17801   #+begin_example
  17802   ,#+BEGIN_SRC shell :results file :file script.sh :file-mode (identity #o755)
  17803     echo "#!/bin/bash"
  17804     echo "echo Hello World"
  17805   ,#+END_SRC
  17806   #+end_example
  17807 
  17808 *** Format
  17809 :PROPERTIES:
  17810 :UNNUMBERED: notoc
  17811 :END:
  17812 
  17813 Format pertains to the type of the result returned by the code block.
  17814 Choose one of the options; they are mutually exclusive.  The default
  17815 follows from the type specified above.
  17816 
  17817 #+attr_texinfo: :sep ,
  17818 - =code= ::
  17819 
  17820   Result enclosed in a code block.  Useful for parsing.  Usage
  17821   example: =:results value code=.
  17822 
  17823 - =drawer= ::
  17824 
  17825   Result wrapped in a =RESULTS= drawer.  Useful for containing =raw=
  17826   or =org= results for later scripting and automated processing.
  17827   Usage example: =:results value drawer=.
  17828 
  17829 - =html= ::
  17830 
  17831   Results enclosed in a =BEGIN_EXPORT html= block.  Usage example:
  17832   =:results value html=.
  17833 
  17834 - =latex= ::
  17835 
  17836   Results enclosed in a =BEGIN_EXPORT latex= block.  Usage example:
  17837   =:results value latex=.
  17838 
  17839 - =link=, =graphics= ::
  17840 
  17841   When used along with =file= type, the result is a link to the file
  17842   specified in =:file= header argument.  However, unlike plain =file=
  17843   type, nothing is written to the disk.  The block is used for its
  17844   side-effects only, as in the following example:
  17845 
  17846   #+begin_example
  17847   ,#+begin_src shell :results file link :file "download.tar.gz"
  17848   wget -c "https://example.com/download.tar.gz"
  17849   ,#+end_src
  17850   #+end_example
  17851 
  17852 - =org= ::
  17853 
  17854   Results enclosed in a =BEGIN_SRC org= block.  For comma-escape,
  17855   either {{{kbd(TAB)}}} in the block, or export the file.  Usage
  17856   example: =:results value org=.
  17857 
  17858 - =pp= ::
  17859 
  17860   Result converted to pretty-print source code.  Enclosed in a code
  17861   block.  Languages supported: Emacs Lisp, Python, and Ruby.  Usage
  17862   example: =:results value pp=.
  17863 
  17864 - =raw= ::
  17865 
  17866   Interpreted as raw Org mode.  Inserted directly into the buffer.
  17867   Aligned if it is a table.  Usage example: =:results value raw=.
  17868 
  17869 #+cindex: @samp{wrap}, header argument
  17870 The =wrap= header argument unconditionally marks the results block by
  17871 appending strings to =#+BEGIN_= and =#+END_=.  If no string is
  17872 specified, Org wraps the results in a =#+BEGIN_results=
  17873 ... =#+END_results= block.  It takes precedent over the =results=
  17874 value listed above.  E.g.,
  17875 
  17876 #+begin_example
  17877 ,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown
  17878 "<blink>Welcome back to the 90's</blink>"
  17879 ,#+END_SRC
  17880 
  17881 ,#+RESULTS:
  17882 ,#+BEGIN_EXPORT markdown
  17883 <blink>Welcome back to the 90's</blink>
  17884 ,#+END_EXPORT
  17885 #+end_example
  17886 
  17887 *** Handling
  17888 :PROPERTIES:
  17889 :UNNUMBERED: notoc
  17890 :END:
  17891 
  17892 Handling options after collecting the results.
  17893 
  17894 - =replace= ::
  17895 
  17896   Default.  Insert results in the Org buffer.  Remove previous
  17897   results.  Usage example: =:results output replace=.
  17898 
  17899 - =silent= ::
  17900 
  17901   Do not insert results in the Org mode buffer, but echo them in the
  17902   minibuffer.  Usage example: =:results output silent=.
  17903 
  17904 - =none= ::
  17905 
  17906   Do not process results at all.  No inserting in the Org mode buffer
  17907   nor echo them in the minibuffer.  Usage example: =:results none=.
  17908 
  17909 - =append= ::
  17910 
  17911   Append results to the Org buffer.  Latest results are at the bottom.
  17912   Does not remove previous results.  Usage example: =:results output
  17913   append=.
  17914 
  17915 - =prepend= ::
  17916 
  17917   Prepend results to the Org buffer.  Latest results are at the top.
  17918   Does not remove previous results.  Usage example: =:results output
  17919   prepend=.
  17920 
  17921 *** Post-processing
  17922 :PROPERTIES:
  17923 :UNNUMBERED: notoc
  17924 :END:
  17925 
  17926 #+cindex: @samp{post}, header argument
  17927 #+cindex: @samp{*this*}, in @samp{post} header argument
  17928 The =post= header argument is for post-processing results from block
  17929 evaluation.  When =post= has any value, Org binds the results to
  17930 ~*this*~ variable for easy passing to =var= header argument
  17931 specifications (see [[*Environment of a Code Block]]).  That makes results
  17932 available to other code blocks, or even for direct Emacs Lisp code
  17933 execution.
  17934 
  17935 The following two examples illustrate =post= header argument in
  17936 action.  The first one shows how to attach an =ATTR_LATEX= keyword
  17937 using =post=.
  17938 
  17939 #+begin_example
  17940 ,#+NAME: attr_wrap
  17941 ,#+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
  17942   echo "#+ATTR_LATEX: :width $width"
  17943   echo "$data"
  17944 ,#+END_SRC
  17945 
  17946 ,#+HEADER: :file /tmp/it.png
  17947 ,#+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
  17948   digraph{
  17949           a -> b;
  17950           b -> c;
  17951           c -> a;
  17952   }
  17953 ,#+end_src
  17954 
  17955 ,#+RESULTS:
  17956 :RESULTS:
  17957 ,#+ATTR_LATEX :width 5cm
  17958 [[file:/tmp/it.png]]
  17959 :END:
  17960 #+end_example
  17961 
  17962 The second example shows use of =colnames= header argument in =post=
  17963 to pass data between code blocks.
  17964 
  17965 #+begin_example
  17966 ,#+NAME: round-tbl
  17967 ,#+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
  17968   (mapcar (lambda (row)
  17969             (mapcar (lambda (cell)
  17970                       (if (numberp cell)
  17971                           (format fmt cell)
  17972                         cell))
  17973                     row))
  17974           tbl)
  17975 ,#+end_src
  17976 
  17977 ,#+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
  17978   set.seed(42)
  17979   data.frame(foo=rnorm(1))
  17980 ,#+END_SRC
  17981 
  17982 ,#+RESULTS:
  17983 |   foo |
  17984 |-------|
  17985 | 1.371 |
  17986 #+end_example
  17987 
  17988 ** Exporting Code Blocks
  17989 :PROPERTIES:
  17990 :DESCRIPTION: Export contents and/or results.
  17991 :END:
  17992 #+cindex: code block, exporting
  17993 #+cindex: source code, exporting
  17994 
  17995 It is possible to export the /code/ of code blocks, the /results/ of
  17996 code block evaluation, /both/ the code and the results of code block
  17997 evaluation, or /none/.  Org defaults to exporting /code/ for most
  17998 languages.  For some languages, such as ditaa, Org defaults to
  17999 /results/.  To export just the body of code blocks, see [[*Literal
  18000 Examples]].  To selectively export sub-trees of an Org document, see
  18001 [[*Exporting]].
  18002 
  18003 #+cindex: @samp{exports}, header argument
  18004 The =exports= header argument is to specify if that part of the Org
  18005 file is exported to, say, HTML or LaTeX formats.
  18006 
  18007 - =code= ::
  18008 
  18009   The default.  The body of code is included into the exported file.
  18010   Example: =:exports code=.
  18011 
  18012 - =results= ::
  18013 
  18014   The results of evaluation of the code is included in the exported
  18015   file.  Example: =:exports results=.
  18016 
  18017 - =both= ::
  18018 
  18019   Both the code and results of evaluation are included in the exported
  18020   file.  Example: =:exports both=.
  18021 
  18022 - =none= ::
  18023 
  18024   Neither the code nor the results of evaluation is included in the
  18025   exported file.  Whether the code is evaluated at all depends on
  18026   other options.  Example: =:exports none=.
  18027 
  18028 #+vindex: org-export-use-babel
  18029 To stop Org from evaluating code blocks to speed exports, use the
  18030 header argument =:eval never-export= (see [[*Evaluating Code Blocks]]).
  18031 To stop Org from evaluating code blocks for greater security, set the
  18032 ~org-export-use-babel~ variable to ~nil~, but understand that header
  18033 arguments will have no effect.
  18034 
  18035 Turning off evaluation comes in handy when batch processing.  For
  18036 example, markup languages for wikis, which have a high risk of
  18037 untrusted code.  Stopping code block evaluation also stops evaluation
  18038 of all header arguments of the code block.  This may not be desirable
  18039 in some circumstances.  So during export, to allow evaluation of just
  18040 the header arguments but not any code evaluation in the source block,
  18041 set =:eval never-export= (see [[*Evaluating Code Blocks]]).
  18042 
  18043 Org never evaluates code blocks in commented sub-trees when exporting
  18044 (see [[*Comment Lines]]).  On the other hand, Org does evaluate code
  18045 blocks in sub-trees excluded from export (see [[*Export Settings]]).
  18046 
  18047 ** Extracting Source Code
  18048 :PROPERTIES:
  18049 :DESCRIPTION: Create pure source code files.
  18050 :END:
  18051 #+cindex: tangling
  18052 #+cindex: source code, extracting
  18053 #+cindex: code block, extracting source code
  18054 
  18055 Extracting source code from code blocks is a basic task in literate
  18056 programming.  Org has features to make this easy.  In literate
  18057 programming parlance, documents on creation are /woven/ with code and
  18058 documentation, and on export, the code is tangled for execution by
  18059 a computer.  Org facilitates weaving and tangling for producing,
  18060 maintaining, sharing, and exporting literate programming documents.
  18061 Org provides extensive customization options for extracting source
  18062 code.
  18063 
  18064 When Org tangles code blocks, it expands, merges, and transforms them.
  18065 Then Org recomposes them into one or more separate files, as
  18066 configured through the options.  During this tangling process, Org
  18067 expands variables in the source code, and resolves any noweb style
  18068 references (see [[*Noweb Reference Syntax]]).
  18069 
  18070 *** Header arguments
  18071 :PROPERTIES:
  18072 :UNNUMBERED: notoc
  18073 :END:
  18074 
  18075 #+cindex: @samp{tangle}, header argument
  18076 The =tangle= header argument specifies if the code block is exported
  18077 to source file(s).
  18078 
  18079 - =yes= ::
  18080 
  18081   Export the code block to source file.  The file name for the source
  18082   file is derived from the name of the Org file, and the file
  18083   extension is derived from the source code language identifier.
  18084   Example: =:tangle yes=.
  18085 
  18086 - =no= ::
  18087 
  18088   The default.  Do not extract the code in a source code file.
  18089   Example: =:tangle no=.
  18090 
  18091 - {{{var(FILENAME)}}} ::
  18092 
  18093   Export the code block to source file whose file name is derived from
  18094   any string passed to the =tangle= header argument.  Org derives the
  18095   file name as being relative to the directory of the Org file's
  18096   location.  Example: =:tangle FILENAME=.
  18097 
  18098 #+cindex: @samp{mkdirp}, header argument
  18099 The =mkdirp= header argument creates parent directories for tangled
  18100 files if the directory does not exist.  A =yes= value enables
  18101 directory creation whereas =no= inhibits it.
  18102 
  18103 #+cindex: @samp{comments}, header argument
  18104 The =comments= header argument controls inserting comments into
  18105 tangled files.  These are above and beyond whatever comments may
  18106 already exist in the code block.
  18107 
  18108 - =no= ::
  18109 
  18110   The default.  Do not insert any extra comments during tangling.
  18111 
  18112 - =link= ::
  18113 
  18114   Wrap the code block in comments.  Include links pointing back to the
  18115   place in the Org file from where the code was tangled.
  18116 
  18117 - =yes= ::
  18118 
  18119   Kept for backward compatibility; same as =link=.
  18120 
  18121 - =org= ::
  18122 
  18123   Nearest headline text from Org file is inserted as comment.  The
  18124   exact text that is inserted is picked from the leading context of
  18125   the source block.
  18126 
  18127 - =both= ::
  18128 
  18129   Includes both =link= and =org= options.
  18130 
  18131 - =noweb= ::
  18132 
  18133   Includes =link= option, expands noweb references (see [[*Noweb
  18134   Reference Syntax]]), and wraps them in link comments inside the body
  18135   of the code block.
  18136 
  18137 #+cindex: @samp{padline}, header argument
  18138 The =padline= header argument controls insertion of newlines to pad
  18139 source code in the tangled file.
  18140 
  18141 - =yes= ::
  18142 
  18143   Default.  Insert a newline before and after each code block in the
  18144   tangled file.
  18145 
  18146 - =no= ::
  18147 
  18148   Do not insert newlines to pad the tangled code blocks.
  18149 
  18150 #+cindex: @samp{shebang}, header argument
  18151 The =shebang= header argument can turn results into executable script
  18152 files.  By setting it to a string value---for example, =:shebang
  18153 "#!/bin/bash"=---Org inserts that string as the first line of the
  18154 tangled file that the code block is extracted to.  Org then turns on
  18155 the tangled file's executable permission.
  18156 
  18157 #+cindex: @samp{tangle-mode}, header argument
  18158 The =tangle-mode= header argument specifies what permissions to set
  18159 for tangled files by ~set-file-modes~.  For example, to make
  18160 a read-only tangled file, use =:tangle-mode (identity #o444)=.  To
  18161 make it executable, use =:tangle-mode (identity #o755)=.  It also
  18162 overrides executable permission granted by =shebang=.  When multiple
  18163 source code blocks tangle to a single file with different and
  18164 conflicting =tangle-mode= header arguments, Org's behavior is
  18165 undefined.
  18166 
  18167 #+cindex: @samp{no-expand}, header argument
  18168 By default Org expands code blocks during tangling.  The =no-expand=
  18169 header argument turns off such expansions.  Note that one side-effect
  18170 of expansion by ~org-babel-expand-src-block~ also assigns values (see
  18171 [[*Environment of a Code Block]]) to variables.  Expansions also replace
  18172 noweb references with their targets (see [[*Noweb Reference Syntax]]).
  18173 Some of these expansions may cause premature assignment, hence this
  18174 option.  This option makes a difference only for tangling.  It has no
  18175 effect when exporting since code blocks for execution have to be
  18176 expanded anyway.
  18177 
  18178 *** Functions
  18179 :PROPERTIES:
  18180 :UNNUMBERED: notoc
  18181 :END:
  18182 
  18183 - ~org-babel-tangle~ ::
  18184 
  18185   #+findex: org-babel-tangle
  18186   #+kindex: C-c C-v t
  18187   Tangle the current file.  Bound to {{{kbd(C-c C-v t)}}}.
  18188 
  18189   With prefix argument only tangle the current code block.
  18190 
  18191 - ~org-babel-tangle-file~ ::
  18192 
  18193   #+findex: org-babel-tangle-file
  18194   #+kindex: C-c C-v f
  18195   Choose a file to tangle.  Bound to {{{kbd(C-c C-v f)}}}.
  18196 
  18197 *** Hooks
  18198 :PROPERTIES:
  18199 :UNNUMBERED: notoc
  18200 :END:
  18201 
  18202 - ~org-babel-post-tangle-hook~ ::
  18203 
  18204   #+vindex: org-babel-post-tangle-hook
  18205   This hook is run from within code files tangled by
  18206   ~org-babel-tangle~, making it suitable for post-processing,
  18207   compilation, and evaluation of code in the tangled files.
  18208 
  18209 *** Jumping between code and Org
  18210 :PROPERTIES:
  18211 :UNNUMBERED: notoc
  18212 :END:
  18213 
  18214 #+findex: org-babel-tangle-jump-to-org
  18215 Debuggers normally link errors and messages back to the source code.
  18216 But for tangled files, we want to link back to the Org file, not to
  18217 the tangled source file.  To make this extra jump, Org uses
  18218 ~org-babel-tangle-jump-to-org~ function with two additional source
  18219 code block header arguments:
  18220 
  18221 1. Set =padline= to true---this is the default setting.
  18222 2. Set =comments= to =link=, which makes Org insert links to the Org
  18223    file.
  18224 
  18225 ** Languages
  18226 :PROPERTIES:
  18227 :DESCRIPTION: List of supported code block languages.
  18228 :END:
  18229 #+cindex: babel, languages
  18230 #+cindex: source code, languages
  18231 #+cindex: code block, languages
  18232 
  18233 Code blocks in dozens of languages are supported.  See Worg for
  18234 [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language specific documentation]].
  18235 
  18236 #+vindex: org-babel-load-languages
  18237 By default, only Emacs Lisp is enabled for evaluation.  To enable or
  18238 disable other languages, customize the ~org-babel-load-languages~
  18239 variable either through the Emacs customization interface, or by
  18240 adding code to the init file as shown next.
  18241 
  18242 In this example, evaluation is disabled for Emacs Lisp, and enabled
  18243 for R.
  18244 
  18245 #+begin_src emacs-lisp
  18246 (org-babel-do-load-languages
  18247  'org-babel-load-languages
  18248  '((emacs-lisp . nil)
  18249    (R . t)))
  18250 #+end_src
  18251 
  18252 Note that this is not the only way to enable a language.  Org also
  18253 enables languages when loaded with ~require~ statement.  For example,
  18254 the following enables execution of Clojure code blocks:
  18255 
  18256 #+begin_src emacs-lisp
  18257 (require 'ob-clojure)
  18258 #+end_src
  18259 
  18260 ** Editing Source Code
  18261 :PROPERTIES:
  18262 :DESCRIPTION: Language major-mode editing.
  18263 :END:
  18264 #+cindex: code block, editing
  18265 #+cindex: source code, editing
  18266 
  18267 #+kindex: C-c '
  18268 Use {{{kbd(C-c ')}}} to edit the current code block.  It opens a new
  18269 major mode edit buffer containing the body of the source code block,
  18270 ready for any edits.  Use {{{kbd(C-c ')}}} again to close the buffer
  18271 and return to the Org buffer.
  18272 
  18273 #+kindex: C-x C-s
  18274 #+vindex: org-edit-src-auto-save-idle-delay
  18275 #+cindex: auto-save, in code block editing
  18276 {{{kbd(C-x C-s)}}} saves the buffer and updates the contents of the
  18277 Org buffer.  Set ~org-edit-src-auto-save-idle-delay~ to save the base
  18278 buffer after a certain idle delay time.  Set
  18279 ~org-edit-src-turn-on-auto-save~ to auto-save this buffer into
  18280 a separate file using Auto-save mode.
  18281 
  18282 While editing the source code in the major mode, the Org Src minor
  18283 mode remains active.  It provides these customization variables as
  18284 described below.  For even more variables, look in the customization
  18285 group ~org-edit-structure~.
  18286 
  18287 - ~org-src-lang-modes~ ::
  18288 
  18289   #+vindex: org-src-lang-modes
  18290   If an Emacs major-mode named ~<LANG>-mode~ exists, where
  18291   {{{var(<LANG>)}}} is the language identifier from code block's
  18292   header line, then the edit buffer uses that major mode.  Use this
  18293   variable to arbitrarily map language identifiers to major modes.
  18294 
  18295 - ~org-src-window-setup~ ::
  18296 
  18297   #+vindex: org-src-window-setup
  18298   For specifying Emacs window arrangement when the new edit buffer is
  18299   created.
  18300 
  18301 - ~org-src-preserve-indentation~ ::
  18302 
  18303   #+cindex: indentation, in code blocks
  18304   #+vindex: org-src-preserve-indentation
  18305   Default is ~nil~.  Source code is indented.  This indentation
  18306   applies during export or tangling, and depending on the context, may
  18307   alter leading spaces and tabs.  When non-~nil~, source code is
  18308   aligned with the leftmost column.  No lines are modified during
  18309   export or tangling, which is very useful for white-space sensitive
  18310   languages, such as Python.
  18311 
  18312 - ~org-src-ask-before-returning-to-edit-buffer~ ::
  18313 
  18314   #+vindex: org-src-ask-before-returning-to-edit-buffer
  18315   When ~nil~, Org returns to the edit buffer without further prompts.
  18316   The default prompts for a confirmation.
  18317 
  18318 #+vindex: org-src-fontify-natively
  18319 #+vindex: org-src-block-faces
  18320 Set ~org-src-fontify-natively~ to non-~nil~ to turn on native code
  18321 fontification in the /Org/ buffer.  Fontification of code blocks can
  18322 give visual separation of text and code on the display page.  To
  18323 further customize the appearance of ~org-block~ for specific
  18324 languages, customize ~org-src-block-faces~.  The following example
  18325 shades the background of regular blocks, and colors source blocks only
  18326 for Python and Emacs Lisp languages.
  18327 
  18328 #+begin_src emacs-lisp
  18329 (require 'color)
  18330 (set-face-attribute 'org-block nil :background
  18331                     (color-darken-name
  18332                      (face-attribute 'default :background) 3))
  18333 
  18334 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
  18335                             ("python" (:background "#E5FFB8"))))
  18336 #+end_src
  18337 
  18338 ** Noweb Reference Syntax
  18339 :PROPERTIES:
  18340 :DESCRIPTION: Literate programming in Org mode.
  18341 :END:
  18342 #+cindex: code block, noweb reference
  18343 #+cindex: syntax, noweb
  18344 #+cindex: source code, noweb reference
  18345 
  18346 #+cindex: @samp{noweb-ref}, header argument
  18347 Source code blocks can include references to other source code blocks,
  18348 using a noweb[fn:144] style syntax:
  18349 
  18350 : <<CODE-BLOCK-ID>>
  18351 
  18352 #+texinfo: @noindent
  18353 where {{{var(CODE-BLOCK-ID)}}} refers to either the =NAME= of a single
  18354 source code block, or a collection of one or more source code blocks
  18355 sharing the same =noweb-ref= header argument (see [[*Using Header
  18356 Arguments]]).  Org can replace such references with the source code of
  18357 the block or blocks being referenced, or, in the case of a single
  18358 source code block named with =NAME=, with the results of an evaluation
  18359 of that block.
  18360 
  18361 #+cindex: @samp{noweb}, header argument
  18362 The =noweb= header argument controls expansion of noweb syntax
  18363 references.  Expansions occur when source code blocks are evaluated,
  18364 tangled, or exported.
  18365 
  18366 - =no= ::
  18367 
  18368   Default.  No expansion of noweb syntax references in the body of the
  18369   code when evaluating, tangling, or exporting.
  18370 
  18371 - =yes= ::
  18372 
  18373   Expansion of noweb syntax references in the body of the code block
  18374   when evaluating, tangling, or exporting.
  18375 
  18376 - =tangle= ::
  18377 
  18378   Expansion of noweb syntax references in the body of the code block
  18379   when tangling.  No expansion when evaluating or exporting.
  18380 
  18381 - =no-export= ::
  18382 
  18383   Expansion of noweb syntax references in the body of the code block
  18384   when evaluating or tangling.  No expansion when exporting.
  18385 
  18386 - =strip-export= ::
  18387 
  18388   Expansion of noweb syntax references in the body of the code block
  18389   when expanding prior to evaluating or tangling.  Removes noweb
  18390   syntax references when exporting.
  18391 
  18392 - =eval= ::
  18393 
  18394   Expansion of noweb syntax references in the body of the code block
  18395   only before evaluating.
  18396 
  18397 In the most simple case, the contents of a single source block is
  18398 inserted within other blocks.  Thus, in following example,
  18399 
  18400 #+begin_example
  18401 ,#+NAME: initialization
  18402 ,#+BEGIN_SRC emacs-lisp
  18403   (setq sentence "Never a foot too far, even.")
  18404 ,#+END_SRC
  18405 
  18406 ,#+BEGIN_SRC emacs-lisp :noweb yes
  18407   <<initialization>>
  18408   (reverse sentence)
  18409 ,#+END_SRC
  18410 #+end_example
  18411 
  18412 #+texinfo: @noindent
  18413 the second code block is expanded as
  18414 
  18415 #+begin_example
  18416 ,#+BEGIN_SRC emacs-lisp :noweb yes
  18417   (setq sentence "Never a foot too far, even.")
  18418   (reverse sentence)
  18419 ,#+END_SRC
  18420 #+end_example
  18421 
  18422 You may also include the contents of multiple blocks sharing a common
  18423 =noweb-ref= header argument, which can be set at the file, sub-tree,
  18424 or code block level.  In the example Org file shown next, the body of
  18425 the source code in each block is extracted for concatenation to a pure
  18426 code file when tangled.
  18427 
  18428 #+begin_example
  18429 ,#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
  18430   <<fullest-disk>>
  18431 ,#+END_SRC
  18432 ,* the mount point of the fullest disk
  18433   :PROPERTIES:
  18434   :header-args: :noweb-ref fullest-disk
  18435   :END:
  18436 
  18437 ,** query all mounted disks
  18438 ,#+BEGIN_SRC sh
  18439   df \
  18440 ,#+END_SRC
  18441 
  18442 ,** strip the header row
  18443 ,#+BEGIN_SRC sh
  18444   |sed '1d' \
  18445 ,#+END_SRC
  18446 
  18447 ,** output mount point of fullest disk
  18448 ,#+BEGIN_SRC sh
  18449   |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
  18450 ,#+END_SRC
  18451 #+end_example
  18452 
  18453 #+cindex: @samp{noweb-sep}, header argument
  18454 By default a newline separates each noweb reference concatenation.  To
  18455 use a different separator, edit the =noweb-sep= header argument.
  18456 
  18457 Alternatively, Org can include the results of evaluation of a single
  18458 code block rather than its body.  Evaluation occurs when parentheses,
  18459 possibly including arguments, are appended to the code block name, as
  18460 shown below.
  18461 
  18462 : <<NAME(optional arguments)>>
  18463 
  18464 Note that in this case, a code block name set by =NAME= keyword is
  18465 required; the reference set by =noweb-ref= will not work when
  18466 evaluation is desired.
  18467 
  18468 Here is an example that demonstrates how the exported content changes
  18469 when noweb style references are used with parentheses versus without.
  18470 Given:
  18471 
  18472 #+begin_example
  18473 ,#+NAME: some-code
  18474 ,#+BEGIN_SRC python :var num=0 :results output :exports none
  18475   print(num*10)
  18476 ,#+END_SRC
  18477 #+end_example
  18478 
  18479 #+texinfo: @noindent
  18480 this code block:
  18481 
  18482 #+begin_example
  18483 ,#+BEGIN_SRC text :noweb yes
  18484   <<some-code>>
  18485 ,#+END_SRC
  18486 #+end_example
  18487 
  18488 #+texinfo: @noindent
  18489 expands to:
  18490 
  18491 : print(num*10)
  18492 
  18493 Below, a similar noweb style reference is used, but with parentheses,
  18494 while setting a variable =num= to 10:
  18495 
  18496 #+begin_example
  18497 ,#+BEGIN_SRC text :noweb yes
  18498   <<some-code(num=10)>>
  18499 ,#+END_SRC
  18500 #+end_example
  18501 
  18502 #+texinfo: @noindent
  18503 Note that the expansion now contains the results of the code block
  18504 =some-code=, not the code block itself:
  18505 
  18506 : 100
  18507 
  18508 Noweb insertions honor prefix characters that appear before the noweb
  18509 syntax reference.  This behavior is illustrated in the following
  18510 example.  Because the =<<example>>= noweb reference appears behind the
  18511 SQL comment syntax, each line of the expanded noweb reference is
  18512 commented.  With:
  18513 
  18514 #+begin_example
  18515 ,#+NAME: example
  18516 ,#+BEGIN_SRC text
  18517   this is the
  18518   multi-line body of example
  18519 ,#+END_SRC
  18520 #+end_example
  18521 
  18522 #+texinfo: @noindent
  18523 this code block:
  18524 
  18525 #+begin_example
  18526 ,#+BEGIN_SRC sql :noweb yes
  18527  ---<<example>>
  18528 ,#+END_SRC
  18529 #+end_example
  18530 
  18531 #+texinfo: @noindent
  18532 expands to:
  18533 
  18534 #+begin_example
  18535 ,#+BEGIN_SRC sql :noweb yes
  18536  ---this is the
  18537  ---multi-line body of example
  18538 ,#+END_SRC
  18539 #+end_example
  18540 
  18541 Since this change does not affect noweb replacement text without
  18542 newlines in them, inline noweb references are acceptable.
  18543 
  18544 This feature can also be used for management of indentation in
  18545 exported code snippets.  With:
  18546 
  18547 #+begin_example
  18548 ,#+NAME: if-true
  18549 ,#+BEGIN_SRC python :exports none
  18550   print('do things when true')
  18551 ,#+end_src
  18552 
  18553 ,#+name: if-false
  18554 ,#+begin_src python :exports none
  18555   print('do things when false')
  18556 ,#+end_src
  18557 #+end_example
  18558 
  18559 #+texinfo: @noindent
  18560 this code block:
  18561 
  18562 #+begin_example
  18563 ,#+begin_src python :noweb yes :results output
  18564   if true:
  18565       <<if-true>>
  18566   else:
  18567       <<if-false>>
  18568 ,#+end_src
  18569 #+end_example
  18570 
  18571 #+texinfo: @noindent
  18572 expands to:
  18573 
  18574 #+begin_example
  18575 if true:
  18576     print('do things when true')
  18577 else:
  18578     print('do things when false')
  18579 #+end_example
  18580 
  18581 When in doubt about the outcome of a source code block expansion, you
  18582 can preview the results with the following command:
  18583 
  18584 - {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} (~org-babel-expand-src-block~) ::
  18585 
  18586   #+findex: org-babel-expand-src-block
  18587   #+kindex: C-c C-v v
  18588   #+kindex: C-c C-v C-v
  18589   Expand the current source code block according to its header
  18590   arguments and pop open the results in a preview buffer.
  18591 
  18592 ** Library of Babel
  18593 :PROPERTIES:
  18594 :DESCRIPTION: Use and contribute to a library of useful code blocks.
  18595 :END:
  18596 #+cindex: babel, library of
  18597 #+cindex: source code, library
  18598 #+cindex: code block, library
  18599 
  18600 The "Library of Babel" is a collection of code blocks.  Like
  18601 a function library, these code blocks can be called from other Org
  18602 files.  A collection of useful code blocks is available on [[https://orgmode.org/worg/library-of-babel.html][Worg]].  For
  18603 remote code block evaluation syntax, see [[*Evaluating Code Blocks]].
  18604 
  18605 #+kindex: C-c C-v i
  18606 #+findex: org-babel-lob-ingest
  18607 For any user to add code to the library, first save the code in
  18608 regular code blocks of an Org file, and then load the Org file with
  18609 ~org-babel-lob-ingest~, which is bound to {{{kbd(C-c C-v i)}}}.
  18610 
  18611 ** Key bindings and Useful Functions
  18612 :PROPERTIES:
  18613 :DESCRIPTION: Work quickly with code blocks.
  18614 :END:
  18615 #+cindex: code block, key bindings
  18616 
  18617 Many common Org mode key sequences are re-bound depending on
  18618 the context.
  18619 
  18620 Active key bindings in code blocks:
  18621 
  18622 #+kindex: C-c C-c
  18623 #+findex: org-babel-execute-src-block
  18624 #+kindex: C-c C-o
  18625 #+findex: org-babel-open-src-block-result
  18626 #+kindex: M-UP
  18627 #+findex: org-babel-load-in-session
  18628 #+kindex: M-DOWN
  18629 #+findex: org-babel-pop-to-session
  18630 #+attr_texinfo: :columns 0.2 0.55
  18631 | Key binding        | Function                          |
  18632 |--------------------+-----------------------------------|
  18633 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~     |
  18634 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ |
  18635 | {{{kbd(M-UP)}}}    | ~org-babel-load-in-session~       |
  18636 | {{{kbd(M-DOWN)}}}  | ~org-babel-pop-to-session~        |
  18637 
  18638 Active key bindings in Org mode buffer:
  18639 
  18640 #+kindex: C-c C-v p
  18641 #+kindex: C-c C-v C-p
  18642 #+kindex: C-c C-v n
  18643 #+kindex: C-c C-v C-n
  18644 #+kindex: C-c C-v e
  18645 #+kindex: C-c C-v C-e
  18646 #+kindex: C-c C-v o
  18647 #+kindex: C-c C-v C-o
  18648 #+kindex: C-c C-v v
  18649 #+kindex: C-c C-v C-v
  18650 #+kindex: C-c C-v u
  18651 #+kindex: C-c C-v C-u
  18652 #+kindex: C-c C-v g
  18653 #+kindex: C-c C-v C-g
  18654 #+kindex: C-c C-v r
  18655 #+kindex: C-c C-v C-r
  18656 #+kindex: C-c C-v b
  18657 #+kindex: C-c C-v C-b
  18658 #+kindex: C-c C-v s
  18659 #+kindex: C-c C-v C-s
  18660 #+kindex: C-c C-v d
  18661 #+kindex: C-c C-v C-d
  18662 #+kindex: C-c C-v t
  18663 #+kindex: C-c C-v C-t
  18664 #+kindex: C-c C-v f
  18665 #+kindex: C-c C-v C-f
  18666 #+kindex: C-c C-v c
  18667 #+kindex: C-c C-v C-c
  18668 #+kindex: C-c C-v j
  18669 #+kindex: C-c C-v C-j
  18670 #+kindex: C-c C-v l
  18671 #+kindex: C-c C-v C-l
  18672 #+kindex: C-c C-v i
  18673 #+kindex: C-c C-v C-i
  18674 #+kindex: C-c C-v I
  18675 #+kindex: C-c C-v C-I
  18676 #+kindex: C-c C-v z
  18677 #+kindex: C-c C-v C-z
  18678 #+kindex: C-c C-v a
  18679 #+kindex: C-c C-v C-a
  18680 #+kindex: C-c C-v h
  18681 #+kindex: C-c C-v C-h
  18682 #+kindex: C-c C-v x
  18683 #+kindex: C-c C-v C-x
  18684 #+findex: org-babel-previous-src-block
  18685 #+findex: org-babel-next-src-block
  18686 #+findex: org-babel-execute-maybe
  18687 #+findex: org-babel-open-src-block-result
  18688 #+findex: org-babel-expand-src-block
  18689 #+findex: org-babel-goto-src-block-head
  18690 #+findex: org-babel-goto-named-src-block
  18691 #+findex: org-babel-goto-named-result
  18692 #+findex: org-babel-execute-buffer
  18693 #+findex: org-babel-execute-subtree
  18694 #+findex: org-babel-demarcate-block
  18695 #+findex: org-babel-tangle
  18696 #+findex: org-babel-tangle-file
  18697 #+findex: org-babel-check-src-block
  18698 #+findex: org-babel-insert-header-arg
  18699 #+findex: org-babel-load-in-session
  18700 #+findex: org-babel-lob-ingest
  18701 #+findex: org-babel-view-src-block-info
  18702 #+findex: org-babel-switch-to-session-with-code
  18703 #+findex: org-babel-sha1-hash
  18704 #+findex: org-babel-describe-bindings
  18705 #+findex: org-babel-do-key-sequence-in-edit-buffer
  18706 #+attr_texinfo: :columns 0.45 0.55
  18707 | Key binding                                    | Function                                   |
  18708 |------------------------------------------------+--------------------------------------------|
  18709 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~             |
  18710 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~                 |
  18711 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~                  |
  18712 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~          |
  18713 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~               |
  18714 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~            |
  18715 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~           |
  18716 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~              |
  18717 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~                 |
  18718 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~                |
  18719 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~                |
  18720 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~                         |
  18721 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~                    |
  18722 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~                |
  18723 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~              |
  18724 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~                |
  18725 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~                     |
  18726 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~            |
  18727 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~    |
  18728 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~                      |
  18729 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~              |
  18730 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
  18731 
  18732 ** Batch Execution
  18733 :PROPERTIES:
  18734 :DESCRIPTION: Call functions from the command line.
  18735 :END:
  18736 #+cindex: code block, batch execution
  18737 #+cindex: source code, batch execution
  18738 
  18739 Org mode features, including working with source code facilities can
  18740 be invoked from the command line.  This enables building shell scripts
  18741 for batch processing, running automated system tasks, and expanding
  18742 Org mode's usefulness.
  18743 
  18744 The sample script shows batch processing of multiple files using
  18745 ~org-babel-tangle~.
  18746 
  18747 #+begin_example
  18748 #!/bin/sh
  18749 # Tangle files with Org mode
  18750 #
  18751 emacs -Q --batch --eval "
  18752     (progn
  18753       (require 'ob-tangle)
  18754       (dolist (file command-line-args-left)
  18755         (with-current-buffer (find-file-noselect file)
  18756           (org-babel-tangle))))
  18757   " "$@"
  18758 #+end_example
  18759 
  18760 * Miscellaneous
  18761 :PROPERTIES:
  18762 :DESCRIPTION: All the rest which did not fit elsewhere.
  18763 :END:
  18764 
  18765 ** Completion
  18766 :PROPERTIES:
  18767 :DESCRIPTION: @kbd{M-@key{TAB}} guesses completions.
  18768 :END:
  18769 #+cindex: completion, of @TeX{} symbols
  18770 #+cindex: completion, of TODO keywords
  18771 #+cindex: completion, of dictionary words
  18772 #+cindex: completion, of option keywords
  18773 #+cindex: completion, of tags
  18774 #+cindex: completion, of property keys
  18775 #+cindex: completion, of link abbreviations
  18776 #+cindex: @TeX{} symbol completion
  18777 #+cindex: TODO keywords completion
  18778 #+cindex: dictionary word completion
  18779 #+cindex: option keyword completion
  18780 #+cindex: tag completion
  18781 #+cindex: link abbreviations, completion of
  18782 
  18783 Org has in-buffer completions.  Unlike minibuffer completions, which
  18784 are useful for quick command interactions, Org's in-buffer completions
  18785 are more suitable for content creation in Org documents.  Type one or
  18786 more letters and invoke the hot key to complete the text in-place.
  18787 Depending on the context and the keys, Org offers different types of
  18788 completions.  No minibuffer is involved.  Such mode-specific hot keys
  18789 have become an integral part of Emacs and Org provides several
  18790 shortcuts.
  18791 
  18792 - {{{kbd(M-TAB)}}} ::
  18793   #+kindex: M-TAB
  18794 
  18795   Complete word at point.
  18796 
  18797   - At the beginning of an empty headline, complete TODO keywords.
  18798 
  18799   - After =\=, complete TeX symbols supported by the exporter.
  18800 
  18801   - After =:= in a headline, complete tags.  Org deduces the list of
  18802     tags from the =TAGS= in-buffer option (see [[*Setting Tags]]), the
  18803     variable ~org-tag-alist~, or from all tags used in the current
  18804     buffer.
  18805 
  18806   - After =:= and not in a headline, complete property keys.  The list
  18807     of keys is constructed dynamically from all keys used in the
  18808     current buffer.
  18809 
  18810   - After =[[=, complete link abbreviations (see [[*Link Abbreviations]]).
  18811 
  18812   - After =[[*=, complete headlines in the current buffer so that they
  18813     can be used in search links like: =[[*find this headline]]=
  18814 
  18815   - After =#+=, complete the special keywords like =TYP_TODO= or
  18816     file-specific =OPTIONS=.  After option keyword is complete,
  18817     pressing {{{kbd(M-TAB)}}} again inserts example settings for this
  18818     keyword.
  18819 
  18820   - After =STARTUP= keyword, complete startup items.
  18821 
  18822   - When point is anywhere else, complete dictionary words using
  18823     Ispell.
  18824 
  18825 ** Structure Templates
  18826 :PROPERTIES:
  18827 :DESCRIPTION: Quick insertion of structural elements.
  18828 :END:
  18829 #+cindex: template insertion
  18830 #+cindex: insertion, of templates
  18831 
  18832 With just a few keystrokes, it is possible to insert empty structural
  18833 blocks, such as =#+BEGIN_SRC= ... =#+END_SRC=, or to wrap existing
  18834 text in such a block.
  18835 
  18836 - {{{kbd(C-c C-\,)}}} (~org-insert-structure-template~) ::
  18837 
  18838   #+findex: org-insert-structure-template
  18839   #+kindex: C-c C-,
  18840   Prompt for a type of block structure, and insert the block at point.
  18841   If the region is active, it is wrapped in the block.  First prompts
  18842   the user for keys, which are used to look up a structure type from
  18843   the variable below.  If the key is {{{kbd(TAB)}}}, {{{kbd(RET)}}},
  18844   or {{{kbd(SPC)}}}, the user is prompted to enter a block type.
  18845 
  18846 #+vindex: org-structure-template-alist
  18847 Available structure types are defined in
  18848 ~org-structure-template-alist~, see the docstring for adding or
  18849 changing values.
  18850 
  18851 #+cindex: Tempo
  18852 #+cindex: template expansion
  18853 #+cindex: insertion, of templates
  18854 #+vindex: org-tempo-keywords-alist
  18855 Org Tempo expands snippets to structures defined in
  18856 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~.  For
  18857 example, {{{kbd(< s TAB)}}} creates a code block.  Enable it by
  18858 customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs
  18859 init file[fn:145].
  18860 
  18861 #+attr_texinfo: :columns 0.1 0.9
  18862 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
  18863 | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER=       |
  18864 | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT=     |
  18865 | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE=     |
  18866 | {{{kbd(E)}}} | =#+BEGIN_EXPORT= ... =#+END_EXPORT=       |
  18867 | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT=  |
  18868 | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= |
  18869 | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE=         |
  18870 | {{{kbd(s)}}} | =#+BEGIN_SRC= ... =#+END_SRC=             |
  18871 | {{{kbd(v)}}} | =#+BEGIN_VERSE= ... =#+END_VERSE=         |
  18872 
  18873 ** Speed Keys
  18874 :PROPERTIES:
  18875 :DESCRIPTION: Electric commands at the beginning of a headline.
  18876 :END:
  18877 #+cindex: speed keys
  18878 
  18879 Single keystrokes can execute custom commands in an Org file when
  18880 point is on a headline.  Without the extra burden of a meta or
  18881 modifier key, Speed Keys can speed navigation or execute custom
  18882 commands.  Besides faster navigation, Speed Keys may come in handy on
  18883 small mobile devices that do not have full keyboards.  Speed Keys may
  18884 also work on TTY devices known for their problems when entering Emacs
  18885 key chords.
  18886 
  18887 #+vindex: org-use-speed-commands
  18888 By default, Org has Speed Keys disabled.  To activate Speed Keys, set
  18889 the variable ~org-use-speed-commands~ to a non-~nil~ value.  To
  18890 trigger a Speed Key, point must be at the beginning of an Org
  18891 headline, before any of the stars.
  18892 
  18893 #+vindex: org-speed-commands
  18894 #+findex: org-speed-command-help
  18895 Org comes with a pre-defined list of Speed Keys.  To add or modify
  18896 Speed Keys, customize the option ~org-speed-commands~.  For more
  18897 details, see the variable's docstring.  With Speed Keys activated,
  18898 {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when point is at the
  18899 beginning of an Org headline, shows currently active Speed Keys,
  18900 including the user-defined ones.
  18901 
  18902 ** A Cleaner Outline View
  18903 :PROPERTIES:
  18904 :DESCRIPTION: Getting rid of leading stars in the outline.
  18905 :ALT_TITLE: Clean View
  18906 :END:
  18907 #+cindex: hiding leading stars
  18908 #+cindex: dynamic indentation
  18909 #+cindex: odd-levels-only outlines
  18910 #+cindex: clean outline view
  18911 
  18912 Org's outline with stars and no indents can look cluttered for short
  18913 documents.  For /book-like/ long documents, the effect is not as
  18914 noticeable.  Org provides an alternate stars and indentation scheme,
  18915 as shown on the right in the following table.  It displays only one
  18916 star and indents text to line up with the heading:
  18917 
  18918 #+begin_example
  18919 ,* Top level headline             |    * Top level headline
  18920 ,** Second level                  |      * Second level
  18921 ,*** Third level                  |        * Third level
  18922 some text                        |          some text
  18923 ,*** Third level                  |        * Third level
  18924 more text                        |          more text
  18925 ,* Another top level headline     |    * Another top level headline
  18926 #+end_example
  18927 
  18928 Org can achieve this in two ways, (1) by just displaying the buffer in
  18929 this way without changing it, or (2) by actually indenting every line
  18930 in the desired amount with hard spaces and hiding leading stars.
  18931 
  18932 *** Org Indent Mode
  18933 
  18934 #+cindex: Indent mode
  18935 #+findex: org-indent-mode
  18936 To display the buffer in the indented view, activate Org Indent minor
  18937 mode, using {{{kbd(M-x org-indent-mode)}}}.  Text lines that are not
  18938 headlines are prefixed with virtual spaces to vertically align with
  18939 the headline text[fn:146].
  18940 
  18941 #+vindex: org-indent-indentation-per-level
  18942 To make more horizontal space, the headlines are shifted by two
  18943 characters.  Configure ~org-indent-indentation-per-level~ variable for
  18944 a different number.
  18945 
  18946 #+vindex: org-indent-mode-turns-on-hiding-stars
  18947 #+vindex: org-indent-mode-turns-off-org-adapt-indentation
  18948 By default, Org Indent mode turns off ~org-adapt-indentation~ and does
  18949 hide leading stars by locally setting ~org-hide-leading-stars~ to ~t~:
  18950 only one star on each headline is visible, the rest are masked with
  18951 the same font color as the background.  If you want to customize this
  18952 default behavior, see ~org-indent-mode-turns-on-hiding-stars~ and
  18953 ~org-indent-mode-turns-off-org-adapt-indentation~.
  18954 
  18955 #+vindex: org-startup-indented
  18956 To globally turn on Org Indent mode for all files, customize the
  18957 variable ~org-startup-indented~.  To control it for individual files,
  18958 use =STARTUP= keyword as follows:
  18959 
  18960 : #+STARTUP: indent
  18961 : #+STARTUP: noindent
  18962 
  18963 *** Hard indentation
  18964 
  18965 It is possible to use hard spaces to achieve the indentation instead,
  18966 if the bare ASCII file should have the indented look also outside
  18967 Emacs[fn:147].  With Org's support, you have to indent all lines to
  18968 line up with the outline headers.  You would use these
  18969 settings[fn:148]:
  18970 
  18971 #+begin_src emacs-lisp
  18972 (setq org-adapt-indentation t
  18973       org-hide-leading-stars t
  18974       org-odd-levels-only t)
  18975 #+end_src
  18976 
  18977 - /Indentation of text below headlines/ (~org-adapt-indentation~) ::
  18978 
  18979   #+vindex: org-adapt-indentation
  18980   The first setting modifies paragraph filling, line wrapping, and
  18981   structure editing commands to preserving or adapting the indentation
  18982   as appropriate.
  18983 
  18984 - /Hiding leading stars/ (~org-hide-leading-stars~) ::
  18985 
  18986   #+vindex: org-hide-leading-stars
  18987   #+vindex: org-hide, face
  18988   The second setting makes leading stars invisible by applying the
  18989   face ~org-hide~ to them.  For per-file preference, use these file
  18990   =STARTUP= options:
  18991 
  18992   #+begin_example
  18993   ,#+STARTUP: hidestars
  18994   ,#+STARTUP: showstars
  18995   #+end_example
  18996 
  18997 - /Odd levels/ (~org-odd-levels-only~) ::
  18998 
  18999   #+vindex: org-odd-levels-only
  19000   The third setting makes Org use only odd levels, 1, 3, 5, ..., in
  19001   the outline to create more indentation.  On a per-file level,
  19002   control this with:
  19003 
  19004   #+begin_example
  19005   ,#+STARTUP: odd
  19006   ,#+STARTUP: oddeven
  19007   #+end_example
  19008 
  19009   To convert a file between single and double stars layouts, use
  19010   {{{kbd(M-x org-convert-to-odd-levels)}}} and {{{kbd(M-x
  19011   org-convert-to-oddeven-levels)}}}.
  19012 
  19013 ** Execute commands in the active region
  19014 :PROPERTIES:
  19015 :DESCRIPTION: Execute commands on multiple items in Org or agenda view.
  19016 :END:
  19017 
  19018 #+vindex: org-loop-over-headlines-in-active-region
  19019 When in an Org buffer and the region is active, some commands will
  19020 apply to all the subtrees in the active region.  For example, hitting
  19021 {{{kbd(C-c C-s)}}} when multiple headlines are within the active region will
  19022 successively prompt you for a new schedule date and time.  To disable
  19023 this, set the option ~org-loop-over-headlines-in-active-region~ to
  19024 non-~t~, activate the region and run the command normally.
  19025 
  19026 #+vindex: org-agenda-loop-over-headlines-in-active-region
  19027 ~org-agenda-loop-over-headlines-in-active-region~ is the equivalent
  19028 option of the agenda buffer, where you can also use [[*Bulk remote editing selected entries][bulk editing of
  19029 selected entries]].
  19030 
  19031 Not all commands can loop in the active region and what subtrees or
  19032 headlines are considered can be refined: see the docstrings of these
  19033 options for more details.
  19034 
  19035 ** Dynamic Headline Numbering
  19036 :PROPERTIES:
  19037 :DESCRIPTION: Display and update outline numbering.
  19038 :END:
  19039 
  19040 #+cindex: Org Num mode
  19041 #+cindex: number headlines
  19042 The Org Num minor mode, toggled with {{{kbd(M-x org-num-mode)}}},
  19043 displays outline numbering on top of headlines.  It also updates it
  19044 automatically upon changes to the structure of the document.
  19045 
  19046 #+vindex: org-num-max-level
  19047 #+vindex: org-num-skip-tags
  19048 #+vindex: org-num-skip-commented
  19049 #+vindex: org-num-skip-unnumbered
  19050 By default, all headlines are numbered.  You can limit numbering to
  19051 specific headlines according to their level, tags, =COMMENT= keyword,
  19052 or =UNNUMBERED= property.  Set ~org-num-max-level~,
  19053 ~org-num-skip-tags~, ~org-num-skip-commented~,
  19054 ~org-num-skip-unnumbered~, or ~org-num-skip-footnotes~ accordingly.
  19055 
  19056 #+vindex: org-num-skip-footnotes
  19057 If ~org-num-skip-footnotes~ is non-~nil~, footnotes sections (see
  19058 [[*Creating Footnotes]]) are not numbered either.
  19059 
  19060 #+vindex: org-num-face
  19061 #+vindex: org-num-format-function
  19062 You can control how the numbering is displayed by setting
  19063 ~org-num-face~ and ~org-num-format-function~.
  19064 
  19065 #+vindex: org-startup-numerated
  19066 You can also turn this mode globally for all Org files by setting the
  19067 option ~org-startup-numerated~ to =t=, or locally on a file by using
  19068 =#+startup: num=.
  19069 
  19070 ** The Very Busy {{{kbd(C-c C-c)}}} Key
  19071 :PROPERTIES:
  19072 :DESCRIPTION: When in doubt, press @kbd{C-c C-c}.
  19073 :END:
  19074 #+kindex: C-c C-c
  19075 #+cindex: @kbd{C-c C-c}, overview
  19076 
  19077 The {{{kbd(C-c C-c)}}} key in Org serves many purposes depending on
  19078 the context.  It is probably the most over-worked, multi-purpose key
  19079 combination in Org.  Its uses are well documented throughout this
  19080 manual, but here is a consolidated list for easy reference.
  19081 
  19082 - If column view (see [[*Column View]]) is on, exit column view.
  19083 
  19084 - If any highlights shown in the buffer from the creation of a sparse
  19085   tree, or from clock display, remove such highlights.
  19086 
  19087 - If point is in one of the special =KEYWORD= lines, scan the buffer
  19088   for these lines and update the information.  Also reset the Org file
  19089   cache used to temporary store the contents of URLs used as values
  19090   for keywords like =SETUPFILE=.
  19091 
  19092 - If point is inside a table, realign the table.
  19093 
  19094 - If point is on a =TBLFM= keyword, re-apply the formulas to the
  19095   entire table.
  19096 
  19097 - If the current buffer is a capture buffer, close the note and file
  19098   it.  With a prefix argument, also jump to the target location after
  19099   saving the note.
  19100 
  19101 - If point is on a =<<<target>>>=, update radio targets and
  19102   corresponding links in this buffer.
  19103 
  19104 - If point is on a property line or at the start or end of a property
  19105   drawer, offer property commands.
  19106 
  19107 - If point is at a footnote reference, go to the corresponding
  19108   definition, and /vice versa/.
  19109 
  19110 - If point is on a statistics cookie, update it.
  19111 
  19112 - If point is in a plain list item with a checkbox, toggle the status
  19113   of the checkbox.
  19114 
  19115 - If point is on a numbered item in a plain list, renumber the ordered
  19116   list.
  19117 
  19118 - If point is on the =#+BEGIN= line of a dynamic block, the block is
  19119   updated.
  19120 
  19121 - If point is at a timestamp, fix the day name in the timestamp.
  19122 
  19123 ** Summary of In-Buffer Settings
  19124 :PROPERTIES:
  19125 :DESCRIPTION: Overview of keywords.
  19126 :ALT_TITLE: In-buffer Settings
  19127 :END:
  19128 #+cindex: in-buffer settings
  19129 #+cindex: special keywords
  19130 
  19131 In-buffer settings start with =#+=, followed by a keyword, a colon,
  19132 and then a word for each setting.  Org accepts multiple settings on
  19133 the same line.  Org also accepts multiple lines for a keyword.  This
  19134 manual describes these settings throughout.  A summary follows here.
  19135 
  19136 #+cindex: refresh set-up
  19137 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
  19138 Closing and reopening the Org file in Emacs also activates the
  19139 changes.
  19140 
  19141 #+attr_texinfo: :sep ,
  19142 - =#+ARCHIVE: %s_done::= ::
  19143 
  19144   #+cindex: @samp{ARCHIVE}, keyword
  19145   #+vindex: org-archive-location
  19146   Sets the archive location of the agenda file.  The corresponding
  19147   variable is ~org-archive-location~.
  19148 
  19149 - =#+CATEGORY= ::
  19150 
  19151   #+cindex: @samp{CATEGORY}, keyword
  19152   Sets the category of the agenda file, which applies to the entire
  19153   document.
  19154 
  19155 - =#+COLUMNS: %25ITEM ...= ::
  19156 
  19157   #+cindex: @samp{COLUMNS}, property
  19158   Set the default format for columns view.  This format applies when
  19159   columns view is invoked in locations where no =COLUMNS= property
  19160   applies.
  19161 
  19162 - =#+CONSTANTS: name1=value1 ...= ::
  19163 
  19164   #+cindex: @samp{CONSTANTS}, keyword
  19165   #+vindex: org-table-formula-constants
  19166   #+vindex: org-table-formula
  19167   Set file-local values for constants that table formulas can use.
  19168   This line sets the local variable
  19169   ~org-table-formula-constants-local~.  The global version of this
  19170   variable is ~org-table-formula-constants~.
  19171 
  19172 - =#+FILETAGS: :tag1:tag2:tag3:= ::
  19173 
  19174   #+cindex: @samp{FILETAGS}, keyword
  19175   Set tags that all entries in the file inherit from, including the
  19176   top-level entries.
  19177 
  19178 - =#+LINK: linkword replace= ::
  19179 
  19180   #+cindex: @samp{LINK}, keyword
  19181   #+vindex: org-link-abbrev-alist
  19182   Each line specifies one abbreviation for one link.  Use multiple
  19183   =LINK= keywords for more, see [[*Link Abbreviations]].  The
  19184   corresponding variable is ~org-link-abbrev-alist~.
  19185 
  19186 - =#+PRIORITIES: highest lowest default= ::
  19187 
  19188   #+cindex: @samp{PRIORITIES}, keyword
  19189   #+vindex: org-priority-highest
  19190   #+vindex: org-priority-lowest
  19191   #+vindex: org-priority-default
  19192   This line sets the limits and the default for the priorities.  All
  19193   three must be either letters A--Z or numbers 0--9.  The highest
  19194   priority must have a lower ASCII number than the lowest priority.
  19195 
  19196 - =#+PROPERTY: Property_Name Value= ::
  19197 
  19198   #+cindex: @samp{PROPERTY}, keyword
  19199   This line sets a default inheritance value for entries in the
  19200   current buffer, most useful for specifying the allowed values of
  19201   a property.
  19202 
  19203 - =#+SETUPFILE: file= ::
  19204 
  19205   #+cindex: @samp{SETUPFILE}, keyword
  19206   The setup file or a URL pointing to such file is for additional
  19207   in-buffer settings.  Org loads this file and parses it for any
  19208   settings in it only when Org opens the main file.  If URL is
  19209   specified, the contents are downloaded and stored in a temporary
  19210   file cache.  {{{kbd(C-c C-c)}}} on the settings line parses and
  19211   loads the file, and also resets the temporary file cache.  Org also
  19212   parses and loads the document during normal exporting process.  Org
  19213   parses the contents of this document as if it was included in the
  19214   buffer.  It can be another Org file.  To visit the file---not
  19215   a URL---use {{{kbd(C-c ')}}} while point is on the line with the
  19216   file name.
  19217 
  19218 - =#+STARTUP:= ::
  19219 
  19220   #+cindex: @samp{STARTUP}, keyword
  19221   Startup options Org uses when first visiting a file.
  19222 
  19223   #+vindex: org-startup-folded
  19224   The first set of options deals with the initial visibility of the
  19225   outline tree.  The corresponding variable for global default
  19226   settings is ~org-startup-folded~ with a default value of
  19227   ~showeverything~.
  19228 
  19229   | =overview=       | Top-level headlines only.  |
  19230   | =content=        | All headlines.             |
  19231   | =showall=        | No folding on any entry.   |
  19232   | =show2levels=    | Headline levels 1-2.       |
  19233   | =show3levels=    | Headline levels 1-3.       |
  19234   | =show4levels=    | Headline levels 1-4.       |
  19235   | =show5levels=    | Headline levels 1-5.       |
  19236   | =showeverything= | Show even drawer contents. |
  19237 
  19238   #+vindex: org-startup-indented
  19239   Dynamic virtual indentation is controlled by the variable
  19240   ~org-startup-indented~[fn:149].
  19241 
  19242   | =indent=   | Start with Org Indent mode turned on.  |
  19243   | =noindent= | Start with Org Indent mode turned off. |
  19244 
  19245   #+vindex: org-startup-numerated
  19246   Dynamic virtual numeration of headlines is controlled by the variable
  19247   ~org-startup-numerated~.
  19248 
  19249   | =num=   | Start with Org num mode turned on.  |
  19250   | =nonum= | Start with Org num mode turned off. |
  19251 
  19252   #+vindex: org-startup-align-all-tables
  19253   Aligns tables consistently upon visiting a file.  The
  19254   corresponding variable is ~org-startup-align-all-tables~ with
  19255   ~nil~ as default value.
  19256 
  19257   | =align=   | Align all tables.               |
  19258   | =noalign= | Do not align tables on startup. |
  19259 
  19260   #+vindex: org-startup-shrink-all-tables
  19261   Shrink table columns with a width cookie.  The corresponding
  19262   variable is ~org-startup-shrink-all-tables~ with ~nil~ as
  19263   default value.
  19264 
  19265   #+vindex: org-startup-with-inline-images
  19266   When visiting a file, inline images can be automatically
  19267   displayed.  The corresponding variable is
  19268   ~org-startup-with-inline-images~, with a default value ~nil~ to
  19269   avoid delays when visiting a file.
  19270 
  19271   | =inlineimages=   | Show inline images.                   |
  19272   | =noinlineimages= | Do not show inline images on startup. |
  19273 
  19274   #+vindex: org-log-done
  19275   #+vindex: org-log-note-clock-out
  19276   #+vindex: org-log-repeat
  19277   Logging the closing and reopening of TODO items and clock
  19278   intervals can be configured using these options (see variables
  19279   ~org-log-done~, ~org-log-note-clock-out~, and ~org-log-repeat~).
  19280 
  19281   | =logdone=            | Record a timestamp when an item is marked as done. |
  19282   | =lognotedone=        | Record timestamp and a note when DONE.             |
  19283   | =nologdone=          | Do not record when items are marked as done.       |
  19284   | =logrepeat=          | Record a time when reinstating a repeating item.   |
  19285   | =lognoterepeat=      | Record a note when reinstating a repeating item.   |
  19286   | =nologrepeat=        | Do not record when reinstating repeating item.     |
  19287   | =lognoteclock-out=   | Record a note when clocking out.                   |
  19288   | =nolognoteclock-out= | Do not record a note when clocking out.            |
  19289   | =logreschedule=      | Record a timestamp when scheduling time changes.   |
  19290   | =lognotereschedule=  | Record a note when scheduling time changes.        |
  19291   | =nologreschedule=    | Do not record when a scheduling date changes.      |
  19292   | =logredeadline=      | Record a timestamp when deadline changes.          |
  19293   | =lognoteredeadline=  | Record a note when deadline changes.               |
  19294   | =nologredeadline=    | Do not record when a deadline date changes.        |
  19295   | =logrefile=          | Record a timestamp when refiling.                  |
  19296   | =lognoterefile=      | Record a note when refiling.                       |
  19297   | =nologrefile=        | Do not record when refiling.                       |
  19298 
  19299   #+vindex: org-hide-leading-stars
  19300   #+vindex: org-odd-levels-only
  19301   Here are the options for hiding leading stars in outline
  19302   headings, and for indenting outlines.  The corresponding
  19303   variables are ~org-hide-leading-stars~ and
  19304   ~org-odd-levels-only~, both with a default setting ~nil~
  19305   (meaning =showstars= and =oddeven=).
  19306 
  19307   | =hidestars= | Make all but one of the stars starting a headline invisible. |
  19308   | =showstars= | Show all stars starting a headline.                          |
  19309   | =indent=    | Virtual indentation according to outline level.              |
  19310   | =noindent=  | No virtual indentation according to outline level.           |
  19311   | =odd=       | Allow only odd outline levels (1, 3, ...).                   |
  19312   | =oddeven=   | Allow all outline levels.                                    |
  19313 
  19314   #+vindex: org-put-time-stamp-overlays
  19315   #+vindex: org-time-stamp-overlay-formats
  19316   To turn on custom format overlays over timestamps (variables
  19317   ~org-put-time-stamp-overlays~ and
  19318   ~org-time-stamp-overlay-formats~), use:
  19319 
  19320   | =customtime= | Overlay custom time format. |
  19321 
  19322   #+vindex: constants-unit-system
  19323   The following options influence the table spreadsheet (variable
  19324   ~constants-unit-system~).
  19325 
  19326   | =constcgs= | =constants.el= should use the c-g-s unit system. |
  19327   | =constSI=  | =constants.el= should use the SI unit system.    |
  19328 
  19329   #+vindex: org-footnote-define-inline
  19330   #+vindex: org-footnote-auto-label
  19331   #+vindex: org-footnote-auto-adjust
  19332   To influence footnote settings, use the following keywords.  The
  19333   corresponding variables are ~org-footnote-define-inline~,
  19334   ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
  19335 
  19336   | =fninline=   | Define footnotes inline.                               |
  19337   | =fnnoinline= | Define footnotes in separate section.                  |
  19338   | =fnlocal=    | Define footnotes near first reference, but not inline. |
  19339   | =fnprompt=   | Prompt for footnote labels.                            |
  19340   | =fnauto=     | Create =[fn:1]=-like labels automatically (default).   |
  19341   | =fnconfirm=  | Offer automatic label for editing or confirmation.     |
  19342   | =fnadjust=   | Automatically renumber and sort footnotes.             |
  19343   | =nofnadjust= | Do not renumber and sort automatically.                |
  19344 
  19345   #+vindex: org-hide-block-startup
  19346   To hide blocks on startup, use these keywords.  The
  19347   corresponding variable is ~org-hide-block-startup~.
  19348 
  19349   | =hideblocks=   | Hide all begin/end blocks on startup. |
  19350   | =nohideblocks= | Do not hide blocks on startup.        |
  19351 
  19352   #+vindex: org-pretty-entities
  19353   The display of entities as UTF-8 characters is governed by the
  19354   variable ~org-pretty-entities~ and the keywords
  19355 
  19356   | =entitiespretty= | Show entities as UTF-8 characters where possible. |
  19357   | =entitiesplain=  | Leave entities plain.                             |
  19358 
  19359 - =#+TAGS: TAG1(c1) TAG2(c2)= ::
  19360 
  19361   #+cindex: @samp{TAGS}, keyword
  19362   #+vindex: org-tag-alist
  19363   These lines (several such lines are allowed) specify the valid tags
  19364   in this file, and (potentially) the corresponding /fast tag
  19365   selection/ keys.  The corresponding variable is ~org-tag-alist~.
  19366 
  19367 - =#+TODO:=, =#+SEQ_TODO:=, =#+TYP_TODO:= ::
  19368 
  19369   #+cindex: @samp{SEQ_TODO}, keyword
  19370   #+cindex: @samp{TODO}, keyword
  19371   #+cindex: @samp{TYP_TODO}, keyword
  19372   #+vindex: org-todo-keywords
  19373   These lines set the TODO keywords and their interpretation in the
  19374   current file.  The corresponding variable is ~org-todo-keywords~.
  19375 
  19376 ** Regular Expressions
  19377 :PROPERTIES:
  19378 :DESCRIPTION: Elisp regular expressions.
  19379 :END:
  19380 #+cindex: regular expressions syntax
  19381 #+cindex: regular expressions, in searches
  19382 
  19383 Org, as an Emacs mode, makes use of Elisp regular expressions for
  19384 searching, matching and filtering.  Elisp regular expressions have a
  19385 somewhat different syntax then some common standards.  Most notably,
  19386 alternation is indicated using =\|= and matching groups are denoted by
  19387 =\(...\)=.  For example the string =home\|work= matches either =home=
  19388 or =work=.
  19389 
  19390 For more information, see [[info:emacs::Regexps][Regular Expressions in Emacs]].
  19391 
  19392 ** Org Syntax
  19393 :PROPERTIES:
  19394 :DESCRIPTION: Formal description of Org's syntax.
  19395 :END:
  19396 
  19397 A reference document providing a formal description of Org's syntax is
  19398 available as [[https://orgmode.org/worg/dev/org-syntax.html][a draft on Worg]], written and maintained by Nicolas
  19399 Goaziou.  It defines Org's core internal concepts such as "headlines",
  19400 "sections", "affiliated keywords", "(greater) elements" and "objects".
  19401 Each part of an Org document belongs to one of the previous
  19402 categories.
  19403 
  19404 To explore the abstract structure of an Org buffer, run this in
  19405 a buffer:
  19406 
  19407 : M-: (org-element-parse-buffer) <RET>
  19408 
  19409 #+texinfo: @noindent
  19410 It outputs a list containing the buffer's content represented as an
  19411 abstract structure.  The export engine relies on the information
  19412 stored in this list.  Most interactive commands---e.g., for structure
  19413 editing---also rely on the syntactic meaning of the surrounding
  19414 context.
  19415 
  19416 #+cindex: syntax checker
  19417 #+cindex: linter
  19418 #+findex: org-lint
  19419 You can probe the syntax of your documents with the command
  19420 
  19421 : M-x org-lint <RET>
  19422 
  19423 #+texinfo: @noindent
  19424 It runs a number of checks to find common mistakes.  It then displays
  19425 their location in a dedicated buffer, along with a description and
  19426 a "trust level", since false-positive are possible.  From there, you
  19427 can operate on the reports with the following keys:
  19428 
  19429 #+attr_texinfo: :columns 0.22 0.78
  19430 | {{{kbd(C-j)}}}, {{{kbd(TAB)}}} | Display the offending line                  |
  19431 | {{{kbd(RET)}}}                 | Move point to the offending line            |
  19432 | {{{kbd(g)}}}                   | Check the document again                    |
  19433 | {{{kbd(h)}}}                   | Hide all reports from the same checker      |
  19434 | {{{kbd(i)}}}                   | Also remove them from all subsequent checks |
  19435 | {{{kbd(S)}}}                   | Sort reports by the column at point         |
  19436 
  19437 ** Context Dependent Documentation
  19438 :PROPERTIES:
  19439 :DESCRIPTION: Read documentation about current syntax.
  19440 :ALT_TITLE: Documentation Access
  19441 :END:
  19442 #+cindex: documentation
  19443 #+cindex: Info
  19444 
  19445 #+findex: org-info-find-node
  19446 #+kindex: C-c C-x I
  19447 {{{kbd(C-c C-x I)}}} in an Org file tries to open a suitable section
  19448 of the Org manual depending on the syntax at point.  For example,
  19449 using it on a headline displays "Document Structure" section.
  19450 
  19451 {{{kbd(q)}}} closes the Info window.
  19452 
  19453 ** Escape Character
  19454 :PROPERTIES:
  19455 :DESCRIPTION: Prevent Org from interpreting your writing.
  19456 :END:
  19457 
  19458 #+cindex: escape character
  19459 #+cindex: zero width space
  19460 You may sometimes want to write text that looks like Org syntax, but
  19461 should really read as plain text.  Org may use a specific escape
  19462 character in some situations, i.e., a backslash in macros (see [[*Macro
  19463 Replacement]]) and links (see [[*Link Format]]), or a comma in source and
  19464 example blocks (see [[*Literal Examples]]).  In the general case, however,
  19465 we suggest to use the zero width space.  You can insert one with any
  19466 of the following:
  19467 
  19468 : C-x 8 <RET> zero width space <RET>
  19469 : C-x 8 <RET> 200B <RET>
  19470 
  19471 For example, in order to write =[[1,2]]= as-is in your document, you
  19472 may write instead
  19473 
  19474 : [X[1,2]]
  19475 
  19476 where =X= denotes the zero width space character.
  19477 
  19478 ** Code Evaluation and Security Issues
  19479 :PROPERTIES:
  19480 :DESCRIPTION: Org files evaluate in-line code.
  19481 :ALT_TITLE: Code Evaluation Security
  19482 :END:
  19483 
  19484 Unlike plain text, running code comes with risk.  Each source code
  19485 block, in terms of risk, is equivalent to an executable file.  Org
  19486 therefore puts a few confirmation prompts by default.  This is to
  19487 alert the casual user from accidentally running untrusted code.
  19488 
  19489 For users who do not run code blocks or write code regularly, Org's
  19490 default settings should suffice.  However, some users may want to
  19491 tweak the prompts for fewer interruptions.  To weigh the risks of
  19492 automatic execution of code blocks, here are some details about code
  19493 evaluation.
  19494 
  19495 Org evaluates code in the following circumstances:
  19496 
  19497 - /Source code blocks/ ::
  19498 
  19499   Org evaluates source code blocks in an Org file during export.  Org
  19500   also evaluates a source code block with the {{{kbd(C-c C-c)}}} key
  19501   chord.  Users exporting or running code blocks must load files only
  19502   from trusted sources.  Be wary of customizing variables that remove
  19503   or alter default security measures.
  19504 
  19505   #+attr_texinfo: :options org-confirm-babel-evaluate
  19506   #+begin_defopt
  19507   When ~t~, Org prompts the user for confirmation before executing
  19508   each code block.  When ~nil~, Org executes code blocks without
  19509   prompting the user for confirmation.  When this option is set to
  19510   a custom function, Org invokes the function with these two
  19511   arguments: the source code language and the body of the code block.
  19512   The custom function must return either a ~t~ or ~nil~, which
  19513   determines if the user is prompted.  Each source code language can
  19514   be handled separately through this function argument.
  19515   #+end_defopt
  19516 
  19517   For example, here is how to execute ditaa code blocks without
  19518   prompting:
  19519 
  19520   #+begin_src emacs-lisp
  19521   (defun my-org-confirm-babel-evaluate (lang body)
  19522     (not (string= lang "ditaa")))  ;don't ask for ditaa
  19523   (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  19524   #+end_src
  19525 
  19526 - /Following =shell= and =elisp= links/ ::
  19527 
  19528   Org has two link types that can directly evaluate code (see
  19529   [[*External Links]]).  Because such code is not visible, these links
  19530   have a potential risk.  Org therefore prompts the user when it
  19531   encounters such links.  The customization variables are:
  19532 
  19533   #+attr_texinfo: :options org-link-shell-confirm-function
  19534   #+begin_defopt
  19535   Function that prompts the user before executing a shell link.
  19536   #+end_defopt
  19537 
  19538   #+attr_texinfo: :options org-link-elisp-confirm-function
  19539   #+begin_defopt
  19540   Function that prompts the user before executing an Emacs Lisp link.
  19541   #+end_defopt
  19542 
  19543 - /Formulas in tables/ ::
  19544 
  19545   Formulas in tables (see [[*The Spreadsheet]]) are code that is evaluated
  19546   either by the Calc interpreter, or by the Emacs Lisp interpreter.
  19547 
  19548 ** Interaction with Other Packages
  19549 :PROPERTIES:
  19550 :DESCRIPTION: With other Emacs packages.
  19551 :ALT_TITLE: Interaction
  19552 :END:
  19553 #+cindex: packages, interaction with other
  19554 
  19555 Org's compatibility and the level of interaction with other Emacs
  19556 packages are documented here.
  19557 
  19558 *** Packages that Org cooperates with
  19559 :PROPERTIES:
  19560 :DESCRIPTION: Packages Org cooperates with.
  19561 :ALT_TITLE: Cooperation
  19562 :END:
  19563 
  19564 - =calc.el= by Dave Gillespie ::
  19565   #+cindex: @file{calc.el}
  19566 
  19567   Org uses the Calc package for implementing spreadsheet functionality
  19568   in its tables (see [[*The Spreadsheet]]).  Org also uses Calc for
  19569   embedded calculations.  See [[info:calc::Embedded Mode][GNU Emacs Calc Manual]].
  19570 
  19571 - =constants.el= by Carsten Dominik ::
  19572   #+cindex: @file{constants.el}
  19573   #+vindex: org-table-formula-constants
  19574 
  19575   Org can use names for constants in formulas in tables.  Org can also
  19576   use calculation suffixes for units, such as =M= for =Mega=.  For
  19577   a standard collection of such constants, install the =constants=
  19578   package.  Install version 2.0 of this package, available at
  19579   [[http://www.astro.uva.nl/~dominik/Tools]].  Org checks if the function
  19580   ~constants-get~ has been autoloaded.  Installation instructions are
  19581   in the file =constants.el=.
  19582 
  19583 - =cdlatex.el= by Carsten Dominik ::
  19584   #+cindex: @file{cdlatex.el}
  19585 
  19586   Org mode can make use of the CDLaTeX package to efficiently enter
  19587   LaTeX fragments into Org files.  See [[*Using CDLaTeX to enter math]].
  19588 
  19589 - =imenu.el= by Ake Stenhoff and Lars Lindberg ::
  19590   #+cindex: @file{imenu.el}
  19591 
  19592   Imenu creates dynamic menus based on an index of items in a file.
  19593   Org mode supports Imenu menus.  Enable it with a mode hook as
  19594   follows:
  19595 
  19596   #+begin_src emacs-lisp
  19597   (add-hook 'org-mode-hook
  19598             (lambda () (imenu-add-to-menubar "Imenu")))
  19599   #+end_src
  19600 
  19601   #+vindex: org-imenu-depth
  19602   By default the index is two levels deep---you can modify the
  19603   depth using the option ~org-imenu-depth~.
  19604 
  19605 - =speedbar.el= by Eric\nbsp{}M.\nbsp{}Ludlam ::
  19606   #+cindex: @file{speedbar.el}
  19607 
  19608   Speedbar package creates a special Emacs frame for displaying files
  19609   and index items in files.  Org mode supports Speedbar; users can
  19610   drill into Org files directly from the Speedbar.  The {{{kbd(<)}}}
  19611   in the Speedbar frame tweaks the agenda commands to that file or to
  19612   a subtree.
  19613 
  19614 - =table.el= by Takaaki Ota ::
  19615   #+cindex: table editor, @file{table.el}
  19616   #+cindex: @file{table.el}
  19617 
  19618   Complex ASCII tables with automatic line wrapping, column- and
  19619   row-spanning, and alignment can be created using the Emacs table
  19620   package by Takaaki Ota.  Org mode recognizes such tables and exports
  19621   them properly.  {{{kbd(C-c ')}}} to edit these tables in a special
  19622   buffer, much like Org's code blocks.  Because of interference with
  19623   other Org mode functionality, Takaaki Ota tables cannot be edited
  19624   directly in the Org buffer.
  19625 
  19626   - {{{kbd(C-c ')}}} (~org-edit-special~) ::
  19627 
  19628     #+kindex: C-c '
  19629     #+findex: org-edit-special
  19630     Edit a =table.el= table.  Works when point is in a =table.el=
  19631     table.
  19632 
  19633   - {{{kbd(C-c ~​)}}} (~org-table-create-with-table.el~) ::
  19634 
  19635     #+kindex: C-c ~
  19636     #+findex: org-table-create-with-table.el
  19637     Insert a =table.el= table.  If there is already a table at point,
  19638     this command converts it between the =table.el= format and the Org
  19639     mode format.  See the documentation string of the command
  19640     ~org-convert-table~ for the restrictions under which this is
  19641     possible.
  19642 
  19643 *** Packages that conflict with Org mode
  19644 :PROPERTIES:
  19645 :DESCRIPTION: Packages that lead to conflicts.
  19646 :ALT_TITLE: Conflicts
  19647 :END:
  19648 
  19649 #+cindex: shift-selection
  19650 #+vindex: org-support-shift-select
  19651 In Emacs, shift-selection combines motions of point with shift key to
  19652 enlarge regions.  Emacs sets this mode by default.  This conflicts
  19653 with Org's use of {{{kbd(S-<cursor>)}}} commands to change timestamps,
  19654 TODO keywords, priorities, and item bullet types, etc.  Since
  19655 {{{kbd(S-<cursor>)}}} commands outside of specific contexts do not do
  19656 anything, Org offers the variable ~org-support-shift-select~ for
  19657 customization.  Org mode accommodates shift selection by (i) making it
  19658 available outside of the special contexts where special commands
  19659 apply, and (ii) extending an existing active region even if point
  19660 moves across a special context.
  19661 
  19662 - =cua.el= by Kim\nbsp{}F.\nbsp{}Storm ::
  19663 
  19664   #+cindex: @file{cua.el}
  19665   #+vindex: org-replace-disputed-keys
  19666   Org key bindings conflict with {{{kbd(S-<cursor>)}}} keys used by
  19667   CUA mode.  For Org to relinquish these bindings to CUA mode,
  19668   configure the variable ~org-replace-disputed-keys~.  When set, Org
  19669   moves the following key bindings in Org files, and in the agenda
  19670   buffer---but not during date selection.
  19671 
  19672   #+attr_texinfo: :columns 0.4 0.4
  19673   | {{{kbd(S-UP)}}}      \rArr{}  {{{kbd(M-p)}}}   | {{{kbd(S-DOWN)}}}     \rArr{}  {{{kbd(M-n)}}}   |
  19674   | {{{kbd(S-LEFT)}}}    \rArr{}  {{{kbd(M--)}}}   | {{{kbd(S-RIGHT)}}}    \rArr{}  {{{kbd(M-+)}}}   |
  19675   | {{{kbd(C-S-LEFT)}}}  \rArr{}  {{{kbd(M-S--)}}} | {{{kbd(C-S-RIGHT)}}}  \rArr{}  {{{kbd(M-S-+)}}} |
  19676 
  19677   #+vindex: org-disputed-keys
  19678   Yes, these are unfortunately more difficult to remember.  If you
  19679   want to have other replacement keys, look at the variable
  19680   ~org-disputed-keys~.
  19681 
  19682 - =ecomplete.el= by Lars Magne Ingebrigtsen ::
  19683 
  19684   #+cindex: @file{ecomplete.el}
  19685   Ecomplete provides "electric" address completion in address header
  19686   lines in message buffers.  Sadly Orgtbl mode cuts Ecomplete's power
  19687   supply: no completion happens when Orgtbl mode is enabled in message
  19688   buffers while entering text in address header lines.  If one wants
  19689   to use ecomplete one should /not/ follow the advice to automagically
  19690   turn on Orgtbl mode in message buffers (see [[*The Orgtbl Minor Mode]]),
  19691   but instead---after filling in the message headers---turn on Orgtbl
  19692   mode manually when needed in the messages body.
  19693 
  19694 - =filladapt.el= by Kyle Jones ::
  19695 
  19696   #+cindex: @file{filladapt.el}
  19697   Org mode tries to do the right thing when filling paragraphs, list
  19698   items and other elements.  Many users reported problems using both
  19699   =filladapt.el= and Org mode, so a safe thing to do is to disable
  19700   filladapt like this:
  19701 
  19702   #+begin_src emacs-lisp
  19703   (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
  19704   #+end_src
  19705 
  19706 - =viper.el= by Michael Kifer ::
  19707   #+cindex: @file{viper.el}
  19708   #+kindex: C-c /
  19709 
  19710   Viper uses {{{kbd(C-c /)}}} and therefore makes this key not access
  19711   the corresponding Org mode command ~org-sparse-tree~.  You need to
  19712   find another key for this command, or override the key in
  19713   ~viper-vi-global-user-map~ with
  19714 
  19715   #+begin_src emacs-lisp
  19716   (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  19717   #+end_src
  19718 
  19719 - =windmove.el= by Hovav Shacham ::
  19720   #+cindex: @file{windmove.el}
  19721 
  19722   This package also uses the {{{kbd(S-<cursor>)}}} keys, so everything
  19723   written in the paragraph above about CUA mode also applies here.  If
  19724   you want to make the windmove function active in locations where Org
  19725   mode does not have special functionality on {{{kbd(S-<cursor>)}}},
  19726   add this to your configuration:
  19727 
  19728   #+begin_src emacs-lisp
  19729   ;; Make windmove work in Org mode:
  19730   (add-hook 'org-shiftup-final-hook 'windmove-up)
  19731   (add-hook 'org-shiftleft-final-hook 'windmove-left)
  19732   (add-hook 'org-shiftdown-final-hook 'windmove-down)
  19733   (add-hook 'org-shiftright-final-hook 'windmove-right)
  19734   #+end_src
  19735 
  19736 - =yasnippet.el= ::
  19737 
  19738   #+cindex: @file{yasnippet.el}
  19739   The way Org mode binds the {{{kbd(TAB)}}} key (binding to ~[tab]~
  19740   instead of ~"\t"~) overrules YASnippet's access to this key.  The
  19741   following code fixed this problem:
  19742 
  19743   #+begin_src emacs-lisp
  19744   (add-hook 'org-mode-hook
  19745             (lambda ()
  19746               (setq-local yas/trigger-key [tab])
  19747               (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  19748   #+end_src
  19749 
  19750   The latest version of YASnippet does not play well with Org mode.
  19751   If the above code does not fix the conflict, start by defining
  19752   the following function:
  19753 
  19754   #+begin_src emacs-lisp
  19755   (defun yas/org-very-safe-expand ()
  19756     (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  19757   #+end_src
  19758 
  19759   Then, tell Org mode to use that function:
  19760 
  19761   #+begin_src emacs-lisp
  19762   (add-hook 'org-mode-hook
  19763             (lambda ()
  19764               (make-variable-buffer-local 'yas/trigger-key)
  19765               (setq yas/trigger-key [tab])
  19766               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
  19767               (define-key yas/keymap [tab] 'yas/next-field)))
  19768   #+end_src
  19769 ** Using Org on a TTY
  19770 :PROPERTIES:
  19771 :DESCRIPTION: Using Org on a tty.
  19772 :ALT_TITLE: TTY Keys
  19773 :END:
  19774 #+cindex: tty key bindings
  19775 
  19776 Org provides alternative key bindings for TTY and modern mobile
  19777 devices that cannot perform movement commands on point and key
  19778 bindings with modifier keys.  Some of these workarounds may be more
  19779 cumbersome than necessary.  Users should look into customizing these
  19780 further based on their usage needs.  For example, the normal
  19781 {{{kbd(S-<cursor>)}}} for editing timestamp might be better with
  19782 {{{kbd(C-c .)}}} chord.
  19783 
  19784 #+attr_texinfo: :columns 0.2 0.28 0.15 0.21
  19785 | Default              | Alternative 1            | Speed key    | Alternative 2        |
  19786 |----------------------+--------------------------+--------------+----------------------|
  19787 | {{{kbd(S-TAB)}}}     | {{{kbd(C-u TAB)}}}       | {{{kbd(C)}}} |                      |
  19788 | {{{kbd(M-LEFT)}}}    | {{{kbd(C-c C-x l)}}}     | {{{kbd(l)}}} | {{{kbd(Esc LEFT)}}}  |
  19789 | {{{kbd(M-S-LEFT)}}}  | {{{kbd(C-c C-x L)}}}     | {{{kbd(L)}}} |                      |
  19790 | {{{kbd(M-RIGHT)}}}   | {{{kbd(C-c C-x r)}}}     | {{{kbd(r)}}} | {{{kbd(Esc RIGHT)}}} |
  19791 | {{{kbd(M-S-RIGHT)}}} | {{{kbd(C-c C-x R)}}}     | {{{kbd(R)}}} |                      |
  19792 | {{{kbd(M-UP)}}}      | {{{kbd(C-c C-x u)}}}     |              | {{{kbd(Esc UP)}}}    |
  19793 | {{{kbd(M-S-UP)}}}    | {{{kbd(C-c C-x U)}}}     | {{{kbd(U)}}} |                      |
  19794 | {{{kbd(M-DOWN)}}}    | {{{kbd(C-c C-x d)}}}     |              | {{{kbd(Esc DOWN)}}}  |
  19795 | {{{kbd(M-S-DOWN)}}}  | {{{kbd(C-c C-x D)}}}     | {{{kbd(D)}}} |                      |
  19796 | {{{kbd(S-RET)}}}     | {{{kbd(C-c C-x c)}}}     |              |                      |
  19797 | {{{kbd(M-RET)}}}     | {{{kbd(C-c C-x m)}}}     |              | {{{kbd(Esc RET)}}}   |
  19798 | {{{kbd(M-S-RET)}}}   | {{{kbd(C-c C-x M)}}}     |              |                      |
  19799 | {{{kbd(S-LEFT)}}}    | {{{kbd(C-c LEFT)}}}      |              |                      |
  19800 | {{{kbd(S-RIGHT)}}}   | {{{kbd(C-c RIGHT)}}}     |              |                      |
  19801 | {{{kbd(S-UP)}}}      | {{{kbd(C-c UP)}}}        |              |                      |
  19802 | {{{kbd(S-DOWN)}}}    | {{{kbd(C-c DOWN)}}}      |              |                      |
  19803 | {{{kbd(C-S-LEFT)}}}  | {{{kbd(C-c C-x LEFT)}}}  |              |                      |
  19804 | {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} |              |                      |
  19805 
  19806 ** Protocols for External Access
  19807 :PROPERTIES:
  19808 :DESCRIPTION: External access to Emacs and Org.
  19809 :ALT_TITLE: Protocols
  19810 :END:
  19811 #+cindex: protocols, for external access
  19812 
  19813 Org protocol is a tool to trigger custom actions in Emacs from
  19814 external applications.  Any application that supports calling external
  19815 programs with an URL as argument may be used with this functionality.
  19816 For example, you can configure bookmarks in your web browser to send a
  19817 link to the current page to Org and create a note from it using
  19818 capture (see [[*Capture]]).  You can also create a bookmark that tells
  19819 Emacs to open the local source file of a remote website you are
  19820 browsing.
  19821 
  19822 #+cindex: Org protocol, set-up
  19823 #+cindex: Installing Org protocol
  19824 In order to use Org protocol from an application, you need to register
  19825 =org-protocol://= as a valid scheme-handler.  External calls are
  19826 passed to Emacs through the =emacsclient= command, so you also need to
  19827 ensure an Emacs server is running.  More precisely, when the
  19828 application calls
  19829 
  19830 : emacsclient "org-protocol://PROTOCOL?key1=val1&key2=val2"
  19831 
  19832 #+texinfo: @noindent
  19833 Emacs calls the handler associated to {{{var(PROTOCOL)}}} with
  19834 argument =(:key1 val1 :key2 val2)=.
  19835 
  19836 #+cindex: protocol, new protocol
  19837 #+cindex: defining new protocols
  19838 Org protocol comes with three predefined protocols, detailed in the
  19839 following sections.  Configure ~org-protocol-protocol-alist~ to define
  19840 your own.
  19841 
  19842 *** The ~store-link~ protocol
  19843 :PROPERTIES:
  19844 :DESCRIPTION: Store a link, push URL to kill-ring.
  19845 :END:
  19846 #+cindex: store-link protocol
  19847 #+cindex: protocol, store-link
  19848 
  19849 Using the ~store-link~ handler, you can copy links, to that they can
  19850 be inserted using {{{kbd(M-x org-insert-link)}}} or yanking.  More
  19851 precisely, the command
  19852 
  19853 : emacsclient "org-protocol://store-link?url=URL&title=TITLE"
  19854 
  19855 #+texinfo: @noindent
  19856 stores the following link:
  19857 
  19858 : [[URL][TITLE]]
  19859 
  19860 In addition, {{{var(URL)}}} is pushed on the kill-ring for yanking.
  19861 You need to encode {{{var(URL)}}} and {{{var(TITLE)}}} if they contain
  19862 slashes, and probably quote those for the shell.
  19863 
  19864 To use this feature from a browser, add a bookmark with an arbitrary
  19865 name, e.g., =Org: store-link= and enter this as /Location/:
  19866 
  19867 #+begin_example
  19868 javascript:location.href='org-protocol://store-link?' +
  19869       new URLSearchParams({url:location.href, title:document.title});
  19870 #+end_example
  19871 
  19872 Title is an optional parameter.  Another expression was recommended earlier:
  19873 
  19874 #+begin_example
  19875 javascript:location.href='org-protocol://store-link?url='+
  19876       encodeURIComponent(location.href);
  19877 #+end_example
  19878 
  19879 The latter form is compatible with older Org versions from 9.0 to 9.4.
  19880 
  19881 *** The ~capture~ protocol
  19882 :PROPERTIES:
  19883 :DESCRIPTION: Fill a buffer with external information.
  19884 :END:
  19885 #+cindex: capture protocol
  19886 #+cindex: protocol, capture
  19887 
  19888 Activating the "capture" handler pops up a =Capture= buffer in Emacs,
  19889 using acapture template.
  19890 
  19891 : emacsclient "org-protocol://capture?template=X&url=URL&title=TITLE&body=BODY"
  19892 
  19893 To use this feature, add a bookmark with an arbitrary name, e.g.,
  19894 =Org: capture=, and enter this as =Location=:
  19895 
  19896 #+begin_example
  19897 javascript:location.href='org-protocol://capture?' +
  19898       new URLSearchParams({
  19899             template: 'x', url: window.location.href,
  19900             title: document.title, body: window.getSelection()});
  19901 #+end_example
  19902 
  19903 You might have seen another expression:
  19904 
  19905 #+begin_example
  19906 javascript:location.href='org-protocol://capture?template=x'+
  19907       '&url='+encodeURIComponent(window.location.href)+
  19908       '&title='+encodeURIComponent(document.title)+
  19909       '&body='+encodeURIComponent(window.getSelection());
  19910 #+end_example
  19911 
  19912 It is a bit more cluttered than the former one, but it is compatible
  19913 with previous Org versions 9.0-9.4.  In these versions encoding of
  19914 space as "+" character was not supported by URI decoder.
  19915 
  19916 #+vindex: org-protocol-default-template-key
  19917 The capture template to be used can be specified in the bookmark (like
  19918 =X= above).  If unspecified, the template key is set in the variable
  19919 ~org-protocol-default-template-key~.  The following template
  19920 placeholders are available:
  19921 
  19922 #+begin_example
  19923 %:link          The URL
  19924 %:description   The webpage title
  19925 %:annotation    Equivalent to [[%:link][%:description]]
  19926 %i              The selected text
  19927 #+end_example
  19928 
  19929 *** The ~open-source~ protocol
  19930 :PROPERTIES:
  19931 :DESCRIPTION: Edit published contents.
  19932 :END:
  19933 #+cindex: open-source protocol
  19934 #+cindex: protocol, open-source
  19935 
  19936 The ~open-source~ handler is designed to help with editing local
  19937 sources when reading a document.  To that effect, you can use
  19938 a bookmark with the following location:
  19939 
  19940 #+begin_example
  19941 javascript:location.href='org-protocol://open-source?&url='+
  19942       encodeURIComponent(location.href)
  19943 #+end_example
  19944 
  19945 #+vindex: org-protocol-project-alist
  19946 The variable ~org-protocol-project-alist~ maps URLs to local file
  19947 names, by stripping URL parameters from the end and replacing the
  19948 ~:base-url~ with ~:working-directory~ and ~:online-suffix~ with
  19949 ~:working-suffix~.  For example, assuming you own a local copy of
  19950 =https://orgmode.org/worg/= contents at =/home/user/worg=, you can set
  19951 ~org-protocol-project-alist~ to the following
  19952 
  19953 #+begin_src emacs-lisp
  19954 (setq org-protocol-project-alist
  19955       '(("Worg"
  19956          :base-url "https://orgmode.org/worg/"
  19957          :working-directory "/home/user/worg/"
  19958          :online-suffix ".html"
  19959          :working-suffix ".org")))
  19960 #+end_src
  19961 
  19962 #+texinfo: @noindent
  19963 If you are now browsing
  19964 =https://orgmode.org/worg/org-contrib/org-protocol.html= and find
  19965 a typo or have an idea about how to enhance the documentation, simply
  19966 click the bookmark and start editing.
  19967 
  19968 #+cindex: rewritten URL in open-source protocol
  19969 #+cindex: protocol, open-source rewritten URL
  19970 However, such mapping may not always yield the desired results.
  19971 Suppose you maintain an online store located at =https://example.com/=.
  19972 The local sources reside in =/home/user/example/=.  It is common
  19973 practice to serve all products in such a store through one file and
  19974 rewrite URLs that do not match an existing file on the server.  That
  19975 way, a request to =https://example.com/print/posters.html= might be
  19976 rewritten on the server to something like
  19977 =https://example.com/shop/products.php/posters.html.php=.  The
  19978 ~open-source~ handler probably cannot find a file named
  19979 =/home/user/example/print/posters.html.php= and fails.
  19980 
  19981 Such an entry in ~org-protocol-project-alist~ may hold an additional
  19982 property ~:rewrites~.  This property is a list of cons cells, each of
  19983 which maps a regular expression to a path relative to the
  19984 ~:working-directory~.
  19985 
  19986 Now map the URL to the path =/home/user/example/products.php= by
  19987 adding ~:rewrites~ rules like this:
  19988 
  19989 #+begin_src emacs-lisp
  19990 (setq org-protocol-project-alist
  19991       '(("example.com"
  19992          :base-url "https://example.com/"
  19993          :working-directory "/home/user/example/"
  19994          :online-suffix ".php"
  19995          :working-suffix ".php"
  19996          :rewrites (("example.com/print/" . "products.php")
  19997                     ("example.com/$" . "index.php")))))
  19998 #+end_src
  19999 
  20000 #+texinfo: @noindent
  20001 Since =example.com/$= is used as a regular expression, it maps
  20002 =http://example.com/=, =https://example.com=,
  20003 =http://www.example.com/= and similar to
  20004 =/home/user/example/index.php=.
  20005 
  20006 The ~:rewrites~ rules are searched as a last resort if and only if no
  20007 existing file name is matched.
  20008 
  20009 #+cindex: protocol, open-source, set-up mapping
  20010 #+cindex: mappings in open-source protocol
  20011 #+findex: org-protocol-create
  20012 #+findex: org-protocol-create-for-org
  20013 Two functions can help you filling ~org-protocol-project-alist~ with
  20014 valid contents: ~org-protocol-create~ and
  20015 ~org-protocol-create-for-org~.  The latter is of use if you're editing
  20016 an Org file that is part of a publishing project.
  20017 ** Org Crypt
  20018 :PROPERTIES:
  20019 :DESCRIPTION: Encrypting Org files.
  20020 :END:
  20021 
  20022 Org Crypt encrypts the text of an entry, but not the headline, or
  20023 properties.  Behind the scene, it uses the [[info:epa][Emacs EasyPG Library]] to
  20024 encrypt and decrypt files, and EasyPG needs a correct [[info:gnupg][GnuPG]] setup.
  20025 
  20026 #+vindex: org-crypt-tag-matcher
  20027 Any text below a headline that has a =crypt= tag is automatically
  20028 encrypted when the file is saved.  To use a different tag, customize
  20029 the ~org-crypt-tag-matcher~ setting.
  20030 
  20031 Here is a suggestion for Org Crypt settings in Emacs init file:
  20032 
  20033 #+begin_src emacs-lisp
  20034 (require 'org-crypt)
  20035 (org-crypt-use-before-save-magic)
  20036 (setq org-tags-exclude-from-inheritance '("crypt"))
  20037 
  20038 (setq org-crypt-key nil)
  20039 ;; GPG key to use for encryption
  20040 ;; Either the Key ID or set to nil to use symmetric encryption.
  20041 
  20042 (setq auto-save-default nil)
  20043 ;; Auto-saving does not cooperate with org-crypt.el: so you need to
  20044 ;; turn it off if you plan to use org-crypt.el quite often.  Otherwise,
  20045 ;; you'll get an (annoying) message each time you start Org.
  20046 
  20047 ;; To turn it off only locally, you can insert this:
  20048 ;;
  20049 ;; # -*- buffer-auto-save-file-name: nil; -*-
  20050 #+end_src
  20051 
  20052 It's possible to use different keys for different headings by
  20053 specifying the respective key as property =CRYPTKEY=, e.g.:
  20054 
  20055 #+begin_example
  20056 ,* Totally secret :crypt:
  20057   :PROPERTIES:
  20058   :CRYPTKEY: 0x0123456789012345678901234567890123456789
  20059   :END:
  20060 #+end_example
  20061 
  20062 Excluding the =crypt= tag from inheritance prevents already encrypted
  20063 text from being encrypted again.
  20064 
  20065 ** Org Mobile
  20066 :PROPERTIES:
  20067 :DESCRIPTION: Viewing and capture on a mobile device.
  20068 :END:
  20069 #+cindex: smartphone
  20070 
  20071 Org Mobile is a protocol for synchronizing Org files between Emacs and
  20072 other applications, e.g., on mobile devices.  It enables offline-views
  20073 and capture support for an Org mode system that is rooted on a "real"
  20074 computer.  The external application can also record changes to
  20075 existing entries.
  20076 
  20077 This appendix describes Org's support for agenda view formats
  20078 compatible with Org Mobile.  It also describes synchronizing changes,
  20079 such as to notes, between the mobile application and the computer.
  20080 
  20081 To change tags and TODO states in the mobile application, first
  20082 customize the variables ~org-todo-keywords~, ~org-tag-alist~ and
  20083 ~org-tag-persistent-alist~.  These should cover all the important tags
  20084 and TODO keywords, even if Org files use only some of them.  Though
  20085 the mobile application is expected to support in-buffer settings, it
  20086 is required to understand TODO states /sets/ (see [[*Setting up keywords
  20087 for individual files]]) and /mutually exclusive/ tags (see [[*Setting
  20088 Tags]]) only for those set in these variables.
  20089 
  20090 *** Setting up the staging area
  20091 :PROPERTIES:
  20092 :DESCRIPTION: For the mobile device.
  20093 :END:
  20094 
  20095 #+vindex: org-mobile-directory
  20096 The mobile application needs access to a file directory on
  20097 a server[fn:150] to interact with Emacs.  Pass its location through
  20098 the ~org-mobile-directory~ variable.  If you can mount that directory
  20099 locally just set the variable to point to that directory:
  20100 
  20101 #+begin_src emacs-lisp
  20102 (setq org-mobile-directory "~/orgmobile/")
  20103 #+end_src
  20104 
  20105 Alternatively, by using TRAMP (see [[info:tramp][TRAMP User Manual]]),
  20106 ~org-mobile-directory~ may point to a remote directory accessible
  20107 through, for example, SSH, SCP, or DAVS:
  20108 
  20109 #+begin_src emacs-lisp
  20110 (setq org-mobile-directory "/davs:user@remote.host:/org/webdav/")
  20111 #+end_src
  20112 
  20113 #+vindex: org-mobile-encryption
  20114 With a public server, consider encrypting the files.  Org also
  20115 requires OpenSSL installed on the local computer.  To turn on
  20116 encryption, set the same password in the mobile application and in
  20117 Emacs.  Set the password in the variable
  20118 ~org-mobile-use-encryption~[fn:151].  Note that even after the mobile
  20119 application encrypts the file contents, the file name remains visible
  20120 on the file systems of the local computer, the server, and the mobile
  20121 device.
  20122 
  20123 *** Pushing to the mobile application
  20124 :PROPERTIES:
  20125 :DESCRIPTION: Uploading Org files and agendas.
  20126 :END:
  20127 
  20128 #+findex: org-mobile-push
  20129 #+vindex: org-mobile-files
  20130 The command ~org-mobile-push~ copies files listed in
  20131 ~org-mobile-files~ into the staging area.  Files include agenda files
  20132 (as listed in ~org-agenda-files~).  Customize ~org-mobile-files~ to
  20133 add other files.  File names are staged with paths relative to
  20134 ~org-directory~, so all files should be inside this directory[fn:152].
  20135 
  20136 Push creates a special Org file =agendas.org= with custom agenda views
  20137 defined by the user[fn:153].
  20138 
  20139 Finally, Org writes the file =index.org=, containing links to other
  20140 files.  The mobile application reads this file first from the server
  20141 to determine what other files to download for agendas.  For faster
  20142 downloads, it is expected to only read files whose checksums[fn:154]
  20143 have changed.
  20144 
  20145 *** Pulling from the mobile application
  20146 :PROPERTIES:
  20147 :DESCRIPTION: Integrating captured and flagged items.
  20148 :END:
  20149 
  20150 #+findex: org-mobile-pull
  20151 The command ~org-mobile-pull~ synchronizes changes with the server.
  20152 More specifically, it first pulls the Org files for viewing.  It then
  20153 appends captured entries and pointers to flagged or changed entries to
  20154 the file =mobileorg.org= on the server.  Org ultimately integrates its
  20155 data in an inbox file format, through the following steps:
  20156 
  20157 1.
  20158    #+vindex: org-mobile-inbox-for-pull
  20159    Org moves all entries found in =mobileorg.org=[fn:155] and appends
  20160    them to the file pointed to by the variable
  20161    ~org-mobile-inbox-for-pull~.  It should reside neither in the
  20162    staging area nor on the server.  Each captured entry and each
  20163    editing event is a top-level entry in the inbox file.
  20164 
  20165 2.
  20166    #+cindex: @samp{FLAGGED}, tag
  20167    After moving the entries, Org processes changes to the shared
  20168    files.  Some of them are applied directly and without user
  20169    interaction.  Examples include changes to tags, TODO state,
  20170    headline and body text.  Entries requiring further action are
  20171    tagged as =FLAGGED=.  Org marks entries with problems with an error
  20172    message in the inbox.  They have to be resolved manually.
  20173 
  20174 3. Org generates an agenda view for flagged entries for user
  20175    intervention to clean up.  For notes stored in flagged entries, Org
  20176    displays them in the echo area when point is on the corresponding
  20177    agenda item.
  20178 
  20179    - {{{kbd(?)}}} ::
  20180 
  20181      Pressing {{{kbd(?)}}} displays the entire flagged note in another
  20182      window.  Org also pushes it to the kill ring.  To store flagged
  20183      note as a normal note, use {{{kbd(? z C-y C-c C-c)}}}.  Pressing
  20184      {{{kbd(?)}}} twice does these things: first it removes the
  20185      =FLAGGED= tag; second, it removes the flagged note from the
  20186      property drawer; third, it signals that manual editing of the
  20187      flagged entry is now finished.
  20188 
  20189 #+kindex: ? @r{(Agenda dispatcher)}
  20190 From the agenda dispatcher, {{{kbd(?)}}} returns to the view to finish
  20191 processing flagged entries.  Note that these entries may not be the
  20192 most recent since the mobile application searches files that were last
  20193 pulled.  To get an updated agenda view with changes since the last
  20194 pull, pull again.
  20195 
  20196 * Hacking
  20197 :PROPERTIES:
  20198 :DESCRIPTION: How to hack your way around.
  20199 :APPENDIX: t
  20200 :END:
  20201 #+cindex: hacking
  20202 
  20203 This appendix describes some ways a user can extend the functionality
  20204 of Org.
  20205 
  20206 ** Hooks
  20207 :PROPERTIES:
  20208 :DESCRIPTION: How to reach into Org's internals.
  20209 :END:
  20210 #+cindex: hooks
  20211 
  20212 Org has a large number of hook variables for adding functionality.
  20213 This appendix illustrates using a few.  A complete list of hooks with
  20214 documentation is maintained by the Worg project at
  20215 https://orgmode.org/worg/doc.html#hooks.
  20216 
  20217 ** Add-on Packages
  20218 :PROPERTIES:
  20219 :DESCRIPTION: Available extensions.
  20220 :END:
  20221 #+cindex: add-on packages
  20222 
  20223 Various authors wrote a large number of add-on packages for Org.  Some
  20224 of these packages used to be part of the =org-mode= repository but are
  20225 now hosted in a separate =org-contrib= repository
  20226 [[https://git.sr.ht/~bzg/org-contrib][here]].  A Worg page with more
  20227 information is at: https://orgmode.org/worg/org-contrib/.
  20228 
  20229 ** Adding Hyperlink Types
  20230 :PROPERTIES:
  20231 :DESCRIPTION: New custom link types.
  20232 :END:
  20233 #+cindex: hyperlinks, adding new types
  20234 
  20235 Org has many built-in hyperlink types (see [[*Hyperlinks]]), and an
  20236 interface for adding new link types.  The following example shows the
  20237 process of adding Org links to Unix man pages, which look like this
  20238 
  20239 : [[man:printf][The printf manual]]
  20240 
  20241 #+texinfo: @noindent
  20242 The following =ol-man.el= file implements it
  20243 
  20244 #+begin_src emacs-lisp
  20245 ;;; ol-man.el - Support for links to man pages in Org mode
  20246 (require 'ol)
  20247 
  20248 (org-link-set-parameters "man"
  20249                          :follow #'org-man-open
  20250                          :export #'org-man-export
  20251                          :store #'org-man-store-link)
  20252 
  20253 (defcustom org-man-command 'man
  20254   "The Emacs command to be used to display a man page."
  20255   :group 'org-link
  20256   :type '(choice (const man) (const woman)))
  20257 
  20258 (defun org-man-open (path _)
  20259   "Visit the manpage on PATH.
  20260 PATH should be a topic that can be thrown at the man command."
  20261   (funcall org-man-command path))
  20262 
  20263 (defun org-man-store-link ()
  20264   "Store a link to a man page."
  20265   (when (memq major-mode '(Man-mode woman-mode))
  20266     ;; This is a man page, we do make this link.
  20267     (let* ((page (org-man-get-page-name))
  20268            (link (concat "man:" page))
  20269            (description (format "Man page for %s" page)))
  20270       (org-link-store-props
  20271        :type "man"
  20272        :link link
  20273        :description description))))
  20274 
  20275 (defun org-man-get-page-name ()
  20276   "Extract the page name from the buffer name."
  20277   ;; This works for both `Man-mode' and `woman-mode'.
  20278   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  20279       (match-string 1 (buffer-name))
  20280     (error "Cannot create link to this man page")))
  20281 
  20282 (defun org-man-export (link description format _)
  20283   "Export a man page link from Org files."
  20284   (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  20285         (desc (or description link)))
  20286     (pcase format
  20287       (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  20288       (`latex (format "\\href{%s}{%s}" path desc))
  20289       (`texinfo (format "@uref{%s,%s}" path desc))
  20290       (`ascii (format "%s (%s)" desc path))
  20291       (t path))))
  20292 
  20293 (provide ol-man)
  20294 ;;; ol-man.el ends here
  20295 #+end_src
  20296 
  20297 #+texinfo: @noindent
  20298 To activate links to man pages in Org, enter this in the Emacs init
  20299 file:
  20300 
  20301 #+begin_src emacs-lisp
  20302 (require 'ol-man)
  20303 #+end_src
  20304 
  20305 #+texinfo: @noindent
  20306 A review of =ol-man.el=:
  20307 
  20308 1. First, =(require 'ol)= ensures that =ol.el= is loaded.
  20309 
  20310 2.
  20311 
  20312    #+findex: org-link-set-parameters
  20313    #+vindex: org-link-parameters
  20314    Then ~org-link-set-parameters~ defines a new link type with =man=
  20315    prefix and associates functions for following, exporting and
  20316    storing such links.  See the variable ~org-link-parameters~ for
  20317    a complete list of possible associations.
  20318 
  20319 3. The rest of the file implements necessary variables and functions.
  20320 
  20321    For example, ~org-man-store-link~ is responsible for storing a link
  20322    when ~org-store-link~ (see [[*Handling Links]]) is called from a buffer
  20323    displaying a man page.  It first checks if the major mode is
  20324    appropriate.  If check fails, the function returns ~nil~, which
  20325    means it isn't responsible for creating a link to the current
  20326    buffer.  Otherwise the function makes a link string by combining
  20327    the =man:= prefix with the man topic.  It also provides a default
  20328    description.  The function ~org-insert-link~ can insert it back
  20329    into an Org buffer later on.
  20330 
  20331 ** Adding Export Back-ends
  20332 :PROPERTIES:
  20333 :DESCRIPTION: How to write new export back-ends.
  20334 :END:
  20335 #+cindex: Export, writing back-ends
  20336 
  20337 Org's export engine makes it easy for writing new back-ends.  The
  20338 framework on which the engine was built makes it easy to derive new
  20339 back-ends from existing ones.
  20340 
  20341 #+findex: org-export-define-backend
  20342 #+findex: org-export-define-derived-backend
  20343 The two main entry points to the export engine are:
  20344 ~org-export-define-backend~ and ~org-export-define-derived-backend~.
  20345 To grok these functions, see =ox-latex.el= for an example of defining
  20346 a new back-end from scratch, and =ox-beamer.el= for an example of
  20347 deriving from an existing engine.
  20348 
  20349 For creating a new back-end from scratch, first set its name as
  20350 a symbol in an alist consisting of elements and export functions.  To
  20351 make the back-end visible to the export dispatcher, set ~:menu-entry~
  20352 keyword.  For export options specific to this back-end, set the
  20353 ~:options-alist~.
  20354 
  20355 For creating a new back-end from an existing one, set
  20356 ~:translate-alist~ to an alist of export functions.  This alist
  20357 replaces the parent back-end functions.
  20358 
  20359 For complete documentation, see [[https://orgmode.org/worg/dev/org-export-reference.html][the Org Export Reference on Worg]].
  20360 
  20361 ** Tables in Arbitrary Syntax
  20362 :PROPERTIES:
  20363 :DESCRIPTION: Orgtbl for LaTeX and other programs.
  20364 :END:
  20365 #+cindex: tables, in other modes
  20366 #+cindex: lists, in other modes
  20367 #+cindex: Orgtbl mode
  20368 
  20369 Due to Org's success in handling tables with Orgtbl, a frequently
  20370 requested feature is the use of Org's table functions in other modes,
  20371 e.g., LaTeX.  This would be hard to do in a general way without
  20372 complicated customization nightmares.  Moreover, that would take Org
  20373 away from its simplicity roots that Orgtbl has proven.  There is,
  20374 however, an alternate approach to accomplishing the same.
  20375 
  20376 This approach involves implementing a custom /translate/ function that
  20377 operates on a native Org /source table/ to produce a table in another
  20378 format.  This strategy would keep the excellently working Orgtbl
  20379 simple and isolate complications, if any, confined to the translate
  20380 function.  To add more alien table formats, we just add more translate
  20381 functions.  Also the burden of developing custom translate functions
  20382 for new table formats is in the hands of those who know those formats
  20383 best.
  20384 
  20385 *** Radio tables
  20386 :PROPERTIES:
  20387 :DESCRIPTION: Sending and receiving radio tables.
  20388 :END:
  20389 #+cindex: radio tables
  20390 
  20391 Radio tables are target locations for translated tables that are not near
  20392 their source.  Org finds the target location and inserts the translated
  20393 table.
  20394 
  20395 The key to finding the target location is the magic words =BEGIN/END
  20396 RECEIVE ORGTBL=.  They have to appear as comments in the current mode.
  20397 If the mode is C, then:
  20398 
  20399 #+begin_example
  20400 /* BEGIN RECEIVE ORGTBL table_name */
  20401 /* END RECEIVE ORGTBL table_name */
  20402 #+end_example
  20403 
  20404 At the location of source, Org needs a special line to direct Orgtbl
  20405 to translate and to find the target for inserting the translated
  20406 table.  For example:
  20407 
  20408 #+cindex: @samp{ORGTBL}, keyword
  20409 : #+ORGTBL: SEND table_name translation_function arguments ...
  20410 
  20411 #+texinfo: @noindent
  20412 =table_name= is the table's reference name, which is also used in the
  20413 receiver lines, and the =translation_function= is the Lisp function
  20414 that translates.  This line, in addition, may also contain alternating
  20415 key and value arguments at the end.  The translation function gets
  20416 these values as a property list.  A few standard parameters are
  20417 already recognized and acted upon before the translation function is
  20418 called:
  20419 
  20420 - =:skip N= ::
  20421 
  20422   Skip the first N lines of the table.  Hlines do count; include them
  20423   if they are to be skipped.
  20424 
  20425 - =:skipcols (n1 n2 ...)= ::
  20426 
  20427   List of columns to be skipped.  First Org automatically discards
  20428   columns with calculation marks and then sends the table to the
  20429   translator function, which then skips columns as specified in
  20430   =skipcols=.
  20431 
  20432 To keep the source table intact in the buffer without being disturbed
  20433 when the source file is compiled or otherwise being worked on, use one
  20434 of these strategies:
  20435 
  20436 - Place the table in a block comment.  For example, in C mode you
  20437   could wrap the table between =/*= and =*/= lines.
  20438 
  20439 - Put the table after an "end" statement.  For example ~\bye~ in TeX
  20440   and ~\end{document}~ in LaTeX.
  20441 
  20442 - Comment and un-comment each line of the table during edits.  The
  20443   {{{kbd(M-x orgtbl-toggle-comment)}}} command makes toggling easy.
  20444 
  20445 *** A LaTeX example of radio tables
  20446 :PROPERTIES:
  20447 :DESCRIPTION: Step by step, almost a tutorial.
  20448 :ALT_TITLE: A LaTeX example
  20449 :END:
  20450 #+cindex: @LaTeX{}, and Orgtbl mode
  20451 
  20452 To wrap a source table in LaTeX, use the =comment= environment
  20453 provided by =comment.sty=[fn:156].  To activate it, put
  20454 ~\usepackage{comment}~ in the document header.  Orgtbl mode inserts
  20455 a radio table skeleton[fn:157] with the command {{{kbd(M-x
  20456 orgtbl-insert-radio-table)}}}, which prompts for a table name.  For
  20457 example, if =salesfigures= is the name, the template inserts:
  20458 
  20459 #+begin_example
  20460 % BEGIN RECEIVE ORGTBL salesfigures
  20461 % END RECEIVE ORGTBL salesfigures
  20462 \begin{comment}
  20463 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
  20464 | | |
  20465 \end{comment}
  20466 #+end_example
  20467 
  20468 #+vindex: LaTeX-verbatim-environments
  20469 #+texinfo: @noindent
  20470 The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
  20471 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
  20472 the table at the target (receive) location named =salesfigures=.  Now
  20473 the table is ready for data entry.  It can even use spreadsheet
  20474 features[fn:158]:
  20475 
  20476 #+begin_example
  20477 % BEGIN RECEIVE ORGTBL salesfigures
  20478 % END RECEIVE ORGTBL salesfigures
  20479 \begin{comment}
  20480 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
  20481 | Month | Days | Nr sold | per day |
  20482 |-------+------+---------+---------|
  20483 | Jan   |   23 |      55 |     2.4 |
  20484 | Feb   |   21 |      16 |     0.8 |
  20485 | March |   22 |     278 |    12.6 |
  20486 ,#+TBLFM: $4=$3/$2;%.1f
  20487 % $ (optional extra dollar to keep Font Lock happy, see footnote)
  20488 \end{comment}
  20489 #+end_example
  20490 
  20491 After editing, {{{kbd(C-c C-c)}}} inserts the translated table at the
  20492 target location, between the two marker lines.
  20493 
  20494 For hand-made custom tables, note that the translator needs to skip
  20495 the first two lines of the source table.  Also the command has to
  20496 /splice/ out the target table without the header and footer.
  20497 
  20498 #+begin_example
  20499 \begin{tabular}{lrrr}
  20500 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
  20501 % BEGIN RECEIVE ORGTBL salesfigures
  20502 % END RECEIVE ORGTBL salesfigures
  20503 \end{tabular}
  20504 %
  20505 \begin{comment}
  20506 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  20507 | Month | Days | Nr sold | per day |
  20508 |-------+------+---------+---------|
  20509 | Jan   |   23 |      55 |     2.4 |
  20510 | Feb   |   21 |      16 |     0.8 |
  20511 | March |   22 |     278 |    12.6 |
  20512 ,#+TBLFM: $4=$3/$2;%.1f
  20513 \end{comment}
  20514 #+end_example
  20515 
  20516 The LaTeX translator function ~orgtbl-to-latex~ is already part of
  20517 Orgtbl mode and uses a =tabular= environment to typeset the table and
  20518 marks horizontal lines with ~\hline~.  For additional parameters to
  20519 control output, see [[*Translator functions]]:
  20520 
  20521 - =:splice BOOLEAN= ::
  20522 
  20523   When {{{var(BOOLEAN}}} is non-~nil~, return only table body lines;
  20524   i.e., not wrapped in =tabular= environment.  Default is ~nil~.
  20525 
  20526 - =:fmt FMT= ::
  20527 
  20528   Format string to warp each field.  It should contain =%s= for the
  20529   original field value.  For example, to wrap each field value in
  20530   dollar symbol, you could use =:fmt "$%s$"=.  Format can also wrap
  20531   a property list with column numbers and formats, for example =:fmt
  20532   (2 "$%s$" 4 "%s\\%%")=.  In place of a string, a function of one
  20533   argument can be used; the function must return a formatted string.
  20534 
  20535 - =:efmt EFMT= ::
  20536 
  20537   Format numbers as exponentials.  The spec should have =%s= twice for
  20538   inserting mantissa and exponent, for example ="%s\\times10^{%s}"=.  This
  20539   may also be a property list with column numbers and formats, for
  20540   example =:efmt (2 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")=.  After
  20541   {{{var(EFMT)}}} has been applied to a value, {{{var(FMT)}}}---see
  20542   above---is also applied.  Functions with two arguments can be
  20543   supplied instead of strings.  By default, no special formatting is
  20544   applied.
  20545 
  20546 *** Translator functions
  20547 :PROPERTIES:
  20548 :DESCRIPTION: Copy and modify.
  20549 :END:
  20550 #+cindex: HTML, and Orgtbl mode
  20551 #+cindex: translator function
  20552 
  20553 #+findex: orgtbl-to-csv
  20554 #+findex: orgtbl-to-tsv
  20555 #+findex: orgtbl-to-latex
  20556 #+findex: orgtbl-to-html
  20557 #+findex: orgtbl-to-texinfo
  20558 #+findex: orgtbl-to-unicode
  20559 #+findex: orgtbl-to-orgtbl
  20560 #+findex: orgtbl-to-generic
  20561 Orgtbl mode has built-in translator functions: ~orgtbl-to-csv~
  20562 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values),
  20563 ~orgtbl-to-latex~, ~orgtbl-to-html~, ~orgtbl-to-texinfo~,
  20564 ~orgtbl-to-unicode~ and ~orgtbl-to-orgtbl~.  They use the generic
  20565 translator, ~orgtbl-to-generic~, which delegates translations to
  20566 various export back-ends.
  20567 
  20568 Properties passed to the function through the =ORGTBL SEND= line take
  20569 precedence over properties defined inside the function.  For example,
  20570 this overrides the default LaTeX line endings, ~\\~, with ~\\[2mm]~:
  20571 
  20572 : #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  20573 
  20574 For a new language translator, define a converter function.  It can be
  20575 a generic function, such as shown in this example.  It marks
  20576 a beginning and ending of a table with =!BTBL!= and =!ETBL!=;
  20577 a beginning and ending of lines with =!BL!= and =!EL!=; and uses a TAB
  20578 for a field separator:
  20579 
  20580 #+begin_src emacs-lisp
  20581 (defun orgtbl-to-language (table params)
  20582   "Convert the orgtbl-mode TABLE to language."
  20583   (orgtbl-to-generic
  20584    table
  20585    (org-combine-plists
  20586     '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
  20587     params)))
  20588 #+end_src
  20589 
  20590 #+texinfo: @noindent
  20591 The documentation for the ~orgtbl-to-generic~ function shows
  20592 a complete list of parameters, each of which can be passed through to
  20593 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
  20594 that generic function.
  20595 
  20596 For complicated translations the generic translator function could be
  20597 replaced by a custom translator function.  Such a custom function must
  20598 take two arguments and return a single string containing the formatted
  20599 table.  The first argument is the table whose lines are a list of
  20600 fields or the symbol ~hline~.  The second argument is the property
  20601 list consisting of parameters specified in the =#+ORGTBL: SEND= line.
  20602 Please share your translator functions by posting them to the Org
  20603 users mailing list, at mailto:emacs-orgmode@gnu.org.
  20604 
  20605 ** Dynamic Blocks
  20606 :PROPERTIES:
  20607 :DESCRIPTION: Automatically filled blocks.
  20608 :END:
  20609 #+cindex: dynamic blocks
  20610 
  20611 Org supports /dynamic blocks/ in Org documents.  They are inserted
  20612 with begin and end markers like any other code block, but the contents
  20613 are updated automatically by a user function.
  20614 
  20615 #+kindex: C-c C-x x
  20616 #+findex: org-dynamic-block-insert-dblock
  20617 You can insert a dynamic block with ~org-dynamic-block-insert-dblock~,
  20618 which is bound to {{{kbd(C-c C-x x)}}} by default.  For example,
  20619 {{{kbd(C-c C-x x c l o c k t a b l e RET)}}} inserts a table that
  20620 updates the work time (see [[*Clocking Work Time]]).
  20621 
  20622 Dynamic blocks can have names and function parameters.  The syntax is
  20623 similar to source code block specifications:
  20624 
  20625 #+begin_example
  20626 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  20627   ...
  20628 ,#+END:
  20629 #+end_example
  20630 
  20631 These commands update dynamic blocks:
  20632 
  20633 - {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
  20634 
  20635   #+kindex: C-c C-x C-u
  20636   #+findex: org-dblock-update
  20637   Update dynamic block at point.
  20638 
  20639 - {{{kbd(C-u C-c C-x C-u)}}} ::
  20640 
  20641   #+kindex: C-u C-c C-x C-u
  20642   Update all dynamic blocks in the current file.
  20643 
  20644 Before updating a dynamic block, Org removes content between the
  20645 =BEGIN= and =END= markers.  Org then reads the parameters on the
  20646 =BEGIN= line for passing to the writer function as a plist.  The
  20647 previous content of the dynamic block becomes erased from the buffer
  20648 and appended to the plist under ~:content~.
  20649 
  20650 The syntax for naming a writer function with a dynamic block labeled
  20651 =myblock= is: ~org-dblock-write:myblock~.
  20652 
  20653 The following is an example of a dynamic block and a block writer function
  20654 that updates the time when the function was last run:
  20655 
  20656 #+begin_example
  20657 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  20658   ...
  20659 ,#+END:
  20660 #+end_example
  20661 
  20662 #+texinfo: @noindent
  20663 The dynamic block's writer function:
  20664 
  20665 #+begin_src emacs-lisp
  20666 (defun org-dblock-write:block-update-time (params)
  20667   (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  20668     (insert "Last block update at: "
  20669             (format-time-string fmt))))
  20670 #+end_src
  20671 
  20672 To keep dynamic blocks up-to-date in an Org file, use the function,
  20673 ~org-update-all-dblocks~ in hook, such as ~before-save-hook~.  The
  20674 ~org-update-all-dblocks~ function does not run if the file is not in
  20675 Org mode.
  20676 
  20677 #+findex: org-narrow-to-block
  20678 Dynamic blocks, like any other block, can be narrowed with
  20679 ~org-narrow-to-block~.
  20680 
  20681 ** Special Agenda Views
  20682 :PROPERTIES:
  20683 :DESCRIPTION: Customized views.
  20684 :END:
  20685 #+cindex: agenda views, user-defined
  20686 
  20687 #+vindex: org-agenda-skip-function
  20688 #+vindex: org-agenda-skip-function-global
  20689 Org provides a special hook to further limit items in agenda views:
  20690 ~agenda~, ~agenda*~[fn:159], ~todo~, ~alltodo~, ~tags~, ~tags-todo~,
  20691 ~tags-tree~.  Specify a custom function that tests inclusion of every
  20692 matched item in the view.  This function can also skip as much as is
  20693 needed.
  20694 
  20695 For a global condition applicable to agenda views, use the
  20696 ~org-agenda-skip-function-global~ variable.  Org uses a global
  20697 condition with ~org-agenda-skip-function~ for custom searching.
  20698 
  20699 This example defines a function for a custom view showing TODO items
  20700 with =waiting= status.  Manually this is a multi-step search process,
  20701 but with a custom view, this can be automated as follows:
  20702 
  20703 The custom function searches the subtree for the =waiting= tag and
  20704 returns ~nil~ on match.  Otherwise it gives the location from where
  20705 the search continues.
  20706 
  20707 #+begin_src emacs-lisp
  20708 (defun my-skip-unless-waiting ()
  20709   "Skip trees that are not waiting"
  20710   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  20711     (if (re-search-forward ":waiting:" subtree-end t)
  20712         nil          ; tag found, do not skip
  20713       subtree-end))) ; tag not found, continue after end of subtree
  20714 #+end_src
  20715 
  20716 To use this custom function in a custom agenda command:
  20717 
  20718 #+begin_src emacs-lisp
  20719 (org-add-agenda-custom-command
  20720  '("b" todo "PROJECT"
  20721    ((org-agenda-skip-function 'my-skip-unless-waiting)
  20722     (org-agenda-overriding-header "Projects waiting for something: "))))
  20723 #+end_src
  20724 
  20725 #+vindex: org-agenda-overriding-header
  20726 Note that this also binds ~org-agenda-overriding-header~ to a more
  20727 meaningful string suitable for the agenda view.
  20728 
  20729 #+vindex: org-odd-levels-only
  20730 #+vindex: org-agenda-skip-function
  20731 Search for entries with a limit set on levels for the custom search.
  20732 This is a general approach to creating custom searches in Org.  To
  20733 include all levels, use =LEVEL>0=[fn:160].  Then to selectively pick
  20734 the matched entries, use ~org-agenda-skip-function~, which also
  20735 accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and
  20736 ~org-agenda-skip-subtree-if~.  For example:
  20737 
  20738 - =(org-agenda-skip-entry-if 'scheduled)= ::
  20739 
  20740   Skip current entry if it has been scheduled.
  20741 
  20742 - =(org-agenda-skip-entry-if 'notscheduled)= ::
  20743 
  20744   Skip current entry if it has not been scheduled.
  20745 
  20746 - =(org-agenda-skip-entry-if 'deadline)= ::
  20747 
  20748   Skip current entry if it has a deadline.
  20749 
  20750 - =(org-agenda-skip-entry-if 'scheduled 'deadline)= ::
  20751 
  20752   Skip current entry if it has a deadline, or if it is scheduled.
  20753 
  20754 - =(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))= ::
  20755 
  20756   Skip current entry if the TODO keyword is TODO or WAITING.
  20757 
  20758 - =(org-agenda-skip-entry-if 'todo 'done)= ::
  20759 
  20760   Skip current entry if the TODO keyword marks a DONE state.
  20761 
  20762 - =(org-agenda-skip-entry-if 'timestamp)= ::
  20763 
  20764   Skip current entry if it has any timestamp, may also be deadline or
  20765   scheduled.
  20766 
  20767 - =(org-agenda-skip-entry-if 'regexp "regular expression")= ::
  20768 
  20769   Skip current entry if the regular expression matches in the entry.
  20770 
  20771 - =(org-agenda-skip-entry-if 'notregexp "regular expression")= ::
  20772 
  20773   Skip current entry unless the regular expression matches.
  20774 
  20775 - =(org-agenda-skip-subtree-if 'regexp "regular expression")= ::
  20776 
  20777   Same as above, but check and skip the entire subtree.
  20778 
  20779 The following is an example of a search for =waiting= without the
  20780 special function:
  20781 
  20782 #+begin_src emacs-lisp
  20783 (org-add-agenda-custom-command
  20784  '("b" todo "PROJECT"
  20785    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  20786                                 'regexp ":waiting:"))
  20787     (org-agenda-overriding-header "Projects waiting for something: "))))
  20788 #+end_src
  20789 
  20790 ** Speeding Up Your Agendas
  20791 :PROPERTIES:
  20792 :DESCRIPTION: Tips on how to speed up your agendas.
  20793 :END:
  20794 #+cindex: agenda views, optimization
  20795 
  20796 Some agenda commands slow down when the Org files grow in size or
  20797 number.  Here are tips to speed up:
  20798 
  20799 - Reduce the number of Org agenda files to avoid slowdowns due to hard drive
  20800   accesses.
  20801 
  20802 - Reduce the number of DONE and archived headlines so agenda
  20803   operations that skip over these can finish faster.
  20804 
  20805 - Do not dim blocked tasks:
  20806   #+vindex: org-agenda-dim-blocked-tasks
  20807 
  20808   #+begin_src emacs-lisp
  20809   (setq org-agenda-dim-blocked-tasks nil)
  20810   #+end_src
  20811 
  20812 - Stop preparing agenda buffers on startup:
  20813   #+vindex: org-startup-folded
  20814   #+vindex: org-agenda-inhibit-startup
  20815 
  20816   #+begin_src emacs-lisp
  20817   (setq org-agenda-inhibit-startup t)
  20818   #+end_src
  20819 
  20820 - Disable tag inheritance for agendas:
  20821   #+vindex: org-agenda-show-inherited-tags
  20822   #+vindex: org-agenda-use-tag-inheritance
  20823 
  20824   #+begin_src emacs-lisp
  20825   (setq org-agenda-use-tag-inheritance nil)
  20826   #+end_src
  20827 
  20828 These options can be applied to selected agenda views.  For more
  20829 details about generation of agenda views, see the docstrings for the
  20830 relevant variables, and this [[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda
  20831 optimization.
  20832 
  20833 ** Extracting Agenda Information
  20834 :PROPERTIES:
  20835 :DESCRIPTION: Post-processing agenda information.
  20836 :END:
  20837 #+cindex: agenda, pipe
  20838 #+cindex: scripts, for agenda processing
  20839 
  20840 Org provides commands to access agendas through Emacs batch mode.
  20841 Through this command-line interface, agendas are automated for further
  20842 processing or printing.
  20843 
  20844 #+vindex: org-agenda-custom-commands
  20845 #+findex: org-batch-agenda
  20846 ~org-batch-agenda~ creates an agenda view in ASCII and outputs to
  20847 standard output.  This command takes one string parameter.  When
  20848 string consists of a single character, Org uses it as a key to
  20849 ~org-agenda-custom-commands~.  These are the same ones available
  20850 through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
  20851 
  20852 This example command line directly prints the TODO list to the printer:
  20853 
  20854 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  20855 
  20856 When the string parameter length is two or more characters, Org
  20857 matches it with tags/TODO strings.  For example, this example command
  20858 line prints items tagged with =shop=, but excludes items tagged with
  20859 =NewYork=:
  20860 
  20861 #+begin_example
  20862 emacs -batch -l ~/.emacs                                      \
  20863       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  20864 #+end_example
  20865 
  20866 #+texinfo: @noindent
  20867 An example showing on-the-fly parameter modifications:
  20868 
  20869 #+begin_example
  20870 emacs -batch -l ~/.emacs                                      \
  20871    -eval '(org-batch-agenda "a"                               \
  20872            org-agenda-span (quote month)                      \
  20873            org-agenda-include-diary nil                       \
  20874            org-agenda-files (quote ("~/org/project.org")))'   \
  20875    | lpr
  20876 #+end_example
  20877 
  20878 #+texinfo: @noindent
  20879 which produces an agenda for the next 30 days from just the
  20880 =~/org/projects.org= file.
  20881 
  20882 #+findex: org-batch-agenda-csv
  20883 For structured processing of agenda output, use ~org-batch-agenda-csv~
  20884 with the following fields:
  20885 
  20886 - category :: The category of the item
  20887 - head :: The headline, without TODO keyword, TAGS and PRIORITY
  20888 - type :: The type of the agenda entry, can be
  20889 
  20890   | ~todo~              | selected in TODO match              |
  20891   | ~tagsmatch~         | selected in tags match              |
  20892   | ~diary~             | imported from diary                 |
  20893   | ~deadline~          | a deadline                          |
  20894   | ~scheduled~         | scheduled                           |
  20895   | ~timestamp~         | appointment, selected by timestamp  |
  20896   | ~closed~            | entry was closed on date            |
  20897   | ~upcoming-deadline~ | warning about nearing deadline      |
  20898   | ~past-scheduled~    | forwarded scheduled item            |
  20899   | ~block~             | entry has date block including date |
  20900 
  20901 - todo :: The TODO keyword, if any
  20902 - tags :: All tags including inherited ones, separated by colons
  20903 - date :: The relevant date, like =2007-2-14=
  20904 - time :: The time, like =15:00-16:50=
  20905 - extra :: String with extra planning info
  20906 - priority-l :: The priority letter if any was given
  20907 - priority-n :: The computed numerical priority
  20908 
  20909 If the selection of the agenda item was based on a timestamp,
  20910 including those items with =DEADLINE= and =SCHEDULED= keywords, then
  20911 Org includes date and time in the output.
  20912 
  20913 If the selection of the agenda item was based on a timestamp  (or
  20914 deadline/scheduled), then Org includes date and time in the output.
  20915 
  20916 Here is an example of a post-processing script in Perl.  It takes the
  20917 CSV output from Emacs and prints with a checkbox:
  20918 
  20919 #+begin_src perl
  20920 #!/usr/bin/perl
  20921 
  20922 # define the Emacs command to run
  20923 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  20924 
  20925 # run it and capture the output
  20926 $agenda = qx{$cmd 2>/dev/null};
  20927 
  20928 # loop over all lines
  20929 foreach $line (split(/\n/,$agenda)) {
  20930     # get the individual values
  20931     ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  20932      $priority_l,$priority_n) = split(/,/,$line);
  20933     # process and print
  20934     print "[ ] $head\n";
  20935 }
  20936 #+end_src
  20937 
  20938 ** Using the Property API
  20939 :PROPERTIES:
  20940 :DESCRIPTION: Writing programs that use entry properties.
  20941 :END:
  20942 #+cindex: API, for properties
  20943 #+cindex: properties, API
  20944 
  20945 Here is a description of the functions that can be used to work with
  20946 properties.
  20947 
  20948 #+attr_texinfo: :options org-entry-properties &optional pom which
  20949 #+begin_defun
  20950 Get all properties of the entry at point-or-marker {{{var(POM)}}}.
  20951 This includes the TODO keyword, the tags, time strings for deadline,
  20952 scheduled, and clocking, and any additional properties defined in the
  20953 entry.  The return value is an alist.  Keys may occur multiple times
  20954 if the property key was used several times.  {{{var(POM)}}} may also
  20955 be ~nil~, in which case the current entry is used.  If
  20956 {{{var(WHICH)}}} is ~nil~ or ~all~, get all properties.  If
  20957 {{{var(WHICH)}}} is ~special~ or ~standard~, only get that subclass.
  20958 #+end_defun
  20959 
  20960 #+vindex: org-use-property-inheritance
  20961 #+findex: org-insert-property-drawer
  20962 #+attr_texinfo: :options org-entry-get pom property &optional inherit
  20963 #+begin_defun
  20964 Get value of {{{var(PROPERTY)}}} for entry at point-or-marker
  20965 {{{var(POM)}}}.  By default, this only looks at properties defined
  20966 locally in the entry.  If {{{var(INHERIT)}}} is non-~nil~ and the
  20967 entry does not have the property, then also check higher levels of the
  20968 hierarchy.  If {{{var(INHERIT)}}} is the symbol ~selective~, use
  20969 inheritance if and only if the setting of
  20970 ~org-use-property-inheritance~ selects {{{var(PROPERTY)}}} for
  20971 inheritance.
  20972 #+end_defun
  20973 
  20974 #+attr_texinfo: :options org-entry-delete pom property
  20975 #+begin_defun
  20976 Delete the property {{{var(PROPERTY)}}} from entry at point-or-marker
  20977 {{{var(POM)}}}.
  20978 #+end_defun
  20979 
  20980 #+attr_texinfo: :options org-entry-put pom property value
  20981 #+begin_defun
  20982 Set {{{var(PROPERTY)}}} to {{{var(VALUES)}}} for entry at
  20983 point-or-marker POM.
  20984 #+end_defun
  20985 
  20986 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
  20987 #+begin_defun
  20988 Get all property keys in the current buffer.
  20989 #+end_defun
  20990 
  20991 #+attr_texinfo: :options org-insert-property-drawer
  20992 #+begin_defun
  20993 Insert a property drawer for the current entry.  Also
  20994 #+end_defun
  20995 
  20996 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
  20997 #+begin_defun
  20998 Set {{{var(PROPERTY)}}} at point-or-marker {{{var(POM)}}} to
  20999 {{{var(VALUES)}}}.  {{{var(VALUES)}}} should be a list of strings.
  21000 They are concatenated, with spaces as separators.
  21001 #+end_defun
  21002 
  21003 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
  21004 #+begin_defun
  21005 Treat the value of the property {{{var(PROPERTY)}}} as
  21006 a whitespace-separated list of values and return the values as a list
  21007 of strings.
  21008 #+end_defun
  21009 
  21010 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
  21011 #+begin_defun
  21012 Treat the value of the property {{{var(PROPERTY)}}} as
  21013 a whitespace-separated list of values and make sure that
  21014 {{{var(VALUE)}}} is in this list.
  21015 #+end_defun
  21016 
  21017 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
  21018 #+begin_defun
  21019 Treat the value of the property {{{var(PROPERTY)}}} as
  21020 a whitespace-separated list of values and make sure that
  21021 {{{var(VALUE)}}} is /not/ in this list.
  21022 #+end_defun
  21023 
  21024 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
  21025 #+begin_defun
  21026 Treat the value of the property {{{var(PROPERTY)}}} as
  21027 a whitespace-separated list of values and check if {{{var(VALUE)}}} is
  21028 in this list.
  21029 #+end_defun
  21030 
  21031 #+attr_texinfo: :options org-property-allowed-value-functions
  21032 #+begin_defopt
  21033 Hook for functions supplying allowed values for a specific property.
  21034 The functions must take a single argument, the name of the property,
  21035 and return a flat list of allowed values.  If =:ETC= is one of the
  21036 values, use the values as completion help, but allow also other values
  21037 to be entered.  The functions must return ~nil~ if they are not
  21038 responsible for this property.
  21039 #+end_defopt
  21040 
  21041 ** Using the Mapping API
  21042 :PROPERTIES:
  21043 :DESCRIPTION: Mapping over all or selected entries.
  21044 :END:
  21045 #+cindex: API, for mapping
  21046 #+cindex: mapping entries, API
  21047 
  21048 Org has sophisticated mapping capabilities to find all entries
  21049 satisfying certain criteria.  Internally, this functionality is used
  21050 to produce agenda views, but there is also an API that can be used to
  21051 execute arbitrary functions for each or selected entries.  The main
  21052 entry point for this API is:
  21053 
  21054 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
  21055 #+begin_defun
  21056 Call {{{var(FUNC)}}} at each headline selected by {{{var(MATCH)}}} in
  21057 {{{var(SCOPE)}}}.
  21058 
  21059 {{{var(FUNC)}}} is a function or a Lisp form.  With point positioned
  21060 at the beginning of the headline, call the function without arguments.
  21061 Org returns an alist of return values of calls to the function.
  21062 
  21063 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in
  21064 ~save-excursion~ form.  After evaluation, Org moves point to the end
  21065 of the line that was just processed.  Search continues from that point
  21066 forward.  This may not always work as expected under some conditions,
  21067 such as if the current sub-tree was removed by a previous archiving
  21068 operation.  In such rare circumstances, Org skips the next entry
  21069 entirely when it should not.  To stop Org from such skips, make
  21070 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
  21071 buffer position.
  21072 
  21073 {{{var(MATCH)}}} is a tags/property/TODO match.  Org iterates only
  21074 matched headlines.  Org iterates over all headlines when
  21075 {{{var(MATCH)}}} is ~nil~ or ~t~.
  21076 
  21077 {{{var(SCOPE)}}} determines the scope of this command.  It can be any
  21078 of:
  21079 
  21080 - ~nil~ ::
  21081 
  21082   The current buffer, respecting the restriction, if any.
  21083 
  21084 - ~tree~ ::
  21085 
  21086   The subtree started with the entry at point.
  21087 
  21088 - ~region~ ::
  21089 
  21090   The entries within the active region, if any.
  21091 
  21092 - ~file~ ::
  21093 
  21094   The current buffer, without restriction.
  21095 
  21096 - ~file-with-archives~ ::
  21097 
  21098   The current buffer, and any archives associated with it.
  21099 
  21100 - ~agenda~ ::
  21101 
  21102   All agenda files.
  21103 
  21104 - ~agenda-with-archives~ ::
  21105 
  21106   All agenda files with any archive files associated with them.
  21107 
  21108 - list of filenames ::
  21109 
  21110   If this is a list, all files in the list are scanned.
  21111 
  21112 #+texinfo: @noindent
  21113 The remaining arguments are treated as settings for the scanner's
  21114 skipping facilities.  Valid arguments are:
  21115 
  21116 - ~archive~ ::
  21117 
  21118   Skip trees with the =ARCHIVE= tag.
  21119 
  21120 - ~comment~ ::
  21121 
  21122   Skip trees with the COMMENT keyword.
  21123 
  21124 - function or Lisp form ::
  21125 
  21126   #+vindex: org-agenda-skip-function
  21127   Used as value for ~org-agenda-skip-function~, so whenever the
  21128   function returns ~t~, {{{var(FUNC)}}} is called for that entry and
  21129   search continues from the point where the function leaves it.
  21130 #+end_defun
  21131 
  21132 The mapping routine can call any arbitrary function, even functions
  21133 that change meta data or query the property API (see [[*Using the
  21134 Property API]]).  Here are some handy functions:
  21135 
  21136 #+attr_texinfo: :options org-todo &optional arg
  21137 #+begin_defun
  21138 Change the TODO state of the entry.  See the docstring of the
  21139 functions for the many possible values for the argument
  21140 {{{var(ARG)}}}.
  21141 #+end_defun
  21142 
  21143 #+attr_texinfo: :options org-priority &optional action
  21144 #+begin_defun
  21145 Change the priority of the entry.  See the docstring of this function
  21146 for the possible values for {{{var(ACTION)}}}.
  21147 #+end_defun
  21148 
  21149 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
  21150 #+begin_defun
  21151 Toggle the tag {{{var(TAG)}}} in the current entry.  Setting
  21152 {{{var(ONOFF)}}} to either ~on~ or ~off~ does not toggle tag, but
  21153 ensure that it is either on or off.
  21154 #+end_defun
  21155 
  21156 #+attr_texinfo: :options org-promote
  21157 #+begin_defun
  21158 Promote the current entry.
  21159 #+end_defun
  21160 
  21161 #+attr_texinfo: :options org-demote
  21162 #+begin_defun
  21163 Demote the current entry.
  21164 #+end_defun
  21165 
  21166 This example turns all entries tagged with =TOMORROW= into TODO
  21167 entries with keyword =UPCOMING=.  Org ignores entries in comment trees
  21168 and archive trees.
  21169 
  21170 #+begin_src emacs-lisp
  21171 (org-map-entries '(org-todo "UPCOMING")
  21172                  "+TOMORROW" 'file 'archive 'comment)
  21173 #+end_src
  21174 
  21175 The following example counts the number of entries with TODO keyword
  21176 =WAITING=, in all agenda files.
  21177 
  21178 #+begin_src emacs-lisp
  21179 (length (org-map-entries t "/+WAITING" 'agenda))
  21180 #+end_src
  21181 
  21182 * History and Acknowledgments
  21183 :PROPERTIES:
  21184 :DESCRIPTION: How Org came into being.
  21185 :APPENDIX: t
  21186 :END:
  21187 
  21188 ** From Carsten
  21189 :PROPERTIES:
  21190 :UNNUMBERED: notoc
  21191 :END:
  21192 
  21193 Org was born in 2003, out of frustration over the user interface of
  21194 the Emacs Outline mode.  I was trying to organize my notes and
  21195 projects, and using Emacs seemed to be the natural way to go.
  21196 However, having to remember eleven different commands with two or
  21197 three keys per command, only to hide and show parts of the outline
  21198 tree, that seemed entirely unacceptable to me.  Also, when using
  21199 outlines to take notes, I constantly wanted to restructure the tree,
  21200 organizing it parallel to my thoughts and plans.  /Visibility cycling/
  21201 and /structure editing/ were originally implemented in the package
  21202 =outline-magic.el=, but quickly moved to the more general =org.el=.
  21203 As this environment became comfortable for project planning, the next
  21204 step was adding /TODO entries/, basic /timestamps/, and /table
  21205 support/.  These areas highlighted the two main goals that Org still
  21206 has today: to be a new, outline-based, plain text mode with innovative
  21207 and intuitive editing features, and to incorporate project planning
  21208 functionality directly into a notes file.
  21209 
  21210 Since the first release, literally thousands of emails to me or to the
  21211 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
  21212 new ideas, and sometimes patches and add-on code.  Many thanks to
  21213 everyone who has helped to improve this package.  I am trying to keep
  21214 here a list of the people who had significant influence in shaping one
  21215 or more aspects of Org.  The list may not be complete, if I have
  21216 forgotten someone, please accept my apologies and let me know.
  21217 
  21218 Before I get to this list, a few special mentions are in order:
  21219 
  21220 - Bastien Guerry ::
  21221 
  21222   Bastien has written a large number of extensions to Org (most of
  21223   them integrated into the core by now), including the LaTeX exporter
  21224   and the plain list parser.  His support during the early days was
  21225   central to the success of this project.  Bastien also invented Worg,
  21226   helped establishing the Web presence of Org, and sponsored hosting
  21227   costs for the orgmode.org website.  Bastien stepped in as maintainer
  21228   of Org between 2011 and 2013, at a time when I desperately needed
  21229   a break.
  21230 
  21231 - Eric Schulte and Dan Davison ::
  21232 
  21233   Eric and Dan are jointly responsible for the Org Babel system, which
  21234   turns Org into a multi-language environment for evaluating code and
  21235   doing literate programming and reproducible research.  This has
  21236   become one of Org's killer features that define what Org is today.
  21237 
  21238 - John Wiegley ::
  21239 
  21240   John has contributed a number of great ideas and patches directly to
  21241   Org, including the attachment system (=org-attach.el=), integration
  21242   with Apple Mail (=org-mac-message.el=), hierarchical dependencies of
  21243   TODO items, habit tracking (=org-habits.el=), and encryption
  21244   (=org-crypt.el=).  Also, the capture system is really an extended
  21245   copy of his great =remember.el=.
  21246 
  21247 - Sebastian Rose ::
  21248 
  21249   Without Sebastian, the HTML/XHTML publishing of Org would be the
  21250   pitiful work of an ignorant amateur.  Sebastian has pushed this part
  21251   of Org onto a much higher level.  He also wrote =org-info.js=,
  21252   a JavaScript program for displaying webpages derived from Org using
  21253   an Info-like or a folding interface with single-key navigation.
  21254 
  21255 See below for the full list of contributions!  Again, please let me
  21256 know what I am missing here!
  21257 
  21258 ** From Bastien
  21259 :PROPERTIES:
  21260 :UNNUMBERED: notoc
  21261 :END:
  21262 
  21263 I (Bastien) have been maintaining Org between 2011 and 2013.  This
  21264 appendix would not be complete without adding a few more
  21265 acknowledgments and thanks.
  21266 
  21267 I am first grateful to Carsten for his trust while handing me over the
  21268 maintainership of Org.  His unremitting support is what really helped
  21269 me getting more confident over time, with both the community and the
  21270 code.
  21271 
  21272 When I took over maintainership, I knew I would have to make Org more
  21273 collaborative than ever, as I would have to rely on people that are
  21274 more knowledgeable than I am on many parts of the code.  Here is
  21275 a list of the persons I could rely on, they should really be
  21276 considered co-maintainers, either of the code or the community:
  21277 
  21278 - Eric Schulte ::
  21279 
  21280   Eric is maintaining the Babel parts of Org.  His reactivity here
  21281   kept me away from worrying about possible bugs here and let me focus
  21282   on other parts.
  21283 
  21284 - Nicolas Goaziou ::
  21285 
  21286   Nicolas is maintaining the consistency of the deepest parts of Org.
  21287   His work on =org-element.el= and =ox.el= has been outstanding, and
  21288   it opened the doors for many new ideas and features.  He rewrote
  21289   many of the old exporters to use the new export engine, and helped
  21290   with documenting this major change.  More importantly (if that's
  21291   possible), he has been more than reliable during all the work done
  21292   for Org 8.0, and always very reactive on the mailing list.
  21293 
  21294 - Achim Gratz ::
  21295 
  21296   Achim rewrote the building process of Org, turning some /ad hoc/
  21297   tools into a flexible and conceptually clean process.  He patiently
  21298   coped with the many hiccups that such a change can create for users.
  21299 
  21300 - Nick Dokos ::
  21301 
  21302   The Org mode mailing list would not be such a nice place without
  21303   Nick, who patiently helped users so many times.  It is impossible to
  21304   overestimate such a great help, and the list would not be so active
  21305   without him.
  21306 
  21307 I received support from so many users that it is clearly impossible to
  21308 be fair when shortlisting a few of them, but Org's history would not
  21309 be complete if the ones above were not mentioned in this manual.
  21310 
  21311 ** List of Contributions
  21312 :PROPERTIES:
  21313 :UNNUMBERED: notoc
  21314 :END:
  21315 
  21316 - Russell Adams came up with the idea for drawers.
  21317 
  21318 - Thomas Baumann wrote =ol-bbdb.el= and =ol-mhe.el=.
  21319 
  21320 - Christophe Bataillon created the great unicorn logo that we use on
  21321   the Org mode website.
  21322 
  21323 - Alex Bochannek provided a patch for rounding timestamps.
  21324 
  21325 - Jan Böcker wrote =ol-docview.el=.
  21326 
  21327 - Brad Bozarth showed how to pull RSS feed data into Org files.
  21328 
  21329 - Tom Breton wrote =org-choose.el=.
  21330 
  21331 - Charles Cave's suggestion sparked the implementation of templates
  21332   for Remember, which are now templates for capture.
  21333 
  21334 - Timothy E Chapman worked on a complete overhaul of the orgmode.org
  21335   website in 2020 and helped fixing various bugs.
  21336 
  21337 - Pavel Chalmoviansky influenced the agenda treatment of items with
  21338   specified time.
  21339 
  21340 - Gregory Chernov patched support for Lisp forms into table
  21341   calculations and improved XEmacs compatibility, in particular by
  21342   porting =nouline.el= to XEmacs.
  21343 
  21344 - Sacha Chua suggested copying some linking code from Planner.
  21345 
  21346 - Baoqiu Cui contributed the DocBook exporter.
  21347 
  21348 - Eddward DeVilla proposed and tested checkbox statistics.  He also
  21349   came up with the idea of properties, and that there should be an API
  21350   for them.
  21351 
  21352 - Nick Dokos tracked down several nasty bugs.
  21353 
  21354 - Kees Dullemond used to edit projects lists directly in HTML and so
  21355   inspired some of the early development, including HTML export.  He
  21356   also asked for a way to narrow wide table columns.
  21357 
  21358 - Thomas\nbsp{}S.\nbsp{}Dye contributed documentation on Worg and helped
  21359   integrating the Org Babel documentation into the manual.
  21360 
  21361 - Christian Egli converted the documentation into Texinfo format,
  21362   inspired the agenda, patched CSS formatting into the HTML exporter,
  21363   and wrote =org-taskjuggler.el=.
  21364 
  21365 - David Emery provided a patch for custom CSS support in exported HTML
  21366   agendas.
  21367 
  21368 - Nic Ferrier contributed mailcap and XOXO support.
  21369 
  21370 - Miguel\nbsp{}A.\nbsp{}Figueroa-Villanueva implemented hierarchical checkboxes.
  21371 
  21372 - John Foerch figured out how to make incremental search show context
  21373   around a match in a hidden outline tree.
  21374 
  21375 - Raimar Finken wrote =org-git-line.el=.
  21376 
  21377 - Mikael Fornius works as a mailing list moderator.
  21378 
  21379 - Austin Frank works as a mailing list moderator.
  21380 
  21381 - Eric Fraga drove the development of Beamer export with ideas and
  21382   testing.
  21383 
  21384 - Barry Gidden did proofreading the manual in preparation for the book
  21385   publication through Network Theory Ltd.
  21386 
  21387 - Niels Giesen had the idea to automatically archive DONE trees.
  21388 
  21389 - Nicolas Goaziou rewrote much of the plain list code.
  21390 
  21391 - Kai Grossjohann pointed out key-binding conflicts with other
  21392   packages.
  21393 
  21394 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
  21395   a book.
  21396 
  21397 - Bernt Hansen has driven much of the support for auto-repeating
  21398   tasks, task state change logging, and the clocktable.  His clear
  21399   explanations have been critical when we started to adopt the Git
  21400   version control system.
  21401 
  21402 - Manuel Hermenegildo has contributed various ideas, small fixes and
  21403   patches.
  21404 
  21405 - Phil Jackson wrote =ol-irc.el=.
  21406 
  21407 - Scott Jaderholm proposed footnotes, control over whitespace between
  21408   folded entries, and column view for properties.
  21409 
  21410 - Matt Jones wrote MobileOrg Android.
  21411 
  21412 - Tokuya Kameshima wrote =org-wl.el= and =org-mew.el=.
  21413 
  21414 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it.  He also
  21415   provided frequent feedback and some patches.
  21416 
  21417 - Matt Lundin has proposed last-row references for table formulas and
  21418   named invisible anchors.  He has also worked a lot on the FAQ.
  21419 
  21420 - David Maus wrote =org-atom.el=, maintains the issues file for Org,
  21421   and is a prolific contributor on the mailing list with competent
  21422   replies, small fixes and patches.
  21423 
  21424 - Jason\nbsp{}F.\nbsp{}McBrayer suggested agenda export to CSV format.
  21425 
  21426 - Kyle Meyer helped setting up the [[https://public-inbox.org/][public-inbox]] archive of the [[https://orgmode.org/list/][Org
  21427   mailing list]] and has been fixing many bugs.
  21428 
  21429 - Max Mikhanosha came up with the idea of refiling.
  21430 
  21431 - Dmitri Minaev sent a patch to set priority limits on a per-file
  21432   basis.
  21433 
  21434 - Stefan Monnier provided a patch to keep the Emacs Lisp compiler
  21435   happy.
  21436 
  21437 - Richard Moreland wrote MobileOrg for the iPhone.
  21438 
  21439 - Rick Moynihan proposed allowing multiple TODO sequences in a file
  21440   and being able to quickly restrict the agenda to a subtree.
  21441 
  21442 - Todd Neal provided patches for links to Info files and Elisp forms.
  21443 
  21444 - Greg Newman refreshed the unicorn logo into its current form.
  21445 
  21446 - Tim O'Callaghan suggested in-file links, search options for general
  21447   file links, and tags.
  21448 
  21449 - Osamu Okano wrote =orgcard2ref.pl=, a Perl program to create a text
  21450   version of the reference card.
  21451 
  21452 - Takeshi Okano translated the manual and David O'Toole's tutorial
  21453   into Japanese.
  21454 
  21455 - Oliver Oppitz suggested multi-state TODO items.
  21456 
  21457 - Scott Otterson sparked the introduction of descriptive text for
  21458   links, among other things.
  21459 
  21460 - Pete Phillips helped during the development of the TAGS feature,
  21461   and provided frequent feedback.
  21462 
  21463 - Martin Pohlack provided the code snippet to bundle character
  21464   insertion into bundles of 20 for undo.
  21465 
  21466 - Ihor Radchenko helped with fixing bugs and improving the user
  21467   experience regarding Org's speed.
  21468 
  21469 - T.\nbsp{}V.\nbsp{}Raman reported bugs and suggested improvements.
  21470 
  21471 - Matthias Rempe (Oelde) provided ideas, Windows support, and quality
  21472   control.
  21473 
  21474 - Paul Rivier provided the basic implementation of named footnotes.
  21475   He also acted as mailing list moderator for some time.
  21476 
  21477 - Kevin Rogers contributed code to access VM files on remote hosts.
  21478 
  21479 - Frank Ruell solved the mystery of the =keymapp nil= bug, a conflict
  21480   with =allout.el=.
  21481 
  21482 - Jason Riedy generalized the send-receive mechanism for Orgtbl
  21483   tables with extensive patches.
  21484 
  21485 - Philip Rooke created the Org reference card, provided lots of
  21486   feedback, developed and applied standards to the Org documentation.
  21487 
  21488 - Christian Schlauer proposed angular brackets around links, among
  21489   other things.
  21490 
  21491 - Paul Sexton wrote =org-ctags.el=.
  21492 
  21493 - Tom Shannon's =organizer-mode.el= inspired linking to VM/BBDB/Gnus.
  21494 
  21495 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
  21496   literal examples, and remote highlighting for referenced code lines.
  21497 
  21498 - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is
  21499   now packaged into the [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository.
  21500 
  21501 - Daniel Sinder came up with the idea of internal archiving by locking
  21502   subtrees.
  21503 
  21504 - Dale Smith proposed link abbreviations.
  21505 
  21506 - James TD Smith has contributed a large number of patches for
  21507   useful tweaks and features.
  21508 
  21509 - Adam Spiers asked for global linking commands, inspired the link
  21510   extension system, added support for Mairix, and proposed the mapping
  21511   API.
  21512 
  21513 - Ulf Stegemann created the table to translate special symbols to
  21514   HTML, LaTeX, UTF-8, Latin-1 and ASCII.
  21515 
  21516 - Andy Stewart contributed code to =ol-w3m.el=, to copy
  21517   HTML content with links transformation to Org syntax.
  21518 
  21519 - David O'Toole wrote =org-publish.el= and drafted the
  21520   manual chapter about publishing.
  21521 
  21522 - Jambunathan\nbsp{}K.\nbsp{}contributed the ODT exporter.
  21523 
  21524 - Sebastien Vauban reported many issues with LaTeX and Beamer export
  21525   and enabled source code highlighting in Gnus.
  21526 
  21527 - Stefan Vollmar organized a video-recorded talk at the
  21528   Max-Planck-Institute for Neurology.  He also inspired the creation
  21529   of a concept index for HTML export.
  21530 
  21531 - Jürgen Vollmer contributed code generating the table of contents in
  21532   HTML output.
  21533 
  21534 - Samuel Wales has provided important feedback and bug reports.
  21535 
  21536 - Chris Wallace provided a patch implementing the =QUOTE= block.
  21537 
  21538 - David Wainberg suggested archiving, and improvements to the
  21539   linking system.
  21540 
  21541 - Carsten Wimmer suggested some changes and helped fix a bug in
  21542   linking to Gnus.
  21543 
  21544 - Roland Winkler requested additional key bindings to make Org work on
  21545   a TTY.
  21546 
  21547 - Piotr Zielinski wrote =org-mouse.el=, proposed agenda
  21548   blocks and contributed various ideas and code snippets.
  21549 
  21550 - Marco Wahl wrote =ol-eww.el=.
  21551 
  21552 * GNU Free Documentation License
  21553 :PROPERTIES:
  21554 :APPENDIX: t
  21555 :DESCRIPTION: The license for this documentation.
  21556 :END:
  21557 
  21558 #+include: fdl.org
  21559 
  21560 * Main Index
  21561 :PROPERTIES:
  21562 :INDEX:    cp
  21563 :DESCRIPTION: An index of Org's concepts and features.
  21564 :END:
  21565 
  21566 * Key Index
  21567 :PROPERTIES:
  21568 :DESCRIPTION: Key bindings and where they are described.
  21569 :INDEX:    ky
  21570 :END:
  21571 
  21572 * Command and Function Index
  21573 :PROPERTIES:
  21574 :DESCRIPTION: Command names and some internal functions.
  21575 :INDEX:    fn
  21576 :END:
  21577 
  21578 * Variable Index
  21579 :PROPERTIES:
  21580 :DESCRIPTION: Variables mentioned in the manual.
  21581 :INDEX:    vr
  21582 :END:
  21583 
  21584 This is not a complete index of variables and faces, only the ones
  21585 that are mentioned in the manual.  For a more complete list, use
  21586 {{{kbd(M-x org-customize)}}} and then click yourself through the tree.
  21587 
  21588 * Copying
  21589 :PROPERTIES:
  21590 :copying:  t
  21591 :END:
  21592 
  21593 This manual is for Org version {{{version}}}.
  21594 
  21595 Copyright \copy 2004--2021 Free Software Foundation, Inc.
  21596 
  21597 #+begin_quote
  21598 Permission is granted to copy, distribute and/or modify this document
  21599 under the terms of the GNU Free Documentation License, Version 1.3 or
  21600 any later version published by the Free Software Foundation; with no
  21601 Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
  21602 and with the Back-Cover Texts as in (a) below.  A copy of the license
  21603 is included in the section entitled "GNU Free Documentation License."
  21604 
  21605 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  21606 modify this GNU manual."
  21607 #+end_quote
  21608 
  21609 * Export Setup                                                          :noexport:
  21610 
  21611 #+setupfile: doc-setup.org
  21612 
  21613 #+export_file_name: org.texi
  21614 
  21615 #+texinfo_dir_category: Emacs editing modes
  21616 #+texinfo_dir_title: Org Mode: (org)
  21617 #+texinfo_dir_desc: Outline-based notes management and organizer
  21618 
  21619 * Footnotes
  21620 
  21621 [fn:1] If you do not use Font Lock globally turn it on in Org buffer
  21622 with =(add-hook 'org-mode-hook #'turn-on-font-lock)=.
  21623 
  21624 [fn:2] Please consider subscribing to the mailing list in order to
  21625 minimize the work the mailing list moderators have to do.
  21626 
  21627 [fn:3] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
  21628 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
  21629 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines.  Note
  21630 also that clocking only works with headings indented less than 30
  21631 stars.
  21632 
  21633 [fn:4] See, however, the option ~org-cycle-emulate-tab~.
  21634 
  21635 [fn:5] The indirect buffer contains the entire buffer, but is narrowed
  21636 to the current tree.  Editing the indirect buffer also changes the
  21637 original buffer, but without affecting visibility in that buffer.  For
  21638 more information about indirect buffers, see [[info:emacs#Indirect Buffers][GNU Emacs Manual]].
  21639 
  21640 [fn:6] When ~org-agenda-inhibit-startup~ is non-~nil~, Org does not
  21641 honor the default visibility state when first opening a file for the
  21642 agenda (see [[*Speeding Up Your Agendas]]).
  21643 
  21644 [fn:7] See also the variable ~org-show-context-detail~ to decide how
  21645 much context is shown around each match.
  21646 
  21647 [fn:8] This depends on the option ~org-remove-highlights-with-change~.
  21648 
  21649 [fn:9] When using =*= as a bullet, lines must be indented so that they
  21650 are not interpreted as headlines.  Also, when you are hiding leading
  21651 stars to get a clean outline view, plain list items starting with
  21652 a star may be hard to distinguish from true headlines.  In short: even
  21653 though =*= is supported, it may be better to not use it for plain list
  21654 items.
  21655 
  21656 [fn:10] You can filter out any of them by configuring
  21657 ~org-plain-list-ordered-item-terminator~.
  21658 
  21659 [fn:11] You can also get =a.=, =A.=, =a)= and =A)= by configuring
  21660 ~org-list-allow-alphabetical~.  To minimize confusion with normal
  21661 text, those are limited to one character only.  Beyond that limit,
  21662 bullets automatically become numbers.
  21663 
  21664 [fn:12] If there's a checkbox in the item, the cookie must be put
  21665 /before/ the checkbox.  If you have activated alphabetical lists, you
  21666 can also use counters like =[@b]=.
  21667 
  21668 [fn:13] If you do not want the item to be split, customize the
  21669 variable ~org-M-RET-may-split-line~.
  21670 
  21671 [fn:14] If you want to cycle around items that way, you may customize
  21672 ~org-list-use-circular-motion~.
  21673 
  21674 [fn:15] See ~org-list-use-circular-motion~ for a cyclic behavior.
  21675 
  21676 [fn:16] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
  21677 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
  21678 
  21679 [fn:17] To insert a vertical bar into a table field, use =\vert= or,
  21680 inside a word =abc\vert{}def=.
  21681 
  21682 [fn:18] Org understands references typed by the user as =B4=, but it
  21683 does not use this syntax when offering a formula for editing.  You can
  21684 customize this behavior using the variable
  21685 ~org-table-use-standard-references~.
  21686 
  21687 [fn:19] The computation time scales as O(N^2) because table
  21688 {{{var(FOO)}}} is parsed for each field to be copied.
  21689 
  21690 [fn:20] The file =constants.el= can supply the values of constants in
  21691 two different unit systems, =SI= and =cgs=.  Which one is used depends
  21692 on the value of the variable ~constants-unit-system~.  You can use the
  21693 =STARTUP= options =constSI= and =constcgs= to set this value for the
  21694 current buffer.
  21695 
  21696 [fn:21] The printf reformatting is limited in precision because the
  21697 value passed to it is converted into an "integer" or "double".  The
  21698 "integer" is limited in size by truncating the signed value to 32
  21699 bits.  The "double" is limited in precision to 64 bits overall which
  21700 leaves approximately 16 significant decimal digits.
  21701 
  21702 [fn:22] Such names must start with an alphabetic character and use
  21703 only alphanumeric/underscore characters.
  21704 
  21705 [fn:23] Plain URIs are recognized only for a well-defined set of
  21706 schemes.  See [[*External Links]].  Unlike URI syntax, they cannot contain
  21707 parenthesis or white spaces, either.  URIs within angle brackets have
  21708 no such limitation.
  21709 
  21710 [fn:24] More accurately, the precise behavior depends on how point
  21711 arrived there---see [[info:elisp#Invisible Text][Invisible Text]].
  21712 
  21713 [fn:25] To insert a link targeting a headline, in-buffer completion
  21714 can be used.  Just type a star followed by a few optional letters into
  21715 the buffer and press {{{kbd(M-TAB)}}}.  All headlines in the current
  21716 buffer are offered as completions.
  21717 
  21718 [fn:26] When targeting a =NAME= keyword, the =CAPTION= keyword is
  21719 mandatory in order to get proper numbering (see [[*Captions]]).
  21720 
  21721 [fn:27] The actual behavior of the search depends on the value of the
  21722 variable ~org-link-search-must-match-exact-headline~.  If its value is
  21723 ~nil~, then a fuzzy text search is done.  If it is ~t~, then only the
  21724 exact headline is matched, ignoring spaces and statistic cookies.  If
  21725 the value is ~query-to-create~, then an exact headline is searched; if
  21726 it is not found, then the user is queried to create it.
  21727 
  21728 [fn:28] If the headline contains a timestamp, it is removed from the
  21729 link, which results in a wrong link---you should avoid putting
  21730 a timestamp in the headline.
  21731 
  21732 [fn:29] The Org Id library must first be loaded, either through
  21733 ~org-customize~, by enabling ~id~ in ~org-modules~, or by adding
  21734 =(require 'org-id)= in your Emacs init file.
  21735 
  21736 [fn:30] Note that you do not have to use this command to insert
  21737 a link.  Links in Org are plain text, and you can type or paste them
  21738 straight into the buffer.  By using this command, the links are
  21739 automatically enclosed in double brackets, and you will be asked for
  21740 the optional descriptive text.
  21741 
  21742 [fn:31] After insertion of a stored link, the link will be removed
  21743 from the list of stored links.  To keep it in the list for later use,
  21744 use a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
  21745 configure the option ~org-link-keep-stored-after-insertion~.
  21746 
  21747 [fn:32] This works if a function has been defined in the ~:complete~
  21748 property of a link in ~org-link-parameters~.
  21749 
  21750 [fn:33] See the variable ~org-link-use-indirect-buffer-for-internals~.
  21751 
  21752 [fn:34] For backward compatibility, line numbers can also follow a
  21753 single colon.
  21754 
  21755 [fn:35] Of course, you can make a document that contains only long
  21756 lists of TODO items, but this is not required.
  21757 
  21758 [fn:36] Changing the variable ~org-todo-keywords~ only becomes
  21759 effective after restarting Org mode in a buffer.
  21760 
  21761 [fn:37] This is also true for the {{{kbd(t)}}} command in the agenda
  21762 buffer.
  21763 
  21764 [fn:38] All characters are allowed except =@=, =^= and =!=, which have
  21765 a special meaning here.
  21766 
  21767 [fn:39] Check also the variable ~org-fast-tag-selection-include-todo~,
  21768 it allows you to change the TODO state through the tags interface (see
  21769 [[*Setting Tags]]), in case you like to mingle the two concepts.  Note
  21770 that this means you need to come up with unique keys across both sets
  21771 of keywords.
  21772 
  21773 [fn:40] Org mode parses these lines only when Org mode is activated
  21774 after visiting a file.  {{{kbd(C-c C-c)}}} with point in a line
  21775 starting with =#+= is simply restarting Org mode for the current
  21776 buffer.
  21777 
  21778 [fn:41] The corresponding in-buffer setting is: =#+STARTUP: logdone=.
  21779 
  21780 [fn:42] The corresponding in-buffer setting is: =#+STARTUP:
  21781 lognotedone=.
  21782 
  21783 [fn:43] See the variable ~org-log-states-order-reversed~.
  21784 
  21785 [fn:44] Note that the =LOGBOOK= drawer is unfolded when pressing
  21786 {{{kbd(SPC)}}} in the agenda to show an entry---use {{{kbd(C-u
  21787 SPC)}}} to keep it folded here.
  21788 
  21789 [fn:45] It is possible that Org mode records two timestamps when you
  21790 are using both ~org-log-done~ and state change logging.  However, it
  21791 never prompts for two notes: if you have configured both, the state
  21792 change recording note takes precedence and cancel the closing note.
  21793 
  21794 [fn:46] See also the option ~org-priority-start-cycle-with-default~.
  21795 
  21796 [fn:47] To keep subtasks out of the global TODO list, see the option
  21797 ~org-agenda-todo-list-sublevels~.
  21798 
  21799 [fn:48] With the exception of description lists.  But you can allow it
  21800 by modifying ~org-list-automatic-rules~ accordingly.
  21801 
  21802 [fn:49] Set the variable ~org-hierarchical-checkbox-statistics~ if you
  21803 want such cookies to count all checkboxes below the cookie, not just
  21804 those belonging to direct children.
  21805 
  21806 [fn:50] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
  21807 checkbox adds checkboxes to the rest of the list.
  21808 
  21809 [fn:51] As with all these in-buffer settings, pressing {{{kbd(C-c
  21810 C-c)}}} activates any changes in the line.
  21811 
  21812 [fn:52] This is only true if the search does not involve more complex
  21813 tests including properties (see [[*Property Searches]]).
  21814 
  21815 [fn:53] To extend this default list to all tags used in all agenda
  21816 files (see [[*Agenda Views]]), customize the variable
  21817 ~org-complete-tags-always-offer-all-agenda-tags~.
  21818 
  21819 [fn:54] Keys are automatically assigned to tags that have no
  21820 configured keys.
  21821 
  21822 [fn:55] If more than one summary type applies to the same property,
  21823 the parent values are computed according to the first of them.
  21824 
  21825 [fn:56] An age can be defined as a duration, using units defined in
  21826 ~org-duration-units~, e.g., =3d 1h=.  If any value in the column is as
  21827 such, the summary is also expressed as a duration.
  21828 
  21829 [fn:57] Please note that the =COLUMNS= definition must be on a single
  21830 line; it is wrapped here only because of formatting constraints.
  21831 
  21832 [fn:58] Contributed packages are not part of Emacs, but are
  21833 distributed with the main distribution of Org---visit
  21834 [[https://orgmode.org]].
  21835 
  21836 [fn:59] The Org date format is inspired by the standard ISO 8601
  21837 date/time format.  To use an alternative format, see [[*Custom time
  21838 format]].  The day name is optional when you type the date yourself.
  21839 However, any date inserted or modified by Org adds that day name, for
  21840 reading convenience.
  21841 
  21842 [fn:60] When working with the standard diary expression functions, you
  21843 need to be very careful with the order of the arguments.  That order
  21844 depends evilly on the variable ~calendar-date-style~.  For example, to
  21845 specify a date December 12, 2005, the call might look like
  21846 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date
  21847 2005 12 1)=, depending on the settings.  This has been the source of
  21848 much confusion.  Org mode users can resort to special versions of
  21849 these functions like ~org-date~ or ~org-anniversary~.  These work just
  21850 like the corresponding ~diary-~ functions, but with stable ISO order
  21851 of arguments (year, month, day) wherever applicable, independent of
  21852 the value of ~calendar-date-style~.
  21853 
  21854 [fn:61] See the variable ~org-read-date-prefer-future~.  You may set
  21855 that variable to the symbol ~time~ to even make a time before now
  21856 shift the date to tomorrow.
  21857 
  21858 [fn:62] If you do not need/want the calendar, configure the variable
  21859 ~org-popup-calendar-for-date-prompt~.
  21860 
  21861 [fn:63] You can also use the calendar command {{{kbd(.)}}} to jump to
  21862 today's date, but if you are inserting an hour specification for your
  21863 timestamp, {{{kbd(.)}}} will then insert a dot after the hour.  By contrast,
  21864 {{{kbd(C-.)}}} will always jump to today's date.
  21865 
  21866 [fn:64] If you find this distracting, turn off the display with
  21867 ~org-read-date-display-live~.
  21868 
  21869 [fn:65] It will still be listed on that date after it has been marked
  21870 as done.  If you do not like this, set the variable
  21871 ~org-agenda-skip-scheduled-if-done~.
  21872 
  21873 [fn:66] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
  21874 right below the headline.  Do not put any text between this line and
  21875 the headline.
  21876 
  21877 [fn:67] Note the corresponding =STARTUP= options =logredeadline=,
  21878 =lognoteredeadline=, and =nologredeadline=.
  21879 
  21880 [fn:68] Note the corresponding =STARTUP= options =logreschedule=,
  21881 =lognotereschedule=, and =nologreschedule=.
  21882 
  21883 [fn:69] Org does not repeat inactive timestamps, however.  See
  21884 [[*Timestamps]].
  21885 
  21886 [fn:70] In fact, the target state is taken from, in this sequence, the
  21887 =REPEAT_TO_STATE= property, the variable ~org-todo-repeat-to-state~ if
  21888 it is a string, the previous TODO state if ~org-todo-repeat-to-state~
  21889 is ~t~, or the first state of the TODO state sequence.
  21890 
  21891 [fn:71] You can change this using the option ~org-log-repeat~, or the
  21892 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=.
  21893 With =lognoterepeat=, you will also be prompted for a note.
  21894 
  21895 [fn:72] Clocking only works if all headings are indented with less
  21896 than 30 stars.  This is a hard-coded limitation of ~lmax~ in
  21897 ~org-clock-sum~.
  21898 
  21899 [fn:73] To resume the clock under the assumption that you have worked
  21900 on this task while outside Emacs, use =(setq org-clock-persist t)=.
  21901 
  21902 [fn:74] To add an effort estimate "on the fly", hook a function doing
  21903 this to ~org-clock-in-prepare-hook~.
  21904 
  21905 [fn:75] The last reset of the task is recorded by the =LAST_REPEAT=
  21906 property.
  21907 
  21908 [fn:76] See also the variable ~org-clock-mode-line-total~.
  21909 
  21910 [fn:77] The corresponding in-buffer setting is: =#+STARTUP:
  21911 lognoteclock-out=.
  21912 
  21913 [fn:78] When using ~:step~, ~untilnow~ starts from the beginning of
  21914 2003, not the beginning of time.
  21915 
  21916 [fn:79] Language terms can be set through the variable
  21917 ~org-clock-clocktable-language-setup~.
  21918 
  21919 [fn:80] Note that all parameters must be specified in a single
  21920 line---the line is broken here only to fit it into the manual.
  21921 
  21922 [fn:81] On computers using macOS, idleness is based on actual user
  21923 idleness, not just Emacs' idle time.  For X11, you can install a
  21924 utility program =x11idle.c=, available in the =org-contrib/=
  21925 repository, or install the xprintidle package and set it to the
  21926 variable ~org-clock-x11idle-program-name~ if you are running Debian,
  21927 to get the same general treatment of idleness.  On other systems, idle
  21928 time refers to Emacs idle time only.
  21929 
  21930 [fn:82] Please note the pitfalls of summing hierarchical data in
  21931 a flat list (see [[*Using Column View in the Agenda]]).
  21932 
  21933 [fn:83] Note the corresponding =STARTUP= options =logrefile=,
  21934 =lognoterefile=, and =nologrefile=.
  21935 
  21936 [fn:84] Org used to offer four different targets for date/week tree
  21937 capture.  Now, Org automatically translates these to use
  21938 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
  21939 properties.  Please rewrite your date/week-tree targets using
  21940 ~file+olp+datetree~ since the older targets are now deprecated.
  21941 
  21942 [fn:85] A date tree is an outline structure with years on the highest
  21943 level, months or ISO weeks as sublevels and then dates on the lowest
  21944 level.  Tags are allowed in the tree structure.
  21945 
  21946 [fn:86] When the file name is not absolute, Org assumes it is relative
  21947 to ~org-directory~.
  21948 
  21949 [fn:87] If you need one of these sequences literally, escape the =%=
  21950 with a backslash.
  21951 
  21952 [fn:88] If you define your own link types (see [[*Adding Hyperlink
  21953 Types]]), any property you store with ~org-store-link-props~ can be
  21954 accessed in capture templates in a similar way.
  21955 
  21956 [fn:89] This is always the other, not the user.  See the variable
  21957 ~org-link-from-user-regexp~.
  21958 
  21959 [fn:90] If you move entries or Org files from one directory to
  21960 another, you may want to configure ~org-attach-id-dir~ to contain
  21961 an absolute path.
  21962 
  21963 [fn:91] If the value of that variable is not a list, but a single file
  21964 name, then the list of agenda files in maintained in that external
  21965 file.
  21966 
  21967 [fn:92] When using the dispatcher, pressing {{{kbd(<)}}} before
  21968 selecting a command actually limits the command to the current file,
  21969 and ignores ~org-agenda-files~ until the next dispatcher command.
  21970 
  21971 [fn:93] For backward compatibility, you can also press {{{kbd(1)}}} to
  21972 restrict to the current buffer.
  21973 
  21974 [fn:94] For backward compatibility, you can also press {{{kbd(0)}}} to
  21975 restrict to the current region/subtree.
  21976 
  21977 [fn:95] For backward compatibility, the universal prefix argument
  21978 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
  21979 This feature is deprecated, use the dedicated TODO list, or a block
  21980 agenda instead (see [[*Block agenda]]).
  21981 
  21982 [fn:96] The variable ~org-anniversary~ used in the example is just
  21983 like ~diary-anniversary~, but the argument order is always according
  21984 to ISO and therefore independent of the value of
  21985 ~calendar-date-style~.
  21986 
  21987 [fn:97] You can, however, disable this by setting
  21988 ~org-agenda-search-headline-for-time~ variable to a ~nil~ value.
  21989 
  21990 [fn:98] Custom agenda commands can preset a filter by binding one of
  21991 the variables ~org-agenda-tag-filter-preset~,
  21992 ~org-agenda-category-filter-preset~, ~org-agenda-effort-filter-preset~
  21993 or ~org-agenda-regexp-filter-preset~ as an option.  This filter is
  21994 then applied to the view and persists as a basic filter through
  21995 refreshes and more secondary filtering.  The filter is a global
  21996 property of the entire agenda view---in a block agenda, you should
  21997 only set this in the global options section, not in the section of an
  21998 individual block.
  21999 
  22000 [fn:99] Only tags filtering is respected here, effort filtering is
  22001 ignored.
  22002 
  22003 [fn:100] You can also create persistent custom functions through
  22004 ~org-agenda-bulk-custom-functions~.
  22005 
  22006 [fn:101] This file is parsed for the agenda when
  22007 ~org-agenda-include-diary~ is set.
  22008 
  22009 [fn:102] You can provide a description for a prefix key by inserting
  22010 a cons cell with the prefix and the description.
  22011 
  22012 [fn:103] /Planned/ means here that these entries have some planning
  22013 information attached to them, like a time-stamp, a scheduled or
  22014 a deadline string.  See ~org-agenda-entry-types~ on how to set what
  22015 planning information is taken into account.
  22016 
  22017 [fn:104] For HTML you need to install Hrvoje Nikšić's =htmlize.el=
  22018 as an Emacs package from MELPA or from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].
  22019 
  22020 [fn:105] To create PDF output, the Ghostscript ps2pdf utility must be
  22021 installed on the system.  Selecting a PDF file also creates the
  22022 postscript file.
  22023 
  22024 [fn:106] If you want to store standard views like the weekly agenda or
  22025 the global TODO list as well, you need to define custom commands for
  22026 them in order to be able to specify file names.
  22027 
  22028 [fn:107] Quoting depends on the system you use, please check the FAQ
  22029 for examples.
  22030 
  22031 [fn:108] You can turn this on by default by setting the variable
  22032 ~org-pretty-entities~, or on a per-file base with the =STARTUP= option
  22033 =entitiespretty=.
  22034 
  22035 [fn:109] This behavior can be disabled with =-= export setting (see
  22036 [[*Export Settings]]).
  22037 
  22038 [fn:110] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
  22039 system.  Many of the features described here as "LaTeX" are really
  22040 from TeX, but for simplicity I am blurring this distinction.
  22041 
  22042 [fn:111] When MathJax is used, only the environments recognized by
  22043 MathJax are processed.  When dvipng, dvisvgm, or ImageMagick suite is
  22044 used to create images, any LaTeX environment is handled.
  22045 
  22046 [fn:112] These are respectively available at
  22047 [[http://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
  22048 and from the ImageMagick suite.  Choose the converter by setting the
  22049 variable ~org-preview-latex-default-process~ accordingly.
  22050 
  22051 [fn:113] Org mode has a method to test if point is inside such
  22052 a fragment, see the documentation of the function
  22053 ~org-inside-LaTeX-fragment-p~.
  22054 
  22055 [fn:114] This works automatically for the HTML backend (it requires
  22056 version 1.34 of the =htmlize.el= package, which you need to install).
  22057 Fontified code chunks in LaTeX can be achieved using either the
  22058 [[https://www.ctan.org/pkg/listings][listings]] package or the [[https://www.ctan.org/pkg/minted][minted]] package.  Refer to
  22059 ~org-latex-listings~ for details.
  22060 
  22061 [fn:115] Source code in code blocks may also be evaluated either
  22062 interactively or on export.  See [[*Working with Source Code]] for more
  22063 information on evaluating code blocks.
  22064 
  22065 [fn:116] Adding =-k= to =-n -r= /keeps/ the labels in the source code
  22066 while using line numbers for the links, which might be useful to
  22067 explain those in an Org mode example code.
  22068 
  22069 [fn:117] You may select a different mode with the variable
  22070 ~org-edit-fixed-width-region-mode~.
  22071 
  22072 [fn:118] What Emacs considers to be an image depends on
  22073 ~image-file-name-extensions~ and ~image-file-name-regexps~.
  22074 
  22075 [fn:119] The variable ~org-startup-with-inline-images~ can be set
  22076 within a buffer with the =STARTUP= options =inlineimages= and
  22077 =noinlineimages=.
  22078 
  22079 [fn:120] The corresponding in-buffer setting is: =#+STARTUP: fninline=
  22080 or =#+STARTUP: nofninline=.
  22081 
  22082 [fn:121] The corresponding in-buffer options are =#+STARTUP: fnadjust=
  22083 and =#+STARTUP: nofnadjust=.
  22084 
  22085 [fn:122] The variable ~org-export-date-timestamp-format~ defines how
  22086 this timestamp are exported.
  22087 
  22088 [fn:123] For export to LaTeX format---or LaTeX-related formats such as
  22089 Beamer---, the =org-latex-package-alist= variable needs further
  22090 configuration.  See [[LaTeX specific export settings]].
  22091 
  22092 [fn:124] At the moment, some export back-ends do not obey this
  22093 specification.  For example, LaTeX export excludes every unnumbered
  22094 headline from the table of contents.
  22095 
  22096 [fn:125] Note that ~org-link-search-must-match-exact-headline~ is
  22097 locally bound to non-~nil~.  Therefore, ~org-link-search~ only matches
  22098 headlines and named elements.
  22099 
  22100 [fn:126] Since commas separate the arguments, commas within arguments
  22101 have to be escaped with the backslash character.  So only those
  22102 backslash characters before a comma need escaping with another
  22103 backslash character.
  22104 
  22105 [fn:127] For a less drastic behavior, consider using a select tag (see
  22106 [[*Export Settings]]) instead.
  22107 
  22108 [fn:128] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
  22109 to make it visible.  The tag serves as a visual aid and has no
  22110 semantic relevance.
  22111 
  22112 [fn:129] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by
  22113 [[https://www.mathjax.org][MathJax]].
  22114 
  22115 [fn:130] Please note that exported formulas are part of an HTML
  22116 document, and that signs such as =<=, =>=, or =&= have special
  22117 meanings.  See [[http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX support]].
  22118 
  22119 [fn:131] See [[http://docs.mathjax.org/en/latest/tex.html#tex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn
  22120 about extensions.
  22121 
  22122 [fn:132] If the classes on TODO keywords and tags lead to conflicts,
  22123 use the variables ~org-html-todo-kwd-class-prefix~ and
  22124 ~org-html-tag-class-prefix~ to make them unique.
  22125 
  22126 [fn:133] This does not allow setting different bibliography compilers
  22127 for different files.  However, "smart" LaTeX compilation systems, such
  22128 as latexmk, can select the correct bibliography compiler.
  22129 
  22130 [fn:134] Minted uses an external Python package for code highlighting,
  22131 which requires the flag =-shell-escape= to be added to
  22132 ~org-latex-pdf-process~.
  22133 
  22134 [fn:135] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications
  22135 (OpenDocument) Version 1.2]].
  22136 
  22137 [fn:136] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
  22138 
  22139 [fn:137] See [[http://dlmf.nist.gov/LaTeXML/]].
  22140 
  22141 [fn:138] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]]
  22142 
  22143 [fn:139] See the =<table:table-template>= element of the
  22144 OpenDocument-v1.2 specification.
  22145 
  22146 [fn:140] See the attributes =table:template-name=,
  22147 =table:use-first-row-styles=, =table:use-last-row-styles=,
  22148 =table:use-first-column-styles=, =table:use-last-column-styles=,
  22149 =table:use-banding-rows-styles=, and =table:use-banding-column-styles=
  22150 of the =<table:table>= element in the OpenDocument-v1.2 specification.
  22151 
  22152 [fn:141] If the publishing directory is the same as the source
  22153 directory, =file.org= is exported as =file.org.org=, so you probably
  22154 do not want to do this.
  22155 
  22156 [fn:142] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used
  22157 to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
  22158 
  22159 [fn:143] Actually, the constructs =call_<name>()= and =src_<lang>{}=
  22160 are not evaluated when they appear in a keyword (see [[*Summary of
  22161 In-Buffer Settings]]).
  22162 
  22163 [fn:144] For noweb literate programming details, see
  22164 http://www.cs.tufts.edu/~nr/noweb/.
  22165 
  22166 [fn:145] For more information, please refer to the commentary section
  22167 in =org-tempo.el=.
  22168 
  22169 [fn:146] Org Indent mode also sets ~wrap-prefix~ correctly for
  22170 indenting and wrapping long lines of headlines or text.  This minor
  22171 mode also handles Visual Line mode and directly applied settings
  22172 through ~word-wrap~.
  22173 
  22174 [fn:147] This works, but requires extra effort.  Org Indent mode is
  22175 more convenient for most applications.
  22176 
  22177 [fn:148] ~org-adapt-indentation~ can also be set to ='headline-data=,
  22178 in which case only data lines below the headline will be indented.
  22179 
  22180 [fn:149] Note that Org Indent mode also sets the ~wrap-prefix~
  22181 property, such that Visual Line mode (or purely setting ~word-wrap~)
  22182 wraps long lines, including headlines, correctly indented.
  22183 
  22184 [fn:150] For a server to host files, consider using a WebDAV server,
  22185 such as [[https://nextcloud.com][Nextcloud]].  Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
  22186 
  22187 [fn:151] If Emacs is configured for safe storing of passwords, then
  22188 configure the variable ~org-mobile-encryption-password~; please read
  22189 the docstring of that variable.
  22190 
  22191 [fn:152] Symbolic links in ~org-directory~ need to have the same name
  22192 as their targets.
  22193 
  22194 [fn:153] While creating the agendas, Org mode forces =ID= properties
  22195 on all referenced entries, so that these entries can be uniquely
  22196 identified if Org Mobile flags them for further action.  To avoid
  22197 setting properties configure the variable
  22198 ~org-mobile-force-id-on-agenda-items~ to ~nil~.  Org mode then relies
  22199 on outline paths, assuming they are unique.
  22200 
  22201 [fn:154] Checksums are stored automatically in the file
  22202 =checksums.dat=.
  22203 
  22204 [fn:155] The file will be empty after this operation.
  22205 
  22206 [fn:156] https://www.ctan.org/pkg/comment
  22207 
  22208 [fn:157] By default this works only for LaTeX, HTML, and Texinfo.
  22209 Configure the variable ~orgtbl-radio-table-templates~ to install
  22210 templates for other modes.
  22211 
  22212 [fn:158] If the =TBLFM= keyword contains an odd number of dollar
  22213 characters, this may cause problems with Font Lock in LaTeX mode.  As
  22214 shown in the example you can fix this by adding an extra line inside
  22215 the =comment= environment that is used to balance the dollar
  22216 expressions.  If you are using AUCTeX with the font-latex library,
  22217 a much better solution is to add the =comment= environment to the
  22218 variable ~LaTeX-verbatim-environments~.
  22219 
  22220 [fn:159] The ~agenda*~ view is the same as ~agenda~ except that it
  22221 only considers /appointments/, i.e., scheduled and deadline items that
  22222 have a time specification =[h]h:mm= in their time-stamps.
  22223 
  22224 [fn:160] Note that, for ~org-odd-levels-only~, a level number
  22225 corresponds to order in the hierarchy, not to the number of stars.