config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

org-manual.org (840947B)


      1 #+title: The Org Manual
      2 #+subtitle:  Release {{{version}}}
      3 #+author:    The Org Mode Developers
      4 #+language:  en
      5 #+startup: literallinks
      6 
      7 
      8 #+texinfo: @insertcopying
      9 
     10 * Introduction
     11 :PROPERTIES:
     12 :DESCRIPTION: Getting started.
     13 :END:
     14 #+cindex: introduction
     15 
     16 ** Summary
     17 :PROPERTIES:
     18 :DESCRIPTION: Brief summary of what Org does.
     19 :END:
     20 #+cindex: summary
     21 
     22 Org Mode is an authoring tool and a TODO lists manager for GNU Emacs.
     23 It relies on a lightweight plain-text markup language used in files
     24 with the =.org= extension.
     25 
     26 Authoring Org files is best supported by Emacs, but you can view,
     27 understand, and change them with any text editor.
     28 
     29 As an authoring tool, Org helps you write structured documents and
     30 provides exporting facilities.  Org files can also be used for literate
     31 programming and reproducible research.  As a TODO lists manager, Org
     32 helps you organize your tasks in a flexible way, from daily needs to
     33 detailed project-planning, allowing logging, multiple views on your
     34 tasks, exporting your agendas, etc.
     35 
     36 Org mode is implemented on top of Outline mode, which makes it
     37 possible to keep the content of large files well structured.
     38 Visibility cycling and structure editing help to work with the tree.
     39 Tables are easily created with a built-in table editor.  Plain text
     40 URL-like links connect to websites, emails, Usenet messages, BBDB
     41 entries, and any files related to the projects.
     42 
     43 Org develops organizational tasks around notes files that contain
     44 lists or information about projects as plain text.  Project planning
     45 and task management make use of metadata which is part of an outline
     46 node.  Based on this data, specific entries can be extracted in
     47 queries and create dynamic /agenda views/ that also integrate the Emacs
     48 calendar and diary.  Org can be used to implement many different
     49 project planning schemes, such as David Allen's GTD system.
     50 
     51 Org files can serve as a single source authoring system with export to
     52 many different formats such as HTML, LaTeX, Open Document, and
     53 Markdown.  New export backends can be derived from existing ones, or
     54 defined from scratch.
     55 
     56 Org files can include source code blocks, which makes Org uniquely
     57 suited for authoring technical documents with code examples.  Org
     58 source code blocks are fully functional; they can be evaluated in
     59 place and their results can be captured in the file.  This makes it
     60 possible to create a single file reproducible research compendium.
     61 
     62 Org keeps simple things simple.  When first fired up, it should feel
     63 like a straightforward, easy to use outliner.  Complexity is not
     64 imposed, but a large amount of functionality is available when needed.
     65 Org is a toolbox.  Many users actually run only a---very
     66 personal---fraction of Org's capabilities, and know that there is more
     67 whenever they need it.
     68 
     69 All of this is achieved with strictly plain text files, the most
     70 portable and future-proof file format.  Org runs in Emacs.  Emacs is
     71 one of the most widely ported programs, so that Org mode is available
     72 on every major platform.
     73 
     74 #+cindex: FAQ
     75 There is a website for Org which provides links to the newest version
     76 of Org, as well as additional information, frequently asked questions
     77 (FAQ), links to tutorials, etc.  This page is located at
     78 [[https://orgmode.org]].
     79 
     80 #+cindex: print edition
     81 An earlier version (7.3) of this manual was available as a paperback
     82 book from the Network Theory Ltd. publishing company, closed in 2009.
     83 
     84 ** Installation
     85 :PROPERTIES:
     86 :DESCRIPTION: Installing Org.
     87 :END:
     88 #+cindex: installation
     89 
     90 Org is included in distributions of GNU Emacs, you probably do not
     91 need to install it.  Most users will simply activate Org and begin
     92 exploring its features.
     93 
     94 If, for one reason or another, you want to install Org on top of this
     95 pre-packaged version, you can use the Emacs package system or clone
     96 Org's git repository.  We *strongly recommend* sticking to a single
     97 installation method.
     98 
     99 When installing Org on top of the pre-packaged version, please note
    100 that Org stable versions are meant to be fully compatible with the
    101 last three stable versions of Emacs but not with older Emacsen.
    102 
    103 Some Org components also depend on third-party packages available
    104 through package archives.  Org is only guaranteed to be compatible
    105 with the latest stable versions of these third-party packages.
    106 
    107 *** Using Emacs packaging system
    108 :PROPERTIES:
    109 :UNNUMBERED: notoc
    110 :END:
    111 
    112 Recent Emacs distributions include a packaging system which lets you
    113 install Elisp libraries.  You can install Org from the "package menu",
    114 with {{{kbd(M-x list-packages)}}}.  See [[info:emacs::Package Menu][Package Menu]].
    115 
    116 #+attr_texinfo: :tag Important
    117 #+begin_quote
    118 You need to do this in a session where no =.org= file has been
    119 visited, i.e., where no Org built-in function have been loaded.
    120 Otherwise autoload Org functions will mess up the installation.
    121 #+end_quote
    122 
    123 To avoid interference with built-in Org mode, you can use command line:
    124 
    125 #+begin_src sh
    126 emacs -Q -batch -eval "(progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))"
    127 #+end_src
    128 
    129 This approach has the advantage of isolating the upgrade process from
    130 a running Emacs session, ensuring that version conflicts can not
    131 arise.
    132 
    133 *** Using Org's git repository
    134 :PROPERTIES:
    135 :UNNUMBERED: notoc
    136 :END:
    137 
    138 You can clone Org's repository and install Org like this:
    139 
    140 #+begin_example
    141 $ cd ~/src/
    142 $ git clone https://git.savannah.gnu.org/git/emacs/org-mode.git
    143 $ cd org-mode/
    144 $ make autoloads
    145 #+end_example
    146 
    147 Note that in this case, =make autoloads= is mandatory: it defines
    148 Org's version in =org-version.el= and Org's autoloads in
    149 =org-loaddefs.el=.
    150 
    151 Make sure you set the load path correctly in your Emacs init file:
    152 
    153 #+begin_src emacs-lisp
    154 (add-to-list 'load-path "~/src/org-mode/lisp")
    155 #+end_src
    156 
    157 You can also compile with =make=, generate the documentation with
    158 =make doc=, create a local configuration with =make config= and
    159 install Org with =make install=.  Please run =make help= to get the
    160 list of compilation/installation options.
    161 
    162 For more detailed explanations on Org's build system, please check the
    163 Org Build System page on [[https://orgmode.org/worg/dev/org-build-system.html][Worg]].
    164 
    165 *** Installing Org's contributed packages
    166 :PROPERTIES:
    167 :UNNUMBERED: notoc
    168 :END:
    169 
    170 Org's repository used to contain =contrib/= directory for add-ons
    171 contributed by others.  As of Org 9.5, the directory has been moved to
    172 the dedicated org-contrib [[https://git.sr.ht/~bzg/org-contrib][repository]], which you can install
    173 separately as a [[https://elpa.nongnu.org/nongnu/org-contrib.html][package]] from NonGNU ELPA.
    174 
    175 There are enough valuable packages maintained outside of the Org repository.
    176 Worg has a list of [[https://orgmode.org/worg/org-contrib/index.html][org-contrib and external packages]], certainly it is not
    177 exhaustive.
    178 
    179 ** Activation
    180 :PROPERTIES:
    181 :DESCRIPTION: How to activate Org for certain buffers.
    182 :END:
    183 #+cindex: activation
    184 #+cindex: autoload
    185 #+cindex: ELPA
    186 #+cindex: global key bindings
    187 #+cindex: key bindings, global
    188 
    189 Org mode buffers need Font Lock to be turned on: this is the default
    190 in Emacs[fn:: If you do not use Font Lock globally turn it on in Org
    191 buffer with =(add-hook 'org-mode-hook #'turn-on-font-lock)=.].
    192 
    193 There are compatibility issues between Org mode and some other Elisp
    194 packages (see [[*Packages that conflict with Org mode]]).  Please take the
    195 time to check the list.
    196 
    197 #+findex: org-agenda
    198 #+findex: org-capture
    199 #+findex: org-store-link
    200 For a better experience, the three Org commands ~org-store-link~,
    201 ~org-capture~ and ~org-agenda~ ought to be accessible anywhere in
    202 Emacs, not just in Org buffers.  To that effect, you need to bind them
    203 to globally available keys, like the ones reserved for users (see
    204 [[info:elisp::Key Binding Conventions]]).  Here are suggested bindings,
    205 please modify the keys to your own liking in your [[info:emacs#Init File][personal init file]].
    206 
    207 #+begin_src emacs-lisp
    208 (global-set-key (kbd "C-c l") #'org-store-link)
    209 (global-set-key (kbd "C-c a") #'org-agenda)
    210 (global-set-key (kbd "C-c c") #'org-capture)
    211 #+end_src
    212 
    213 #+cindex: Org mode, turning on
    214 Files with the =.org= extension use Org mode by default.  To turn on
    215 Org mode in a file that does not have the extension =.org=, make the
    216 first line of a file look like this:
    217 
    218 : MY PROJECTS    -*- mode: org; -*-
    219 
    220 #+vindex: org-insert-mode-line-in-empty-file
    221 #+texinfo: @noindent
    222 which selects Org mode for this buffer no matter what the file's name
    223 is.  See also the variable ~org-insert-mode-line-in-empty-file~.
    224 
    225 Many commands in Org work on the region if the region is /active/.  To
    226 make use of this, you need to have Transient Mark mode turned on,
    227 which is the default.  If you do not like it, you can create an active
    228 region by using the mouse to select a region, or pressing
    229 {{{kbd(C-SPC)}}} twice before moving point.
    230 
    231 ** Feedback
    232 :PROPERTIES:
    233 :DESCRIPTION: Bug reports, ideas, patches, etc.
    234 :END:
    235 #+cindex: feedback
    236 #+cindex: contact
    237 #+cindex: bug reports
    238 #+cindex: reporting a bug
    239 #+cindex: request a feature
    240 #+cindex: feature requests
    241 #+cindex: ideas
    242 #+cindex: maintainer
    243 #+cindex: author
    244 
    245 If you find problems with Org, or if you have questions, remarks, or
    246 ideas about it, please send an email to the Org mailing list
    247 [[mailto:emacs-orgmode@gnu.org]].  You can subscribe to the list
    248 [[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this web
    249 page]].  If you are not a member of the mailing list, your mail will
    250 be passed to the list after a moderator has approved it[fn:: Please
    251 consider subscribing to the mailing list in order to minimize the work
    252 the mailing list moderators have to do.].  We ask you to read and
    253 respect the
    254 [[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind
    255 Communications Guidelines]] when sending messages on this mailing
    256 list.  Please allow up to one month for the response and followup if
    257 no response is received on the bug report.
    258 
    259 #+findex: org-version
    260 #+findex: org-submit-bug-report
    261 For bug reports, please first try to reproduce the bug with the latest
    262 version of Org available---if you are running an outdated version, it
    263 is quite possible that the bug has been fixed already.  If the bug
    264 persists, prepare a report and provide as much information as
    265 possible, including the version information of Emacs ({{{kbd(M-x
    266 emacs-version)}}}) and Org ({{{kbd(M-x org-version)}}}), as well as
    267 the Org related setup in the Emacs init file.  The easiest way to do
    268 this is to use the command
    269 
    270 : M-x org-submit-bug-report <RET>
    271 
    272 #+texinfo: @noindent
    273 which puts all this information into an Emacs mail buffer so that you
    274 only need to add your description.  If you are not sending the Email
    275 from within Emacs, please copy and paste the content into your Email
    276 program.
    277 
    278 Sometimes you might face a problem due to an error in your Emacs or
    279 Org mode setup.  Before reporting a bug, it is very helpful to start
    280 Emacs with minimal customizations and reproduce the problem.  Doing so
    281 often helps you determine if the problem is with your customization or
    282 with Org mode itself.  You can start a typical minimal session with
    283 a command like the example below.
    284 
    285 : $ emacs -Q -l /path/to/minimal-org.el
    286 
    287 However if you are using Org mode as distributed with Emacs, a minimal
    288 setup is not necessary.  In that case it is sufficient to start Emacs
    289 as =emacs -Q=.  The =minimal-org.el= setup file can have contents as
    290 shown below.
    291 
    292 #+begin_src emacs-lisp
    293 ;;; Minimal setup to load latest `org-mode'.
    294 
    295 ;; Activate debugging.
    296 (setq debug-on-error t
    297       debug-on-signal nil
    298       debug-on-quit nil)
    299 
    300 ;; Add latest Org mode to load path.
    301 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
    302 #+end_src
    303 
    304 If you are using Org mode version from Git repository, you can start
    305 minimal session using make.
    306 
    307 : # Bare Emacs
    308 : make repro
    309 : # or pass extra arguments
    310 : make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org"
    311 
    312 If an error occurs, a "backtrace" can be very useful---see below on
    313 how to create one.  Often a small example file helps, along with clear
    314 information about:
    315 
    316 1. What exactly did you do?
    317 2. What did you expect to happen?
    318 3. What happened instead?
    319 
    320 #+cindex: performance
    321 #+cindex: profile
    322 #+cindex: slow
    323 #+cindex: slowdown
    324 #+cindex: laggy
    325 #+cindex: not responsive
    326 If you experience degraded performance, you can record a "profile" and
    327 share it on the Org mailing list.  See below for the instructions how
    328 to record a useful profile.
    329 
    330 Thank you for helping to improve this program.
    331 *** How to create a useful backtrace
    332 :PROPERTIES:
    333 :UNNUMBERED: notoc
    334 :END:
    335 
    336 #+cindex: backtrace of an error
    337 If working with Org produces an error with a message you do not
    338 understand, you may have hit a bug.  The best way to report this is by
    339 providing, in addition to what was mentioned above, a backtrace.  This
    340 is information from the built-in debugger about where and how the
    341 error occurred.  Here is how to produce a useful backtrace:
    342 
    343 1. Reload uncompiled versions of all Org mode Lisp files.  The
    344    backtrace contains much more information if it is produced with
    345    uncompiled code.  To do this, use
    346 
    347    : C-u M-x org-reload <RET>
    348 
    349    #+texinfo: @noindent
    350    or, from the menu: Org \rarr Refresh/Reload \rarr Reload Org uncompiled.
    351 
    352 2. Then, activate the debugger:
    353 
    354    : M-x toggle-debug-on-error <RET>
    355 
    356    #+texinfo: @noindent
    357    or, from the menu: Options \rarr Enter Debugger on Error.
    358 
    359 3. Do whatever you have to do to hit the error.  Do not forget to
    360    document the steps you take.
    361 
    362 4. When you hit the error, a =*Backtrace*= buffer appears on the
    363    screen.  Save this buffer to a file---for example using {{{kbd(C-x
    364    C-w)}}}---and attach it to your bug report.
    365 
    366 *** How to profile Org performance
    367 :PROPERTIES:
    368 :UNNUMBERED: notoc
    369 :END:
    370 
    371 #+cindex: profiler
    372 Sometimes, Org is becoming slow for no apparent reason.  Such slowdown
    373 is often caused by interaction between third-party packages and Org
    374 mode.  However, identifying the root cause is not always straightforward.
    375 
    376 Emacs is able to record performance statistics, which can then be used
    377 to find out which functions are taking most of the time to execute.
    378 To record the statistics, one can use so-called profiler.  To use the
    379 Emacs profiler, we recommend the following steps:
    380 
    381 1. Make sure that no profiler is currently active:
    382 
    383    : M-x profiler-stop <RET>
    384 
    385 2. Start a new CPU profiler session:
    386 
    387    : M-x profiler-start <RET> cpu <RET>
    388 
    389 3. Use Emacs as usual, performing the actions that are deemed slow.
    390 
    391 4. Display and examine the recorded performance statistics:
    392 
    393    : M-x profiler-report <RET>
    394 
    395    This command will display a summary of the commands and functions
    396    that have been executed between ~profiler-start~ and
    397    ~profiler-report~ invocations, with command taking most of the time
    398    displayed on top.
    399 
    400    =<TAB>= key can be used to fold and unfold lines in the profiler
    401    buffer.  The child items revealed upon unfolding are the functions
    402    and commands called by the unfolded parent.
    403 
    404    The root causes are often buried deep inside sub-children items in
    405    the profiler.  You can press =B= (~profiler-report-render-reversed-calltree~)
    406    to quickly reveal the actual function/command that takes most of
    407    the time to run.
    408 
    409    Pressing =C= ~profiler-report-render-calltree~ will recover the
    410    original view.
    411 
    412 5. If you need further help, you can share the statistics data.
    413 
    414    Just save the data by issuing
    415 
    416    : M-x profiler-report-write-profile <RET>
    417    : /path/to/profile-file-to-be-saved <RET>
    418 
    419    Then, you can attached the saved file to your email to the Org
    420    mailing list, alongside with details about what you did to trigger
    421    the slowdown.
    422 
    423    Note that the saved statistics will only contain the function names
    424    and how long their execution takes.  No private data will be
    425    recorded.
    426 
    427 ** Typesetting Conventions Used in this Manual
    428 :PROPERTIES:
    429 :DESCRIPTION: Typesetting conventions used in this manual.
    430 :ALT_TITLE: Conventions
    431 :END:
    432 
    433 *** TODO keywords, tags, properties, etc.
    434 :PROPERTIES:
    435 :UNNUMBERED: notoc
    436 :END:
    437 
    438 Org uses various syntactical elements: TODO keywords, tags, property
    439 names, keywords, blocks, etc.  In this manual we use the following
    440 conventions:
    441 
    442 #+attr_texinfo: :sep ,
    443 - =TODO=, =WAITING= ::
    444 
    445   TODO keywords are written with all capitals, even if they are
    446   user-defined.
    447 
    448 - =boss=, =ARCHIVE= ::
    449 
    450   Tags are case-sensitive.  User-defined tags are usually written in
    451   lowercase; built-in tags with special meaning are written as they
    452   should appear in the document, usually with all capitals.
    453 
    454 - =Release=, =PRIORITY= ::
    455 
    456   User-defined properties are capitalized; built-in properties with
    457   special meaning are written with all capitals.
    458 
    459 - =TITLE=, =BEGIN= ... =END= ::
    460 
    461   Keywords and blocks are written in uppercase to enhance their
    462   readability, but you can use lowercase in your Org files.
    463 
    464 *** Key bindings and commands
    465 :PROPERTIES:
    466 :UNNUMBERED: notoc
    467 :END:
    468 
    469 The manual lists both the keys and the corresponding commands for
    470 accessing a functionality.  Org mode often uses the same key for
    471 different functions, depending on context.  The command that is bound
    472 to such keys has a generic name, like ~org-metaright~.  In the manual
    473 we will, wherever possible, give the function that is internally
    474 called by the generic command.  For example, in the chapter on
    475 document structure, {{{kbd(M-RIGHT)}}} will be listed to call
    476 ~org-do-demote~, while in the chapter on tables, it will be listed to
    477 call ~org-table-move-column-right~.
    478 
    479 * Document Structure
    480 :PROPERTIES:
    481 :DESCRIPTION: A tree works like your brain.
    482 :END:
    483 
    484 #+cindex: document structure
    485 #+cindex: structure of document
    486 Org is an outliner.  Outlines allow a document to be organized in
    487 a hierarchical structure, which, least for me, is the best
    488 representation of notes and thoughts.  An overview of this structure
    489 is achieved by folding, i.e., hiding large parts of the document to
    490 show only the general document structure and the parts currently being
    491 worked on.  Org greatly simplifies the use of outlines by compressing
    492 the entire show and hide functionalities into a single command,
    493 ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key.
    494 
    495 ** Headlines
    496 :PROPERTIES:
    497 :DESCRIPTION: How to typeset Org tree headlines.
    498 :END:
    499 #+cindex: headlines
    500 #+cindex: outline tree
    501 #+vindex: org-special-ctrl-a/e
    502 #+vindex: org-special-ctrl-k
    503 #+vindex: org-ctrl-k-protect-subtree
    504 
    505 Headlines define the structure of an outline tree.  Org headlines
    506 start on the left margin[fn:1] with one or more stars followed by
    507 a space.  For example:
    508 
    509 #+begin_example
    510 ,* Top level headline
    511 ,** Second level
    512 ,*** Third level
    513     some text
    514 ,*** Third level
    515     more text
    516 ,* Another top level headline
    517 #+end_example
    518 
    519 #+vindex: org-footnote-section
    520 The name defined in ~org-footnote-section~ is reserved.  Do not use it
    521 as a title for your own headings.
    522 
    523 Some people find the many stars too noisy and would prefer an outline
    524 that has whitespace followed by a single star as headline starters.
    525 This can be achieved using an Org Indent minor mode.  See [[*A Cleaner
    526 Outline View]] for more information.
    527 
    528 Headlines are not numbered.  However, you may want to dynamically
    529 number some, or all, of them.  See [[*Dynamic Headline Numbering]].
    530 
    531 #+vindex: org-cycle-separator-lines
    532 An empty line after the end of a subtree is considered part of it and
    533 is hidden when the subtree is folded.  However, if you leave at least
    534 two empty lines, one empty line remains visible after folding the
    535 subtree, in order to structure the collapsed view.  See the variable
    536 ~org-cycle-separator-lines~ to modify this behavior.
    537 
    538 ** Visibility Cycling
    539 :PROPERTIES:
    540 :DESCRIPTION: Show and hide, much simplified.
    541 :END:
    542 #+cindex: cycling, visibility
    543 #+cindex: visibility cycling
    544 #+cindex: trees, visibility
    545 #+cindex: show hidden text
    546 #+cindex: hide text
    547 
    548 *** Global and local cycling
    549 :PROPERTIES:
    550 :DESCRIPTION: Cycling through various visibility states.
    551 :END:
    552 #+cindex: subtree visibility states
    553 #+cindex: subtree cycling
    554 #+cindex: folded, subtree visibility state
    555 #+cindex: children, subtree visibility state
    556 #+cindex: subtree, subtree visibility state
    557 
    558 Outlines make it possible to hide parts of the text in the buffer.
    559 Org uses just two commands, bound to {{{kbd(TAB)}}} and
    560 {{{kbd(S-TAB)}}} to change the visibility in the buffer.
    561 
    562 #+attr_texinfo: :sep ,
    563 - {{{kbd(TAB)}}} (~org-cycle~) ::
    564 
    565   #+kindex: TAB
    566   #+findex: org-cycle
    567   /Subtree cycling/: Rotate current subtree among the states
    568 
    569   #+begin_example
    570   ,-> FOLDED -> CHILDREN -> SUBTREE --.
    571   '-----------------------------------'
    572   #+end_example
    573 
    574   #+vindex: org-cycle-emulate-tab
    575   Point must be on a headline for this to work[fn:: See, however, the
    576   option ~org-cycle-emulate-tab~.].
    577 
    578 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
    579 
    580   #+cindex: global visibility states
    581   #+cindex: global cycling
    582   #+cindex: overview, global visibility state
    583   #+cindex: contents, global visibility state
    584   #+cindex: show all, global visibility state
    585   #+kindex: C-u TAB
    586   #+kindex: S-TAB
    587   #+findex: org-global-cycle
    588   /Global cycling/: Rotate the entire buffer among the states
    589 
    590   #+begin_example
    591   ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
    592   '--------------------------------------'
    593   #+end_example
    594 
    595   When {{{kbd(S-TAB)}}} is called with a numeric prefix argument
    596   {{{var(N)}}}, view contents only up to headlines of level
    597   {{{var(N)}}}.
    598 
    599   Note that inside tables (see [[*Tables]]), {{{kbd(S-TAB)}}} jumps to the
    600   previous field instead.
    601 
    602   #+vindex: org-cycle-global-at-bob
    603   You can run global cycling using {{{kbd(TAB)}}} only if point is at
    604   the very beginning of the buffer, but not on a headline, and
    605   ~org-cycle-global-at-bob~ is set to a non-~nil~ value.
    606 
    607 - {{{kbd(C-u C-u TAB)}}} (~org-cycle-set-startup-visibility~) ::
    608 
    609   #+cindex: startup visibility
    610   #+kindex: C-u C-u TAB
    611   #+findex: org-cycle-set-startup-visibility
    612   Switch back to the startup visibility of the buffer (see [[*Initial
    613   visibility]]).
    614 
    615 - {{{kbd(C-u C-u C-u TAB)}}} (~org-show-all~) ::
    616 
    617   #+cindex: show all, command
    618   #+kindex: C-u C-u C-u TAB
    619   #+findex: org-show-all
    620   Show all, including drawers.
    621 
    622 - {{{kbd(C-c C-r)}}} (~org-reveal~) ::
    623 
    624   #+cindex: revealing context
    625   #+kindex: C-c C-r
    626   #+findex: org-reveal
    627   Reveal context around point, showing the current entry, the
    628   following heading and the hierarchy above.  It is useful for working
    629   near a location that has been exposed by a sparse tree command (see
    630   [[*Sparse Trees]]) or an agenda command (see [[*Commands in the Agenda
    631   Buffer]]).  With a prefix argument, show, on each level, all sibling
    632   headings.  With a double prefix argument, also show the entire
    633   subtree of the parent.
    634 
    635 - {{{kbd(C-c C-k)}}} (~org-show-branches~) ::
    636 
    637   #+cindex: show branches, command
    638   #+kindex: C-c C-k
    639   #+findex: org-show-branches
    640   Expose all the headings of the subtree, but not their bodies.
    641 
    642 - {{{kbd(C-c TAB)}}} (~org-show-children~) ::
    643 
    644   #+cindex: show children, command
    645   #+kindex: C-c TAB
    646   #+findex: org-show-children
    647   Expose all direct children of the subtree.  With a numeric prefix
    648   argument {{{var(N)}}}, expose all children down to level
    649   {{{var(N)}}}.
    650 
    651 - {{{kbd(C-c C-x b)}}} (~org-tree-to-indirect-buffer~) ::
    652 
    653   #+kindex: C-c C-x b
    654   #+findex: org-tree-to-indirect-buffer
    655   Show the current subtree in an indirect buffer[fn:2].  With
    656   a numeric prefix argument {{{var(N)}}}, go up to level {{{var(N)}}}
    657   and then take that tree.  If {{{var(N)}}} is negative then go up
    658   that many levels.  With a {{{kbd(C-u)}}} prefix, do not remove the
    659   previously used indirect buffer.
    660 
    661 - {{{kbd(C-c C-x v)}}} (~org-copy-visible~) ::
    662 
    663   #+kindex: C-c C-x v
    664   #+findex: org-copy-visible
    665   Copy the /visible/ text in the region into the kill ring.
    666 
    667 *** Initial visibility
    668 :PROPERTIES:
    669 :DESCRIPTION: Setting the initial visibility state.
    670 :END:
    671 
    672 #+vindex: org-startup-folded
    673 When Emacs first visits an Org file, the global state is set to
    674 ~showeverything~, i.e., all file content is visible[fn:: When
    675 ~org-agenda-inhibit-startup~ is non-~nil~, Org does not honor the
    676 default visibility state when first opening a file for the agenda (see
    677 [[*Speeding Up Your Agendas]]).].  This can be configured through the
    678 variable ~org-startup-folded~, or on a per-file basis by adding one of
    679 the following lines anywhere in the buffer:
    680 
    681 #+cindex: @samp{STARTUP}, keyword
    682 #+begin_example
    683 ,#+STARTUP: overview
    684 ,#+STARTUP: content
    685 ,#+STARTUP: showall
    686 ,#+STARTUP: show2levels
    687 ,#+STARTUP: show3levels
    688 ,#+STARTUP: show4levels
    689 ,#+STARTUP: show5levels
    690 ,#+STARTUP: showeverything
    691 #+end_example
    692 
    693 #+cindex: @samp{VISIBILITY}, property
    694 Furthermore, any entries with a =VISIBILITY= property (see [[*Properties
    695 and Columns]]) get their visibility adapted accordingly.  Allowed values
    696 for this property are =folded=, =children=, =content=, and =all=.
    697 
    698 - {{{kbd(C-u C-u TAB)}}} (~org-cycle-set-startup-visibility~) ::
    699 
    700   #+kindex: C-u C-u TAB
    701   #+findex: org-cycle-set-startup-visibility
    702   Switch back to the startup visibility of the buffer, i.e., whatever
    703   is requested by startup options and =VISIBILITY= properties in
    704   individual entries.
    705 
    706 *** Catching invisible edits
    707 :PROPERTIES:
    708 :DESCRIPTION: Preventing mistakes when editing invisible parts.
    709 :END:
    710 #+cindex: edits, catching invisible
    711 
    712 #+vindex: org-fold-catch-invisible-edits
    713 #+vindex: org-fold-catch-invisible-edits-commands
    714 Sometimes you may inadvertently edit an invisible part of the buffer
    715 and be confused on what has been edited and how to undo the mistake.
    716 By default, Org prevents such edits for a limited set of user
    717 commands.  Users can control which commands are affected by
    718 customizing ~org-fold-catch-invisible-edits-commands~.
    719 
    720 The strategy used to decide if a given edit is dangerous is controlled
    721 by ~org-fold-catch-invisible-edits~.  See the docstring of this option
    722 on the available strategies.  Set the option to ~nil~ to disable
    723 catching invisible edits completely.
    724 
    725 ** Motion
    726 :PROPERTIES:
    727 :DESCRIPTION: Jumping to other headlines.
    728 :END:
    729 #+cindex: motion, between headlines
    730 #+cindex: jumping, to headlines
    731 #+cindex: headline navigation
    732 
    733 The following commands jump to other headlines in the buffer.
    734 
    735 - {{{kbd(C-c C-n)}}} (~org-next-visible-heading~) ::
    736 
    737   #+kindex: C-c C-n
    738   #+findex: org-next-visible-heading
    739   Next heading.
    740 
    741 - {{{kbd(C-c C-p)}}} (~org-previous-visible-heading~) ::
    742 
    743   #+kindex: C-c C-p
    744   #+findex: org-previous-visible-heading
    745   Previous heading.
    746 
    747 - {{{kbd(C-c C-f)}}} (~org-forward-heading-same-level~) ::
    748 
    749   #+kindex: C-c C-f
    750   #+findex: org-forward-heading-same-level
    751   Next heading same level.
    752 
    753 - {{{kbd(C-c C-b)}}} (~org-backward-heading-same-level~) ::
    754 
    755   #+kindex: C-c C-b
    756   #+findex: org-backward-heading-same-level
    757   Previous heading same level.
    758 
    759 - {{{kbd(C-c C-u)}}} (~outline-up-heading~) ::
    760 
    761   #+kindex: C-c C-u
    762   #+findex: outline-up-heading
    763   Backward to higher level heading.
    764 
    765 - {{{kbd(C-c C-j)}}} (~org-goto~) ::
    766 
    767   #+kindex: C-c C-j
    768   #+findex: org-goto
    769   #+vindex: org-goto-auto-isearch
    770   Jump to a different place without changing the current outline
    771   visibility.  Shows the document structure in a temporary buffer,
    772   where you can use the following keys to find your destination:
    773 
    774   #+attr_texinfo: :columns 0.3 0.7
    775   | {{{kbd(TAB)}}}            | Cycle visibility.               |
    776   | {{{kbd(DOWN)}}} / {{{kbd(UP)}}} | Next/previous visible headline. |
    777   | {{{kbd(RET)}}}            | Select this location.           |
    778   | {{{kbd(/)}}}              | Do a Sparse-tree search         |
    779 
    780   #+texinfo: @noindent
    781   The following keys work if you turn off ~org-goto-auto-isearch~
    782 
    783   #+attr_texinfo: :columns 0.3 0.7
    784   | {{{kbd(n)}}} / {{{kbd(p)}}}   | Next/previous visible headline.    |
    785   | {{{kbd(f)}}} / {{{kbd(b)}}}   | Next/previous headline same level. |
    786   | {{{kbd(u)}}}            | One level up.                      |
    787   | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument.                    |
    788   | {{{kbd(q)}}}            | Quit.                              |
    789 
    790   #+vindex: org-goto-interface
    791   #+texinfo: @noindent
    792   See also the variable ~org-goto-interface~.
    793 
    794 ** Structure Editing
    795 :PROPERTIES:
    796 :DESCRIPTION: Changing sequence and level of headlines.
    797 :END:
    798 #+cindex: structure editing
    799 #+cindex: headline, promotion and demotion
    800 #+cindex: promotion, of subtrees
    801 #+cindex: demotion, of subtrees
    802 #+cindex: subtree, cut and paste
    803 #+cindex: pasting, of subtrees
    804 #+cindex: cutting, of subtrees
    805 #+cindex: copying, of subtrees
    806 #+cindex: sorting, of subtrees
    807 #+cindex: subtrees, cut and paste
    808 
    809 #+attr_texinfo: :sep ,
    810 - {{{kbd(M-RET)}}} (~org-meta-return~) ::
    811 
    812   #+kindex: M-RET
    813   #+findex: org-meta-return
    814   #+vindex: org-M-RET-may-split-line
    815   Insert a new heading, item or row.
    816 
    817   If the command is used at the /beginning/ of a line, and if there is
    818   a heading or a plain list item (see [[*Plain Lists]]) at point, the new
    819   heading/item is created /before/ the current line.  When used at the
    820   beginning of a regular line of text, turn that line into a heading.
    821 
    822   When this command is used in the middle of a line, the line is split
    823   and the rest of the line becomes the new item or headline.  If you
    824   do not want the line to be split, customize
    825   ~org-M-RET-may-split-line~.
    826 
    827   Calling the command with a {{{kbd(C-u)}}} prefix unconditionally
    828   inserts a new heading at the end of the current subtree, thus
    829   preserving its contents.  With a double {{{kbd(C-u C-u)}}} prefix,
    830   the new heading is created at the end of the parent subtree instead.
    831 
    832 - {{{kbd(C-RET)}}} (~org-insert-heading-respect-content~) ::
    833 
    834   #+kindex: C-RET
    835   #+findex: org-insert-heading-respect-content
    836   Insert a new heading at the end of the current subtree.
    837 
    838 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
    839 
    840   #+kindex: M-S-RET
    841   #+findex: org-insert-todo-heading
    842   #+vindex: org-treat-insert-todo-heading-as-state-change
    843   Insert new TODO entry with same level as current heading.  See also
    844   the variable ~org-treat-insert-todo-heading-as-state-change~.
    845 
    846 - {{{kbd(C-S-RET)}}} (~org-insert-todo-heading-respect-content~) ::
    847 
    848   #+kindex: C-S-RET
    849   #+findex: org-insert-todo-heading-respect-content
    850   Insert new TODO entry with same level as current heading.  Like
    851   {{{kbd(C-RET)}}}, the new headline is inserted after the current
    852   subtree.
    853 
    854 - {{{kbd(TAB)}}} (~org-cycle~) ::
    855 
    856   #+kindex: TAB
    857   #+findex: org-cycle
    858   In a new entry with no text yet, the first {{{kbd(TAB)}}} demotes
    859   the entry to become a child of the previous one.  The next
    860   {{{kbd(TAB)}}} makes it a parent, and so on, all the way to top
    861   level.  Yet another {{{kbd(TAB)}}}, and you are back to the initial
    862   level.
    863 
    864 - {{{kbd(M-LEFT)}}} (~org-do-promote~), {{{kbd(M-RIGHT)}}} (~org-do-demote~) ::
    865 
    866   #+kindex: M-LEFT
    867   #+findex: org-do-promote
    868   #+kindex: M-RIGHT
    869   #+findex: org-do-demote
    870   Promote or demote current heading by one level.
    871 
    872   #+cindex: region, active
    873   #+cindex: active region
    874   #+cindex: transient mark mode
    875   When there is an active region---i.e., when Transient Mark mode is
    876   active---promotion and demotion work on all headlines in the region.
    877   To select a region of headlines, it is best to place both point and
    878   mark at the beginning of a line, mark at the beginning of the first
    879   headline, and point at the line just after the last headline to
    880   change.
    881 
    882 - {{{kbd(M-S-LEFT)}}} (~org-promote-subtree~) ::
    883 
    884   #+kindex: M-S-LEFT
    885   #+findex: org-promote-subtree
    886   Promote the current subtree by one level.
    887 
    888 - {{{kbd(M-S-RIGHT)}}} (~org-demote-subtree~) ::
    889 
    890   #+kindex: M-S-RIGHT
    891   #+findex: org-demote-subtree
    892   Demote the current subtree by one level.
    893 
    894 - {{{kbd(M-UP)}}} (~org-move-subtree-up~) ::
    895 
    896   #+kindex: M-UP
    897   #+findex: org-move-subtree-up
    898   Move subtree up, i.e., swap with previous subtree of same level.
    899 
    900 - {{{kbd(M-DOWN)}}} (~org-move-subtree-down~) ::
    901 
    902   #+kindex: M-DOWN
    903   #+findex: org-move-subtree-down
    904   Move subtree down, i.e., swap with next subtree of same level.
    905 
    906 - {{{kbd(C-c @)}}} (~org-mark-subtree~) ::
    907 
    908   #+kindex: C-c @@
    909   #+findex: org-mark-subtree
    910   Mark the subtree at point.  Hitting repeatedly marks subsequent
    911   subtrees of the same level as the marked subtree.
    912 
    913 - {{{kbd(C-c C-x C-w)}}} (~org-cut-subtree~) ::
    914 
    915   #+kindex: C-c C-x C-w
    916   #+findex: org-cut-subtree
    917   Kill subtree, i.e., remove it from buffer but save in kill ring.
    918   With a numeric prefix argument N, kill N sequential subtrees.
    919 
    920 - {{{kbd(C-c C-x M-w)}}} (~org-copy-subtree~) ::
    921 
    922   #+kindex: C-c C-x M-w
    923   #+findex: org-copy-subtree
    924   Copy subtree to kill ring.  With a numeric prefix argument N, copy
    925   the N sequential subtrees.
    926 
    927 - {{{kbd(C-c C-x C-y)}}} (~org-paste-subtree~) ::
    928 
    929   #+kindex: C-c C-x C-y
    930   #+findex: org-paste-subtree
    931   Yank subtree from kill ring.  This does modify the level of the
    932   subtree to make sure the tree fits in nicely at the yank position.
    933   The yank level can also be specified with a numeric prefix argument,
    934   or by yanking after a headline marker like =****=.  With
    935   {{{kbd(C-u)}}} prefix, force inserting as a sibling.  With
    936   {{{kbd(C-u C-u)}}} prefix argument, force inserting as a child.
    937 
    938 - {{{kbd(C-y)}}} (~org-yank~) ::
    939 
    940   #+kindex: C-y
    941   #+findex: org-yank
    942   #+vindex: org-yank-adjusted-subtrees
    943   #+vindex: org-yank-folded-subtrees
    944   Depending on the variables ~org-yank-adjusted-subtrees~ and
    945   ~org-yank-folded-subtrees~, Org's internal ~yank~ command pastes
    946   subtrees folded and in a clever way, using the same command as
    947   {{{kbd(C-c C-x C-y)}}}.  With the default settings, no level
    948   adjustment takes place, but the yanked tree is folded unless doing
    949   so would swallow text previously visible.  Any prefix argument to
    950   this command forces a normal ~yank~ to be executed, with the prefix
    951   passed along.  A good way to force a normal yank is {{{kbd(C-u
    952   C-y)}}}.  If you use ~yank-pop~ after a yank, it yanks previous kill
    953   items plainly, without adjustment and folding.
    954 
    955 - {{{kbd(C-c C-x c)}}} (~org-clone-subtree-with-time-shift~) ::
    956 
    957   #+kindex: C-c C-x c
    958   #+findex: org-clone-subtree-with-time-shift
    959   Clone a subtree by making a number of sibling copies of it.  You are
    960   prompted for the number of copies to make, and you can also specify
    961   if any timestamps in the entry should be shifted.  This can be
    962   useful, for example, to create a number of tasks related to a series
    963   of lectures to prepare.  For more details, see the docstring of the
    964   command ~org-clone-subtree-with-time-shift~.
    965 
    966 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
    967 
    968   #+kindex: C-c C-w
    969   #+findex: org-refile
    970   Refile entry or region to a different location.  See [[*Refile and
    971   Copy]].
    972 
    973 - {{{kbd(C-c ^)}}} (~org-sort~) ::
    974 
    975   #+kindex: C-c ^
    976   #+findex: org-sort
    977   Sort same-level entries.  When there is an active region, all
    978   entries in the region are sorted.  Otherwise the children of the
    979   current headline are sorted.  The command prompts for the sorting
    980   method, which can be alphabetically, numerically, by time---first
    981   timestamp with active preferred, creation time, scheduled time,
    982   deadline time---by priority, by TODO keyword---in the sequence the
    983   keywords have been defined in the setup---or by the value of
    984   a property.  Reverse sorting is possible as well.  You can also
    985   supply your own function to extract the sorting key.  With
    986   a {{{kbd(C-u)}}} prefix, sorting is case-sensitive.
    987 
    988 - {{{kbd(C-x n s)}}} (~org-narrow-to-subtree~) ::
    989 
    990   #+kindex: C-x n s
    991   #+findex: org-narrow-to-subtree
    992   Narrow buffer to current subtree.
    993 
    994 - {{{kbd(C-x n b)}}} (~org-narrow-to-block~) ::
    995 
    996   #+kindex: C-x n b
    997   #+findex: org-narrow-to-block
    998   Narrow buffer to current block.
    999 
   1000 - {{{kbd(C-x n w)}}} (~widen~) ::
   1001 
   1002   #+kindex: C-x n w
   1003   #+findex: widen
   1004   Widen buffer to remove narrowing.
   1005 
   1006 - {{{kbd(C-c *)}}} (~org-toggle-heading~) ::
   1007 
   1008   #+kindex: C-c *
   1009   #+findex: org-toggle-heading
   1010   Turn a normal line or plain list item into a headline---so that it
   1011   becomes a subheading at its location.  Also turn a headline into
   1012   a normal line by removing the stars.  If there is an active region,
   1013   turn all lines in the region into headlines.  If the first line in
   1014   the region was an item, turn only the item lines into headlines.
   1015   Finally, if the first line is a headline, remove the stars from all
   1016   headlines in the region.
   1017 
   1018 Note that when point is inside a table (see [[*Tables]]), the Meta-Cursor
   1019 keys have different functionality.
   1020 
   1021 ** Sparse Trees
   1022 :PROPERTIES:
   1023 :DESCRIPTION: Matches embedded in context.
   1024 :END:
   1025 #+cindex: sparse trees
   1026 #+cindex: trees, sparse
   1027 #+cindex: folding, sparse trees
   1028 #+cindex: occur, command
   1029 
   1030 #+vindex: org-show-context-detail
   1031 An important feature of Org mode is the ability to construct /sparse
   1032 trees/ for selected information in an outline tree, so that the entire
   1033 document is folded as much as possible, but the selected information
   1034 is made visible along with the headline structure above it[fn:: See
   1035 also the variable ~org-show-context-detail~ to decide how much context
   1036 is shown around each match.].  Just try it out and you will see
   1037 immediately how it works.
   1038 
   1039 Org mode contains several commands creating such trees, all these
   1040 commands can be accessed through a dispatcher:
   1041 
   1042 - {{{kbd(C-c /)}}} (~org-sparse-tree~) ::
   1043 
   1044   #+kindex: C-c /
   1045   #+findex: org-sparse-tree
   1046   This prompts for an extra key to select a sparse-tree creating
   1047   command.
   1048 
   1049 - {{{kbd(C-c / r)}}} or {{{kbd(C-c / /)}}} (~org-occur~) ::
   1050 
   1051   #+kindex: C-c / r
   1052   #+kindex: C-c / /
   1053   #+findex: org-occur
   1054   #+vindex: org-remove-highlights-with-change
   1055   Prompts for a regexp (see [[*Regular Expressions]]) and shows a
   1056   sparse tree with all matches.  If the match is in a headline, the
   1057   headline is made visible.  If the match is in the body of an entry,
   1058   headline and body are made visible.  In order to provide minimal
   1059   context, also the full hierarchy of headlines above the match is
   1060   shown, as well as the headline following the match.  Each match is
   1061   also highlighted; the highlights disappear when the buffer is
   1062   changed by an editing command, or by pressing {{{kbd(C-c
   1063   C-c)}}}[fn:: This depends on the option
   1064   ~org-remove-highlights-with-change~.].  When called with a
   1065   {{{kbd(C-u)}}} prefix argument, previous highlights are kept, so
   1066   several calls to this command can be stacked.
   1067 
   1068 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
   1069 
   1070   #+kindex: M-g n
   1071   #+kindex: M-g M-n
   1072   #+findex: next-error
   1073   Jump to the next sparse tree match in this buffer.
   1074 
   1075 - {{{kbd(M-g p)}}} or {{{kbd(M-g M-p)}}} (~previous-error~) ::
   1076 
   1077   #+kindex: M-g p
   1078   #+kindex: M-g M-p
   1079   #+findex: previous-error
   1080   Jump to the previous sparse tree match in this buffer.
   1081 
   1082 #+vindex: org-agenda-custom-commands
   1083 For frequently used sparse trees of specific search strings, you can
   1084 use the variable ~org-agenda-custom-commands~ to define fast keyboard
   1085 access to specific sparse trees.  These commands will then be
   1086 accessible through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
   1087 For example:
   1088 
   1089 #+begin_src emacs-lisp
   1090 (setq org-agenda-custom-commands
   1091       '(("f" occur-tree "FIXME")))
   1092 #+end_src
   1093 
   1094 #+texinfo: @noindent
   1095 defines the key {{{kbd(f)}}} as a shortcut for creating a sparse tree
   1096 matching the string =FIXME=.
   1097 
   1098 The other sparse tree commands select headings based on TODO keywords,
   1099 tags, or properties and are discussed later in this manual.
   1100 
   1101 #+kindex: C-c C-e C-v
   1102 #+cindex: printing sparse trees
   1103 #+cindex: visible text, printing
   1104 To print a sparse tree, you can use the Emacs command
   1105 ~ps-print-buffer-with-faces~ which does not print invisible parts of
   1106 the document.  Or you can use the command {{{kbd(C-c C-e C-v)}}} to
   1107 export only the visible part of the document and print the resulting
   1108 file.
   1109 
   1110 ** Plain Lists
   1111 :PROPERTIES:
   1112 :DESCRIPTION: Additional structure within an entry.
   1113 :END:
   1114 #+cindex: plain lists
   1115 #+cindex: lists, plain
   1116 #+cindex: lists, ordered
   1117 #+cindex: ordered lists
   1118 
   1119 Within an entry of the outline tree, hand-formatted lists can provide
   1120 additional structure.  They also provide a way to create lists of
   1121 checkboxes (see [[*Checkboxes]]).  Org supports editing such lists, and
   1122 every exporter (see [[*Exporting]]) can parse and format them.
   1123 
   1124 Org knows ordered lists, unordered lists, and description lists.
   1125 
   1126 #+attr_texinfo: :indic @bullet
   1127 - /Unordered/ list items start with =-=, =+=, or =*=[fn:3] as bullets.
   1128 
   1129 -
   1130   #+vindex: org-plain-list-ordered-item-terminator
   1131   #+vindex: org-alphabetical-lists
   1132   /Ordered/ list items start with a numeral followed by either a
   1133   period or a right parenthesis[fn:: You can filter out any of them by
   1134   configuring ~org-plain-list-ordered-item-terminator~.], such as =1.=
   1135   or =1)=[fn:4] If you want a list to start with a different
   1136   value---e.g., 20---start the text of the item with =[@20]=[fn:5].
   1137   Those constructs can be used in any item of the list in order to
   1138   enforce a particular numbering.
   1139 
   1140 - /Description/ list items are unordered list items, and contain the
   1141   separator =::= to distinguish the description /term/ from the
   1142   description.
   1143 
   1144 Items belonging to the same list must have the same indentation on the
   1145 first line.  In particular, if an ordered list reaches number =10.=,
   1146 then the 2-digit numbers must be written left-aligned with the other
   1147 numbers in the list.  An item ends before the next line that is less
   1148 or equally indented than its bullet/number.
   1149 
   1150 A list ends whenever every item has ended, which means before any line
   1151 less or equally indented than items at top level.  It also ends before
   1152 two blank lines.  In that case, all items are closed.  Here is an
   1153 example:
   1154 
   1155 #+begin_example
   1156 ,* Lord of the Rings
   1157 My favorite scenes are (in this order)
   1158 1. The attack of the Rohirrim
   1159 2. Eowyn's fight with the witch king
   1160    + this was already my favorite scene in the book
   1161    + I really like Miranda Otto.
   1162 3. Peter Jackson being shot by Legolas
   1163    - on DVD only
   1164    He makes a really funny face when it happens.
   1165 8. [@8] <favorite scenes 4 to 8 are skipped for brevity>
   1166 But in the end, no individual scenes matter but the film as a whole.
   1167 Important actors in this film are:
   1168 - Elijah Wood :: He plays Frodo
   1169 - Sean Astin :: He plays Sam, Frodo's friend.  I still remember him
   1170      very well from his role as Mikey Walsh in /The Goonies/.
   1171 #+end_example
   1172 
   1173 Org supports these lists by tuning filling and wrapping commands to
   1174 deal with them correctly, and by exporting them properly (see
   1175 [[*Exporting]]).  Since indentation is what governs the structure of these
   1176 lists, many structural constructs like =#+BEGIN_= blocks can be
   1177 indented to signal that they belong to a particular item.
   1178 
   1179 #+vindex: org-list-demote-modify-bullet
   1180 #+vindex: org-list-indent-offset
   1181 If you find that using a different bullet for a sub-list---than that
   1182 used for the current list-level---improves readability, customize the
   1183 variable ~org-list-demote-modify-bullet~.  To get a greater difference
   1184 of indentation between items and theirs sub-items, customize
   1185 ~org-list-indent-offset~.
   1186 
   1187 #+vindex: org-list-automatic-rules
   1188 The following commands act on items when point is in the first line of
   1189 an item---the line with the bullet or number.  Some of them imply the
   1190 application of automatic rules to keep list structure intact.  If some
   1191 of these actions get in your way, configure ~org-list-automatic-rules~
   1192 to disable them individually.
   1193 
   1194 #+attr_texinfo: :sep ,
   1195 - {{{kbd(TAB)}}} (~org-cycle~) ::
   1196 
   1197   #+cindex: cycling, in plain lists
   1198   #+kindex: TAB
   1199   #+findex: org-cycle
   1200   #+vindex: org-cycle-include-plain-lists
   1201   Items can be folded just like headline levels.  Normally this works
   1202   only if point is on a plain list item.  For more details, see the
   1203   variable ~org-cycle-include-plain-lists~.  If this variable is set
   1204   to ~integrate~, plain list items are treated like low-level
   1205   headlines.  The level of an item is then given by the indentation of
   1206   the bullet/number.  Items are always subordinate to real headlines,
   1207   however; the hierarchies remain completely separated.  In a new item
   1208   with no text yet, the first {{{kbd(TAB)}}} demotes the item to
   1209   become a child of the previous one.  Subsequent {{{kbd(TAB)}}}s move
   1210   the item to meaningful levels in the list and eventually get it back
   1211   to its initial position.
   1212 
   1213 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
   1214 
   1215   #+kindex: M-RET
   1216   #+findex: org-insert-heading
   1217   #+vindex: org-M-RET-may-split-line
   1218   Insert new item at current level.  With a prefix argument, force a
   1219   new heading (see [[*Structure Editing]]).  If this command is used
   1220   in the middle of an item, that item is /split/ in two, and the
   1221   second part becomes the new item[fn:: If you do not want the item to
   1222   be split, customize the variable ~org-M-RET-may-split-line~.].  If
   1223   this command is executed /before item's body/, the new item is
   1224   created /before/ the current one.
   1225 
   1226 - {{{kbd(M-S-RET)}}} ::
   1227 
   1228   #+kindex: M-S-RET
   1229   Insert a new item with a checkbox (see [[*Checkboxes]]).
   1230 
   1231 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}} ::
   1232 
   1233   #+kindex: S-UP
   1234   #+kindex: S-DOWN
   1235   #+cindex: shift-selection-mode
   1236   #+vindex: org-support-shift-select
   1237   #+vindex: org-list-use-circular-motion
   1238   Jump to the previous/next item in the current list, but only if
   1239   ~org-support-shift-select~ is off[fn:: If you want to cycle around
   1240   items that way, you may customize ~org-list-use-circular-motion~.].
   1241   If not, you can still use paragraph jumping commands like
   1242   {{{kbd(C-UP)}}} and {{{kbd(C-DOWN)}}} to quite similar effect.
   1243 
   1244 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
   1245 
   1246   #+kindex: M-UP
   1247   #+kindex: M-DOWN
   1248   Move the item including subitems up/down[fn:: See
   1249   ~org-list-use-circular-motion~ for a cyclic behavior.], i.e., swap
   1250   with previous/next item of same indentation.  If the list is
   1251   ordered, renumbering is automatic.
   1252 
   1253 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
   1254 
   1255   #+kindex: M-LEFT
   1256   #+kindex: M-RIGHT
   1257   Decrease/increase the indentation of an item, leaving children
   1258   alone.
   1259 
   1260 - {{{kbd(M-S-LEFT)}}}, {{{kbd(M-S-RIGHT)}}} ::
   1261 
   1262   #+kindex: M-S-LEFT
   1263   #+kindex: M-S-RIGHT
   1264   Decrease/increase the indentation of the item, including subitems.
   1265   Initially, the item tree is selected based on current indentation.
   1266   When these commands are executed several times in direct succession,
   1267   the initially selected region is used, even if the new indentation
   1268   would imply a different hierarchy.  To use the new hierarchy, break
   1269   the command chain by moving point.
   1270 
   1271   As a special case, using this command on the very first item of
   1272   a list moves the whole list.  This behavior can be disabled by
   1273   configuring ~org-list-automatic-rules~.  The global indentation of
   1274   a list has no influence on the text /after/ the list.
   1275 
   1276 - {{{kbd(C-c C-c)}}} ::
   1277 
   1278   #+kindex: C-c C-c
   1279   If there is a checkbox (see [[*Checkboxes]]) in the item line, toggle
   1280   the state of the checkbox.  In any case, verify bullets and
   1281   indentation consistency in the whole list.
   1282 
   1283 - {{{kbd(C-c -)}}} ::
   1284 
   1285   #+kindex: C-c -
   1286   #+vindex: org-plain-list-ordered-item-terminator
   1287   Cycle the entire list level through the different itemize/enumerate
   1288   bullets (=-=, =+=, =*=, =1.=, =1)=) or a subset of them, depending
   1289   on ~org-plain-list-ordered-item-terminator~, the type of list, and
   1290   its indentation.  With a numeric prefix argument N, select the Nth
   1291   bullet from this list.  If there is an active region when calling
   1292   this, all lines are converted to list items.  With a prefix
   1293   argument, the selected text is changed into a single item.  If the
   1294   first line already was a list item, any item marker is removed from
   1295   the list.  Finally, even without an active region, a normal line is
   1296   converted into a list item.
   1297 
   1298 - {{{kbd(C-c *)}}} ::
   1299 
   1300   #+kindex: C-c *
   1301   Turn a plain list item into a headline---so that it becomes
   1302   a subheading at its location.  See [[*Structure Editing]], for
   1303   a detailed explanation.
   1304 
   1305 - {{{kbd(C-c C-*)}}} ::
   1306 
   1307   #+kindex: C-c C-*
   1308   Turn the whole plain list into a subtree of the current heading.
   1309   Checkboxes (see [[*Checkboxes]]) become =TODO=, respectively =DONE=,
   1310   keywords when unchecked, respectively checked.
   1311 
   1312 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
   1313 
   1314   #+vindex: org-support-shift-select
   1315   #+kindex: S-LEFT
   1316   #+kindex: S-RIGHT
   1317   This command also cycles bullet styles when point is in on the
   1318   bullet or anywhere in an item line, details depending on
   1319   ~org-support-shift-select~.
   1320 
   1321 - {{{kbd(C-c ^)}}} ::
   1322 
   1323   #+kindex: C-c ^
   1324   #+cindex: sorting, of plain list
   1325   Sort the plain list.  Prompt for the sorting method: numerically,
   1326   alphabetically, by time, or by custom function.
   1327 
   1328 ** Drawers
   1329 :PROPERTIES:
   1330 :DESCRIPTION: Tucking stuff away.
   1331 :END:
   1332 #+cindex: drawers
   1333 #+cindex: visibility cycling, drawers
   1334 
   1335 Sometimes you want to keep information associated with an entry, but
   1336 you normally do not want to see it.  For this, Org mode has /drawers/.
   1337 They can contain anything but a headline and another drawer.  Drawers
   1338 look like this:
   1339 
   1340 #+begin_example
   1341 ,** This is a headline
   1342 Still outside the drawer
   1343 :DRAWERNAME:
   1344 This is inside the drawer.
   1345 :END:
   1346 After the drawer.
   1347 #+end_example
   1348 
   1349 #+kindex: C-c C-x d
   1350 #+findex: org-insert-drawer
   1351 You can interactively insert a drawer at point by calling
   1352 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}.  With an
   1353 active region, this command puts the region inside the drawer.  With a
   1354 prefix argument, this command calls non-interactive function
   1355 ~org-insert-property-drawer~, which creates a =PROPERTIES= drawer
   1356 right below the current headline.  Org mode uses this special drawer
   1357 for storing properties (see [[*Properties and Columns]]).  You cannot use
   1358 it for anything else.
   1359 
   1360 Completion over drawer keywords is also possible using
   1361 {{{kbd(M-TAB)}}}[fn:6].
   1362 
   1363 Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and
   1364 shows the entry, but keep the drawer collapsed to a single line.  In
   1365 order to look inside the drawer, you need to move point to the drawer
   1366 line and press {{{kbd(TAB)}}} there.
   1367 
   1368 You can also arrange for state change notes (see [[Tracking TODO state
   1369 changes]]) and clock times (see [[*Clocking Work Time]]) to be stored in
   1370 a =LOGBOOK= drawer.  If you want to store a quick note there, in
   1371 a similar way to state changes, use
   1372 
   1373 - {{{kbd(C-c C-z)}}} ::
   1374 
   1375   #+kindex: C-c C-z
   1376   Add a time-stamped note to the =LOGBOOK= drawer.
   1377 
   1378 ** Blocks
   1379 :PROPERTIES:
   1380 :DESCRIPTION: Folding blocks.
   1381 :END:
   1382 #+vindex: org-hide-block-startup
   1383 #+cindex: blocks, folding
   1384 
   1385 Org mode uses =#+BEGIN= ... =#+END= blocks for various purposes from
   1386 including source code examples (see [[*Literal Examples]]) to capturing
   1387 time logging information (see [[*Clocking Work Time]]).  These blocks can
   1388 be folded and unfolded by pressing {{{kbd(TAB)}}} in the =#+BEGIN=
   1389 line.  You can also get all blocks folded at startup by configuring
   1390 the variable ~org-hide-block-startup~ or on a per-file basis by using
   1391 
   1392 #+cindex: STARTUP, keyword
   1393 #+begin_example
   1394 ,#+STARTUP: hideblocks
   1395 ,#+STARTUP: nohideblocks
   1396 #+end_example
   1397 
   1398 * Tables
   1399 :PROPERTIES:
   1400 :DESCRIPTION: Pure magic for quick formatting.
   1401 :END:
   1402 #+cindex: tables
   1403 #+cindex: editing tables
   1404 
   1405 Org comes with a fast and intuitive table editor.  Spreadsheet-like
   1406 calculations are supported using the Emacs Calc package (see [[info:calc][GNU Emacs
   1407 Calculator Manual]]).
   1408 
   1409 ** Built-in Table Editor
   1410 :PROPERTIES:
   1411 :DESCRIPTION: Simple tables.
   1412 :END:
   1413 #+cindex: table editor, built-in
   1414 
   1415 #+cindex: header lines, in tables
   1416 #+cindex: horizontal rule, in tables
   1417 #+cindex: row separator, in tables
   1418 #+cindex: table syntax
   1419 Org makes it easy to format tables in plain ASCII.  Any line with =|=
   1420 as the first non-whitespace character is considered part of a table.
   1421 =|= is also the column separator[fn:: To insert a vertical bar into a
   1422 table field, use =\vert= or, inside a word =abc\vert{}def=.].
   1423 Moreover, a line starting with =|-= is a horizontal rule.  It
   1424 separates rows explicitly.  Rows before the first horizontal rule are
   1425 header lines.  A table might look like this:
   1426 
   1427 #+begin_example
   1428 | Name  | Phone | Age |
   1429 |-------+-------+-----|
   1430 | Peter |  1234 |  17 |
   1431 | Anna  |  4321 |  25 |
   1432 #+end_example
   1433 
   1434 A table is re-aligned automatically each time you press
   1435 {{{kbd(TAB)}}}, {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} inside the table.
   1436 {{{kbd(TAB)}}} also moves to the next field---{{{kbd(RET)}}} to the
   1437 next row---and creates new table rows at the end of the table or
   1438 before horizontal lines.  The indentation of the table is set by the
   1439 first line.  Horizontal rules are automatically expanded on every
   1440 re-align to span the whole table width.  So, to create the above
   1441 table, you would only type
   1442 
   1443 #+begin_example
   1444 |Name|Phone|Age|
   1445 |-
   1446 #+end_example
   1447 
   1448 #+texinfo: @noindent
   1449 and then press {{{kbd(TAB)}}} to align the table and start filling in
   1450 fields.  Even faster would be to type =|Name|Phone|Age= followed by
   1451 {{{kbd(C-c RET)}}}.
   1452 
   1453 When typing text into a field, Org treats {{{kbd(DEL)}}},
   1454 {{{kbd(Backspace)}}}, and all character keys in a special way, so that
   1455 inserting and deleting avoids shifting other fields.  Also, when
   1456 typing /immediately/ after point was moved into a new field with
   1457 {{{kbd(TAB)}}}, {{{kbd(S-TAB)}}} or {{{kbd(RET)}}}, the field is
   1458 automatically made blank.  If this behavior is too unpredictable for
   1459 you, configure the option ~org-table-auto-blank-field~.
   1460 
   1461 *** Creation and conversion
   1462 :PROPERTIES:
   1463 :UNNUMBERED: notoc
   1464 :END:
   1465 
   1466 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
   1467 
   1468   #+kindex: C-c |
   1469   #+findex: org-table-create-or-convert-from-region
   1470   Convert the active region to table.  If every line contains at least
   1471   one {{{kbd(TAB)}}} character, the function assumes that the material
   1472   is tab separated.  If every line contains a comma, comma-separated
   1473   values (CSV) are assumed.  If not, lines are split at whitespace
   1474   into fields.  You can use a prefix argument to force a specific
   1475   separator: {{{kbd(C-u)}}} forces CSV, {{{kbd(C-u C-u)}}} forces
   1476   {{{kbd(TAB)}}}, {{{kbd(C-u C-u C-u)}}} prompts for a regular
   1477   expression to match the separator, and a numeric argument
   1478   N indicates that at least N consecutive spaces, or alternatively
   1479   a {{{kbd(TAB)}}} will be the separator.
   1480 
   1481   If there is no active region, this command creates an empty Org
   1482   table.  But it is easier just to start typing, like {{{kbd(|
   1483   N a m e | P h o n e | A g e RET | - TAB)}}}.
   1484 
   1485 *** Re-aligning and field motion
   1486 :PROPERTIES:
   1487 :UNNUMBERED: notoc
   1488 :END:
   1489 
   1490 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
   1491 
   1492   #+kindex: C-c C-c
   1493   #+findex: org-table-align
   1494   Re-align the table without moving point.
   1495 
   1496 - {{{kbd(TAB)}}} (~org-table-next-field~) ::
   1497 
   1498   #+kindex: TAB
   1499   #+findex: org-table-next-field
   1500   Re-align the table, move to the next field.  Creates a new row if
   1501   necessary.
   1502 
   1503 - {{{kbd(M-x org-table-blank-field)}}} ::
   1504 
   1505   #+findex: org-table-blank-field
   1506   Blank the current table field or active region.
   1507 
   1508 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
   1509 
   1510   #+kindex: S-TAB
   1511   #+findex: org-table-previous-field
   1512   Re-align, move to previous field.
   1513 
   1514 - {{{kbd(RET)}}} (~org-table-next-row~) ::
   1515 
   1516   #+kindex: RET
   1517   #+findex: org-table-next-row
   1518   Re-align the table and move down to next row.  Creates a new row if
   1519   necessary.  At the beginning or end of a line, {{{kbd(RET)}}} still
   1520   inserts a new line, so it can be used to split a table.
   1521 
   1522 - {{{kbd(M-a)}}} (~org-table-beginning-of-field~) ::
   1523 
   1524   #+kindex: M-a
   1525   #+findex: org-table-beginning-of-field
   1526   Move to beginning of the current table field, or on to the previous
   1527   field.
   1528 
   1529 - {{{kbd(M-e)}}} (~org-table-end-of-field~) ::
   1530 
   1531   #+kindex: M-e
   1532   #+findex: org-table-end-of-field
   1533   Move to end of the current table field, or on to the next field.
   1534 
   1535 *** Column and row editing
   1536 :PROPERTIES:
   1537 :UNNUMBERED: notoc
   1538 :END:
   1539 
   1540 - {{{kbd(M-LEFT)}}} (~org-table-move-column-left~) ::
   1541 
   1542   #+kindex: M-LEFT
   1543   #+findex: org-table-move-column-left
   1544   Move the current column left.
   1545 
   1546 - {{{kbd(M-RIGHT)}}} (~org-table-move-column-right~) ::
   1547 
   1548   #+kindex: M-RIGHT
   1549   #+findex: org-table-move-column-right
   1550   Move the current column right.
   1551 
   1552 - {{{kbd(M-S-LEFT)}}} (~org-table-delete-column~) ::
   1553 
   1554   #+kindex: M-S-LEFT
   1555   #+findex: org-table-delete-column
   1556   Kill the current column.
   1557 
   1558 - {{{kbd(M-S-RIGHT)}}} (~org-table-insert-column~) ::
   1559 
   1560   #+kindex: M-S-RIGHT
   1561   #+findex: org-table-insert-column
   1562   Insert a new column at point position.  Move the recent column and
   1563   all cells to the right of this column to the right.
   1564 
   1565 - {{{kbd(M-UP)}}} (~org-table-move-row-up~) ::
   1566 
   1567   #+kindex: M-UP
   1568   #+findex: org-table-move-row-up
   1569   Move the current row up.
   1570 
   1571 - {{{kbd(M-DOWN)}}} (~org-table-move-row-down~) ::
   1572 
   1573   #+kindex: M-DOWN
   1574   #+findex: org-table-move-row-down
   1575   Move the current row down.
   1576 
   1577 - {{{kbd(M-S-UP)}}} (~org-table-kill-row~) ::
   1578 
   1579   #+kindex: M-S-UP
   1580   #+findex: org-table-kill-row
   1581   Kill the current row or horizontal line.
   1582 
   1583 - {{{kbd(S-UP)}}} (~org-table-move-cell-up~) ::
   1584 
   1585   #+kindex: S-UP
   1586   #+findex: org-table-move-cell-up
   1587   Move cell up by swapping with adjacent cell.
   1588 
   1589 - {{{kbd(S-DOWN)}}} (~org-table-move-cell-down~) ::
   1590 
   1591   #+kindex: S-DOWN
   1592   #+findex: org-table-move-cell-down
   1593   Move cell down by swapping with adjacent cell.
   1594 
   1595 - {{{kbd(S-LEFT)}}} (~org-table-move-cell-left~) ::
   1596 
   1597   #+kindex: S-LEFT
   1598   #+findex: org-table-move-cell-left
   1599   Move cell left by swapping with adjacent cell.
   1600 
   1601 - {{{kbd(S-RIGHT)}}} (~org-table-move-cell-right~) ::
   1602 
   1603   #+kindex: S-RIGHT
   1604   #+findex: org-table-move-cell-right
   1605   Move cell right by swapping with adjacent cell.
   1606 
   1607 - {{{kbd(M-S-DOWN)}}} (~org-table-insert-row~) ::
   1608 
   1609   #+kindex: M-S-DOWN
   1610   #+findex: org-table-insert-row
   1611   Insert a new row above the current row.  With a prefix argument, the
   1612   line is created below the current one.
   1613 
   1614 - {{{kbd(C-c -)}}} (~org-table-insert-hline~) ::
   1615 
   1616   #+kindex: C-c -
   1617   #+findex: org-table-insert-hline
   1618   Insert a horizontal line below current row.  With a prefix argument,
   1619   the line is created above the current line.
   1620 
   1621 - {{{kbd(C-c RET)}}} (~org-table-hline-and-move~) ::
   1622 
   1623   #+kindex: C-c RET
   1624   #+findex: org-table-hline-and-move
   1625   Insert a horizontal line below current row, and move point into the
   1626   row below that line.
   1627 
   1628 - {{{kbd(C-c ^)}}} (~org-table-sort-lines~) ::
   1629 
   1630   #+kindex: C-c ^
   1631   #+findex: org-table-sort-lines
   1632   Sort the table lines in the region.  The position of point indicates
   1633   the column to be used for sorting, and the range of lines is the
   1634   range between the nearest horizontal separator lines, or the entire
   1635   table.  If point is before the first column, you are prompted for
   1636   the sorting column.  If there is an active region, the mark
   1637   specifies the first line and the sorting column, while point should
   1638   be in the last line to be included into the sorting.  The command
   1639   prompts for the sorting type, alphabetically, numerically, or by
   1640   time.  You can sort in normal or reverse order.  You can also supply
   1641   your own key extraction and comparison functions.  When called with
   1642   a prefix argument, alphabetic sorting is case-sensitive.
   1643 
   1644 *** Regions
   1645 :PROPERTIES:
   1646 :UNNUMBERED: notoc
   1647 :END:
   1648 
   1649 - {{{kbd(C-c C-x M-w)}}} (~org-table-copy-region~) ::
   1650 
   1651   #+kindex: C-c C-x M-w
   1652   #+findex: org-table-copy-region
   1653   Copy a rectangular region from a table to a special clipboard.
   1654   Point and mark determine edge fields of the rectangle.  If there is
   1655   no active region, copy just the current field.  The process ignores
   1656   horizontal separator lines.
   1657 
   1658 - {{{kbd(C-c C-x C-w)}}} (~org-table-cut-region~) ::
   1659 
   1660   #+kindex: C-c C-x C-w
   1661   #+findex: org-table-cut-region
   1662   Copy a rectangular region from a table to a special clipboard, and
   1663   blank all fields in the rectangle.  So this is the "cut" operation.
   1664 
   1665 - {{{kbd(C-c C-x C-y)}}} (~org-table-paste-rectangle~) ::
   1666 
   1667   #+kindex: C-c C-x C-y
   1668   #+findex: org-table-paste-rectangle
   1669   Paste a rectangular region into a table.  The upper left corner ends
   1670   up in the current field.  All involved fields are overwritten.  If
   1671   the rectangle does not fit into the present table, the table is
   1672   enlarged as needed.  The process ignores horizontal separator lines.
   1673 
   1674 - {{{kbd(M-RET)}}} (~org-table-wrap-region~) ::
   1675 
   1676   #+kindex: M-RET
   1677   #+findex: org-table-wrap-region
   1678   Split the current field at point position and move the rest to the
   1679   line below.  If there is an active region, and both point and mark
   1680   are in the same column, the text in the column is wrapped to minimum
   1681   width for the given number of lines.  A numeric prefix argument may
   1682   be used to change the number of desired lines.  If there is no
   1683   region, but you specify a prefix argument, the current field is made
   1684   blank, and the content is appended to the field above.
   1685 
   1686 *** Calculations
   1687 :PROPERTIES:
   1688 :UNNUMBERED: notoc
   1689 :END:
   1690 
   1691 #+cindex: formula, in tables
   1692 #+cindex: calculations, in tables
   1693 
   1694 - {{{kbd(C-c +)}}} (~org-table-sum~) ::
   1695 
   1696   #+kindex: C-c +
   1697   #+findex: org-table-sum
   1698   Sum the numbers in the current column, or in the rectangle defined
   1699   by the active region.  The result is shown in the echo area and can
   1700   be inserted with {{{kbd(C-y)}}}.
   1701 
   1702 - {{{kbd(S-RET)}}} (~org-table-copy-down~) ::
   1703 
   1704   #+kindex: S-RET
   1705   #+findex: org-table-copy-down
   1706   #+vindex: org-table-copy-increment
   1707   When current field is empty, copy from first non-empty field above.
   1708   When not empty, copy current field down to next row and move point
   1709   along with it.
   1710 
   1711   Depending on the variable ~org-table-copy-increment~, integer and
   1712   time stamp field values, and fields prefixed or suffixed with
   1713   a whole number, can be incremented during copy.  Also, a ~0~ prefix
   1714   argument temporarily disables the increment.
   1715 
   1716   This key is also used by shift-selection and related modes (see
   1717   [[*Packages that conflict with Org mode]]).
   1718 
   1719 *** Miscellaneous
   1720 :PROPERTIES:
   1721 :UNNUMBERED: notoc
   1722 :END:
   1723 
   1724 - {{{kbd(C-c `)}}} (~org-table-edit-field~) ::
   1725 
   1726   #+kindex: C-c `
   1727   #+findex: org-table-edit-field
   1728   Edit the current field in a separate window.  This is useful for
   1729   fields that are not fully visible (see [[*Column Width and Alignment]]).
   1730   When called with a {{{kbd(C-u)}}} prefix, just make the full field
   1731   visible, so that it can be edited in place.  When called with two
   1732   {{{kbd(C-u)}}} prefixes, make the editor window follow point through
   1733   the table and always show the current field.  The follow mode exits
   1734   automatically when point leaves the table, or when you repeat this
   1735   command with {{{kbd(C-u C-u C-c `)}}}.
   1736 
   1737 - {{{kbd(M-x org-table-import)}}} ::
   1738 
   1739   #+findex: org-table-import
   1740   Import a file as a table.  The table should be TAB or whitespace
   1741   separated.  Use, for example, to import a spreadsheet table or data
   1742   from a database, because these programs generally can write
   1743   TAB-separated text files.  This command works by inserting the file
   1744   into the buffer and then converting the region to a table.  Any
   1745   prefix argument is passed on to the converter, which uses it to
   1746   determine the separator.
   1747 
   1748 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
   1749 
   1750   #+kindex: C-c |
   1751   #+findex: org-table-create-or-convert-from-region
   1752   Tables can also be imported by pasting tabular text into the Org
   1753   buffer, selecting the pasted text with {{{kbd(C-x C-x)}}} and then
   1754   using the {{{kbd(C-c |)}}} command (see [[*Creation and conversion]]).
   1755 
   1756 - {{{kbd(M-x org-table-export)}}} ::
   1757 
   1758   #+findex: org-table-export
   1759   #+vindex: org-table-export-default-format
   1760   Export the table, by default as a TAB-separated file.  Use for data
   1761   exchange with, for example, spreadsheet or database programs.  The
   1762   format used to export the file can be configured in the variable
   1763   ~org-table-export-default-format~.  You may also use properties
   1764   =TABLE_EXPORT_FILE= and =TABLE_EXPORT_FORMAT= to specify the file
   1765   name and the format for table export in a subtree.  Org supports
   1766   quite general formats for exported tables.  The exporter format is
   1767   the same as the format used by Orgtbl radio tables, see [[*Translator
   1768   functions]], for a detailed description.
   1769 
   1770 - {{{kbd(M-x org-table-header-line-mode)}}} ::
   1771 
   1772   #+findex: org-table-header-line-mode
   1773   #+vindex: org-table-header-line-p
   1774   Turn on the display of the first data row of the table at point in
   1775   the window header line when this first row is not visible anymore in
   1776   the buffer.  You can activate this minor mode by default by setting
   1777   the option ~org-table-header-line-p~ to ~t~.
   1778 
   1779 - {{{kbd(M-x org-table-transpose-table-at-point)}}} ::
   1780 
   1781   #+findex: org-table-transpose-table-at-point
   1782   Transpose the table at point and eliminate hlines.
   1783 
   1784 ** Column Width and Alignment
   1785 :PROPERTIES:
   1786 :DESCRIPTION: Overrule the automatic settings.
   1787 :END:
   1788 #+cindex: narrow columns in tables
   1789 #+cindex: alignment in tables
   1790 
   1791 The width of columns is automatically determined by the table editor.
   1792 The alignment of a column is determined automatically from the
   1793 fraction of number-like versus non-number fields in the column.
   1794 
   1795 #+vindex: org-table-automatic-realign
   1796 Editing a field may modify alignment of the table.  Moving
   1797 a contiguous row or column---i.e., using {{{kbd(TAB)}}} or
   1798 {{{kbd(RET)}}}---automatically re-aligns it.  If you want to disable
   1799 this behavior, set ~org-table-automatic-realign~ to ~nil~.  In any
   1800 case, you can always align manually a table:
   1801 
   1802 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
   1803 
   1804   #+kindex: C-c C-c
   1805   #+findex: org-table-align
   1806   Align the current table.
   1807 
   1808 #+vindex: org-startup-align-all-tables
   1809 Setting the option ~org-startup-align-all-tables~ re-aligns all tables
   1810 in a file upon visiting it.  You can also set this option on
   1811 a per-file basis with:
   1812 
   1813 #+begin_example
   1814 ,#+STARTUP: align
   1815 ,#+STARTUP: noalign
   1816 #+end_example
   1817 
   1818 Sometimes a single field or a few fields need to carry more text,
   1819 leading to inconveniently wide columns.  Maybe you want to hide away
   1820 several columns or display them with a fixed width, regardless of
   1821 content, as shown in the following example.
   1822 
   1823 #+begin_example
   1824 |---+---------------------+--------|           |---+-------…+…|
   1825 |   | <6>                 |        |           |   | <6>   …|…|
   1826 | 1 | one                 | some   |   ----\   | 1 | one   …|…|
   1827 | 2 | two                 | boring |   ----/   | 2 | two   …|…|
   1828 | 3 | This is a long text | column |           | 3 | This i…|…|
   1829 |---+---------------------+--------|           |---+-------…+…|
   1830 #+end_example
   1831 
   1832 To set the width of a column, one field anywhere in the column may
   1833 contain just the string =<N>= where {{{var(N)}}} specifies the width
   1834 as a number of characters.  You control displayed width of columns
   1835 with the following tools:
   1836 
   1837 - {{{kbd(C-c TAB)}}} (~org-table-toggle-column-width~) ::
   1838 
   1839   #+kindex: C-c TAB
   1840   #+findex: org-table-toggle-column-width
   1841   Shrink or expand current column.
   1842 
   1843   If a width cookie specifies a width W for the column, shrinking it
   1844   displays the first W visible characters only.  Otherwise, the column
   1845   is shrunk to a single character.
   1846 
   1847   When called before the first column or after the last one, ask for
   1848   a list of column ranges to operate on.
   1849 
   1850 - {{{kbd(C-u C-c TAB)}}} (~org-table-shrink~) ::
   1851 
   1852   #+kindex: C-u C-c TAB
   1853   #+findex: org-table-shrink
   1854   Shrink all columns with a column width.  Expand the others.
   1855 
   1856 - {{{kbd(C-u C-u C-c TAB)}}} (~org-table-expand~) ::
   1857 
   1858   #+kindex: C-u C-u C-c TAB
   1859   #+findex: org-table-expand
   1860   Expand all columns.
   1861 
   1862 To see the full text of a shrunk field, hold the mouse over it:
   1863 a tool-tip window then shows the full contents of the field.
   1864 Alternatively, {{{kbd(C-h .)}}} (~display-local-help~) reveals them,
   1865 too.  For convenience, any change near the shrunk part of a column
   1866 expands it.
   1867 
   1868 #+vindex: org-startup-shrink-all-tables
   1869 Setting the option ~org-startup-shrink-all-tables~ shrinks all columns
   1870 containing a width cookie in a file the moment it is visited.  You can
   1871 also set this option on a per-file basis with:
   1872 
   1873 : #+STARTUP: shrink
   1874 
   1875 If you would like to overrule the automatic alignment of number-rich
   1876 columns to the right and of string-rich columns to the left, you can
   1877 use =<r>=, =<c>= or =<l>= in a similar fashion.  You may also combine
   1878 alignment and field width like this: =<r10>=.
   1879 
   1880 Lines which only contain these formatting cookies are removed
   1881 automatically upon exporting the document.
   1882 
   1883 ** Column Groups
   1884 :PROPERTIES:
   1885 :DESCRIPTION: Grouping to trigger vertical lines.
   1886 :END:
   1887 #+cindex: grouping columns in tables
   1888 
   1889 When Org exports tables, it does so by default without vertical lines
   1890 because that is visually more satisfying in general.  Occasionally
   1891 however, vertical lines can be useful to structure a table into groups
   1892 of columns, much like horizontal lines can do for groups of rows.  In
   1893 order to specify column groups, you can use a special row where the
   1894 first field contains only =/=.  The further fields can either contain
   1895 =<= to indicate that this column should start a group, =>= to indicate
   1896 the end of a column, or =<>= (no space between =<= and =>=) to make
   1897 a column a group of its own.  Upon export, boundaries between column
   1898 groups are marked with vertical lines.  Here is an example:
   1899 
   1900 #+begin_example
   1901 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
   1902 |---+-----+-----+-----+---------+------------|
   1903 | / |  <  |     |  >  |       < |          > |
   1904 | 1 |  1  |  1  |  1  |       1 |          1 |
   1905 | 2 |  4  |  8  | 16  |  1.4142 |     1.1892 |
   1906 | 3 |  9  | 27  | 81  |  1.7321 |     1.3161 |
   1907 |---+-----+-----+-----+---------+------------|
   1908 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
   1909 #+end_example
   1910 
   1911 It is also sufficient to just insert the column group starters after
   1912 every vertical line you would like to have:
   1913 
   1914 #+begin_example
   1915 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
   1916 |---+-----+-----+-----+---------+------------|
   1917 | / | <   |     |     | <       |            |
   1918 #+end_example
   1919 
   1920 ** The Orgtbl Minor Mode
   1921 :PROPERTIES:
   1922 :DESCRIPTION: The table editor as minor mode.
   1923 :ALT_TITLE: Orgtbl Mode
   1924 :END:
   1925 #+cindex: Orgtbl mode
   1926 #+cindex: minor mode for tables
   1927 
   1928 #+findex: orgtbl-mode
   1929 If you like the intuitive way the Org table editor works, you might
   1930 also want to use it in other modes like Text mode or Mail mode.  The
   1931 minor mode Orgtbl mode makes this possible.  You can always toggle the
   1932 mode with {{{kbd(M-x orgtbl-mode)}}}.  To turn it on by default, for
   1933 example in Message mode, use
   1934 
   1935 #+begin_src emacs-lisp
   1936 (add-hook 'message-mode-hook #'turn-on-orgtbl)
   1937 #+end_src
   1938 
   1939 Furthermore, with some special setup, it is possible to maintain
   1940 tables in arbitrary syntax with Orgtbl mode.  For example, it is
   1941 possible to construct LaTeX tables with the underlying ease and power
   1942 of Orgtbl mode, including spreadsheet capabilities.  For details, see
   1943 [[*Tables in Arbitrary Syntax]].
   1944 
   1945 ** The Spreadsheet
   1946 :PROPERTIES:
   1947 :DESCRIPTION: The table editor has spreadsheet capabilities.
   1948 :END:
   1949 #+cindex: calculations, in tables
   1950 #+cindex: spreadsheet capabilities
   1951 #+cindex: Calc package
   1952 
   1953 The table editor makes use of the Emacs Calc package to implement
   1954 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms
   1955 to derive fields from other fields.  While fully featured, Org's
   1956 implementation is not identical to other spreadsheets.  For example,
   1957 Org knows the concept of a /column formula/ that will be applied to
   1958 all non-header fields in a column without having to copy the formula
   1959 to each relevant field.  There is also a formula debugger, and a
   1960 formula editor with features for highlighting fields in the table
   1961 corresponding to the references at point in the formula, moving these
   1962 references by arrow keys.
   1963 
   1964 *** References
   1965 :PROPERTIES:
   1966 :DESCRIPTION: How to refer to another field or range.
   1967 :END:
   1968 #+cindex: references
   1969 
   1970 To compute fields in the table from other fields, formulas must
   1971 reference other fields or ranges.  In Org, fields can be referenced by
   1972 name, by absolute coordinates, and by relative coordinates.  To find
   1973 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in
   1974 that field, or press {{{kbd(C-c })}}} to toggle the display of a grid.
   1975 
   1976 **** Field references
   1977 :PROPERTIES:
   1978 :UNNUMBERED: notoc
   1979 :END:
   1980 
   1981 #+cindex: field references
   1982 #+cindex: references, to fields
   1983 Formulas can reference the value of another field in two ways.  Like
   1984 in any other spreadsheet, you may reference fields with
   1985 a letter/number combination like =B3=, meaning the second field in the
   1986 third row.  However, Org prefers to use another, more general
   1987 representation that looks like this:[fn:7]
   1988 
   1989 : @ROW$COLUMN
   1990 
   1991 Column specifications can be absolute like =$1=, =$2=, ..., =$N=, or
   1992 relative to the current column, i.e., the column of the field which is
   1993 being computed, like =$+1= or =$-2=.  =$<= and =$>= are immutable
   1994 references to the first and last column, respectively, and you can use
   1995 =$>>>= to indicate the third column from the right.
   1996 
   1997 The row specification only counts data lines and ignores horizontal
   1998 separator lines, or "hlines".  Like with columns, you can use absolute
   1999 row numbers =@1=, =@2=, ..., =@N=, and row numbers relative to the
   2000 current row like =@+3= or =@-1=.  =@<= and =@>= are immutable
   2001 references the first and last row in the table, respectively.  You may
   2002 also specify the row relative to one of the hlines: =@I= refers to the
   2003 first hline, =@II= to the second, etc.  =@-I= refers to the first such
   2004 line above the current line, =@+I= to the first such line below the
   2005 current line.  You can also write =@III+2= which is the second data
   2006 line after the third hline in the table.
   2007 
   2008 =@0= and =$0= refer to the current row and column, respectively, i.e.,
   2009 to the row/column for the field being computed.  Also, if you omit
   2010 either the column or the row part of the reference, the current
   2011 row/column is implied.
   2012 
   2013 Org's references with /unsigned/ numbers are fixed references in the
   2014 sense that if you use the same reference in the formula for two
   2015 different fields, the same field is referenced each time.  Org's
   2016 references with /signed/ numbers are floating references because the
   2017 same reference operator can reference different fields depending on
   2018 the field being calculated by the formula.
   2019 
   2020 Here are a few examples:
   2021 
   2022 #+attr_texinfo: :columns 0.2 0.8
   2023 | =@2$3=   | 2nd row, 3rd column (same as =C2=)                 |
   2024 | =$5=     | column 5 in the current row (same as =E&=)         |
   2025 | =@2=     | current column, row 2                              |
   2026 | =@-1$-3= | field one row up, three columns to the left        |
   2027 | =@-I$2=  | field just under hline above current row, column 2 |
   2028 | =@>$5=   | field in the last row, in column 5                 |
   2029 
   2030 **** Range references
   2031 :PROPERTIES:
   2032 :UNNUMBERED: notoc
   2033 :END:
   2034 
   2035 #+cindex: range references
   2036 #+cindex: references, to ranges
   2037 You may reference a rectangular range of fields by specifying two
   2038 field references connected by two dots =..=.  The ends are included in
   2039 the range.  If both fields are in the current row, you may simply use
   2040 =$2..$7=, but if at least one field is in a different row, you need to
   2041 use the general =@ROW$COLUMN= format at least for the first field,
   2042 i.e., the reference must start with =@= in order to be interpreted
   2043 correctly.  Examples:
   2044 
   2045 #+attr_texinfo: :columns 0.2 0.8
   2046 | =$1..$3=      | first three fields in the current row                          |
   2047 | =$P..$Q=      | range, using column names (see [[*Advanced features]])             |
   2048 | =$<<<..$>>=   | start in third column, continue to the last but one            |
   2049 | =@2$1..@4$3=  | nine fields between these two fields (same as =A2..C4=)        |
   2050 | =@-1$-2..@-1= | 3 fields in the row above, starting from 2 columns on the left |
   2051 | =@I..II=      | between first and second hline, short for =@I..@II=            |
   2052 
   2053 #+texinfo: @noindent
   2054 Range references return a vector of values that can be fed into Calc
   2055 vector functions.  Empty fields in ranges are normally suppressed, so
   2056 that the vector contains only the non-empty fields.  For other options
   2057 with the mode switches =E=, =N= and examples, see [[*Formula syntax for
   2058 Calc]].
   2059 
   2060 **** Field coordinates in formulas
   2061 :PROPERTIES:
   2062 :UNNUMBERED: notoc
   2063 :END:
   2064 
   2065 #+cindex: field coordinates
   2066 #+cindex: coordinates, of field
   2067 #+cindex: row, of field coordinates
   2068 #+cindex: column, of field coordinates
   2069 #+vindex: org-table-current-column
   2070 #+vindex: org-table-current-dline
   2071 One of the very first actions during evaluation of Calc formulas and
   2072 Lisp formulas is to substitute =@#= and =$#= in the formula with the
   2073 row or column number of the field where the current result will go to.
   2074 The traditional Lisp formula equivalents are ~org-table-current-dline~
   2075 and ~org-table-current-column~.  Examples:
   2076 
   2077 - =if(@# % 2, $#, string(""))= ::
   2078 
   2079   Insert column number on odd rows, set field to empty on even rows.
   2080 
   2081 - =$2 = '(identity remote(FOO, @@#$1))= ::
   2082 
   2083   Copy text or values of each row of column 1 of the table named
   2084   {{{var(FOO)}}} into column 2 of the current table.
   2085 
   2086 - =@3 = 2 * remote(FOO, @1$$#)= ::
   2087 
   2088   Insert the doubled value of each column of row 1 of the table
   2089   named {{{var(FOO)}}} into row 3 of the current table.
   2090 
   2091 #+texinfo: @noindent
   2092 For the second and third examples, table {{{var(FOO)}}} must have at
   2093 least as many rows or columns as the current table.  Note that this is
   2094 inefficient[fn:: The computation time scales as O(N^2) because table
   2095 {{{var(FOO)}}} is parsed for each field to be copied.] for large
   2096 number of rows.
   2097 
   2098 **** Named references
   2099 :PROPERTIES:
   2100 :UNNUMBERED: notoc
   2101 :END:
   2102 #+cindex: named references
   2103 #+cindex: references, named
   2104 #+cindex: name, of column or field
   2105 #+cindex: constants, in calculations
   2106 #+cindex: @samp{CONSTANTS}, keyword
   2107 #+vindex: org-table-formula-constants
   2108 
   2109 =$name= is interpreted as the name of a column, parameter or constant.
   2110 Constants are defined globally through the variable
   2111 ~org-table-formula-constants~, and locally---for the file---through
   2112 a line like this example:
   2113 
   2114 : #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
   2115 
   2116 #+vindex: constants-unit-system
   2117 #+pindex: constants.el
   2118 Also, properties (see [[*Properties and Columns]]) can be used as
   2119 constants in table formulas: for a property =Xyz= use the name
   2120 =$PROP_Xyz=, and the property will be searched in the current outline
   2121 entry and in the hierarchy above it.  If you have the =constants.el=
   2122 package, it will also be used to resolve constants, including natural
   2123 constants like =$h= for Planck's constant, and units like =$km= for
   2124 kilometers[fn:8].  Column names and parameters can be specified in
   2125 special table lines.  These are described below, see [[*Advanced
   2126 features]].  All names must start with a letter, and further consist
   2127 of letters and numbers.
   2128 
   2129 **** Remote references
   2130 :PROPERTIES:
   2131 :UNNUMBERED: notoc
   2132 :END:
   2133 
   2134 #+cindex: remote references
   2135 #+cindex: references, remote
   2136 #+cindex: references, to a different table
   2137 #+cindex: name, of column or field
   2138 #+cindex: @samp{NAME}, keyword
   2139 You may also reference constants, fields and ranges from a different
   2140 table, either in the current file or even in a different file.  The
   2141 syntax is
   2142 
   2143 : remote(NAME,REF)
   2144 
   2145 #+texinfo: @noindent
   2146 where {{{var(NAME)}}} can be the name of a table in the current file
   2147 as set by a =#+NAME:= line before the table.  It can also be the ID of
   2148 an entry, even in a different file, and the reference then refers to
   2149 the first table in that entry.  {{{var(REF)}}} is an absolute field or
   2150 range reference as described above for example =@3$3= or =$somename=,
   2151 valid in the referenced table.
   2152 
   2153 #+cindex: table indirection
   2154 When {{{var(NAME)}}} has the format =@ROW$COLUMN=, it is substituted
   2155 with the name or ID found in this field of the current table.  For
   2156 example =remote($1, @@>$2)= \Rightarrow =remote(year_2013, @@>$1)=.  The format
   2157 =B3= is not supported because it can not be distinguished from a plain
   2158 table name or ID.
   2159 
   2160 *** Formula syntax for Calc
   2161 :PROPERTIES:
   2162 :DESCRIPTION: Using Calc to compute stuff.
   2163 :END:
   2164 #+cindex: formula syntax, Calc
   2165 #+cindex: syntax, of formulas
   2166 
   2167 A formula can be any algebraic expression understood by the Emacs Calc
   2168 package.  Note that Calc has the non-standard convention that =/= has
   2169 lower precedence than =*=, so that =a/b*c= is interpreted as
   2170 =(a/(b*c))=.  Before evaluation by ~calc-eval~ (see [[info:calc#Calling Calc from Your Programs][Calling Calc from
   2171 Your Lisp Programs]]), variable substitution takes place according to
   2172 the rules described above.
   2173 
   2174 #+cindex: vectors, in table calculations
   2175 The range vectors can be directly fed into the Calc vector functions
   2176 like ~vmean~ and ~vsum~.
   2177 
   2178 #+cindex: format specifier, in spreadsheet
   2179 #+cindex: mode, for Calc
   2180 #+vindex: org-calc-default-modes
   2181 A formula can contain an optional mode string after a semicolon.  This
   2182 string consists of flags to influence Calc and other modes during
   2183 execution.  By default, Org uses the standard Calc modes (precision
   2184 12, angular units degrees, fraction and symbolic modes off).  The
   2185 display format, however, has been changed to =(float 8)= to keep
   2186 tables compact.  The default settings can be configured using the
   2187 variable ~org-calc-default-modes~.
   2188 
   2189 - =p20= ::
   2190 
   2191   Set the internal Calc calculation precision to 20 digits.
   2192 
   2193 - =n3=, =s3=, =e2=, =f4= ::
   2194 
   2195   Normal, scientific, engineering or fixed format of the result of
   2196   Calc passed back to Org.  Calc formatting is unlimited in precision
   2197   as long as the Calc calculation precision is greater.
   2198 
   2199 - =D=, =R= ::
   2200 
   2201   Degree and radian angle modes of Calc.
   2202 
   2203 - =F=, =S= ::
   2204 
   2205   Fraction and symbolic modes of Calc.
   2206 
   2207 - =u= ::
   2208 
   2209   Units simplification mode of Calc.  Calc is also a symbolic
   2210   calculator and is capable of working with values having a unit,
   2211   represented with numerals followed by a unit string in Org table
   2212   cells.  This mode instructs Calc to simplify the units in the
   2213   computed expression before returning the result.
   2214 
   2215 - =T=, =t=, =U= ::
   2216 
   2217   Duration computations in Calc or Lisp, [[*Durations and time values]].
   2218 
   2219 - =E= ::
   2220 
   2221   If and how to consider empty fields.  Without =E= empty fields in
   2222   range references are suppressed so that the Calc vector or Lisp list
   2223   contains only the non-empty fields.  With =E= the empty fields are
   2224   kept.  For empty fields in ranges or empty field references the
   2225   value =nan= (not a number) is used in Calc formulas and the empty
   2226   string is used for Lisp formulas.  Add =N= to use 0 instead for both
   2227   formula types.  For the value of a field the mode =N= has higher
   2228   precedence than =E=.
   2229 
   2230 - =N= ::
   2231 
   2232   Interpret all fields as numbers, use 0 for non-numbers.  See the
   2233   next section to see how this is essential for computations with Lisp
   2234   formulas.  In Calc formulas it is used only occasionally because
   2235   there number strings are already interpreted as numbers without =N=.
   2236 
   2237 - =L= ::
   2238 
   2239   Literal, for Lisp formulas only.  See the next section.
   2240 
   2241 Unless you use large integer numbers or high-precision calculation and
   2242 display for floating point numbers you may alternatively provide
   2243 a ~printf~ format specifier to reformat the Calc result after it has
   2244 been passed back to Org instead of letting Calc already do the
   2245 formatting[fn:9].  A few examples:
   2246 
   2247 | =$1+$2=            | Sum of first and second field                    |
   2248 | =$1+$2;%.2f=       | Same, format result to two decimals              |
   2249 | =exp($2)+exp($1)=  | Math functions can be used                       |
   2250 | =$0;%.1f=          | Reformat current cell to 1 decimal               |
   2251 | =($3-32)*5/9=      | Degrees F \to C conversion                         |
   2252 | =$c/$1/$cm=        | Hz \to cm conversion, using =constants.el=         |
   2253 | =tan($1);Dp3s1=    | Compute in degrees, precision 3, display SCI 1   |
   2254 | =sin($1);Dp3%.1e=  | Same, but use ~printf~ specifier for display     |
   2255 | =vmean($2..$7)=    | Compute column range mean, using vector function |
   2256 | =vmean($2..$7);EN= | Same, but treat empty fields as 0                |
   2257 | =taylor($3,x=7,2)= | Taylor series of $3, at x=7, second degree       |
   2258 
   2259 Calc also contains a complete set of logical operations (see [[info:calc#Logical Operations][Logical
   2260 Operations]]).  For example
   2261 
   2262 - =if($1 < 20, teen, string(""))= ::
   2263 
   2264   ="teen"= if age =$1= is less than 20, else the Org table result
   2265   field is set to empty with the empty string.
   2266 
   2267 - =if("$1" =​= "nan" || "$2" =​= "nan", string(""), $1 + $2); E f-1= ::
   2268 
   2269   Sum of the first two columns.  When at least one of the input fields
   2270   is empty the Org table result field is set to empty.  =E= is
   2271   required to not convert empty fields to 0.  =f-1= is an optional
   2272   Calc format string similar to =%.1f= but leaves empty results empty.
   2273 
   2274 - =if(typeof(vmean($1..$7)) =​= 12, string(""), vmean($1..$7)); E= ::
   2275 
   2276   Mean value of a range unless there is any empty field.  Every field
   2277   in the range that is empty is replaced by =nan= which lets =vmean=
   2278   result in =nan=.  Then =typeof == 12= detects the =nan= from ~vmean~
   2279   and the Org table result field is set to empty.  Use this when the
   2280   sample set is expected to never have missing values.
   2281 
   2282 - =if("$1..$7" =​= "[]", string(""), vmean($1..$7))= ::
   2283 
   2284   Mean value of a range with empty fields skipped.  Every field in the
   2285   range that is empty is skipped.  When all fields in the range are
   2286   empty the mean value is not defined and the Org table result field
   2287   is set to empty.  Use this when the sample set can have a variable
   2288   size.
   2289 
   2290 - =vmean($1..$7); EN= ::
   2291 
   2292   To complete the example before: Mean value of a range with empty
   2293   fields counting as samples with value 0.  Use this only when
   2294   incomplete sample sets should be padded with 0 to the full size.
   2295 
   2296 You can add your own Calc functions defined in Emacs Lisp with
   2297 ~defmath~ and use them in formula syntax for Calc.
   2298 
   2299 *** Emacs Lisp forms as formulas
   2300 :PROPERTIES:
   2301 :DESCRIPTION: Writing formulas in Emacs Lisp.
   2302 :ALT_TITLE: Formula syntax for Lisp
   2303 :END:
   2304 #+cindex: Lisp forms, as table formulas
   2305 
   2306 It is also possible to write a formula in Emacs Lisp.  This can be
   2307 useful for string manipulation and control structures, if Calc's
   2308 functionality is not enough.
   2309 
   2310 A formula is evaluated as a Lisp form when it starts with a
   2311 single-quote followed by an opening parenthesis.  Cell table
   2312 references are interpolated into the Lisp form before execution.  The
   2313 evaluation should return either a string or a number.  Evaluation
   2314 modes and a ~printf~ format used to render the returned values can be
   2315 specified after a semicolon.
   2316 
   2317 By default, references are interpolated as literal Lisp strings: the
   2318 field content is replaced in the Lisp form stripped of leading and
   2319 trailing white space and surrounded in double-quotes.  For example:
   2320 
   2321 : '(concat $1 $2)
   2322 
   2323 #+texinfo: @noindent
   2324 concatenates the content of columns 1 and column 2.
   2325 
   2326 When the =N= flag is used, all referenced elements are parsed as
   2327 numbers and interpolated as Lisp numbers, without quotes.  Fields that
   2328 cannot be parsed as numbers are interpolated as zeros.  For example:
   2329 
   2330 : '(+ $1 $2);N
   2331 
   2332 #+texinfo: @noindent
   2333 adds columns 1 and 2, equivalent to Calc's =$1+$2=.  Ranges are
   2334 inserted as space-separated fields, so they can be embedded in list or
   2335 vector syntax.  For example:
   2336 
   2337 : '(apply '+ '($1..$4));N
   2338 
   2339 #+texinfo: @noindent
   2340 computes the sum of columns 1 to 4, like Calc's =vsum($1..$4)=.
   2341 
   2342 When the =L= flag is used, all fields are interpolated literally: the
   2343 cell content is replaced in the Lisp form stripped of leading and
   2344 trailing white space and without quotes.  If a reference is intended
   2345 to be interpreted as a string by the Lisp form, the reference operator
   2346 itself should be enclosed in double-quotes, like ="$3"=.  The =L= flag
   2347 is useful when strings and numbers are used in the same Lisp form.  For
   2348 example:
   2349 
   2350 : '(substring "$1" $2 $3);L
   2351 
   2352 #+texinfo: @noindent
   2353 extracts the part of the string in column 1 between the character
   2354 positions specified in the integers in column 2 and 3 and it is easier
   2355 to read than the equivalent:
   2356 
   2357 : '(substring $1 (string-to-number $2) (string-to-number $3))
   2358 
   2359 When the formula itself contains =;= symbol, Org mode may incorrectly
   2360 interpret everything past =;= as format specifier:
   2361 
   2362 : '(concat $1 ";")
   2363 
   2364 #+texinfo: @noindent
   2365 You can put an extra tailing =;= to indicate that all the earlier
   2366 instances of =;= belong to the formula itself:
   2367 
   2368 : '(concat $1 ";");
   2369 
   2370 *** Durations and time values
   2371 :PROPERTIES:
   2372 :DESCRIPTION: How to compute durations and time values.
   2373 :END:
   2374 #+cindex: duration, computing
   2375 #+cindex: time, computing
   2376 #+vindex: org-table-duration-custom-format
   2377 
   2378 If you want to compute time values use the =T=, =t=, or =U= flag,
   2379 either in Calc formulas or Elisp formulas:
   2380 
   2381 #+begin_example
   2382 |  Task 1 |   Task 2 |    Total |
   2383 |---------+----------+----------|
   2384 |    2:12 |     1:47 | 03:59:00 |
   2385 |    2:12 |     1:47 |    03:59 |
   2386 | 3:02:20 | -2:07:00 |     0.92 |
   2387 ,#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t
   2388 #+end_example
   2389 
   2390 Input duration values must be of the form =HH:MM[:SS]=, where seconds
   2391 are optional.  With the =T= flag, computed durations are displayed as
   2392 =HH:MM:SS= (see the first formula above).  With the =U= flag, seconds
   2393 are omitted so that the result is only =HH:MM= (see second formula
   2394 above).  Zero-padding of the hours field depends upon the value of the
   2395 variable ~org-table-duration-hour-zero-padding~.
   2396 
   2397 With the =t= flag, computed durations are displayed according to the
   2398 value of the option ~org-table-duration-custom-format~, which defaults
   2399 to ~hours~ and displays the result as a fraction of hours (see the
   2400 third formula in the example above).
   2401 
   2402 Negative duration values can be manipulated as well, and integers are
   2403 considered as seconds in addition and subtraction.
   2404 
   2405 *** Field and range formulas
   2406 :PROPERTIES:
   2407 :DESCRIPTION: Formula for specific (ranges of) fields.
   2408 :END:
   2409 #+cindex: field formula
   2410 #+cindex: range formula
   2411 #+cindex: formula, for individual table field
   2412 #+cindex: formula, for range of fields
   2413 
   2414 To assign a formula to a particular field, type it directly into the
   2415 field, preceded by =:==, for example =vsum(@II..III)=.  When you press
   2416 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point
   2417 still in the field, the formula is stored as the formula for this
   2418 field, evaluated, and the current field is replaced with the result.
   2419 
   2420 #+cindex: @samp{TBLFM}, keyword
   2421 Formulas are stored in a special =TBLFM= keyword located directly
   2422 below the table.  If you type the equation in the fourth field of the
   2423 third data line in the table, the formula looks like =@3$4=$1+$2=.
   2424 When inserting/deleting/swapping column and rows with the appropriate
   2425 commands, /absolute references/ (but not relative ones) in stored
   2426 formulas are modified in order to still reference the same field.  To
   2427 avoid this from happening, in particular in range references, anchor
   2428 ranges at the table borders (using =@<=, =@>=, =$<=, =$>=), or at
   2429 hlines using the =@I= notation.  Automatic adaptation of field
   2430 references does not happen if you edit the table structure with normal
   2431 editing commands---you must fix the formulas yourself.
   2432 
   2433 Instead of typing an equation into the field, you may also use the
   2434 following command
   2435 
   2436 - {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
   2437 
   2438   #+kindex: C-u C-c =
   2439   #+findex: org-table-eval-formula
   2440   Install a new formula for the current field.  The command prompts
   2441   for a formula with default taken from the =TBLFM= keyword,
   2442   applies it to the current field, and stores it.
   2443 
   2444 The left-hand side of a formula can also be a special expression in
   2445 order to assign the formula to a number of different fields.  There is
   2446 no keyboard shortcut to enter such range formulas.  To add them, use
   2447 the formula editor (see [[*Editing and debugging formulas]]) or edit
   2448 the =TBLFM= keyword directly.
   2449 
   2450 - =$2== ::
   2451 
   2452   Column formula, valid for the entire column.  This is so common that
   2453   Org treats these formulas in a special way, see [[*Column formulas]].
   2454 
   2455 - =@3== ::
   2456 
   2457   Row formula, applies to all fields in the specified row.  =@>==
   2458   means the last row.
   2459 
   2460 - =@1$2..@4$3== ::
   2461 
   2462   Range formula, applies to all fields in the given rectangular range.
   2463   This can also be used to assign a formula to some but not all fields
   2464   in a row.
   2465 
   2466 - =$NAME== ::
   2467 
   2468   Named field, see [[*Advanced features]].
   2469 
   2470 *** Column formulas
   2471 :PROPERTIES:
   2472 :DESCRIPTION: Formulas valid for an entire column.
   2473 :END:
   2474 #+cindex: column formula
   2475 #+cindex: formula, for table column
   2476 
   2477 When you assign a formula to a simple column reference like =$3==, the
   2478 same formula is used in all fields of that column, with the following
   2479 very convenient exceptions: (i) If the table contains horizontal
   2480 separator hlines with rows above and below, everything before the
   2481 first such hline is considered part of the table /header/ and is not
   2482 modified by column formulas.  Therefore a header is mandatory when you
   2483 use column formulas and want to add hlines to group rows, like for
   2484 example to separate a total row at the bottom from the summand rows
   2485 above.  (ii) Fields that already get a value from a field/range
   2486 formula are left alone by column formulas.  These conditions make
   2487 column formulas very easy to use.
   2488 
   2489 To assign a formula to a column, type it directly into any field in
   2490 the column, preceded by an equal sign, like ==$1+$2=.  When you press
   2491 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point
   2492 still in the field, the formula is stored as the formula for the
   2493 current column, evaluated and the current field replaced with the
   2494 result.  If the field contains only ===, the previously stored formula
   2495 for this column is used.  For each column, Org only remembers the most
   2496 recently used formula.  In the =TBLFM= keyword, column formulas look
   2497 like =$4=$1+$2=.  The left-hand side of a column formula can not be
   2498 the name of column, it must be the numeric column reference or =$>=.
   2499 
   2500 Instead of typing an equation into the field, you may also use the
   2501 following command:
   2502 
   2503 - {{{kbd(C-c =)}}} (~org-table-eval-formula~) ::
   2504 
   2505   #+kindex: C-c =
   2506   #+findex: org-table-eval-formula
   2507   Install a new formula for the current column and replace current
   2508   field with the result of the formula.  The command prompts for
   2509   a formula, with default taken from the =TBLFM= keyword, applies it
   2510   to the current field and stores it.  With a numeric prefix argument,
   2511   e.g., {{{kbd(C-5 C-c =)}}}, the command applies it to that many
   2512   consecutive fields in the current column.
   2513 
   2514 *** Lookup functions
   2515 :PROPERTIES:
   2516 :DESCRIPTION: Lookup functions for searching tables.
   2517 :END:
   2518 #+cindex: lookup functions in tables
   2519 #+cindex: table lookup functions
   2520 
   2521 Org has three predefined Emacs Lisp functions for lookups in tables.
   2522 
   2523 - =(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)= ::
   2524 
   2525   #+findex: org-lookup-first
   2526   Searches for the first element {{{var(S)}}} in list
   2527   {{{var(S-LIST)}}} for which
   2528   #+begin_src emacs-lisp
   2529   (PREDICATE VAL S)
   2530   #+end_src
   2531   is non-~nil~; returns the value from the corresponding position in
   2532   list {{{var(R-LIST)}}}.  The default {{{var(PREDICATE)}}} is
   2533   ~equal~.  Note that the parameters {{{var(VAL)}}} and {{{var(S)}}}
   2534   are passed to {{{var(PREDICATE)}}} in the same order as the
   2535   corresponding parameters are in the call to ~org-lookup-first~,
   2536   where {{{var(VAL)}}} precedes {{{var(S-LIST)}}}.  If
   2537   {{{var(R-LIST)}}} is ~nil~, the matching element {{{var(S)}}} of
   2538   {{{var(S-LIST)}}} is returned.
   2539 
   2540 - =(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)= ::
   2541 
   2542   #+findex: org-lookup-last
   2543   Similar to ~org-lookup-first~ above, but searches for the /last/
   2544   element for which {{{var(PREDICATE)}}} is non-~nil~.
   2545 
   2546 - =(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)= ::
   2547 
   2548   #+findex: org-lookup-all
   2549   Similar to ~org-lookup-first~, but searches for /all/ elements for
   2550   which {{{var(PREDICATE)}}} is non-~nil~, and returns /all/
   2551   corresponding values.  This function can not be used by itself in
   2552   a formula, because it returns a list of values.  However, powerful
   2553   lookups can be built when this function is combined with other Emacs
   2554   Lisp functions.
   2555 
   2556 If the ranges used in these functions contain empty fields, the =E=
   2557 mode for the formula should usually be specified: otherwise empty
   2558 fields are not included in {{{var(S-LIST)}}} and/or {{{var(R-LIST)}}}
   2559 which can, for example, result in an incorrect mapping from an element
   2560 of {{{var(S-LIST)}}} to the corresponding element of
   2561 {{{var(R-LIST)}}}.
   2562 
   2563 These three functions can be used to implement associative arrays,
   2564 count matching cells, rank results, group data, etc.  For practical
   2565 examples see [[https://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]].
   2566 
   2567 *** Editing and debugging formulas
   2568 :PROPERTIES:
   2569 :DESCRIPTION: Fixing formulas.
   2570 :END:
   2571 #+cindex: formula editing
   2572 #+cindex: editing, of table formulas
   2573 
   2574 #+vindex: org-table-use-standard-references
   2575 You can edit individual formulas in the minibuffer or directly in the
   2576 field.  Org can also prepare a special buffer with all active formulas
   2577 of a table.  When offering a formula for editing, Org converts
   2578 references to the standard format (like =B3= or =D&=) if possible.  If
   2579 you prefer to only work with the internal format (like =@3$2= or
   2580 =$4=), configure the variable ~org-table-use-standard-references~.
   2581 
   2582 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
   2583 
   2584   #+kindex: C-c =
   2585   #+kindex: C-u C-c =
   2586   #+findex: org-table-eval-formula
   2587   Edit the formula associated with the current column/field in the
   2588   minibuffer.  See [[*Column formulas]], and [[*Field and range formulas]].
   2589 
   2590 - {{{kbd(C-u C-u C-c =)}}} (~org-table-eval-formula~) ::
   2591 
   2592   #+kindex: C-u C-u C-c =
   2593   #+findex: org-table-eval-formula
   2594   Re-insert the active formula (either a field formula, or a column
   2595   formula) into the current field, so that you can edit it directly in
   2596   the field.  The advantage over editing in the minibuffer is that you
   2597   can use the command {{{kbd(C-c ?)}}}.
   2598 
   2599 - {{{kbd(C-c ?)}}} (~org-table-field-info~) ::
   2600 
   2601   #+kindex: C-c ?
   2602   #+findex: org-table-field-info
   2603   While editing a formula in a table field, highlight the field(s)
   2604   referenced by the reference at point position in the formula.
   2605 
   2606 - {{{kbd(C-c })}}} (~org-table-toggle-coordinate-overlays~) ::
   2607 
   2608   #+kindex: C-c @}
   2609   #+findex: org-table-toggle-coordinate-overlays
   2610   Toggle the display of row and column numbers for a table, using
   2611   overlays.  These are updated each time the table is aligned; you can
   2612   force it with {{{kbd(C-c C-c)}}}.
   2613 
   2614 - {{{kbd(C-c {)}}} (~org-table-toggle-formula-debugger~) ::
   2615 
   2616   #+kindex: C-c @{
   2617   #+findex: org-table-toggle-formula-debugger
   2618   Toggle the formula debugger on and off.  See below.
   2619 
   2620 - {{{kbd(C-c ')}}} (~org-table-edit-formulas~) ::
   2621 
   2622   #+kindex: C-c '
   2623   #+findex: org-table-edit-formulas
   2624   Edit all formulas for the current table in a special buffer, where
   2625   the formulas are displayed one per line.  If the current field has
   2626   an active formula, point in the formula editor marks it.  While
   2627   inside the special buffer, Org automatically highlights any field or
   2628   range reference at point position.  You may edit, remove and add
   2629   formulas, and use the following commands:
   2630 
   2631   - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}} (~org-table-fedit-finish~) ::
   2632 
   2633     #+kindex: C-x C-s
   2634     #+kindex: C-c C-c
   2635     #+findex: org-table-fedit-finish
   2636     Exit the formula editor and store the modified formulas.  With
   2637     {{{kbd(C-u)}}} prefix, also apply the new formulas to the
   2638     entire table.
   2639 
   2640   - {{{kbd(C-c C-q)}}} (~org-table-fedit-abort~) ::
   2641 
   2642     #+kindex: C-c C-q
   2643     #+findex: org-table-fedit-abort
   2644     Exit the formula editor without installing changes.
   2645 
   2646   - {{{kbd(C-c C-r)}}} (~org-table-fedit-toggle-ref-type~) ::
   2647 
   2648     #+kindex: C-c C-r
   2649     #+findex: org-table-fedit-toggle-ref-type
   2650     Toggle all references in the formula editor between standard (like
   2651     =B3=) and internal (like =@3$2=).
   2652 
   2653   - {{{kbd(TAB)}}} (~org-table-fedit-lisp-indent~) ::
   2654 
   2655     #+kindex: TAB
   2656     #+findex: org-table-fedit-lisp-indent
   2657     Pretty-print or indent Lisp formula at point.  When in a line
   2658     containing a Lisp formula, format the formula according to Emacs
   2659     Lisp rules.  Another {{{kbd(TAB)}}} collapses the formula back
   2660     again.  In the open formula, {{{kbd(TAB)}}} re-indents just like
   2661     in Emacs Lisp mode.
   2662 
   2663   - {{{kbd(M-TAB)}}} (~lisp-complete-symbol~) ::
   2664 
   2665     #+kindex: M-TAB
   2666     #+findex: lisp-complete-symbol
   2667     Complete Lisp symbols, just like in Emacs Lisp mode.
   2668 
   2669   - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}}, {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
   2670 
   2671     #+kindex: S-UP
   2672     #+kindex: S-DOWN
   2673     #+kindex: S-LEFT
   2674     #+kindex: S-RIGHT
   2675     #+findex: org-table-fedit-ref-up
   2676     #+findex: org-table-fedit-ref-down
   2677     #+findex: org-table-fedit-ref-left
   2678     #+findex: org-table-fedit-ref-right
   2679     Shift the reference at point.  For example, if the reference is
   2680     =B3= and you press {{{kbd(S-RIGHT)}}}, it becomes =C3=.  This also
   2681     works for relative references and for hline references.
   2682 
   2683   - {{{kbd(M-S-UP)}}} (~org-table-fedit-line-up~) ::
   2684 
   2685     #+kindex: M-S-UP
   2686     #+findex: org-table-fedit-line-up
   2687     Move the test line for column formulas up in the Org buffer.
   2688 
   2689   - {{{kbd(M-S-DOWN)}}} (~org-table-fedit-line-down~) ::
   2690 
   2691     #+kindex: M-S-DOWN
   2692     #+findex: org-table-fedit-line-down
   2693     Move the test line for column formulas down in the Org buffer.
   2694 
   2695   - {{{kbd(M-UP)}}} (~org-table-fedit-scroll-up~) ::
   2696 
   2697     #+kindex: M-UP
   2698     #+findex: org-table-fedit-scroll-up
   2699     Scroll up the window displaying the table.
   2700 
   2701   - {{{kbd(M-DOWN)}}} (~org-table-fedit-scroll-down~) ::
   2702 
   2703     #+kindex: M-DOWN
   2704     #+findex: org-table-fedit-scroll-down
   2705     Scroll down the window displaying the table.
   2706 
   2707   - {{{kbd(C-c })}}} ::
   2708 
   2709     #+kindex: C-c @}
   2710     #+findex: org-table-toggle-coordinate-overlays
   2711     Turn the coordinate grid in the table on and off.
   2712 
   2713 Making a table field blank does not remove the formula associated with
   2714 the field, because that is stored in a different line---the =TBLFM=
   2715 keyword line.  During the next recalculation, the field will be filled
   2716 again.  To remove a formula from a field, you have to give an empty
   2717 reply when prompted for the formula, or to edit the =TBLFM= keyword.
   2718 
   2719 #+kindex: C-c C-c
   2720 You may edit the =TBLFM= keyword directly and re-apply the changed
   2721 equations with {{{kbd(C-c C-c)}}} in that line or with the normal
   2722 recalculation commands in the table.
   2723 
   2724 **** Using multiple =TBLFM= lines
   2725 :PROPERTIES:
   2726 :UNNUMBERED: notoc
   2727 :END:
   2728 #+cindex: multiple formula lines
   2729 #+cindex: @samp{TBLFM} keywords, multiple
   2730 #+cindex: @samp{TBLFM}, switching
   2731 
   2732 #+kindex: C-c C-c
   2733 You may apply the formula temporarily.  This is useful when you want
   2734 to switch the formula applied to the table.  Place multiple =TBLFM=
   2735 keywords right after the table, and then press {{{kbd(C-c C-c)}}} on
   2736 the formula to apply.  Here is an example:
   2737 
   2738 #+begin_example
   2739 | x | y |
   2740 |---+---|
   2741 | 1 |   |
   2742 | 2 |   |
   2743 ,#+TBLFM: $2=$1*1
   2744 ,#+TBLFM: $2=$1*2
   2745 #+end_example
   2746 
   2747 #+texinfo: @noindent
   2748 Pressing {{{kbd(C-c C-c)}}} in the line of =#+TBLFM: $2=$1*2= yields:
   2749 
   2750 #+begin_example
   2751 | x | y |
   2752 |---+---|
   2753 | 1 | 2 |
   2754 | 2 | 4 |
   2755 ,#+TBLFM: $2=$1*1
   2756 ,#+TBLFM: $2=$1*2
   2757 #+end_example
   2758 
   2759 #+texinfo: @noindent
   2760 If you recalculate this table, with {{{kbd(C-u C-c *)}}}, for example,
   2761 you get the following result from applying only the first =TBLFM=
   2762 keyword.
   2763 
   2764 #+begin_example
   2765 | x | y |
   2766 |---+---|
   2767 | 1 | 1 |
   2768 | 2 | 2 |
   2769 ,#+TBLFM: $2=$1*1
   2770 ,#+TBLFM: $2=$1*2
   2771 #+end_example
   2772 
   2773 **** Debugging formulas
   2774 :PROPERTIES:
   2775 :UNNUMBERED: notoc
   2776 :END:
   2777 #+cindex: formula debugging
   2778 #+cindex: debugging, of table formulas
   2779 
   2780 When the evaluation of a formula leads to an error, the field content
   2781 becomes the string =#ERROR=.  If you want to see what is going on
   2782 during variable substitution and calculation in order to find a bug,
   2783 turn on formula debugging in the Tbl menu and repeat the calculation,
   2784 for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in a field.
   2785 Detailed information are displayed.
   2786 
   2787 *** Updating the table
   2788 :PROPERTIES:
   2789 :DESCRIPTION: Recomputing all dependent fields.
   2790 :END:
   2791 #+cindex: recomputing table fields
   2792 #+cindex: updating, table
   2793 
   2794 Recalculation of a table is normally not automatic, but needs to be
   2795 triggered by a command.  To make recalculation at least
   2796 semi-automatic, see [[*Advanced features]].
   2797 
   2798 In order to recalculate a line of a table or the entire table, use the
   2799 following commands:
   2800 
   2801 - {{{kbd(C-c *)}}} (~org-table-recalculate~) ::
   2802 
   2803   #+kindex: C-c *
   2804   #+findex: org-table-recalculate
   2805   Recalculate the current row by first applying the stored column
   2806   formulas from left to right, and all field/range formulas in the
   2807   current row.
   2808 
   2809 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} ::
   2810 
   2811   #+kindex: C-u C-c *
   2812   #+kindex: C-u C-c C-c
   2813   Recompute the entire table, line by line.  Any lines before the
   2814   first hline are left alone, assuming that these are part of the
   2815   table header.
   2816 
   2817 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}} (~org-table-iterate~) ::
   2818 
   2819   #+kindex: C-u C-u C-c *
   2820   #+kindex: C-u C-u C-c C-c
   2821   #+findex: org-table-iterate
   2822   Iterate the table by recomputing it until no further changes occur.
   2823   This may be necessary if some computed fields use the value of other
   2824   fields that are computed /later/ in the calculation sequence.
   2825 
   2826 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} ::
   2827 
   2828   #+findex: org-table-recalculate-buffer-tables
   2829   Recompute all tables in the current buffer.
   2830 
   2831 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} ::
   2832 
   2833   #+findex: org-table-iterate-buffer-tables
   2834   Iterate all tables in the current buffer, in order to converge
   2835   table-to-table dependencies.
   2836 
   2837 *** Advanced features
   2838 :PROPERTIES:
   2839 :DESCRIPTION: Field and column names, automatic recalculation...
   2840 :END:
   2841 
   2842 If you want the recalculation of fields to happen automatically, or if
   2843 you want to be able to assign /names/[fn:: Such names must start with
   2844 an alphabetic character and use only alphanumeric/underscore
   2845 characters.] to fields and columns, you need to reserve the first
   2846 column of the table for special marking characters.
   2847 
   2848 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
   2849 
   2850   #+kindex: C-#
   2851   #+findex: org-table-rotate-recalc-marks
   2852   Rotate the calculation mark in first column through the states =#=,
   2853   =*=, =!=, =$=.  When there is an active region, change all marks in
   2854   the region.
   2855 
   2856 Here is an example of a table that collects exam results of students
   2857 and makes use of these features:
   2858 
   2859 #+begin_example
   2860 |---+---------+--------+--------+--------+-------+------|
   2861 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
   2862 |---+---------+--------+--------+--------+-------+------|
   2863 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
   2864 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
   2865 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
   2866 |---+---------+--------+--------+--------+-------+------|
   2867 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
   2868 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
   2869 |---+---------+--------+--------+--------+-------+------|
   2870 |   | Average |        |        |        |  25.0 |      |
   2871 | ^ |         |        |        |        |    at |      |
   2872 | $ | max=50  |        |        |        |       |      |
   2873 |---+---------+--------+--------+--------+-------+------|
   2874 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f
   2875 #+end_example
   2876 
   2877 #+attr_texinfo: :tag Important
   2878 #+begin_quote
   2879 Please note that for these special tables, recalculating the table
   2880 with {{{kbd(C-u C-c *)}}} only affects rows that are marked =#= or
   2881 =*=, and fields that have a formula assigned to the field itself.  The
   2882 column formulas are not applied in rows with empty first field.
   2883 #+end_quote
   2884 
   2885 #+cindex: marking characters, tables
   2886 The marking characters have the following meaning:
   2887 
   2888 - =!= ::
   2889 
   2890   The fields in this line define names for the columns, so that you
   2891   may refer to a column as =$Tot= instead of =$6=.
   2892 
   2893 - =^= ::
   2894 
   2895   This row defines names for the fields /above/ the row.  With such
   2896   a definition, any formula in the table may use =$m1= to refer to the
   2897   value =10=.  Also, if you assign a formula to a names field, it is
   2898   stored as =$name = ...=.
   2899 
   2900 - =_= ::
   2901 
   2902   Similar to =^=, but defines names for the fields in the row /below/.
   2903 
   2904 - =$= ::
   2905 
   2906   Fields in this row can define /parameters/ for formulas.  For
   2907   example, if a field in a =$= row contains =max=50=, then formulas in
   2908   this table can refer to the value 50 using =$max=.  Parameters work
   2909   exactly like constants, only that they can be defined on a per-table
   2910   basis.
   2911 
   2912 - =#= ::
   2913 
   2914   Fields in this row are automatically recalculated when pressing
   2915   {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(S-TAB)}}} in this row.
   2916   Also, this row is selected for a global recalculation with
   2917   {{{kbd(C-u C-c *)}}}.  Unmarked lines are left alone by this
   2918   command.
   2919 
   2920 - =*= ::
   2921 
   2922   Selects this line for global recalculation with {{{kbd(C-u C-c
   2923   *)}}}, but not for automatic recalculation.  Use this when automatic
   2924   recalculation slows down editing too much.
   2925 
   2926 - =/= ::
   2927 
   2928   Do not export this line.  Useful for lines that contain the
   2929   narrowing =<N>= markers or column group markers.
   2930 
   2931 Finally, just to whet your appetite for what can be done with the
   2932 fantastic Calc package, here is a table that computes the Taylor
   2933 series of degree n at location x for a couple of functions.
   2934 
   2935 #+begin_example
   2936 |---+-------------+---+-----+--------------------------------------|
   2937 |   | Func        | n | x   | Result                               |
   2938 |---+-------------+---+-----+--------------------------------------|
   2939 | # | exp(x)      | 1 | x   | 1 + x                                |
   2940 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
   2941 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
   2942 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
   2943 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
   2944 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
   2945 |---+-------------+---+-----+--------------------------------------|
   2946 ,#+TBLFM: $5=taylor($2,$4,$3);n3
   2947 #+end_example
   2948 
   2949 ** Org Plot
   2950 :PROPERTIES:
   2951 :DESCRIPTION: Plotting from Org tables.
   2952 :END:
   2953 #+cindex: graph, in tables
   2954 #+cindex: plot tables using Gnuplot
   2955 
   2956 Org Plot can produce graphs of information stored in Org tables,
   2957 either graphically or in ASCII art.
   2958 
   2959 *** Graphical plots using Gnuplot
   2960 :PROPERTIES:
   2961 :UNNUMBERED: notoc
   2962 :END:
   2963 
   2964 #+cindex: @samp{PLOT}, keyword
   2965 Org Plot can produce 2D and 3D graphs of information stored in Org
   2966 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
   2967 that you have both Gnuplot and Gnuplot mode installed on your system,
   2968 then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the
   2969 following table.
   2970 
   2971 #+begin_example
   2972 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
   2973 | Sede      | Max cites | H-index |
   2974 |-----------+-----------+---------|
   2975 | Chile     |    257.72 |   21.39 |
   2976 | Leeds     |    165.77 |   19.68 |
   2977 | Sao Paolo |     71.00 |   11.50 |
   2978 | Stockholm |    134.19 |   14.33 |
   2979 | Morelia   |    257.56 |   17.67 |
   2980 #+end_example
   2981 
   2982 Org Plot supports a range of plot types, and provides the ability to add more.
   2983 For example, a radar plot can be generated like so:
   2984 #+begin_example
   2985 ,#+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4
   2986 | Format            | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility |
   2987 |-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------|
   2988 | Word              |                    2 |              4 |                 4 |              2 |            3 |                   2 |           2 |
   2989 | LaTeX             |                    4 |              1 |                 1 |              3 |            2 |                   4 |           3 |
   2990 | Org Mode          |                    4 |              2 |               3.5 |              1 |            4 |                   4 |           4 |
   2991 | Markdown          |                    1 |              3 |                 3 |              4 |            3 |                   3 |           1 |
   2992 | Markdown + Pandoc |                  2.5 |            2.5 |               2.5 |              3 |            3 |                   3 |           2 |
   2993 #+end_example
   2994 
   2995 Notice that Org Plot is smart enough to apply the table's headers as
   2996 labels.  Further control over the labels, type, content, and
   2997 appearance of plots can be exercised through the =PLOT= keyword
   2998 preceding a table.  See below for a complete list of Org Plot options.
   2999 For more information and examples see the [[https://orgmode.org/worg/org-tutorials/org-plot.html][Org Plot tutorial]].
   3000 
   3001 **** Plot options
   3002 :PROPERTIES:
   3003 :UNNUMBERED: notoc
   3004 :END:
   3005 
   3006 - =set= ::
   3007 
   3008   Specify any Gnuplot option to be set when graphing.
   3009 
   3010 - =title= ::
   3011 
   3012   Specify the title of the plot.
   3013 
   3014 - =ind= ::
   3015 
   3016   Specify which column of the table to use as the =x= axis.
   3017 
   3018 - =timeind= ::
   3019 
   3020   Specify which column of the table to use as the =x= axis as a time
   3021   value.
   3022 
   3023 - =deps= ::
   3024 
   3025   Specify the columns to graph as a Lisp style list, surrounded by
   3026   parentheses and separated by spaces for example =dep:(3 4)= to graph
   3027   the third and fourth columns.  Defaults to graphing all other
   3028   columns aside from the =ind= column.
   3029 
   3030 - =transpose= ::
   3031 
   3032   When =y=, =yes=, or =t= attempt to transpose the table data before
   3033   plotting.  Also recognizes the shorthand option =trans=.
   3034 
   3035 - =type= ::
   3036 
   3037   Specify the type of the plot, by default one of  =2d=, =3d=, =radar=, or =grid=.
   3038   Available types can be customized with ~org-plot/preset-plot-types~.
   3039 
   3040 - =with= ::
   3041 
   3042   Specify a =with= option to be inserted for every column being
   3043   plotted, e.g., =lines=, =points=, =boxes=, =impulses=.  Defaults to
   3044   =lines=.
   3045 
   3046 - =file= ::
   3047 
   3048   If you want to plot to a file, specify
   3049   ="path/to/desired/output-file"=.
   3050 
   3051 - =labels= ::
   3052 
   3053   List of labels to be used for the =deps=.  Defaults to the column
   3054   headers if they exist.
   3055 
   3056 - =line= ::
   3057 
   3058   Specify an entire line to be inserted in the Gnuplot script.
   3059 
   3060 - =map= ::
   3061 
   3062   When plotting =3d= or =grid= types, set this to =t= to graph a flat
   3063   mapping rather than a =3d= slope.
   3064 
   3065 - =min= ::
   3066 
   3067   Provides a minimum axis value that may be used by a plot type.
   3068   Implicitly assumes the =y= axis is being referred to.  Can
   3069   explicitly provide a value for a either the =x= or =y= axis with
   3070   =xmin= and =ymin=.
   3071 
   3072 - =max= ::
   3073 
   3074   Provides a maximum axis value that may be used by a plot type.
   3075   Implicitly assumes the =y= axis is being referred to.  Can
   3076   explicitly provide a value for a either the =x= or =y= axis with
   3077   =xmax= and =ymax=.
   3078 
   3079 - =ticks= ::
   3080 
   3081   Provides a desired number of axis ticks to display, that may be used
   3082   by a plot type.  If none is given a plot type that requires ticks
   3083   will use ~org--plot/sensible-tick-num~ to try to determine a good
   3084   value.
   3085 
   3086 - =timefmt= ::
   3087 
   3088   Specify format of Org mode timestamps as they will be parsed by
   3089   Gnuplot.  Defaults to =%Y-%m-%d-%H:%M:%S=.
   3090 
   3091 - =script= ::
   3092 
   3093   If you want total control, you can specify a script file---place the
   3094   file name between double-quotes---which will be used to plot.
   3095   Before plotting, every instance of =$datafile= in the specified
   3096   script will be replaced with the path to the generated data file.
   3097   Note: even if you set this option, you may still want to specify the
   3098   plot type, as that can impact the content of the data file.
   3099 
   3100 *** ASCII bar plots
   3101 :PROPERTIES:
   3102 :UNNUMBERED: notoc
   3103 :END:
   3104 
   3105 While point is on a column, typing {{{kbd(C-c " a)}}} or {{{kbd(M-x
   3106 orgtbl-ascii-plot)}}} create a new column containing an ASCII-art bars
   3107 plot.  The plot is implemented through a regular column formula.  When
   3108 the source column changes, the bar plot may be updated by refreshing
   3109 the table, for example typing {{{kbd(C-u C-c *)}}}.
   3110 
   3111 #+begin_example
   3112 | Sede          | Max cites |              |
   3113 |---------------+-----------+--------------|
   3114 | Chile         |    257.72 | WWWWWWWWWWWW |
   3115 | Leeds         |    165.77 | WWWWWWWh     |
   3116 | Sao Paolo     |     71.00 | WWW;         |
   3117 | Stockholm     |    134.19 | WWWWWW:      |
   3118 | Morelia       |    257.56 | WWWWWWWWWWWH |
   3119 | Rochefourchat |      0.00 |              |
   3120 ,#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
   3121 #+end_example
   3122 
   3123 The formula is an Elisp call.
   3124 
   3125 #+attr_texinfo: :options orgtbl-ascii-draw value min max &optional width
   3126 #+begin_defun
   3127 Draw an ASCII bar in a table.
   3128 
   3129 {{{var(VALUE)}}} is the value to plot.
   3130 
   3131 {{{var(MIN)}}} is the value displayed as an empty bar.  {{{var(MAX)}}}
   3132 is the value filling all the {{{var(WIDTH)}}}.  Sources values outside
   3133 this range are displayed as =too small= or =too large=.
   3134 
   3135 {{{var(WIDTH)}}} is the number of characters of the bar plot.  It
   3136 defaults to =12=.
   3137 #+end_defun
   3138 
   3139 * Hyperlinks
   3140 :PROPERTIES:
   3141 :DESCRIPTION: Notes in context.
   3142 :END:
   3143 #+cindex: hyperlinks
   3144 
   3145 Like HTML, Org provides support for links inside a file, external
   3146 links to other files, Usenet articles, emails, and much more.
   3147 
   3148 ** Link Format
   3149 :PROPERTIES:
   3150 :DESCRIPTION: How links in Org are formatted.
   3151 :END:
   3152 #+cindex: link format
   3153 #+cindex: format, of links
   3154 
   3155 #+cindex: angle bracket links
   3156 #+cindex: plain links
   3157 Org recognizes plain URIs, possibly wrapped within angle
   3158 brackets[fn:10], and activate them as clickable links.
   3159 
   3160 #+cindex: bracket links
   3161 The general link format, however, looks like this:
   3162 
   3163 : [[LINK][DESCRIPTION]]
   3164 
   3165 #+texinfo: @noindent
   3166 or alternatively
   3167 
   3168 : [[LINK]]
   3169 
   3170 #+cindex: escape syntax, for links
   3171 #+cindex: backslashes, in links
   3172 Some =\=, =[= and =]= characters in the {{{var(LINK)}}} part need to
   3173 be "escaped", i.e., preceded by another =\= character.  More
   3174 specifically, the following characters, and only them, must be
   3175 escaped:
   3176 
   3177 1. all =[= and =]= characters,
   3178 2. every =\= character preceding either =]= or =[=,
   3179 3. every =\= character at the end of the link.
   3180 
   3181 #+findex: org-link-escape
   3182 Functions inserting links (see [[*Handling Links]]) properly escape
   3183 ambiguous characters.  You only need to bother about the rules above
   3184 when inserting directly, or yanking, a URI within square brackets.
   3185 When in doubt, you may use the function ~org-link-escape~, which turns
   3186 a link string into its escaped form.
   3187 
   3188 Once a link in the buffer is complete, with all brackets present, Org
   3189 changes the display so that =DESCRIPTION= is displayed instead of
   3190 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=.
   3191 Links are highlighted in the ~org-link~ face, which, by default, is an
   3192 underlined face.
   3193 
   3194 You can directly edit the visible part of a link.  This can be either
   3195 the {{{var(LINK)}}} part, if there is no description, or the
   3196 {{{var(DESCRIPTION)}}} part otherwise.  To also edit the invisible
   3197 {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}} with point on the link
   3198 (see [[*Handling Links]]).
   3199 
   3200 If you place point at the beginning or just behind the end of the
   3201 displayed text and press {{{kbd(BS)}}}, you remove
   3202 the---invisible---bracket at that location[fn:: More accurately, the
   3203 precise behavior depends on how point arrived there---see
   3204 [[info:elisp#Invisible Text][Invisible Text]].].  This makes the link
   3205 incomplete and the internals are again displayed as plain text.
   3206 Inserting the missing bracket hides the link internals again.  To show
   3207 the internal structure of all links, use the menu: Org \rarr
   3208 Hyperlinks \rarr Literal links, customize ~org-link-descriptive~, or use
   3209 =literallinks= [[*Summary of In-Buffer Settings][startup option]].
   3210 
   3211 ** Internal Links
   3212 :PROPERTIES:
   3213 :DESCRIPTION: Links to other places in the current file.
   3214 :END:
   3215 #+cindex: internal links
   3216 #+cindex: links, internal
   3217 
   3218 A link that does not look like a URL---i.e., does not start with
   3219 a known scheme or a file name---refers to the current document.  You
   3220 can follow it with {{{kbd(C-c C-o)}}} when point is on the link, or
   3221 with a mouse click (see [[*Handling Links]]).
   3222 
   3223 #+cindex: @samp{CUSTOM_ID}, property
   3224 Org provides several refinements to internal navigation within
   3225 a document.  Most notably, a construct like =[[#my-custom-id]]=
   3226 specifically targets the entry with the =CUSTOM_ID= property set to
   3227 =my-custom-id=.  Also, an internal link looking like =[[*Some
   3228 section]]= points to a headline with the name =Some section=[fn:11].
   3229 
   3230 #+cindex: targets, for links
   3231 When the link does not belong to any of the cases above, Org looks for
   3232 a /dedicated target/: the same string in double angular brackets, like
   3233 =<<My Target>>=.
   3234 
   3235 #+cindex: @samp{NAME}, keyword
   3236 If no dedicated target exists, the link tries to match the exact name
   3237 of an element within the buffer.  Naming is done, unsurprisingly, with
   3238 the =NAME= keyword, which has to be put in the line before the element
   3239 it refers to, as in the following example
   3240 
   3241 #+begin_example
   3242 ,#+NAME: My Target
   3243 | a  | table      |
   3244 |----+------------|
   3245 | of | four cells |
   3246 #+end_example
   3247 
   3248 #+vindex: org-link-search-must-match-exact-headline
   3249 Ultimately, if none of the above succeeds, Org searches for a headline
   3250 that is exactly the link text but may also include a TODO keyword and
   3251 tags, or initiates a plain text search, according to the value of
   3252 ~org-link-search-must-match-exact-headline~.
   3253 
   3254 Note that you must make sure custom IDs, dedicated targets, and names
   3255 are unique throughout the document.  Org provides a linter to assist
   3256 you in the process, if needed.  See [[*Org Syntax]].
   3257 
   3258 During export, internal links are used to mark objects and assign them
   3259 a number.  Marked objects are then referenced by links pointing to
   3260 them.  In particular, links without a description appear as the number
   3261 assigned to the marked object[fn:: When targeting a =NAME= keyword,
   3262 the =CAPTION= keyword is mandatory in order to get proper numbering
   3263 (see [[*Captions]]).].  In the following excerpt from an Org buffer
   3264 
   3265 #+begin_example
   3266 1. one item
   3267 2. <<target>>another item
   3268 Here we refer to item [[target]].
   3269 #+end_example
   3270 
   3271 #+texinfo: @noindent
   3272 The last sentence will appear as =Here we refer to item 2= when
   3273 exported.
   3274 
   3275 In non-Org files, the search looks for the words in the link text.  In
   3276 the above example the search would be for =target=.
   3277 
   3278 Following a link pushes a mark onto Org's own mark ring.  You can
   3279 return to the previous position with {{{kbd(C-c &)}}}.  Using this
   3280 command several times in direct succession goes back to positions
   3281 recorded earlier.
   3282 
   3283 ** Radio Targets
   3284 :PROPERTIES:
   3285 :DESCRIPTION: Make targets trigger links in plain text.
   3286 :END:
   3287 #+cindex: radio targets
   3288 #+cindex: targets, radio
   3289 #+cindex: links, radio targets
   3290 
   3291 Org can automatically turn any occurrences of certain target names in
   3292 normal text into a link.  So without explicitly creating a link, the
   3293 text connects to the target radioing its position.  Radio targets are
   3294 enclosed by triple angular brackets.  For example, a target =<<<My
   3295 Target>>>= causes each occurrence of =my target= in normal text to
   3296 become activated as a link.  The Org file is scanned automatically for
   3297 radio targets only when the file is first loaded into Emacs.  To
   3298 update the target list during editing, press {{{kbd(C-c C-c)}}} with
   3299 point on or at a target.
   3300 
   3301 ** External Links
   3302 :PROPERTIES:
   3303 :DESCRIPTION: URL-like links to the world.
   3304 :END:
   3305 #+cindex: links, external
   3306 #+cindex: external links
   3307 #+cindex: attachment links
   3308 #+cindex: BBDB links
   3309 #+cindex: Elisp links
   3310 #+cindex: file links
   3311 #+cindex: Gnus links
   3312 #+cindex: Help links
   3313 #+cindex: IRC links
   3314 #+cindex: Info links
   3315 #+cindex: MH-E links
   3316 #+cindex: Rmail links
   3317 #+cindex: shell links
   3318 #+cindex: URL links
   3319 #+cindex: Usenet links
   3320 
   3321 Org supports links to files, websites, Usenet and email messages, BBDB
   3322 database entries and links to both IRC conversations and their logs.
   3323 External links are URL-like locators.  They start with a short
   3324 identifying string followed by a colon.  There can be no space after
   3325 the colon.
   3326 
   3327 Here is the full set of built-in link types:
   3328 
   3329 - =file= ::
   3330 
   3331   File links.  File name may be remote, absolute, or relative.
   3332 
   3333   As a special case, "file" prefix may be omitted if the file name
   3334   is complete, e.g., it starts with =./=, or =/=.
   3335 
   3336 - =attachment= ::
   3337 
   3338   Same as file links but for files and folders attached to the current
   3339   node (see [[*Attachments]]).  Attachment links are intended to behave
   3340   exactly as file links but for files relative to the attachment
   3341   directory.
   3342 
   3343 - =bbdb= ::
   3344 
   3345   Link to a BBDB record, with possible regexp completion.
   3346 
   3347 - =docview= ::
   3348 
   3349   Link to a document opened with DocView mode.  You may specify a page
   3350   number.
   3351 
   3352 - =doi= ::
   3353 
   3354   Link to an electronic resource, through its handle.
   3355 
   3356 - =elisp= ::
   3357 
   3358   Execute an Elisp command upon activation.
   3359 
   3360 - =gnus=, =rmail=, =mhe= ::
   3361 
   3362   Link to messages or folders from a given Emacs MUA.
   3363 
   3364 - =help= ::
   3365 
   3366   Display documentation of a symbol in =*Help*= buffer.
   3367 
   3368 - =http=, =https= ::
   3369 
   3370   Web links.
   3371 
   3372 - =id= ::
   3373 
   3374   Link to a specific headline by its ID property, in an Org file.
   3375 
   3376 - =info= ::
   3377 
   3378   Link to an Info manual, or to a specific node.
   3379 
   3380 - =irc= ::
   3381 
   3382   Link to an IRC channel.
   3383 
   3384 - =mailto= ::
   3385 
   3386   Link to message composition.
   3387 
   3388 - =news= ::
   3389 
   3390   Usenet links.
   3391 
   3392 - =shell= ::
   3393 
   3394   Execute a shell command upon activation.
   3395 
   3396 
   3397 For =file:= and =id:= links, you can additionally specify a line
   3398 number, or a text search string, separated by =::=.  In Org files, you
   3399 may link to a headline name, a custom ID, or a code reference instead.
   3400 
   3401 The following table illustrates the link types above, along with their
   3402 options:
   3403 
   3404 | Link Type  | Example                                                            |
   3405 |------------+--------------------------------------------------------------------|
   3406 | http       | =http://staff.science.uva.nl/c.dominik/=                           |
   3407 | https      | =https://orgmode.org/=                                             |
   3408 | doi        | =doi:10.1000/182=                                                  |
   3409 | file       | =file:/home/dominik/images/jupiter.jpg=                            |
   3410 |            | =/home/dominik/images/jupiter.jpg= (same as above)                 |
   3411 |            | =file:papers/last.pdf=                                             |
   3412 |            | =./papers/last.pdf= (same as above)                                |
   3413 |            | =file:/ssh:me@some.where:papers/last.pdf= (remote)                 |
   3414 |            | =/ssh:me@some.where:papers/last.pdf= (same as above)               |
   3415 |            | =file:sometextfile::NNN= (jump to line number)                     |
   3416 |            | =file:projects.org=                                                |
   3417 |            | =file:projects.org::some words= (text search)[fn:12]               |
   3418 |            | =file:projects.org::*task title= (headline search)                 |
   3419 |            | =file:projects.org::#custom-id= (headline search)                  |
   3420 | attachment | =attachment:projects.org=                                          |
   3421 |            | =attachment:projects.org::some words= (text search)                |
   3422 | docview    | =docview:papers/last.pdf::NNN=                                     |
   3423 | id         | =id:B7423F4D-2E8A-471B-8810-C40F074717E9=                          |
   3424 |            | =id:B7423F4D-2E8A-471B-8810-C40F074717E9::*task= (headline search) |
   3425 | news       | =news:comp.emacs=                                                  |
   3426 | mailto     | =mailto:adent@galaxy.net=                                          |
   3427 | mhe        | =mhe:folder= (folder link)                                         |
   3428 |            | =mhe:folder#id= (message link)                                     |
   3429 | rmail      | =rmail:folder= (folder link)                                       |
   3430 |            | =rmail:folder#id= (message link)                                   |
   3431 | gnus       | =gnus:group= (group link)                                          |
   3432 |            | =gnus:group#id= (article link)                                     |
   3433 | bbdb       | =bbdb:R.*Stallman= (record with regexp)                            |
   3434 | irc        | =irc:/irc.com/#emacs/bob=                                          |
   3435 | help       | =help:org-store-link=                                              |
   3436 | info       | =info:org#External links=                                          |
   3437 | shell      | =shell:ls *.org=                                                   |
   3438 | elisp      | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate)           |
   3439 |            | =elisp:org-agenda= (interactive Elisp command)                     |
   3440 
   3441 #+cindex: VM links
   3442 #+cindex: Wanderlust links
   3443 On top of these built-in link types, additional ones are available
   3444 through the =org-contrib= repository (see [[*Installation]]).  For
   3445 example, these links to VM or Wanderlust messages are available when
   3446 you load the corresponding libraries from the =org-contrib=
   3447 repository:
   3448 
   3449 | =vm:folder=                            | VM folder link          |
   3450 | =vm:folder#id=                         | VM message link         |
   3451 | =vm://myself@some.where.org/folder#id= | VM on remote machine    |
   3452 | =vm-imap:account:folder=               | VM IMAP folder link     |
   3453 | =vm-imap:account:folder#id=            | VM IMAP message link    |
   3454 | =wl:folder=                            | Wanderlust folder link  |
   3455 | =wl:folder#id=                         | Wanderlust message link |
   3456 
   3457 For information on customizing Org to add new link types, see [[*Adding
   3458 Hyperlink Types]].
   3459 
   3460 A link should be enclosed in double brackets and may contain
   3461 descriptive text to be displayed instead of the URL (see [[*Link
   3462 Format]]), for example:
   3463 
   3464 : [[https://www.gnu.org/software/emacs/][GNU Emacs]]
   3465 
   3466 If the description is a file name or URL that points to an image, HTML
   3467 export (see [[*HTML Export]]) inlines the image as a clickable button.  If
   3468 there is no description at all and the link points to an image, that
   3469 image is inlined into the exported HTML file.
   3470 
   3471 #+cindex: square brackets, around links
   3472 #+cindex: angular brackets, around links
   3473 #+cindex: plain text external links
   3474 Org also recognizes external links amid normal text and activates them
   3475 as links.  If spaces must be part of the link (for example in
   3476 =bbdb:R.*Stallman=), or if you need to remove ambiguities about the
   3477 end of the link, enclose the link in square or angular brackets.
   3478 
   3479 ** Handling Links
   3480 :PROPERTIES:
   3481 :DESCRIPTION: Creating, inserting and following.
   3482 :END:
   3483 #+cindex: links, handling
   3484 
   3485 Org provides methods to create a link in the correct syntax, to insert
   3486 it into an Org file, and to follow the link.
   3487 
   3488 #+findex: org-store-link
   3489 #+cindex: storing links
   3490 The main function is ~org-store-link~, called with {{{kbd(M-x
   3491 org-store-link)}}}.  Because of its importance, we suggest to bind it
   3492 to a widely available key (see [[*Activation]]).  It stores a link to the
   3493 current location.  The link is stored for later insertion into an Org
   3494 buffer---see below.  The kind of link that is created depends on the
   3495 current buffer:
   3496 
   3497 - /Org mode buffers/ ::
   3498 
   3499   For Org files, if there is a =<<target>>= at point, the link points
   3500   to the target.  If there is a named block (using =#+name:=) at
   3501   point, the link points to that name.  Otherwise it points to the
   3502   current headline, which is also the description.
   3503 
   3504   #+vindex: org-id-link-to-org-use-id
   3505   #+cindex: @samp{CUSTOM_ID}, property
   3506   #+cindex: @samp{ID}, property
   3507   If the headline has a =CUSTOM_ID= property, store a link to this
   3508   custom ID.  In addition or alternatively, depending on the value of
   3509   ~org-id-link-to-org-use-id~, create and/or use a globally unique
   3510   =ID= property for the link[fn:: The Org Id library must first be
   3511   loaded, either through ~org-customize~, by enabling ~id~ in
   3512   ~org-modules~, or by adding =(require 'org-id)= in your Emacs init
   3513   file.].  So using this command in Org buffers potentially creates
   3514   two links: a human-readable link from the custom ID, and one that is
   3515   globally unique and works even if the entry is moved from file to
   3516   file.  The =ID= property can be either a UUID (default) or a
   3517   timestamp, depending on ~org-id-method~.  Later, when inserting the
   3518   link, you need to decide which one to use.
   3519 
   3520   #+vindex: org-id-link-consider-parent-id
   3521   #+vindex: org-id-link-use-context
   3522   #+vindex: org-link-context-for-files
   3523   When ~org-id-link-consider-parent-id~ is ~t~[fn:: Also,
   3524   ~org-link-context-for-files~ and ~org-id-link-use-context~ should be
   3525   both enabled (which they are, by default).], parent =ID= properties
   3526   are considered.  This allows linking to specific targets, named
   3527   blocks, or headlines (which may not have a globally unique =ID=
   3528   themselves) within the context of a parent headline or file which
   3529   does.
   3530 
   3531   For example, given this org file:
   3532 
   3533   #+begin_src org
   3534   ,* Parent
   3535   :PROPERTIES:
   3536   :ID: abc
   3537   :END:
   3538   ,** Child 1
   3539   ,** Child 2
   3540   #+end_src
   3541 
   3542   Storing a link with point at "Child 1" will produce a link
   3543   =<id:abc::*Child 1>=, which precisely links to the "Child 1"
   3544   headline even though it does not have its own ID.
   3545 
   3546 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
   3547 
   3548   #+vindex: org-link-email-description-format
   3549   Pretty much all Emacs mail clients are supported.  The link points
   3550   to the current article, or, in some Gnus buffers, to the group.  The
   3551   description is constructed according to the variable
   3552   ~org-link-email-description-format~.  By default, it refers to the
   3553   addressee and the subject.
   3554 
   3555 - /Web browsers: W3M and EWW/ ::
   3556 
   3557   Here the link is the current URL, with the page title as the
   3558   description.
   3559 
   3560 - /Contacts: BBDB/ ::
   3561 
   3562   Links created in a BBDB buffer point to the current entry.
   3563 
   3564 - /Chat: IRC/ ::
   3565 
   3566   #+vindex: org-irc-links-to-logs
   3567   For IRC links, if the variable ~org-irc-link-to-logs~ is non-~nil~,
   3568   create a =file= style link to the relevant point in the logs for the
   3569   current conversation.  Otherwise store an =irc= style link to the
   3570   user/channel/server under the point.
   3571 
   3572 - /Other files/ ::
   3573 
   3574   For any other file, the link points to the file, with a search
   3575   string (see [[*Search Options in File Links]]) pointing to the contents
   3576   of the current line.  If there is an active region, the selected
   3577   words form the basis of the search string.  You can write custom Lisp
   3578   functions to select the search string and perform the search for
   3579   particular file types (see [[*Custom Searches]]).
   3580 
   3581   You can also define dedicated links to other files.  See [[*Adding
   3582   Hyperlink Types]].
   3583 
   3584 - /Agenda view/ ::
   3585 
   3586   When point is in an agenda view, the created link points to the
   3587   entry referenced by the current line.
   3588 
   3589 From an Org buffer, the following commands create, navigate or, more
   3590 generally, act on links.
   3591 
   3592 #+attr_texinfo: :sep ,
   3593 - {{{kbd(C-c C-l)}}} (~org-insert-link~) ::
   3594 
   3595   #+kindex: C-c C-l
   3596   #+findex: org-insert-link
   3597   #+cindex: link completion
   3598   #+cindex: completion, of links
   3599   #+cindex: inserting links
   3600   #+vindex: org-link-keep-stored-after-insertion
   3601   Insert a link[fn:13].  This prompts for a link to be inserted into
   3602   the buffer.  You can just type a link, using text for an internal
   3603   link, or one of the link type prefixes mentioned in the examples
   3604   above.  The link is inserted into the buffer, along with
   3605   a descriptive text[fn:14].  If some text was selected at this time,
   3606   it becomes the default description.
   3607 
   3608   - /Inserting stored links/ ::
   3609 
   3610     All links stored during the current session are part of the
   3611     history for this prompt, so you can access them with {{{kbd(UP)}}}
   3612     and {{{kbd(DOWN)}}} (or {{{kbd(M-p)}}}, {{{kbd(M-n)}}}).
   3613 
   3614   - /Completion support/ ::
   3615 
   3616     Completion with {{{kbd(TAB)}}} helps you to insert valid link
   3617     prefixes like =http= or =ftp=, including the prefixes defined
   3618     through link abbreviations (see [[*Link Abbreviations]]).  If you
   3619     press {{{kbd(RET)}}} after inserting only the prefix, Org offers
   3620     specific completion support for some link types[fn:: This works if
   3621     a function has been defined in the ~:complete~ property of a link
   3622     in ~org-link-parameters~.].  For example, if you type {{{kbd(f i l
   3623     e RET)}}}---alternative access: {{{kbd(C-u C-c C-l)}}}, see
   3624     below---Org offers file name completion, and after {{{kbd(b b d b
   3625     RET)}}} you can complete contact names.
   3626 
   3627 - {{{kbd(C-u C-c C-l)}}} ::
   3628 
   3629   #+cindex: file name completion
   3630   #+cindex: completion, of file names
   3631   #+kindex: C-u C-c C-l
   3632   When {{{kbd(C-c C-l)}}} is called with a {{{kbd(C-u)}}} prefix
   3633   argument, insert a link to a file.  You may use file name completion
   3634   to select the name of the file.  The path to the file is inserted
   3635   relative to the directory of the current Org file, if the linked
   3636   file is in the current directory or in a sub-directory of it, or if
   3637   the path is written relative to the current directory using =../=.
   3638   Otherwise an absolute path is used, if possible with =~/= for your
   3639   home directory.  You can force an absolute path with two
   3640   {{{kbd(C-u)}}} prefixes.
   3641 
   3642 - {{{kbd(C-c C-l)}}} (with point on existing link) ::
   3643 
   3644   #+cindex: following links
   3645   When point is on an existing link, {{{kbd(C-c C-l)}}} allows you to
   3646   edit the link and description parts of the link.
   3647 
   3648 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
   3649 
   3650   #+kindex: C-c C-o
   3651   #+findex: org-open-at-point
   3652   #+vindex: org-file-apps
   3653   Open link at point.  This launches a web browser for URL (using
   3654   ~browse-url-at-point~), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
   3655   the corresponding links, and execute the command in a shell link.
   3656   When point is on an internal link, this command runs the
   3657   corresponding search.  When point is on the tags part of a headline,
   3658   it creates the corresponding tags view (see [[*Matching tags and
   3659   properties]]).  If point is on a timestamp, it compiles the agenda for
   3660   that date.  Furthermore, it visits text and remote files in =file=
   3661   links with Emacs and select a suitable application for local
   3662   non-text files.  Classification of files is based on file extension
   3663   only.  See option ~org-file-apps~.  If you want to override the
   3664   default application and visit the file with Emacs, use
   3665   a {{{kbd(C-u)}}} prefix.  If you want to avoid opening in Emacs, use
   3666   a {{{kbd(C-u C-u)}}} prefix.
   3667 
   3668   #+vindex: org-link-frame-setup
   3669   If point is on a headline, but not on a link, offer all links in the
   3670   headline and entry text.  If you want to setup the frame
   3671   configuration for following links, customize ~org-link-frame-setup~.
   3672 
   3673 - {{{kbd(RET)}}} ::
   3674 
   3675   #+vindex: org-return-follows-link
   3676   #+kindex: RET
   3677   When ~org-return-follows-link~ is set, {{{kbd(RET)}}} also follows
   3678   the link at point.
   3679 
   3680 - {{{kbd(mouse-2)}}} or {{{kbd(mouse-1)}}} ::
   3681 
   3682   #+kindex: mouse-2
   3683   #+kindex: mouse-1
   3684   On links, {{{kbd(mouse-1)}}} and {{{kbd(mouse-2)}}} opens the link
   3685   just as {{{kbd(C-c C-o)}}} does.
   3686 
   3687 - {{{kbd(mouse-3)}}} ::
   3688 
   3689   #+vindex: org-link-use-indirect-buffer-for-internals
   3690   #+kindex: mouse-3
   3691   Like {{{kbd(mouse-2)}}}, but force file links to be opened with
   3692   Emacs, and internal links to be displayed in another window[fn:: See
   3693   the variable ~org-link-use-indirect-buffer-for-internals~.].
   3694 
   3695 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
   3696 
   3697   #+kindex: C-c %
   3698   #+findex: org-mark-ring-push
   3699   #+cindex: mark ring
   3700   Push the current position onto the Org mark ring, to be able to
   3701   return easily.  Commands following an internal link do this
   3702   automatically.
   3703 
   3704 - {{{kbd(C-c &)}}} (~org-mark-ring-goto~) ::
   3705 
   3706   #+kindex: C-c &
   3707   #+findex: org-mark-ring-goto
   3708   #+cindex: links, returning to
   3709   Jump back to a recorded position.  A position is recorded by the
   3710   commands following internal links, and by {{{kbd(C-c %)}}}.  Using
   3711   this command several times in direct succession moves through a ring
   3712   of previously recorded positions.
   3713 
   3714 - {{{kbd(C-c C-x C-n)}}} (~org-next-link~), {{{kbd(C-c C-x C-p)}}} (~org-previous-link~) ::
   3715 
   3716   #+kindex: C-c C-x C-p
   3717   #+findex: org-previous-link
   3718   #+kindex: C-c C-x C-n
   3719   #+findex: org-next-link
   3720   #+cindex: links, finding next/previous
   3721   Move forward/backward to the next link in the buffer.  At the limit
   3722   of the buffer, the search fails once, and then wraps around.  The
   3723   key bindings for this are really too long; you might want to bind
   3724   this also to {{{kbd(M-n)}}} and {{{kbd(M-p)}}}.
   3725 
   3726   #+begin_src emacs-lisp
   3727   (with-eval-after-load 'org
   3728     (define-key org-mode-map (kbd "M-n") #'org-next-link)
   3729     (define-key org-mode-map (kbd "M-p") #'org-previous-link))
   3730   #+end_src
   3731 
   3732 ** Using Links Outside Org
   3733 :PROPERTIES:
   3734 :DESCRIPTION: Linking from my C source code?
   3735 :END:
   3736 
   3737 #+findex: org-insert-link-global
   3738 #+findex: org-open-at-point-global
   3739 You can insert and follow links that have Org syntax not only in Org,
   3740 but in any Emacs buffer.  For this, Org provides two functions:
   3741 ~org-insert-link-global~ and ~org-open-at-point-global~.
   3742 
   3743 You might want to bind them to globally available keys.  See
   3744 [[*Activation]] for some advice.
   3745 
   3746 ** Link Abbreviations
   3747 :PROPERTIES:
   3748 :DESCRIPTION: Shortcuts for writing complex links.
   3749 :END:
   3750 #+cindex: link abbreviations
   3751 #+cindex: abbreviation, links
   3752 
   3753 Long URL can be cumbersome to type, and often many similar links are
   3754 needed in a document.  For this you can use link abbreviations.  An
   3755 abbreviated link looks like this
   3756 
   3757 : [[linkword:tag][description]]
   3758 
   3759 #+texinfo: @noindent
   3760 #+vindex: org-link-abbrev-alist
   3761 where the tag is optional.  The /linkword/ must be a word, starting
   3762 with a letter, followed by letters, numbers, =-=, and =_=.
   3763 Abbreviations are resolved according to the information in the
   3764 variable ~org-link-abbrev-alist~ that relates the linkwords to
   3765 replacement text.  Here is an example:
   3766 
   3767 #+begin_src emacs-lisp
   3768 (setq org-link-abbrev-alist
   3769       '(("bugzilla"        . "https://10.1.2.9/bugzilla/show_bug.cgi?id=")
   3770         ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h")
   3771         ("duckduckgo"      . "https://duckduckgo.com/?q=%s")
   3772         ("omap"            . "https://nominatim.openstreetmap.org/search?q=%s&polygon=1")
   3773         ("ads"             . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\"")))
   3774 #+end_src
   3775 
   3776 If the replacement text contains the string =%s=, it is replaced with
   3777 the tag.  Using =%h= instead of =%s= percent-encodes the tag (see the
   3778 example above, where we need to encode the URL parameter).  Using
   3779 =%(my-function)= passes the tag to a custom Lisp function, and replace
   3780 it by the resulting string.
   3781 
   3782 If the replacement text do not contain any specifier, it is simply
   3783 appended to the string in order to create the link.
   3784 
   3785 Instead of a string, you may also specify a Lisp function to create
   3786 the link.  Such a function will be called with the tag as the only
   3787 argument.
   3788 
   3789 With the above setting, you could link to a specific bug with
   3790 =[[bugzilla:129]]=, search the web for =OrgMode= with =[[duckduckgo:OrgMode]]=,
   3791 show the map location of the Free Software Foundation =[[omap:31
   3792 Milk Street, Boston]]= or of Carsten's office =[[omap:Science Park 904,
   3793 Amsterdam, The Netherlands]]= and find out what the Org author is doing
   3794 besides Emacs hacking with =[[ads:Dominik,C]]=.
   3795 
   3796 If you need special abbreviations just for a single Org buffer, you
   3797 can define them in the file with
   3798 
   3799 #+cindex: @samp{LINK}, keyword
   3800 #+begin_example
   3801 ,#+LINK: bugzilla  https://10.1.2.9/bugzilla/show_bug.cgi?id=
   3802 ,#+LINK: duckduckgo https://duckduckgo.com/?q=%s
   3803 ,#+LINK: "Nu Html Checker" https://validator.w3.org/nu/?doc=%h
   3804 #+end_example
   3805 
   3806 The abbreviations containing spaces must be quoted.
   3807 
   3808 In-buffer completion (see [[*Completion]]) can be used after =[= to
   3809 complete link abbreviations.  You may also define a Lisp function that
   3810 implements special (e.g., completion) support for inserting such a
   3811 link with {{{kbd(C-c C-l)}}}.  Such a function should not accept any
   3812 arguments, and should return the full link with a prefix.  You can set
   3813 the link completion function like this:
   3814 
   3815 #+begin_src emacs-lisp
   3816 (org-link-set-parameter "type" :complete #'some-completion-function)
   3817 #+end_src
   3818 
   3819 ** Search Options in File Links
   3820 :PROPERTIES:
   3821 :DESCRIPTION: Linking to a specific location.
   3822 :ALT_TITLE: Search Options
   3823 :END:
   3824 #+cindex: search option in file links
   3825 #+cindex: search option in id links
   3826 #+cindex: file links, searching
   3827 #+cindex: id links, searching
   3828 #+cindex: attachment links, searching
   3829 
   3830 File links can contain additional information to make Emacs jump to a
   3831 particular location in the file when following a link.  This can be a
   3832 line number or a search option after a double colon[fn:: For backward
   3833 compatibility, line numbers can also follow a single colon.].  For
   3834 example, when the command ~org-store-link~ creates a link (see
   3835 [[*Handling Links]]) to a file, it encodes the words in the current
   3836 line as a search string that can be used to find this line back later
   3837 when following the link with {{{kbd(C-c C-o)}}}.
   3838 
   3839 Note that all search options apply for Attachment and ID links in the
   3840 same way that they apply for File links.
   3841 
   3842 Here is the syntax of the different ways to attach a search to a file
   3843 link, together with explanations for each:
   3844 
   3845 #+begin_example
   3846 [[file:~/code/main.c::255]]
   3847 [[file:~/xx.org::My Target]]
   3848 [[file:~/xx.org::*My Target]]
   3849 [[file:~/xx.org::#my-custom-id]]
   3850 [[file:~/xx.org::/regexp/]]
   3851 [[attachment:main.c::255]]
   3852 #+end_example
   3853 
   3854 - =255= ::
   3855 
   3856   Jump to line 255.
   3857 
   3858 - =My Target= ::
   3859 
   3860   Search for a link target =<<My Target>>=, or do a text search for
   3861   =my target=, similar to the search in internal links, see [[*Internal
   3862   Links]].  In HTML export (see [[*HTML Export]]), such a file link becomes
   3863   a HTML reference to the corresponding named anchor in the linked
   3864   file.
   3865 
   3866 - =*My Target= ::
   3867 
   3868   In an Org file, restrict search to headlines.
   3869 
   3870 - =#my-custom-id= ::
   3871 
   3872   Link to a heading with a =CUSTOM_ID= property
   3873 
   3874 - =/REGEXP/= ::
   3875 
   3876   Do a regular expression search for {{{var(REGEXP)}}} (see [[*Regular
   3877   Expressions]]).  This uses the Emacs command ~occur~ to list all
   3878   matches in a separate window.  If the target file is in Org mode,
   3879   ~org-occur~ is used to create a sparse tree with the matches.
   3880 
   3881 As a degenerate case, a file link with an empty file name can be used
   3882 to search the current file.  For example, =[[file:::find me]]= does
   3883 a search for =find me= in the current file, just as =[[find me]]=
   3884 would.
   3885 
   3886 ** Custom Searches
   3887 :PROPERTIES:
   3888 :DESCRIPTION: When the default search is not enough.
   3889 :END:
   3890 #+cindex: custom search strings
   3891 #+cindex: search strings, custom
   3892 
   3893 The default mechanism for creating search strings and for doing the
   3894 actual search related to a file link may not work correctly in all
   3895 cases.  For example, BibTeX database files have many entries like
   3896 ~year="1993"~ which would not result in good search strings, because
   3897 the only unique identification for a BibTeX entry is the citation key.
   3898 
   3899 #+vindex: org-create-file-search-functions
   3900 #+vindex: org-execute-file-search-functions
   3901 If you come across such a problem, you can write custom functions to
   3902 set the right search string for a particular file type, and to do the
   3903 search for the string in the file.  Using ~add-hook~, these functions
   3904 need to be added to the hook variables
   3905 ~org-create-file-search-functions~ and
   3906 ~org-execute-file-search-functions~.  See the docstring for these
   3907 variables for more information.  Org actually uses this mechanism for
   3908 BibTeX database files, and you can use the corresponding code as an
   3909 implementation example.  See the file =ol-bibtex.el=.
   3910 
   3911 * TODO Items
   3912 :PROPERTIES:
   3913 :DESCRIPTION: Every tree branch can be a TODO item.
   3914 :END:
   3915 #+cindex: TODO items
   3916 
   3917 Org mode does not maintain TODO lists as separate documents[fn:: Of
   3918 course, you can make a document that contains only long lists of TODO
   3919 items, but this is not required.].  Instead, TODO items are an
   3920 integral part of the notes file, because TODO items usually come up
   3921 while taking notes!  With Org mode, simply mark any entry in a tree as
   3922 being a TODO item.  In this way, information is not duplicated, and
   3923 the entire context from which the TODO item emerged is always present.
   3924 
   3925 Of course, this technique for managing TODO items scatters them
   3926 throughout your notes file.  Org mode compensates for this by
   3927 providing methods to give you an overview of all the things that you
   3928 have to do.
   3929 
   3930 ** Basic TODO Functionality
   3931 :PROPERTIES:
   3932 :DESCRIPTION: Marking and displaying TODO entries.
   3933 :ALT_TITLE: TODO Basics
   3934 :END:
   3935 
   3936 Any headline becomes a TODO item when it starts with the word =TODO=,
   3937 for example:
   3938 
   3939 : *** TODO Write letter to Sam Fortune
   3940 
   3941 The most important commands to work with TODO entries are:
   3942 
   3943 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
   3944 
   3945   #+kindex: C-c C-t
   3946   #+cindex: cycling, of TODO states
   3947   Rotate the TODO state of the current item among
   3948 
   3949   #+begin_example
   3950   ,-> (unmarked) -> TODO -> DONE --.
   3951   '--------------------------------'
   3952   #+end_example
   3953 
   3954   If TODO keywords have fast access keys (see [[*Fast access to TODO
   3955   states]]), prompt for a TODO keyword through the fast selection
   3956   interface; this is the default behavior when
   3957   ~org-use-fast-todo-selection~ is non-~nil~.
   3958 
   3959   The same state changing can also be done "remotely" from the agenda
   3960   buffer with the {{{kbd(t)}}} command key (see [[*Commands in the
   3961   Agenda Buffer]]).
   3962 
   3963 - {{{kbd(S-RIGHT)}}} {{{kbd(S-LEFT)}}} ::
   3964 
   3965   #+kindex: S-RIGHT
   3966   #+kindex: S-LEFT
   3967   #+vindex: org-treat-S-cursor-todo-selection-as-state-change
   3968   Select the following/preceding TODO state, similar to cycling.
   3969   Useful mostly if more than two TODO states are possible (see
   3970   [[*Extended Use of TODO Keywords]]).  See also [[*Packages that conflict
   3971   with Org mode]], for a discussion of the interaction with
   3972   shift-selection.  See also the variable
   3973   ~org-treat-S-cursor-todo-selection-as-state-change~.
   3974 
   3975 - {{{kbd(C-c / t)}}} (~org-show-todo-tree~) ::
   3976 
   3977   #+kindex: C-c / t
   3978   #+cindex: sparse tree, for TODO
   3979   #+vindex: org-todo-keywords
   3980   #+findex: org-show-todo-tree
   3981   View TODO items in a /sparse tree/ (see [[*Sparse Trees]]).  Folds the
   3982   entire buffer, but shows all TODO items---with not-DONE state---and
   3983   the headings hierarchy above them.  With a prefix argument, or by
   3984   using {{{kbd(C-c / T)}}}, search for a specific TODO.  You are
   3985   prompted for the keyword, and you can also give a list of keywords
   3986   like =KWD1|KWD2|...= to list entries that match any one of these
   3987   keywords.  With a numeric prefix argument N, show the tree for the
   3988   Nth keyword in the variable ~org-todo-keywords~.  With two prefix
   3989   arguments, find all TODO states, both un-done and done.
   3990 
   3991 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
   3992 
   3993   #+kindex: t @r{(Agenda dispatcher)}
   3994   Show the global TODO list.  Collects the TODO items (with not-DONE
   3995   states) from all agenda files (see [[*Agenda Views]]) into a single
   3996   buffer.  The new buffer is in Org Agenda mode, which provides
   3997   commands to examine and manipulate the TODO entries from the new
   3998   buffer (see [[*Commands in the Agenda Buffer]]).  See [[*The global TODO
   3999   list]], for more information.
   4000 
   4001 - {{{kbd(S-M-RET)}}} (~org-insert-todo-heading~) ::
   4002 
   4003   #+kindex: S-M-RET
   4004   #+findex: org-insert-todo-heading
   4005   Insert a new TODO entry below the current one.
   4006 
   4007 #+vindex: org-todo-state-tags-triggers
   4008 Changing a TODO state can also trigger tag changes.  See the docstring
   4009 of the option ~org-todo-state-tags-triggers~ for details.
   4010 
   4011 ** Extended Use of TODO Keywords
   4012 :PROPERTIES:
   4013 :DESCRIPTION: Workflow and assignments.
   4014 :ALT_TITLE: TODO Extensions
   4015 :END:
   4016 #+cindex: extended TODO keywords
   4017 
   4018 #+vindex: org-todo-keywords
   4019 By default, marked TODO entries have one of only two states: TODO and
   4020 DONE.  Org mode allows you to classify TODO items in more complex ways
   4021 with /TODO keywords/ (stored in ~org-todo-keywords~).  With special
   4022 setup, the TODO keyword system can work differently in different
   4023 files.
   4024 
   4025 Note that /tags/ are another way to classify headlines in general and
   4026 TODO items in particular (see [[*Tags]]).
   4027 
   4028 *** TODO keywords as workflow states
   4029 :PROPERTIES:
   4030 :DESCRIPTION: From TODO to DONE in steps.
   4031 :ALT_TITLE: Workflow states
   4032 :END:
   4033 #+cindex: TODO workflow
   4034 #+cindex: workflow states as TODO keywords
   4035 
   4036 You can use TODO keywords to indicate different, possibly /sequential/
   4037 states in the process of working on an item, for example[fn:: Changing
   4038 the variable ~org-todo-keywords~ only becomes effective after
   4039 restarting Org mode in a buffer.]:
   4040 
   4041 #+begin_src emacs-lisp
   4042 (setq org-todo-keywords
   4043       '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
   4044 #+end_src
   4045 
   4046 The vertical bar separates the TODO keywords (states that /need
   4047 action/) from the DONE states (which need /no further action/).  If
   4048 you do not provide the separator bar, the last state is used as the
   4049 DONE state.
   4050 
   4051 #+cindex: completion, of TODO keywords
   4052 With this setup, the command {{{kbd(C-c C-t)}}} cycles an entry from
   4053 =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to =DONE= and
   4054 =DELEGATED=.  You may also use a numeric prefix argument to quickly
   4055 select a specific state.  For example {{{kbd(C-3 C-c C-t)}}} changes
   4056 the state immediately to =VERIFY=.  Or you can use {{{kbd(S-RIGHT)}}}
   4057 and {{{kbd(S-LEFT)}}} to go forward and backward through the states.
   4058 If you define many keywords, you can use in-buffer completion (see
   4059 [[*Completion]]) or a special one-key selection scheme (see [[*Fast
   4060 access to TODO states]]) to insert these words into the buffer.
   4061 Changing a TODO state can be logged with a timestamp, see [[*Tracking
   4062 TODO state changes]], for more information.
   4063 
   4064 *** TODO keywords as types
   4065 :PROPERTIES:
   4066 :DESCRIPTION: I do this, Fred does the rest.
   4067 :ALT_TITLE: TODO types
   4068 :END:
   4069 #+cindex: TODO types
   4070 #+cindex: names as TODO keywords
   4071 #+cindex: types as TODO keywords
   4072 
   4073 The second possibility is to use TODO keywords to indicate different
   4074 /types/ of action items.  For example, you might want to indicate that
   4075 items are for "work" or "home".  Or, when you work with several people
   4076 on a single project, you might want to assign action items directly to
   4077 persons, by using their names as TODO keywords.  This type of
   4078 functionality is actually much better served by using tags (see
   4079 [[*Tags]]), so the TODO implementation is kept just for backward
   4080 compatibility.
   4081 
   4082 Using TODO types, it would be set up like this:
   4083 
   4084 #+begin_src emacs-lisp
   4085 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
   4086 #+end_src
   4087 
   4088 In this case, different keywords do not indicate states, but rather
   4089 different types.  So the normal work flow would be to assign a task to
   4090 a person, and later to mark it DONE.  Org mode supports this style by
   4091 adapting the workings of the command {{{kbd(C-c C-t)}}}[fn:: This is
   4092 also true for the {{{kbd(t)}}} command in the agenda buffer.].  When
   4093 used several times in succession, it still cycles through all names,
   4094 in order to first select the right type for a task.  But when you
   4095 return to the item after some time and execute {{{kbd(C-c C-t)}}}
   4096 again, it will switch from any name directly to =DONE=.  Use prefix
   4097 arguments or completion to quickly select a specific name.  You can
   4098 also review the items of a specific TODO type in a sparse tree by
   4099 using a numeric prefix to {{{kbd(C-c / t)}}}.  For example, to see all
   4100 things Lucy has to do, you would use {{{kbd(C-3 C-c / t)}}}.  To
   4101 collect Lucy's items from all agenda files into a single buffer, you
   4102 would use the numeric prefix argument as well when creating the global
   4103 TODO list: {{{kbd(C-3 M-x org-agenda t)}}}.
   4104 
   4105 *** Multiple keyword sets in one file
   4106 :PROPERTIES:
   4107 :DESCRIPTION: Mixing it all, still finding your way.
   4108 :ALT_TITLE: Multiple sets in one file
   4109 :END:
   4110 #+cindex: TODO keyword sets
   4111 
   4112 Sometimes you may want to use different sets of TODO keywords in
   4113 parallel.  For example, you may want to have the basic TODO/DONE, but
   4114 also a workflow for bug fixing, and a separate state indicating that
   4115 an item has been canceled---so it is not DONE, but also does not
   4116 require action.  Your setup would then look like this:
   4117 
   4118 #+begin_src emacs-lisp
   4119 (setq org-todo-keywords
   4120       '((sequence "TODO" "|" "DONE")
   4121         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
   4122         (sequence "|" "CANCELED")))
   4123 #+end_src
   4124 
   4125 The keywords should all be different, this helps Org mode keep track
   4126 of which subsequence should be used for a given entry.  In this setup,
   4127 {{{kbd(C-c C-t)}}} only operates within a sub-sequence, so it switches
   4128 from =DONE= to (nothing) to =TODO=, and from =FIXED= to (nothing) to
   4129 =REPORT=.  Therefore you need a mechanism to initially select the
   4130 correct sequence.  In addition to typing a keyword or using completion
   4131 (see [[*Completion]]), you may also apply the following commands:
   4132 
   4133 #+attr_texinfo: :sep ,
   4134 - {{{kbd(C-u C-u C-c C-t)}}}, {{{kbd(C-S-RIGHT)}}}, {{{kbd(C-S-LEFT)}}} ::
   4135 
   4136   #+kindex: C-S-RIGHT
   4137   #+kindex: C-S-LEFT
   4138   #+kindex: C-u C-u C-c C-t
   4139   These keys jump from one TODO sub-sequence to the next.  In the
   4140   above example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbd(C-S-RIGHT)}}}
   4141   would jump from =TODO= or =DONE= to =REPORT=, and any of the words
   4142   in the second row to =CANCELED=.  Note that the {{{kbd(C-S-)}}} key
   4143   binding conflict with shift-selection (see [[*Packages that conflict
   4144   with Org mode]]).
   4145 
   4146 - {{{kbd(S-RIGHT)}}}, {{{kbd(S-LEFT)}}} ::
   4147 
   4148   #+kindex: S-RIGHT
   4149   #+kindex: S-LEFT
   4150   {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}} walk through /all/ keywords
   4151   from all sub-sequences, so for example {{{kbd(S-RIGHT)}}} would
   4152   switch from =DONE= to =REPORT= in the example above.  For
   4153   a discussion of the interaction with shift-selection, see [[*Packages
   4154   that conflict with Org mode]].
   4155 
   4156 *** Fast access to TODO states
   4157 :PROPERTIES:
   4158 :DESCRIPTION: Single letter selection of state.
   4159 :END:
   4160 
   4161 If you would like to quickly change an entry to an arbitrary TODO
   4162 state instead of cycling through the states, you can set up keys for
   4163 single-letter access to the states.  This is done by adding the
   4164 selection character after each keyword, in parentheses[fn:: All
   4165 characters are allowed except =@=, =^= and =!=, which have a special
   4166 meaning here.].  For example:
   4167 
   4168 #+begin_src emacs-lisp
   4169 (setq org-todo-keywords
   4170       '((sequence "TODO(t)" "|" "DONE(d)")
   4171         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
   4172         (sequence "|" "CANCELED(c)")))
   4173 #+end_src
   4174 
   4175 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
   4176 the entry is switched to this state.  {{{kbd(SPC)}}} can be used to
   4177 remove any TODO keyword from an entry.
   4178 
   4179 *** Setting up keywords for individual files
   4180 :PROPERTIES:
   4181 :DESCRIPTION: Different files, different requirements.
   4182 :ALT_TITLE: Per-file keywords
   4183 :END:
   4184 #+cindex: keyword options
   4185 #+cindex: per-file keywords
   4186 #+cindex: @samp{TODO}, keyword
   4187 #+cindex: @samp{TYP_TODO}, keyword
   4188 #+cindex: @samp{SEQ_TODO}, keyword
   4189 
   4190 It can be very useful to use different aspects of the TODO mechanism
   4191 in different files.  For file-local settings, you need to add special
   4192 lines to the file which set the keywords and interpretation for that
   4193 file only.  For example, to set one of the two examples discussed
   4194 above, you need one of the following lines, starting in column zero
   4195 anywhere in the file:
   4196 
   4197 : #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
   4198 
   4199 You may also write =#+SEQ_TODO= to be explicit about the
   4200 interpretation, but it means the same as =#+TODO=, or
   4201 
   4202 : #+TYP_TODO: Fred Sara Lucy Mike | DONE
   4203 
   4204 A setup for using several sets in parallel would be:
   4205 
   4206 #+begin_example
   4207 ,#+TODO: TODO(t) | DONE(d)
   4208 ,#+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f)
   4209 ,#+TODO: | CANCELED(c)
   4210 #+end_example
   4211 
   4212 #+cindex: completion, of option keywords
   4213 #+kindex: M-TAB
   4214 To make sure you are using the correct keyword, type =#+= into the
   4215 buffer and then use {{{kbd(M-TAB)}}} to complete it (see [[*Completion]]).
   4216 
   4217 #+cindex: DONE, final TODO keyword
   4218 Remember that the keywords after the vertical bar---or the last
   4219 keyword if no bar is there---must always mean that the item is DONE,
   4220 although you may use a different word.  After changing one of these
   4221 lines, use {{{kbd(C-c C-c)}}} with point still in the line to make the
   4222 changes known to Org mode[fn:: Org mode parses these lines only when
   4223 Org mode is activated after visiting a file. {{{kbd(C-c C-c)}}} with
   4224 point in a line starting with =#+= is simply restarting Org mode for
   4225 the current buffer.].
   4226 
   4227 *** Faces for TODO keywords
   4228 :PROPERTIES:
   4229 :DESCRIPTION: Highlighting states.
   4230 :END:
   4231 #+cindex: faces, for TODO keywords
   4232 
   4233 #+vindex: org-todo, face
   4234 #+vindex: org-done, face
   4235 #+vindex: org-todo-keyword-faces
   4236 Org mode highlights TODO keywords with special faces: ~org-todo~ for
   4237 keywords indicating that an item still has to be acted upon, and
   4238 ~org-done~ for keywords indicating that an item is finished.  If you
   4239 are using more than two different states, you might want to use
   4240 special faces for some of them.  This can be done using the variable
   4241 ~org-todo-keyword-faces~.  For example:
   4242 
   4243 #+begin_src emacs-lisp
   4244 (setq org-todo-keyword-faces
   4245       '(("TODO" . org-warning) ("STARTED" . "yellow")
   4246         ("CANCELED" . (:foreground "blue" :weight bold))))
   4247 #+end_src
   4248 
   4249 #+vindex: org-faces-easy-properties
   4250 While using a list with face properties as shown for =CANCELED=
   4251 /should/ work, this does not always seem to be the case.  If
   4252 necessary, define a special face and use that.  A string is
   4253 interpreted as a color.  The variable ~org-faces-easy-properties~
   4254 determines if that color is interpreted as a foreground or
   4255 a background color.
   4256 
   4257 *** TODO dependencies
   4258 :PROPERTIES:
   4259 :DESCRIPTION: When one task needs to wait for others.
   4260 :END:
   4261 #+cindex: TODO dependencies
   4262 #+cindex: dependencies, of TODO states
   4263 
   4264 #+vindex: org-enforce-todo-dependencies
   4265 #+cindex: @samp{ORDERED}, property
   4266 The structure of Org files---hierarchy and lists---makes it easy to
   4267 define TODO dependencies.  Usually, a parent TODO task should not be
   4268 marked as done until all TODO subtasks, or children tasks, are marked
   4269 as done.  Sometimes there is a logical sequence to (sub)tasks, so that
   4270 one subtask cannot be acted upon before all siblings above it have
   4271 been marked as done.  If you customize the variable
   4272 ~org-enforce-todo-dependencies~, Org blocks entries from changing
   4273 state to DONE while they have TODO children that are not DONE.
   4274 Furthermore, if an entry has a property =ORDERED=, each of its TODO
   4275 children is blocked until all earlier siblings are marked as done.
   4276 Here is an example:
   4277 
   4278 #+begin_example
   4279 ,* TODO Blocked until (two) is done
   4280 ,** DONE one
   4281 ,** TODO two
   4282 
   4283 ,* Parent
   4284 :PROPERTIES:
   4285 :ORDERED:  t
   4286 :END:
   4287 ,** TODO a
   4288 ,** TODO b, needs to wait for (a)
   4289 ,** TODO c, needs to wait for (a) and (b)
   4290 #+end_example
   4291 
   4292 #+cindex: TODO dependencies, @samp{NOBLOCKING}
   4293 #+cindex: @samp{NOBLOCKING}, property
   4294 You can ensure an entry is never blocked by using the =NOBLOCKING=
   4295 property (see [[*Properties and Columns]]):
   4296 
   4297 #+begin_example
   4298 ,* This entry is never blocked
   4299 :PROPERTIES:
   4300 :NOBLOCKING: t
   4301 :END:
   4302 #+end_example
   4303 
   4304 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
   4305 
   4306   #+kindex: C-c C-x o
   4307   #+findex: org-toggle-ordered-property
   4308   #+vindex: org-track-ordered-property-with-tag
   4309   Toggle the =ORDERED= property of the current entry.  A property is
   4310   used for this behavior because this should be local to the current
   4311   entry, not inherited from entries above like a tag (see [[*Tags]]).
   4312   However, if you would like to /track/ the value of this property
   4313   with a tag for better visibility, customize the variable
   4314   ~org-track-ordered-property-with-tag~.
   4315 
   4316 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
   4317 
   4318   #+kindex: C-u C-u C-u C-u C-c C-t
   4319   Change TODO state, regardless of any state blocking.
   4320 
   4321 #+vindex: org-agenda-dim-blocked-tasks
   4322 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
   4323 that cannot be marked as done because of unmarked children are shown
   4324 in a dimmed font or even made invisible in agenda views (see [[*Agenda
   4325 Views]]).
   4326 
   4327 #+cindex: checkboxes and TODO dependencies
   4328 #+vindex: org-enforce-todo-dependencies
   4329 You can also block changes of TODO states by using checkboxes (see
   4330 [[*Checkboxes]]).  If you set the variable
   4331 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
   4332 checkboxes is blocked from switching to DONE.
   4333 
   4334 If you need more complex dependency structures, for example
   4335 dependencies between entries in different trees or files, check out
   4336 the module =org-depend.el= in the =org-contrib= repository.
   4337 
   4338 ** Progress Logging
   4339 :PROPERTIES:
   4340 :DESCRIPTION: Dates and notes for progress.
   4341 :END:
   4342 #+cindex: progress logging
   4343 #+cindex: logging, of progress
   4344 
   4345 To record a timestamp and a note when changing a TODO state, call the
   4346 command ~org-todo~ with a prefix argument.
   4347 
   4348 - {{{kbd(C-u C-c C-t)}}} (~org-todo~) ::
   4349 
   4350   #+kindex: C-u C-c C-t
   4351   Prompt for a note and record a the time of the TODO state change.
   4352   The note is inserted as a list item below the headline, but can also
   4353   be placed into a drawer, see [[*Tracking TODO state changes]].
   4354 
   4355 If you want to be more systematic, Org mode can automatically record a
   4356 timestamp and optionally a note when you mark a TODO item as DONE, or
   4357 even each time you change the state of a TODO item.  This system is
   4358 highly configurable, settings can be on a per-keyword basis and can be
   4359 localized to a file or even a subtree.  For information on how to
   4360 clock working time for a task, see [[*Clocking Work Time]].
   4361 
   4362 *** Closing items
   4363 :PROPERTIES:
   4364 :DESCRIPTION: When was this entry marked as done?
   4365 :END:
   4366 
   4367 The most basic automatic logging is to keep track of /when/ a certain
   4368 TODO item was marked as done.  This can be achieved with[fn:: The
   4369 corresponding in-buffer setting is: =#+STARTUP: logdone=.]
   4370 
   4371 #+begin_src emacs-lisp
   4372 (setq org-log-done 'time)
   4373 #+end_src
   4374 
   4375 #+vindex: org-closed-keep-when-no-todo
   4376 #+texinfo: @noindent
   4377 Then each time you turn an entry from a TODO (not-done) state into any
   4378 of the DONE states, a line =CLOSED: [timestamp]= is inserted just
   4379 after the headline.  If you turn the entry back into a TODO item
   4380 through further state cycling, that line is removed again.  If you
   4381 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t
   4382 SPC)}}} for example), that line is also removed, unless you set
   4383 ~org-closed-keep-when-no-todo~ to non-~nil~.  If you want to record a
   4384 note along with the timestamp, use[fn:: The corresponding in-buffer
   4385 setting is: =#+STARTUP: lognotedone=.]
   4386 
   4387 #+begin_src emacs-lisp
   4388 (setq org-log-done 'note)
   4389 #+end_src
   4390 
   4391 #+texinfo: @noindent
   4392 You are then prompted for a note, and that note is stored below the
   4393 entry with a =Closing Note= heading.
   4394 
   4395 *** Tracking TODO state changes
   4396 :PROPERTIES:
   4397 :DESCRIPTION: When did the status change?
   4398 :END:
   4399 #+cindex: drawer, for state change recording
   4400 
   4401 #+vindex: org-log-states-order-reversed
   4402 #+vindex: org-log-into-drawer
   4403 #+cindex: @samp{LOG_INTO_DRAWER}, property
   4404 You might want to automatically keep track of when a state change
   4405 occurred and maybe take a note about this change.  You can either
   4406 record just a timestamp, or a time-stamped note.  These records are
   4407 inserted after the headline as an itemized list, newest first[fn:: See
   4408 the variable ~org-log-states-order-reversed~.].  When taking a lot of
   4409 notes, you might want to get the notes out of the way into a drawer
   4410 (see [[*Drawers]]).  Customize the variable ~org-log-into-drawer~ to
   4411 get this behavior---the recommended drawer for this is called
   4412 =LOGBOOK=[fn:: Note that the =LOGBOOK= drawer is unfolded when
   4413 pressing {{{kbd(SPC)}}} in the agenda to show an entry---use
   4414 {{{kbd(C-u SPC)}}} to keep it folded here.].  You can also overrule
   4415 the setting of this variable for a subtree by setting a
   4416 =LOG_INTO_DRAWER= property.
   4417 
   4418 Since it is normally too much to record a note for every state, Org
   4419 mode expects configuration on a per-keyword basis for this.  This is
   4420 achieved by adding special markers =!= (for a timestamp) or =@= (for
   4421 a note with timestamp) in parentheses after each keyword.  For
   4422 example, with the setting
   4423 
   4424 #+begin_src emacs-lisp
   4425 (setq org-todo-keywords
   4426       '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
   4427 #+end_src
   4428 
   4429 #+vindex: org-log-done
   4430 You not only define global TODO keywords and fast access keys, but
   4431 also request that a time is recorded when the entry is set to =DONE=,
   4432 and that a note is recorded when switching to =WAIT= or
   4433 =CANCELED=[fn:15].  The setting for =WAIT= is even more special: the
   4434 =!= after the slash means that in addition to the note taken when
   4435 entering the state, a timestamp should be recorded when /leaving/ the
   4436 =WAIT= state, if and only if the /target/ state does not configure
   4437 logging for entering it.  So it has no effect when switching from
   4438 =WAIT= to =DONE=, because =DONE= is configured to record a timestamp
   4439 only.  But when switching from =WAIT= back to =TODO=, the =/!= in the
   4440 =WAIT= setting now triggers a timestamp even though =TODO= has no
   4441 logging configured.
   4442 
   4443 You can use the exact same syntax for setting logging preferences local
   4444 to a buffer:
   4445 
   4446 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
   4447 
   4448 To record a timestamp without a note for TODO keywords configured with
   4449 =@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted.
   4450 
   4451 #+cindex: @samp{LOGGING}, property
   4452 In order to define logging settings that are local to a subtree or
   4453 a single item, define a =LOGGING= property in this entry.  Any
   4454 non-empty =LOGGING= property resets all logging settings to ~nil~.
   4455 You may then turn on logging for this specific tree using =STARTUP=
   4456 keywords like =lognotedone= or =logrepeat=, as well as adding state
   4457 specific settings like =TODO(!)=.  For example:
   4458 
   4459 #+begin_example
   4460 ,* TODO Log each state with only a time
   4461   :PROPERTIES:
   4462   :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
   4463   :END:
   4464 ,* TODO Only log when switching to WAIT, and when repeating
   4465   :PROPERTIES:
   4466   :LOGGING: WAIT(@) logrepeat
   4467   :END:
   4468 ,* TODO No logging at all
   4469   :PROPERTIES:
   4470   :LOGGING: nil
   4471   :END:
   4472 #+end_example
   4473 
   4474 *** Tracking your habits
   4475 :PROPERTIES:
   4476 :DESCRIPTION: How consistent have you been?
   4477 :END:
   4478 #+cindex: habits
   4479 #+cindex: @samp{STYLE}, property
   4480 
   4481 Org has the ability to track the consistency of a special category of
   4482 TODO, called "habits."  To use habits, you have to enable the ~habit~
   4483 module by customizing the variable ~org-modules~.
   4484 
   4485 A habit has the following properties:
   4486 
   4487 1. The habit is a TODO item, with a TODO keyword representing an open
   4488    state.
   4489 
   4490 2. The property =STYLE= is set to the value =habit= (see [[*Properties
   4491    and Columns]]).
   4492 
   4493 3. The TODO has a scheduled date, usually with a =.+= style repeat
   4494    interval.  A =++= style may be appropriate for habits with time
   4495    constraints, e.g., must be done on specific days of week (=++1w=),
   4496    or a =+= style for an unusual habit that can have a backlog, e.g.,
   4497    weekly reports.  See [[*Repeated tasks]] for more details about repeat
   4498    intervals.
   4499 
   4500 4. The TODO may also have minimum and maximum ranges specified by
   4501    using the syntax =.+2d/3d=, which says that you want to do the task
   4502    at least every three days, but at most every two days.
   4503 
   4504 5. State logging for the DONE state is enabled (see [[*Tracking TODO
   4505    state changes]]), in order for historical data to be represented in
   4506    the consistency graph.  If it is not enabled it is not an error,
   4507    but the consistency graphs are largely meaningless.
   4508 
   4509 To give you an idea of what the above rules look like in action, here's an
   4510 actual habit with some history:
   4511 
   4512 #+begin_example
   4513 ,** TODO Shave
   4514    SCHEDULED: <2009-10-17 Sat .+2d/4d>
   4515    :PROPERTIES:
   4516    :STYLE:    habit
   4517    :LAST_REPEAT: [2009-10-19 Mon 00:36]
   4518    :END:
   4519    - State "DONE"       from "TODO"       [2009-10-15 Thu]
   4520    - State "DONE"       from "TODO"       [2009-10-12 Mon]
   4521    - State "DONE"       from "TODO"       [2009-10-10 Sat]
   4522    - State "DONE"       from "TODO"       [2009-10-04 Sun]
   4523    - State "DONE"       from "TODO"       [2009-10-02 Fri]
   4524    - State "DONE"       from "TODO"       [2009-09-29 Tue]
   4525    - State "DONE"       from "TODO"       [2009-09-25 Fri]
   4526    - State "DONE"       from "TODO"       [2009-09-19 Sat]
   4527    - State "DONE"       from "TODO"       [2009-09-16 Wed]
   4528    - State "DONE"       from "TODO"       [2009-09-12 Sat]
   4529 #+end_example
   4530 
   4531 What this habit says is: I want to shave at most every 2 days---given
   4532 by the =SCHEDULED= date and repeat interval---and at least every
   4533 4 days.  If today is the 15th, then the habit first appears in the
   4534 agenda (see [[*Agenda Views]]) on Oct 17, after the minimum of 2 days has
   4535 elapsed, and will appear overdue on Oct 19, after four days have
   4536 elapsed.
   4537 
   4538 What's really useful about habits is that they are displayed along
   4539 with a consistency graph, to show how consistent you've been at
   4540 getting that task done in the past.  This graph shows every day that
   4541 the task was done over the past three weeks, with colors for each day.
   4542 The colors used are:
   4543 
   4544 - Blue :: If the task was not to be done yet on that day.
   4545 - Green :: If the task could have been done on that day.
   4546 - Yellow :: If the task was going to be overdue the next day.
   4547 - Red :: If the task was overdue on that day.
   4548 
   4549 In addition to coloring each day, the day is also marked with an
   4550 asterisk if the task was actually done that day, and an exclamation
   4551 mark to show where the current day falls in the graph.
   4552 
   4553 There are several configuration variables that can be used to change
   4554 the way habits are displayed in the agenda.
   4555 
   4556 - ~org-habit-graph-column~ ::
   4557 
   4558   #+vindex: org-habit-graph-column
   4559   The buffer column at which the consistency graph should be drawn.
   4560   This overwrites any text in that column, so it is a good idea to
   4561   keep your habits' titles brief and to the point.
   4562 
   4563 - ~org-habit-preceding-days~ ::
   4564 
   4565   #+vindex: org-habit-preceding-days
   4566   The amount of history, in days before today, to appear in
   4567   consistency graphs.
   4568 
   4569 - ~org-habit-following-days~ ::
   4570 
   4571   #+vindex: org-habit-following-days
   4572   The number of days after today that appear in consistency graphs.
   4573 
   4574 - ~org-habit-show-habits-only-for-today~ ::
   4575 
   4576   #+vindex: org-habit-show-habits-only-for-today
   4577   If non-~nil~, only show habits in today's agenda view.  The default
   4578   value is ~t~.  Pressing {{{kbd(C-u K)}}} in the agenda toggles this
   4579   variable.
   4580 
   4581 Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to
   4582 temporarily be disabled and do not appear at all.  Press {{{kbd(K)}}}
   4583 again to bring them back.  They are also subject to tag filtering, if
   4584 you have habits which should only be done in certain contexts, for
   4585 example.
   4586 
   4587 ** Priorities
   4588 :PROPERTIES:
   4589 :DESCRIPTION: Some things are more important than others.
   4590 :END:
   4591 #+cindex: priorities
   4592 #+cindex: priority cookie
   4593 
   4594 If you use Org mode extensively, you may end up with enough TODO items
   4595 that it starts to make sense to prioritize them.  Prioritizing can be
   4596 done by placing a /priority cookie/ into the headline of a TODO item
   4597 right after the TODO keyword, like this:
   4598 
   4599 : *** TODO [#A] Write letter to Sam Fortune
   4600 
   4601 #+vindex: org-priority-faces
   4602 By default, Org mode supports three priorities: =A=, =B=, and =C=.
   4603 =A= is the highest priority.  An entry without a cookie is treated as
   4604 equivalent if it had priority =B=.  Priorities make a difference only
   4605 for sorting in the agenda (see [[*Weekly/daily agenda]]).  Outside the
   4606 agenda, they have no inherent meaning to Org mode.  The cookies are
   4607 displayed with the face defined by the variable ~org-priority-faces~,
   4608 which can be customized.
   4609 
   4610 You can also use numeric values for priorities, such as
   4611 
   4612 : *** TODO [#1] Write letter to Sam Fortune
   4613 
   4614 When using numeric priorities, you need to set ~org-priority-highest~,
   4615 ~org-priority-lowest~ and ~org-priority-default~ to integers, which
   4616 must all be strictly inferior to 65.
   4617 
   4618 Priorities can be attached to any outline node; they do not need to be
   4619 TODO items.
   4620 
   4621 #+attr_texinfo: :sep ;
   4622 - {{{kbd(C-c \,)}}} (~org-priority~) ::
   4623 
   4624   #+kindex: C-c ,
   4625   #+findex: org-priority
   4626   Set the priority of the current headline.  The command prompts for
   4627   a priority character =A=, =B= or =C=.  When you press {{{kbd(SPC)}}}
   4628   instead, the priority cookie, if one is set, is removed from the
   4629   headline.  The priorities can also be changed "remotely" from the
   4630   agenda buffer with the {{{kbd(\,)}}} command (see [[*Commands in the
   4631   Agenda Buffer]]).
   4632 
   4633 - {{{kbd(S-UP)}}} (~org-priority-up~); {{{kbd(S-DOWN)}}} (~org-priority-down~) ::
   4634 
   4635   #+kindex: S-UP
   4636   #+kindex: S-DOWN
   4637   #+findex: org-priority-up
   4638   #+findex: org-priority-down
   4639   #+vindex: org-priority-start-cycle-with-default
   4640   Increase/decrease the priority of the current headline[fn:: See also
   4641   the option ~org-priority-start-cycle-with-default~.].  Note that
   4642   these keys are also used to modify timestamps (see [[*Creating
   4643   Timestamps]]).  See also [[*Packages that conflict with Org mode]],
   4644   for a discussion of the interaction with shift-selection.
   4645 
   4646 #+vindex: org-priority-highest
   4647 #+vindex: org-priority-lowest
   4648 #+vindex: org-priority-default
   4649 You can change the range of allowed priorities by setting the
   4650 variables ~org-priority-highest~, ~org-priority-lowest~, and
   4651 ~org-priority-default~.  For an individual buffer, you may set these
   4652 values (highest, lowest, default) like this (please make sure that the
   4653 highest priority is earlier in the alphabet than the lowest priority):
   4654 
   4655 #+cindex: @samp{PRIORITIES}, keyword
   4656 : #+PRIORITIES: A C B
   4657 
   4658 Or, using numeric values:
   4659 
   4660 : #+PRIORITIES: 1 10 5
   4661 
   4662 ** Breaking Down Tasks into Subtasks
   4663 :PROPERTIES:
   4664 :DESCRIPTION: Splitting a task into manageable pieces.
   4665 :ALT_TITLE: Breaking Down Tasks
   4666 :END:
   4667 #+cindex: tasks, breaking down
   4668 #+cindex: statistics, for TODO items
   4669 
   4670 #+vindex: org-agenda-todo-list-sublevels
   4671 It is often advisable to break down large tasks into smaller,
   4672 manageable subtasks.  You can do this by creating an outline tree
   4673 below a TODO item, with detailed subtasks on the tree[fn:: To keep
   4674 subtasks out of the global TODO list, see the option
   4675 ~org-agenda-todo-list-sublevels~.].  To keep an overview of the
   4676 fraction of subtasks that have already been marked as done, insert
   4677 either =[/]= or =[%]= anywhere in the headline.  These cookies are
   4678 updated each time the TODO status of a child changes, or when pressing
   4679 {{{kbd(C-c C-c)}}} on the cookie.  For example:
   4680 
   4681 #+begin_example
   4682 ,* Organize Party [33%]
   4683 ,** TODO Call people [1/2]
   4684 ,*** TODO Peter
   4685 ,*** DONE Sarah
   4686 ,** TODO Buy food
   4687 ,** DONE Talk to neighbor
   4688 #+end_example
   4689 
   4690 #+cindex: @samp{COOKIE_DATA}, property
   4691 If a heading has both checkboxes and TODO children below it, the
   4692 meaning of the statistics cookie become ambiguous.  Set the property
   4693 =COOKIE_DATA= to either =checkbox= or =todo= to resolve this issue.
   4694 
   4695 #+vindex: org-hierarchical-todo-statistics
   4696 If you would like to have the statistics cookie count any TODO entries
   4697 in the subtree (not just direct children), configure the variable
   4698 ~org-hierarchical-todo-statistics~.  To do this for a single subtree,
   4699 include the word =recursive= into the value of the =COOKIE_DATA=
   4700 property.
   4701 
   4702 #+begin_example
   4703 ,* Parent capturing statistics [2/20]
   4704   :PROPERTIES:
   4705   :COOKIE_DATA: todo recursive
   4706   :END:
   4707 #+end_example
   4708 
   4709 If you would like a TODO entry to automatically change to DONE when
   4710 all children are done, you can use the following setup:
   4711 
   4712 #+begin_src emacs-lisp
   4713 (defun org-summary-todo (n-done n-not-done)
   4714   "Switch entry to DONE when all subentries are done, to TODO otherwise."
   4715   (let (org-log-done org-todo-log-states)   ; turn off logging
   4716     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
   4717 
   4718 (add-hook 'org-after-todo-statistics-hook #'org-summary-todo)
   4719 #+end_src
   4720 
   4721 Another possibility is the use of checkboxes to identify (a hierarchy
   4722 of) a large number of subtasks (see [[*Checkboxes]]).
   4723 
   4724 ** Checkboxes
   4725 :PROPERTIES:
   4726 :DESCRIPTION: Tick-off lists.
   4727 :END:
   4728 #+cindex: checkboxes
   4729 
   4730 #+vindex: org-list-automatic-rules
   4731 Every item in a plain list[fn:16] (see [[*Plain Lists]]) can be made into
   4732 a checkbox by starting it with the string =[ ]=.  This feature is
   4733 similar to TODO items (see [[*TODO Items]]), but is more lightweight.
   4734 Checkboxes are not included into the global TODO list, so they are
   4735 often great to split a task into a number of simple steps.  Or you can
   4736 use them in a shopping list.
   4737 
   4738 Here is an example of a checkbox list.
   4739 
   4740 #+begin_example
   4741 ,* TODO Organize party [2/4]
   4742   - [-] call people [1/3]
   4743     - [ ] Peter
   4744     - [X] Sarah
   4745     - [ ] Sam
   4746   - [X] order food
   4747   - [ ] think about what music to play
   4748   - [X] talk to the neighbors
   4749 #+end_example
   4750 
   4751 #+cindex: statistics, for checkboxes
   4752 #+cindex: checkbox statistics
   4753 #+cindex: @samp{COOKIE_DATA}, property
   4754 #+vindex: org-checkbox-hierarchical-statistics
   4755 The =[2/4]= and =[1/3]= in the first and second line are cookies
   4756 indicating how many checkboxes present in this entry have been checked
   4757 off, and the total number of checkboxes present.  This can give you an
   4758 idea on how many checkboxes remain, even without opening a folded
   4759 entry.  The cookies can be placed into a headline or into (the first
   4760 line of) a plain list item.  Each cookie covers checkboxes of direct
   4761 children structurally below the headline/item on which the cookie
   4762 appears[fn:: Set the variable ~org-checkbox-hierarchical-statistics~
   4763 if you want such cookies to count all checkboxes below the cookie, not
   4764 just those belonging to direct children.].  You have to insert the
   4765 cookie yourself by typing either =[/]= or =[%]=.  With =[/]= you get
   4766 an =n out of m= result, as in the examples above.  With =[%]= you get
   4767 information about the percentage of checkboxes checked (in the above
   4768 example, this would be =[50%]= and =[33%]=, respectively).  In a
   4769 headline, a cookie can count either checkboxes below the heading or
   4770 TODO states of children, and it displays whatever was changed last.
   4771 Set the property =COOKIE_DATA= to either =checkbox= or =todo= to
   4772 resolve this issue.
   4773 
   4774 #+cindex: blocking, of checkboxes
   4775 #+cindex: checkbox blocking
   4776 #+cindex: @samp{ORDERED}, property
   4777 If the current outline node has an =ORDERED= property, checkboxes must
   4778 be checked off in sequence, and an error is thrown if you try to check
   4779 off a box while there are unchecked boxes above it.
   4780 
   4781 A checkbox can be in one of the three states:
   4782 1. not checked =[ ]=
   4783 2. partially checked =[-]=
   4784 3. checked =[X]=
   4785 
   4786 Checkboxes work hierarchically, so if a checkbox item has children
   4787 that are checkboxes, toggling one of the children checkboxes makes the
   4788 parent checkbox reflect if none, some, or all of the children are
   4789 checked.
   4790 
   4791 If all child checkboxes are not checked, the parent checkbox is also not checked.
   4792 #+begin_example
   4793 - [ ] call people
   4794   - [ ] Peter
   4795   - [ ] Sarah
   4796 #+end_example
   4797 
   4798 If some but not all child checkboxes are checked, the parent checkbox is partially checked.
   4799 #+begin_example
   4800 - [-] call people
   4801   - [X] Peter
   4802   - [ ] Sarah
   4803 #+end_example
   4804 
   4805 If all child checkboxes are checked, the parent checkbox is also checked.
   4806 #+begin_example
   4807 - [X] call people
   4808   - [X] Peter
   4809   - [X] Sarah
   4810 #+end_example
   4811 
   4812 The following commands work with checkboxes:
   4813 
   4814 - {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
   4815 
   4816   #+kindex: C-c C-c
   4817   #+findex: org-toggle-checkbox
   4818   Toggle checkbox status or---with prefix argument---checkbox presence
   4819   at point.  With a single prefix argument, add an empty checkbox or
   4820   remove the current one[fn:: {{{kbd(C-u C-c C-c)}}} on the /first/
   4821   item of a list with no checkbox adds checkboxes to the rest of the
   4822   list.].  With a double prefix argument, set it to =[-]=, which is
   4823   considered to be an intermediate state.
   4824 
   4825 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
   4826 
   4827   #+kindex: C-c C-x C-b
   4828   Toggle checkbox status or---with prefix argument---checkbox presence
   4829   at point.  With double prefix argument, set it to =[-]=, which is
   4830   considered to be an intermediate state.
   4831 
   4832   - If there is an active region, toggle the first checkbox in the
   4833     region and set all remaining boxes to the same status as the
   4834     first.  With a prefix argument, add or remove the checkbox for all
   4835     items in the region.
   4836 
   4837   - If point is in a headline, toggle checkboxes in the region between
   4838     this headline and the next---so /not/ the entire subtree.
   4839 
   4840   - If there is no active region, just toggle the checkbox at point.
   4841 
   4842 - {{{kbd(C-c C-x C-r)}}} (~org-toggle-radio-button~) ::
   4843 
   4844   #+kindex: C-c C-x C-r
   4845   #+findex: org-toggle-radio-button
   4846   #+cindex: radio button, checkbox as
   4847   Toggle checkbox status by using the checkbox of the item at point as
   4848   a radio button: when the checkbox is turned on, all other checkboxes
   4849   on the same level will be turned off.  With a universal prefix
   4850   argument, toggle the presence of the checkbox.  With a double prefix
   4851   argument, set it to =[-]=.
   4852 
   4853   #+findex: org-list-checkbox-radio-mode
   4854   {{{kbd(C-c C-c)}}} can be told to consider checkboxes as radio buttons by
   4855   setting =#+ATTR_ORG: :radio t= right before the list or by calling
   4856   {{{kbd(M-x org-list-checkbox-radio-mode)}}} to activate this minor mode.
   4857 
   4858 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
   4859 
   4860   #+kindex: M-S-RET
   4861   #+findex: org-insert-todo-heading
   4862   Insert a new item with a checkbox.  This works only if point is
   4863   already in a plain list item (see [[*Plain Lists]]).
   4864 
   4865 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
   4866 
   4867   #+kindex: C-c C-x o
   4868   #+findex: org-toggle-ordered-property
   4869   #+vindex: org-track-ordered-property-with-tag
   4870   Toggle the =ORDERED= property of the entry, to toggle if checkboxes
   4871   must be checked off in sequence.  A property is used for this
   4872   behavior because this should be local to the current entry, not
   4873   inherited like a tag.  However, if you would like to /track/ the
   4874   value of this property with a tag for better visibility, customize
   4875   ~org-track-ordered-property-with-tag~.
   4876 
   4877 - {{{kbd(C-c #)}}} (~org-update-statistics-cookies~) ::
   4878 
   4879   #+kindex: C-c #
   4880   #+findex: org-update-statistics-cookies
   4881   Update the statistics cookie in the current outline entry.  When
   4882   called with a {{{kbd(C-u)}}} prefix, update the entire file.
   4883   Checkbox statistic cookies are updated automatically if you toggle
   4884   checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
   4885   {{{kbd(M-S-RET)}}}.  TODO statistics cookies update when changing
   4886   TODO states.  If you delete boxes/entries or add/change them by
   4887   hand, use this command to get things back into sync.
   4888 
   4889 * Tags
   4890 :PROPERTIES:
   4891 :DESCRIPTION: Tagging headlines and matching sets of tags.
   4892 :END:
   4893 #+cindex: tags
   4894 #+cindex: headline tagging
   4895 #+cindex: matching, tags
   4896 #+cindex: sparse tree, tag based
   4897 
   4898 An excellent way to implement labels and contexts for
   4899 cross-correlating information is to assign /tags/ to headlines.  Org
   4900 mode has extensive support for tags.
   4901 
   4902 #+vindex: org-tag-faces
   4903 Every headline can contain a list of tags; they occur at the end of
   4904 the headline.  Tags are normal words containing letters, numbers, =_=,
   4905 and =@=.  Tags must be preceded and followed by a single colon, e.g.,
   4906 =:work:=.  Several tags can be specified, as in =:work:urgent:=.  Tags
   4907 by default are in bold face with the same color as the headline.  You
   4908 may specify special faces for specific tags using the variable
   4909 ~org-tag-faces~, in much the same way as you can for TODO keywords
   4910 (see [[*Faces for TODO keywords]]).
   4911 
   4912 ** Tag Inheritance
   4913 :PROPERTIES:
   4914 :DESCRIPTION: Tags use the tree structure of an outline.
   4915 :END:
   4916 #+cindex: tag inheritance
   4917 #+cindex: inheritance, of tags
   4918 #+cindex: sublevels, inclusion into tags match
   4919 
   4920 /Tags/ make use of the hierarchical structure of outline trees.  If
   4921 a heading has a certain tag, all subheadings inherit the tag as well.
   4922 For example, in the list
   4923 
   4924 #+begin_example
   4925 ,* Meeting with the French group      :work:
   4926 ,** Summary by Frank                  :boss:notes:
   4927 ,*** TODO Prepare slides for him      :action:
   4928 #+end_example
   4929 
   4930 #+texinfo: @noindent
   4931 the final heading has the tags =work=, =boss=, =notes=, and =action=
   4932 even though the final heading is not explicitly marked with those
   4933 tags.  You can also set tags that all entries in a file should inherit
   4934 just as if these tags were defined in a hypothetical level zero that
   4935 surrounds the entire file.  Use a line like this[fn:: As with all
   4936 these in-buffer settings, pressing {{{kbd(C-c C-c)}}} activates any
   4937 changes in the line.]
   4938 
   4939 #+cindex: @samp{FILETAGS}, keyword
   4940 : #+FILETAGS: :Peter:Boss:Secret:
   4941 
   4942 #+vindex: org-use-tag-inheritance
   4943 #+vindex: org-tags-exclude-from-inheritance
   4944 To limit tag inheritance to specific tags, or to turn it off entirely,
   4945 use the variables ~org-use-tag-inheritance~ and
   4946 ~org-tags-exclude-from-inheritance~.
   4947 
   4948 #+vindex: org-agenda-use-tag-inheritance
   4949 Tag inheritance is relevant when the agenda search tries to match
   4950 a tag, either in the ~tags~ or ~tags-todo~ agenda types.  In other
   4951 agenda types, ~org-use-tag-inheritance~ has no effect.  Still, you may
   4952 want to have your tags correctly set in the agenda, so that tag
   4953 filtering works fine, with inherited tags.  Set
   4954 ~org-agenda-use-tag-inheritance~ to control this: the default value
   4955 includes all agenda types, but setting this to ~nil~ can really speed
   4956 up agenda generation.
   4957 
   4958 ** Setting Tags
   4959 :PROPERTIES:
   4960 :DESCRIPTION: How to assign tags to a headline.
   4961 :END:
   4962 #+cindex: setting tags
   4963 #+cindex: tags, setting
   4964 
   4965 #+kindex: M-TAB
   4966 Tags can simply be typed into the buffer at the end of a headline.
   4967 After a colon, {{{kbd(M-TAB)}}} offers completion on tags.  There is
   4968 also a special command for inserting tags:
   4969 
   4970 - {{{kbd(C-c C-q)}}} (~org-set-tags-command~) ::
   4971 
   4972   #+kindex: C-c C-q
   4973   #+findex: org-set-tags-command
   4974   #+cindex: completion, of tags
   4975   #+vindex: org-tags-column
   4976   Enter new tags for the current headline.  Org mode either offers
   4977   completion or a special single-key interface for setting tags, see
   4978   below.  After pressing {{{kbd(RET)}}}, the tags are inserted and
   4979   aligned to ~org-tags-column~.  When called with a {{{kbd(C-u)}}}
   4980   prefix, all tags in the current buffer are aligned to that column,
   4981   just to make things look nice.  Tags are automatically realigned
   4982   after promotion, demotion, and TODO state changes (see [[*Basic TODO
   4983   Functionality]]).
   4984 
   4985 - {{{kbd(C-c C-c)}}} (~org-set-tags-command~) ::
   4986 
   4987   #+kindex: C-c C-c
   4988   When point is in a headline, this does the same as {{{kbd(C-c
   4989   C-q)}}}.
   4990 
   4991 #+vindex: org-complete-tags-always-offer-all-agenda-tags
   4992 #+vindex: org-tag-alist
   4993 #+cindex: @samp{TAGS}, keyword
   4994 Org supports tag insertion based on a /list of tags/.  By default this
   4995 list is constructed dynamically, containing all tags currently used in
   4996 the buffer[fn:: To extend this default list to all tags used in all
   4997 agenda files (see [[*Agenda Views]]), customize the variable
   4998 ~org-complete-tags-always-offer-all-agenda-tags~.].  You may also
   4999 globally specify a hard list of tags with the variable
   5000 ~org-tag-alist~.  Finally you can set the default tags for a given
   5001 file using the =TAGS= keyword, like
   5002 
   5003 #+begin_example
   5004 ,#+TAGS: @work @home @tennisclub
   5005 ,#+TAGS: laptop car pc sailboat
   5006 #+end_example
   5007 
   5008 If you have globally defined your preferred set of tags using the
   5009 variable ~org-tag-alist~, but would like to use a dynamic tag list in
   5010 a specific file, add an empty =TAGS= keyword to that file:
   5011 
   5012 : #+TAGS:
   5013 
   5014 #+vindex: org-tag-persistent-alist
   5015 If you have a preferred set of tags that you would like to use in
   5016 every file, in addition to those defined on a per-file basis by =TAGS=
   5017 keyword, then you may specify a list of tags with the variable
   5018 ~org-tag-persistent-alist~.  You may turn this off on a per-file basis
   5019 by adding a =STARTUP= keyword to that file:
   5020 
   5021 : #+STARTUP: noptag
   5022 
   5023 By default Org mode uses the standard minibuffer completion facilities
   5024 for entering tags.  However, it also implements another, quicker, tag
   5025 selection method called /fast tag selection/.  This allows you to
   5026 select and deselect tags with just a single key press.  For this to
   5027 work well you should assign unique letters to most of your commonly
   5028 used tags.  You can do this globally by configuring the variable
   5029 ~org-tag-alist~ in your Emacs init file.  For example, you may find
   5030 the need to tag many items in different files with =@home=.  In this
   5031 case you can set something like:
   5032 
   5033 #+begin_src emacs-lisp
   5034 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))
   5035 #+end_src
   5036 
   5037 If the tag is only relevant to the file you are working on, then you
   5038 can instead set the =TAGS= keyword as:
   5039 
   5040 : #+TAGS: @work(w)  @home(h)  @tennisclub(t)  laptop(l)  pc(p)
   5041 
   5042 The tags interface shows the available tags in a splash window.  If
   5043 you want to start a new line after a specific tag, insert =\n= into
   5044 the tag list
   5045 
   5046 : #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)
   5047 
   5048 #+texinfo: @noindent
   5049 or write them in two lines:
   5050 
   5051 #+begin_example
   5052 ,#+TAGS: @work(w)  @home(h)  @tennisclub(t)
   5053 ,#+TAGS: laptop(l)  pc(p)
   5054 #+end_example
   5055 
   5056 You can also group together tags that are mutually exclusive by using
   5057 braces, as in:
   5058 
   5059 : #+TAGS: { @work(w)  @home(h)  @tennisclub(t) }  laptop(l)  pc(p)
   5060 
   5061 #+texinfo: @noindent
   5062 you indicate that at most one of =@work=, =@home=, and =@tennisclub=
   5063 should be selected.  Multiple such groups are allowed.
   5064 
   5065 Do not forget to press {{{kbd(C-c C-c)}}} with point in one of these
   5066 lines to activate any changes.
   5067 
   5068 To set these mutually exclusive groups in the variable
   5069 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
   5070 ~:endgroup~ instead of the braces.  Similarly, you can use ~:newline~
   5071 to indicate a line break.  The previous example would be set globally
   5072 by the following configuration:
   5073 
   5074 #+begin_src emacs-lisp
   5075 (setq org-tag-alist '((:startgroup . nil)
   5076                       ("@work" . ?w) ("@home" . ?h)
   5077                       ("@tennisclub" . ?t)
   5078                       (:endgroup . nil)
   5079                       ("laptop" . ?l) ("pc" . ?p)))
   5080 #+end_src
   5081 
   5082 If at least one tag has a selection key then pressing {{{kbd(C-c
   5083 C-c)}}} automatically presents you with a special interface, listing
   5084 inherited tags, the tags of the current headline, and a list of all
   5085 valid tags with corresponding keys[fn:: Keys are automatically
   5086 assigned to tags that have no configured keys.].
   5087 
   5088 Pressing keys assigned to tags adds or removes them from the list of
   5089 tags in the current line.  Selecting a tag in a group of mutually
   5090 exclusive tags turns off any other tag from that group.
   5091 
   5092 In this interface, you can also use the following special keys:
   5093 
   5094 - {{{kbd(TAB)}}} ::
   5095 
   5096   #+kindex: TAB
   5097   Enter a tag in the minibuffer, even if the tag is not in the
   5098   predefined list.  You can complete on all tags present in the buffer
   5099   and globally pre-defined tags from ~org-tag-alist~ and
   5100   ~org-tag-persistent-alist~.  You can also add several tags: just
   5101   separate them with a comma.
   5102 
   5103 - {{{kbd(SPC)}}} ::
   5104 
   5105   #+kindex: SPC
   5106   Clear all tags for this line.
   5107 
   5108 - {{{kbd(RET)}}} ::
   5109 
   5110   #+kindex: RET
   5111   Accept the modified set.
   5112 
   5113 - {{{kbd(C-g)}}} ::
   5114 
   5115   #+kindex: C-g
   5116   Abort without installing changes.
   5117 
   5118 - {{{kbd(q)}}} ::
   5119 
   5120   #+kindex: q
   5121   If {{{kbd(q)}}} is not assigned to a tag, it aborts like
   5122   {{{kbd(C-g)}}}.
   5123 
   5124 - {{{kbd(!)}}} ::
   5125 
   5126   #+kindex: !
   5127   Turn off groups of mutually exclusive tags.  Use this to (as an
   5128   exception) assign several tags from such a group.
   5129 
   5130 - {{{kbd(C-c)}}} ::
   5131 
   5132   #+kindex: C-c C-c
   5133   Toggle auto-exit after the next change (see below).  If you are
   5134   using expert mode, the first {{{kbd(C-c)}}} displays the selection
   5135   window.
   5136 
   5137 This method lets you assign tags to a headline with very few keys.
   5138 With the above setup, you could clear the current tags and set
   5139 =@home=, =laptop= and =pc= tags with just the following keys:
   5140 {{{kbd(C-c C-c SPC h l p RET)}}}.  Switching from =@home= to =@work=
   5141 would be done with {{{kbd(C-c C-c w RET)}}} or alternatively with
   5142 {{{kbd(C-c C-c C-c w)}}}.  Adding the non-predefined tag =sarah= could
   5143 be done with {{{kbd(C-c C-c TAB s a r a h RET)}}}.
   5144 
   5145 #+vindex: org-fast-tag-selection-single-key
   5146 If you find that most of the time you need only a single key press to
   5147 modify your list of tags, set the variable
   5148 ~org-fast-tag-selection-single-key~.  Then you no longer have to press
   5149 {{{kbd(RET)}}} to exit fast tag selection---it exits after the first
   5150 change.  If you then occasionally need more keys, press {{{kbd(C-c)}}}
   5151 to turn off auto-exit for the current tag selection process (in
   5152 effect: start selection with {{{kbd(C-c C-c C-c)}}} instead of
   5153 {{{kbd(C-c C-c)}}}).  If you set the variable to the value ~expert~,
   5154 the special window is not even shown for single-key tag selection, it
   5155 comes up only when you press an extra {{{kbd(C-c)}}}.
   5156 
   5157 #+vindex: org-fast-tag-selection-maximum-tags
   5158 The number of tags displayed in the fast tag selection interface is
   5159 limited by ~org-fast-tag-selection-maximum-tags~ to avoid running out
   5160 of keyboard keys.  You can customize this variable.
   5161 
   5162 ** Tag Hierarchy
   5163 :PROPERTIES:
   5164 :DESCRIPTION: Create a hierarchy of tags.
   5165 :END:
   5166 #+cindex: group tags
   5167 #+cindex: tags, groups
   5168 #+cindex: tags hierarchy
   5169 
   5170 Tags can be defined in hierarchies.  A tag can be defined as a /group
   5171 tag/ for a set of other tags.  The group tag can be seen as the
   5172 "broader term" for its set of tags.  Defining multiple group tags and
   5173 nesting them creates a tag hierarchy.
   5174 
   5175 One use-case is to create a taxonomy of terms (tags) that can be used
   5176 to classify nodes in a document or set of documents.
   5177 
   5178 When you search for a group tag, it return matches for all members in
   5179 the group and its subgroups.  In an agenda view, filtering by a group
   5180 tag displays or hide headlines tagged with at least one of the members
   5181 of the group or any of its subgroups.  This makes tag searches and
   5182 filters even more flexible.
   5183 
   5184 You can set group tags by using brackets and inserting a colon between
   5185 the group tag and its related tags---beware that all whitespaces are
   5186 mandatory so that Org can parse this line correctly:
   5187 
   5188 : #+TAGS: [ GTD : Control Persp ]
   5189 
   5190 In this example, =GTD= is the group tag and it is related to two other
   5191 tags: =Control=, =Persp=.  Defining =Control= and =Persp= as group
   5192 tags creates a hierarchy of tags:
   5193 
   5194 #+begin_example
   5195 ,#+TAGS: [ Control : Context Task ]
   5196 ,#+TAGS: [ Persp : Vision Goal AOF Project ]
   5197 #+end_example
   5198 
   5199 That can conceptually be seen as a hierarchy of tags:
   5200 
   5201 - =GTD=
   5202   - =Persp=
   5203     - =Vision=
   5204     - =Goal=
   5205     - =AOF=
   5206     - =Project=
   5207   - =Control=
   5208     - =Context=
   5209     - =Task=
   5210 
   5211 You can use the ~:startgrouptag~, ~:grouptags~ and ~:endgrouptag~
   5212 keyword directly when setting ~org-tag-alist~ directly:
   5213 
   5214 #+begin_src emacs-lisp
   5215 (setq org-tag-alist '((:startgrouptag)
   5216                       ("GTD")
   5217                       (:grouptags)
   5218                       ("Control")
   5219                       ("Persp")
   5220                       (:endgrouptag)
   5221                       (:startgrouptag)
   5222                       ("Control")
   5223                       (:grouptags)
   5224                       ("Context")
   5225                       ("Task")
   5226                       (:endgrouptag)))
   5227 #+end_src
   5228 
   5229 The tags in a group can be mutually exclusive if using the same group
   5230 syntax as is used for grouping mutually exclusive tags together; using
   5231 curly brackets.
   5232 
   5233 : #+TAGS: { Context : @Home @Work @Call }
   5234 
   5235 When setting ~org-tag-alist~ you can use ~:startgroup~ and ~:endgroup~
   5236 instead of ~:startgrouptag~ and ~:endgrouptag~ to make the tags
   5237 mutually exclusive.
   5238 
   5239 Furthermore, the members of a group tag can also be regular
   5240 expressions, creating the possibility of a more dynamic and rule-based
   5241 tag structure (see [[*Regular Expressions]]).  The regular expressions in
   5242 the group must be specified within curly brackets.  Here is an
   5243 expanded example:
   5244 
   5245 #+begin_example
   5246 ,#+TAGS: [ Vision : {V@.+} ]
   5247 ,#+TAGS: [ Goal : {G@.+} ]
   5248 ,#+TAGS: [ AOF : {AOF@.+} ]
   5249 ,#+TAGS: [ Project : {P@.+} ]
   5250 #+end_example
   5251 
   5252 Searching for the tag =Project= now lists all tags also including
   5253 regular expression matches for =P@.+=, and similarly for tag searches
   5254 on =Vision=, =Goal= and =AOF=.  For example, this would work well for
   5255 a project tagged with a common project-identifier, e.g.,
   5256 =P@2014_OrgTags=.
   5257 
   5258 #+kindex: C-c C-x q
   5259 #+findex: org-toggle-tags-groups
   5260 #+vindex: org-group-tags
   5261 If you want to ignore group tags temporarily, toggle group tags
   5262 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}.
   5263 If you want to disable tag groups completely, set ~org-group-tags~ to
   5264 ~nil~.
   5265 
   5266 ** Tag Searches
   5267 :PROPERTIES:
   5268 :DESCRIPTION: Searching for combinations of tags.
   5269 :END:
   5270 #+cindex: tag searches
   5271 #+cindex: searching for tags
   5272 
   5273 Once a system of tags has been set up, it can be used to collect
   5274 related information into special lists.
   5275 
   5276 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
   5277 
   5278   #+kindex: C-c / m
   5279   #+kindex: C-c \
   5280   #+findex: org-match-sparse-tree
   5281   Create a sparse tree with all headlines matching a tags search.
   5282   With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
   5283   a TODO line.
   5284 
   5285 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
   5286 
   5287   #+kindex: m @r{(Agenda dispatcher)}
   5288   #+findex: org-tags-view
   5289   Create a global list of tag matches from all agenda files.  See
   5290   [[*Matching tags and properties]].
   5291 
   5292 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
   5293 
   5294   #+kindex: M @r{(Agenda dispatcher)}
   5295   Create a global list of tag matches from all agenda files, but check
   5296   only TODO items.
   5297 
   5298 These commands all prompt for a match string which allows basic
   5299 Boolean logic like =+boss+urgent-project1=, to find entries with tags
   5300 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find
   5301 entries which are tagged, like =Kathy= or =Sally=.  The full syntax of
   5302 the search string is rich and allows also matching against TODO
   5303 keywords, entry levels and properties.  For a complete description
   5304 with many examples, see [[*Matching tags and properties]].
   5305 
   5306 * Properties and Columns
   5307 :PROPERTIES:
   5308 :DESCRIPTION: Storing information about an entry.
   5309 :END:
   5310 #+cindex: properties
   5311 
   5312 A property is a key-value pair associated with an entry.  Properties
   5313 can be set so they are associated with a single entry, with every
   5314 entry in a tree, or with the whole buffer.
   5315 
   5316 There are two main applications for properties in Org mode.  First,
   5317 properties are like tags, but with a value.  Imagine maintaining
   5318 a file where you document bugs and plan releases for a piece of
   5319 software.  Instead of using tags like =release_1=, =release_2=, you
   5320 can use a property, say =Release=, that in different subtrees has
   5321 different values, such as =1.0= or =2.0=.  Second, you can use
   5322 properties to implement (very basic) database capabilities in an Org
   5323 buffer.  Imagine keeping track of your music CDs, where properties
   5324 could be things such as the album, artist, date of release, number of
   5325 tracks, and so on.
   5326 
   5327 Properties can be conveniently edited and viewed in column view (see
   5328 [[*Column View]]).
   5329 
   5330 ** Property Syntax
   5331 :PROPERTIES:
   5332 :DESCRIPTION: How properties are spelled out.
   5333 :END:
   5334 #+cindex: property syntax
   5335 #+cindex: drawer, for properties
   5336 
   5337 Properties are key--value pairs.  When they are associated with
   5338 a single entry or with a tree they need to be inserted into a special
   5339 drawer (see [[*Drawers]]) with the name =PROPERTIES=, which has to be
   5340 located right below a headline, and its planning line (see [[*Deadlines
   5341 and Scheduling]]) when applicable.  Each property is specified on
   5342 a single line, with the key---surrounded by colons---first, and the
   5343 value after it.  Keys are case-insensitive.  Here is an example:
   5344 
   5345 #+begin_example
   5346 ,* CD collection
   5347 ,** Classic
   5348 ,*** Goldberg Variations
   5349     :PROPERTIES:
   5350     :Title:     Goldberg Variations
   5351     :Composer:  J.S. Bach
   5352     :Artist:    Glenn Gould
   5353     :Publisher: Deutsche Grammophon
   5354     :NDisks:    1
   5355     :END:
   5356 #+end_example
   5357 
   5358 Depending on the value of ~org-use-property-inheritance~, a property
   5359 set this way is associated either with a single entry, or with the
   5360 subtree defined by the entry, see [[*Property Inheritance]].
   5361 
   5362 You may define the allowed values for a particular property =Xyz= by
   5363 setting a property =Xyz_ALL=.  This special property is /inherited/,
   5364 so if you set it in a level 1 entry, it applies to the entire tree.
   5365 When allowed values are defined, setting the corresponding property
   5366 becomes easier and is less prone to typing errors.  For the example
   5367 with the CD collection, we can pre-define publishers and the number of
   5368 disks in a box like this:
   5369 
   5370 #+begin_example
   5371 ,* CD collection
   5372   :PROPERTIES:
   5373   :NDisks_ALL:  1 2 3 4
   5374   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
   5375   :END:
   5376 #+end_example
   5377 
   5378 Properties can be inserted at the buffer level.  That means they apply
   5379 before the first headline and can be inherited by all entries in a
   5380 file.  Property blocks defined before the first headline must be at
   5381 the top of the buffer with only comments above them.
   5382 
   5383 Properties can also be defined using lines like:
   5384 
   5385 #+cindex: @samp{_ALL} suffix, in properties
   5386 #+cindex: @samp{PROPERTY}, keyword
   5387 : #+PROPERTY: NDisks_ALL 1 2 3 4
   5388 
   5389 #+cindex: @samp{+} suffix, in properties
   5390 If you want to add to the value of an existing property, append a =+=
   5391 to the property name.  The following results in the property =var=
   5392 having the value =foo=1 bar=2=.
   5393 
   5394 #+begin_example
   5395 ,#+PROPERTY: var  foo=1
   5396 ,#+PROPERTY: var+ bar=2
   5397 #+end_example
   5398 
   5399 It is also possible to add to the values of inherited properties.  The
   5400 following results in the =Genres= property having the value =Classic
   5401 Baroque= under the =Goldberg Variations= subtree.
   5402 
   5403 #+begin_example
   5404 ,* CD collection
   5405 ,** Classic
   5406     :PROPERTIES:
   5407     :Genres: Classic
   5408     :END:
   5409 ,*** Goldberg Variations
   5410     :PROPERTIES:
   5411     :Title:     Goldberg Variations
   5412     :Composer:  J.S. Bach
   5413     :Artist:    Glenn Gould
   5414     :Publisher: Deutsche Grammophon
   5415     :NDisks:    1
   5416     :Genres+:   Baroque
   5417     :END:
   5418 #+end_example
   5419 
   5420 Note that a property can only have one entry per drawer.
   5421 
   5422 #+vindex: org-global-properties
   5423 Property values set with the global variable ~org-global-properties~
   5424 can be inherited by all entries in all Org files.
   5425 
   5426 The following commands help to work with properties:
   5427 
   5428 #+attr_texinfo: :sep ,
   5429 - {{{kbd(M-TAB)}}} (~pcomplete~) ::
   5430 
   5431   #+kindex: M-TAB
   5432   #+findex: pcomplete
   5433   After an initial colon in a line, complete property keys.  All keys
   5434   used in the current file are offered as possible completions.
   5435 
   5436 - {{{kbd(C-c C-x p)}}} (~org-set-property~) ::
   5437 
   5438   #+kindex: C-c C-x p
   5439   #+findex: org-set-property
   5440   Set a property.  This prompts for a property name and a value.  If
   5441   necessary, the property drawer is created as well.
   5442 
   5443 - {{{kbd(C-u M-x org-insert-drawer)}}} ::
   5444 
   5445   #+findex: org-insert-drawer
   5446   Insert a property drawer into the current entry.  The drawer is
   5447   inserted early in the entry, but after the lines with planning
   5448   information like deadlines.  If before first headline the drawer is
   5449   inserted at the top of the drawer after any potential comments.
   5450 
   5451 - {{{kbd(C-c C-c)}}} (~org-property-action~) ::
   5452 
   5453   #+kindex: C-c C-c
   5454   #+findex: org-property-action
   5455   With point in a property drawer, this executes property commands.
   5456 
   5457 - {{{kbd(C-c C-c s)}}} (~org-set-property~) ::
   5458 
   5459   #+kindex: C-c C-c s
   5460   #+findex: org-set-property
   5461   Set a property in the current entry.  Both the property and the
   5462   value can be inserted using completion.
   5463 
   5464 - {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-value~),  {{{kbd(S-LEFT)}}} (~org-property-previous-allowed-value~) ::
   5465 
   5466   #+kindex: S-RIGHT
   5467   #+kindex: S-LEFT
   5468   Switch property at point to the next/previous allowed value.
   5469 
   5470 - {{{kbd(C-c C-c d)}}} (~org-delete-property~) ::
   5471 
   5472   #+kindex: C-c C-c d
   5473   #+findex: org-delete-property
   5474   Remove a property from the current entry.
   5475 
   5476 - {{{kbd(C-c C-c D)}}} (~org-delete-property-globally~) ::
   5477 
   5478   #+kindex: C-c C-c D
   5479   #+findex: org-delete-property-globally
   5480   Globally remove a property, from all entries in the current file.
   5481 
   5482 - {{{kbd(C-c C-c c)}}} (~org-compute-property-at-point~) ::
   5483 
   5484   #+kindex: C-c C-c c
   5485   #+findex: org-compute-property-at-point
   5486   Compute the property at point, using the operator and scope from the
   5487   nearest column format definition.
   5488 
   5489 ** Special Properties
   5490 :PROPERTIES:
   5491 :DESCRIPTION: Access to other Org mode features.
   5492 :END:
   5493 #+cindex: properties, special
   5494 
   5495 Special properties provide an alternative access method to Org mode
   5496 features, like the TODO state or the priority of an entry, discussed
   5497 in the previous chapters.  This interface exists so that you can
   5498 include these states in a column view (see [[*Column View]]), or to use
   5499 them in queries.  The following property names are special and should
   5500 not be used as keys in the properties drawer:
   5501 
   5502 #+cindex: @samp{ALLTAGS}, special property
   5503 #+cindex: @samp{BLOCKED}, special property
   5504 #+cindex: @samp{CLOCKSUM}, special property
   5505 #+cindex: @samp{CLOCKSUM_T}, special property
   5506 #+cindex: @samp{CLOSED}, special property
   5507 #+cindex: @samp{DEADLINE}, special property
   5508 #+cindex: @samp{FILE}, special property
   5509 #+cindex: @samp{ITEM}, special property
   5510 #+cindex: @samp{PRIORITY}, special property
   5511 #+cindex: @samp{SCHEDULED}, special property
   5512 #+cindex: @samp{TAGS}, special property
   5513 #+cindex: @samp{TIMESTAMP}, special property
   5514 #+cindex: @samp{TIMESTAMP_IA}, special property
   5515 #+cindex: @samp{TODO}, special property
   5516 | =ALLTAGS=      | All tags, including inherited ones.                            |
   5517 | =BLOCKED=      | ~t~ if task is currently blocked by children or siblings.      |
   5518 | =CATEGORY=     | The category of an entry.                                      |
   5519 | =CLOCKSUM=     | The sum of CLOCK intervals in the subtree.  ~org-clock-sum~    |
   5520 |                | must be run first to compute the values in the current buffer. |
   5521 | =CLOCKSUM_T=   | The sum of CLOCK intervals in the subtree for today.           |
   5522 |                | ~org-clock-sum-today~ must be run first to compute the         |
   5523 |                | values in the current buffer.                                  |
   5524 | =CLOSED=       | When was this entry closed?                                    |
   5525 | =DEADLINE=     | The deadline timestamp.                                        |
   5526 | =FILE=         | The filename the entry is located in.                          |
   5527 | =ITEM=         | The headline of the entry.                                     |
   5528 | =PRIORITY=     | The priority of the entry, a string with a single letter.      |
   5529 | =SCHEDULED=    | The scheduling timestamp.                                      |
   5530 | =TAGS=         | The tags defined directly in the headline.                     |
   5531 | =TIMESTAMP=    | The first active keyword-less timestamp in the entry.[fn:17]   |
   5532 | =TIMESTAMP_IA= | The first inactive keyword-less timestamp in the entry.        |
   5533 | =TODO=         | The TODO keyword of the entry.                                 |
   5534 
   5535 ** Property Searches
   5536 :PROPERTIES:
   5537 :DESCRIPTION: Matching property values.
   5538 :END:
   5539 #+cindex: properties, searching
   5540 #+cindex: searching, of properties
   5541 
   5542 To create sparse trees and special lists with selection based on
   5543 properties, the same commands are used as for tag searches (see [[*Tag
   5544 Searches]]).
   5545 
   5546 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
   5547 
   5548   #+kindex: C-c / m
   5549   #+kindex: C-c \
   5550   #+findex: org-match-sparse-tree
   5551   Create a sparse tree with all matching entries.  With
   5552   a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
   5553   a TODO line.
   5554 
   5555 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
   5556 
   5557   #+kindex: m @r{(Agenda dispatcher)}
   5558   #+findex: org-tags-view
   5559   Create a global list of tag/property matches from all agenda files.
   5560 
   5561 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
   5562 
   5563   #+kindex: M @r{(Agenda dispatcher)}
   5564   Create a global list of tag matches from all agenda files, but check
   5565   only TODO items.
   5566 
   5567 The syntax for the search string is described in [[*Matching tags and
   5568 properties]].
   5569 
   5570 There is also a special command for creating sparse trees based on a
   5571 single property:
   5572 
   5573 - {{{kbd(C-c / p)}}} ::
   5574 
   5575   #+kindex: C-c / p
   5576   Create a sparse tree based on the value of a property.  This first
   5577   prompts for the name of a property, and then for a value.  A sparse
   5578   tree is created with all entries that define this property with the
   5579   given value.  If you enclose the value in curly braces, it is
   5580   interpreted as a regular expression and matched against the property
   5581   values (see [[*Regular Expressions]]).
   5582 
   5583 ** Property Inheritance
   5584 :PROPERTIES:
   5585 :DESCRIPTION: Passing values down a tree.
   5586 :END:
   5587 #+cindex: properties, inheritance
   5588 #+cindex: inheritance, of properties
   5589 
   5590 #+vindex: org-use-property-inheritance
   5591 The outline structure of Org documents lends itself to an inheritance
   5592 model of properties: if the parent in a tree has a certain property,
   5593 the children can inherit this property.  Org mode does not turn this
   5594 on by default, because it can slow down property searches
   5595 significantly and is often not needed.  However, if you find
   5596 inheritance useful, you can turn it on by setting the variable
   5597 ~org-use-property-inheritance~.  It may be set to ~t~ to make all
   5598 properties inherited from the parent, to a list of properties that
   5599 should be inherited, or to a regular expression that matches inherited
   5600 properties.  If a property has the value ~nil~, this is interpreted as
   5601 an explicit un-define of the property, so that inheritance search
   5602 stops at this value and returns ~nil~.
   5603 
   5604 Org mode has a few properties for which inheritance is hard-coded, at
   5605 least for the special applications for which they are used:
   5606 
   5607 - ~COLUMNS~ ::
   5608 
   5609   #+cindex: @samp{COLUMNS}, property
   5610   The =COLUMNS= property defines the format of column view (see
   5611   [[*Column View]]).  It is inherited in the sense that the level where
   5612   a =COLUMNS= property is defined is used as the starting point for
   5613   a column view table, independently of the location in the subtree
   5614   from where columns view is turned on.
   5615 
   5616 - ~CATEGORY~ ::
   5617 
   5618   #+cindex: @samp{CATEGORY}, property
   5619   For agenda view, a category set through a =CATEGORY= property
   5620   applies to the entire subtree.
   5621 
   5622 - ~ARCHIVE~ ::
   5623 
   5624   #+cindex: @samp{ARCHIVE}, property
   5625   For archiving, the =ARCHIVE= property may define the archive
   5626   location for the entire subtree (see [[*Moving a tree to an archive
   5627   file]]).
   5628 
   5629 - ~LOGGING~ ::
   5630 
   5631   #+cindex: @samp{LOGGING}, property
   5632   The =LOGGING= property may define logging settings for an entry or
   5633   a subtree (see [[*Tracking TODO state changes]]).
   5634 
   5635 ** Column View
   5636 :PROPERTIES:
   5637 :DESCRIPTION: Tabular viewing and editing.
   5638 :END:
   5639 
   5640 A great way to view and edit properties in an outline tree is /column
   5641 view/.  In column view, each outline node is turned into a table row.
   5642 Columns in this table provide access to properties of the entries.
   5643 Org mode implements columns by overlaying a tabular structure over the
   5644 headline of each item.  While the headlines have been turned into
   5645 a table row, you can still change the visibility of the outline tree.
   5646 For example, you get a compact table by switching to "contents"
   5647 view---{{{kbd(S-TAB)}}} {{{kbd(S-TAB)}}}, or simply {{{kbd(c)}}}
   5648 while column view is active---but you can still open, read, and edit
   5649 the entry below each headline.  Or, you can switch to column view
   5650 after executing a sparse tree command and in this way get a table only
   5651 for the selected items.  Column view also works in agenda buffers (see
   5652 [[*Agenda Views]]) where queries have collected selected items, possibly
   5653 from a number of files.
   5654 
   5655 *** Defining columns
   5656 :PROPERTIES:
   5657 :DESCRIPTION: The COLUMNS format property.
   5658 :END:
   5659 #+cindex: column view, for properties
   5660 #+cindex: properties, column view
   5661 
   5662 Setting up a column view first requires defining the columns.  This is
   5663 done by defining a column format line.
   5664 
   5665 **** Scope of column definitions
   5666 :PROPERTIES:
   5667 :DESCRIPTION: Where defined, where valid?
   5668 :END:
   5669 
   5670 To specify a format that only applies to a specific tree, add
   5671 a =COLUMNS= property to the top node of that tree, for example:
   5672 
   5673 #+begin_example
   5674 ,** Top node for columns view
   5675    :PROPERTIES:
   5676    :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
   5677    :END:
   5678 #+end_example
   5679 
   5680 A =COLUMNS= property within a property drawer before first headline
   5681 will apply to the entire file.  As an addition to property drawers,
   5682 keywords can also be defined for an entire file using a line like:
   5683 
   5684 #+cindex: @samp{COLUMNS}, keyword
   5685 : #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
   5686 
   5687 If a =COLUMNS= property is present in an entry, it defines columns for
   5688 the entry itself, and for the entire subtree below it.  Since the
   5689 column definition is part of the hierarchical structure of the
   5690 document, you can define columns on level 1 that are general enough
   5691 for all sublevels, and more specific columns further down, when you
   5692 edit a deeper part of the tree.
   5693 
   5694 **** Column attributes
   5695 :PROPERTIES:
   5696 :DESCRIPTION: Appearance and content of a column.
   5697 :END:
   5698 
   5699 A column definition sets the attributes of a column.  The general
   5700 definition looks like this:
   5701 
   5702 : %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}]
   5703 
   5704 #+texinfo: @noindent
   5705 Except for the percent sign and the property name, all items are
   5706 optional.  The individual parts have the following meaning:
   5707 
   5708 - {{{var(WIDTH)}}} ::
   5709 
   5710   An integer specifying the width of the column in characters.  If
   5711   omitted, the width is determined automatically.
   5712 
   5713 - {{{var(PROPERTY)}}} ::
   5714 
   5715   The property that should be edited in this column.  Special
   5716   properties representing meta data are allowed here as well (see
   5717   [[*Special Properties]]).
   5718 
   5719 - {{{var(TITLE)}}} ::
   5720 
   5721   The header text for the column.  If omitted, the property name is
   5722   used.
   5723 
   5724 - {{{var(SUMMARY-TYPE)}}} ::
   5725 
   5726   The summary type.  If specified, the column values for parent nodes
   5727   are computed from the children[fn:: If more than one summary type
   5728   applies to the same property, the parent values are computed
   5729   according to the first of them.].
   5730 
   5731   Supported summary types are:
   5732 
   5733   | =+=      | Sum numbers in this column.                           |
   5734   | =+;%.1f= | Like =+=, but format result with =%.1f=.              |
   5735   | =$=      | Currency, short for =+;%.2f=.                         |
   5736   | =min=    | Smallest number in column.                            |
   5737   | =max=    | Largest number.                                       |
   5738   | =mean=   | Arithmetic mean of numbers.                           |
   5739   | =X=      | Checkbox status, =[X]= if all children are =[X]=.     |
   5740   | =X/=     | Checkbox status, =[n/m]=.                             |
   5741   | =X%=     | Checkbox status, =[n%]=.                              |
   5742   | =:=      | Sum times, HH:MM, plain numbers are minutes.          |
   5743   | =:min=   | Smallest time value in column.                        |
   5744   | =:max=   | Largest time value.                                   |
   5745   | =:mean=  | Arithmetic mean of time values.                       |
   5746   | =@min=   | Minimum age[fn:18] (in days/hours/mins/seconds).      |
   5747   | =@max=   | Maximum age (in days/hours/mins/seconds).             |
   5748   | =@mean=  | Arithmetic mean of ages (in days/hours/mins/seconds). |
   5749   | =est+=   | Add low-high estimates.                               |
   5750 
   5751   #+vindex: org-columns-summary-types
   5752   You can also define custom summary types by setting
   5753   ~org-columns-summary-types~.
   5754 
   5755 The =est+= summary type requires further explanation.  It is used for
   5756 combining estimates, expressed as low-high ranges.  For example,
   5757 instead of estimating a particular task will take 5 days, you might
   5758 estimate it as 5--6 days if you're fairly confident you know how much
   5759 work is required, or 1--10 days if you do not really know what needs
   5760 to be done.  Both ranges average at 5.5 days, but the first represents
   5761 a more predictable delivery.
   5762 
   5763 When combining a set of such estimates, simply adding the lows and
   5764 highs produces an unrealistically wide result.  Instead, =est+= adds
   5765 the statistical mean and variance of the subtasks, generating a final
   5766 estimate from the sum.  For example, suppose you had ten tasks, each
   5767 of which was estimated at 0.5 to 2 days of work.  Straight addition
   5768 produces an estimate of 5 to 20 days, representing what to expect if
   5769 everything goes either extremely well or extremely poorly.  In
   5770 contrast, =est+= estimates the full job more realistically, at 10--15
   5771 days.
   5772 
   5773 Here is an example for a complete columns definition, along with
   5774 allowed values[fn:: Please note that the =COLUMNS= definition must be
   5775 on a single line; it is wrapped here only because of formatting
   5776 constraints.].
   5777 
   5778 #+begin_example
   5779 :COLUMNS:  %25ITEM %9Approved(Approved?){X} %Owner %11Status \
   5780                    %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
   5781 :Owner_ALL:    Tammy Mark Karl Lisa Don
   5782 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
   5783 :Approved_ALL: "[ ]" "[X]"
   5784 #+end_example
   5785 
   5786 #+texinfo: @noindent
   5787 The first column, =%25ITEM=, means the first 25 characters of the item
   5788 itself, i.e., of the headline.  You probably always should start the
   5789 column definition with the =ITEM= specifier.  The other specifiers
   5790 create columns =Owner= with a list of names as allowed values, for
   5791 =Status= with four different possible values, and for a checkbox field
   5792 =Approved=.  When no width is given after the =%= character, the
   5793 column is exactly as wide as it needs to be in order to fully display
   5794 all values.  The =Approved= column does have a modified title
   5795 (=Approved?=, with a question mark).  Summaries are created for the
   5796 =Time_Estimate= column by adding time duration expressions like HH:MM,
   5797 and for the =Approved= column, by providing an =[X]= status if all
   5798 children have been checked.  The =CLOCKSUM= and =CLOCKSUM_T= columns
   5799 are special, they lists the sums of CLOCK intervals in the subtree,
   5800 either for all clocks or just for today.
   5801 
   5802 *** Using column view
   5803 :PROPERTIES:
   5804 :DESCRIPTION: How to create and use column view.
   5805 :END:
   5806 
   5807 **** Turning column view on or off
   5808 :PROPERTIES:
   5809 :UNNUMBERED: notoc
   5810 :END:
   5811 
   5812 - {{{kbd(C-c C-x C-c)}}} (~org-columns~) ::
   5813 
   5814   #+kindex: C-c C-x C-c
   5815   #+vindex: org-columns
   5816   #+vindex: org-columns-default-format
   5817   Turn on column view.  If point is before the first headline in the
   5818   file, column view is turned on for the entire file, using the
   5819   =#+COLUMNS= definition.  If point is somewhere inside the outline,
   5820   this command searches the hierarchy, up from point, for a =COLUMNS=
   5821   property that defines a format.  When one is found, the column view
   5822   table is established for the tree starting at the entry that
   5823   contains the =COLUMNS= property.  If no such property is found, the
   5824   format is taken from the =#+COLUMNS= line or from the variable
   5825   ~org-columns-default-format~, and column view is established for the
   5826   current entry and its subtree.
   5827 
   5828 - {{{kbd(r)}}} or {{{kbd(g)}}} on a columns view line (~org-columns-redo~) ::
   5829 
   5830   #+kindex: r
   5831   #+kindex: g
   5832   #+findex: org-columns-redo
   5833   Recreate the column view, to include recent changes made in the
   5834   buffer.
   5835 
   5836 - {{{kbd(C-c C-c)}}} or {{{kbd(q)}}} on a columns view line (~org-columns-quit~) ::
   5837 
   5838   #+kindex: q
   5839   #+kindex: C-c C-c
   5840   #+findex: org-columns-quit
   5841   Exit column view.
   5842 
   5843 **** Editing values
   5844 :PROPERTIES:
   5845 :UNNUMBERED: notoc
   5846 :END:
   5847 
   5848 #+attr_texinfo: :sep and
   5849 - {{{kbd(LEFT)}}}, {{{kbd(RIGHT)}}}, {{{kbd(UP)}}}, {{{kbd(DOWN)}}} ::
   5850 
   5851   Move through the column view from field to field.
   5852 
   5853 - {{{kbd(1..9\,0)}}} ::
   5854 
   5855   #+kindex: 1..9,0
   5856   Directly select the Nth allowed value, {{{kbd(0)}}} selects the
   5857   10th value.
   5858 
   5859 - {{{kbd(n)}}} or {{{kbd(S-RIGHT)}}} (~org-columns-next-allowed-value~) and {{{kbd(p)}}} or {{{kbd(S-LEFT)}}} (~org-columns-previous-allowed-value~) ::
   5860 
   5861   #+kindex: n
   5862   #+kindex: S-RIGHT
   5863   #+kindex: p
   5864   #+kindex: S-LEFT
   5865   #+findex: org-columns-next-allowed-value
   5866   #+findex: org-columns-previous-allowed-value
   5867   Switch to the next/previous allowed value of the field.  For this,
   5868   you have to have specified allowed values for a property.
   5869 
   5870 - {{{kbd(e)}}} (~org-columns-edit-value~) ::
   5871 
   5872   #+kindex: e
   5873   #+findex: org-columns-edit-value
   5874   Edit the property at point.  For the special properties, this
   5875   invokes the same interface that you normally use to change that
   5876   property.  For example, the tag completion or fast selection
   5877   interface pops up when editing a =TAGS= property.
   5878 
   5879 - {{{kbd(C-c C-c)}}} (~org-columns-toggle-or-columns-quit~) ::
   5880 
   5881   #+kindex: C-c C-c
   5882   #+findex: org-columns-toggle-or-columns-quit
   5883   When there is a checkbox at point, toggle it.  Else exit column
   5884   view.
   5885 
   5886 - {{{kbd(v)}}} (~org-columns-show-value~) ::
   5887 
   5888   #+kindex: v
   5889   #+findex: org-columns-show-value
   5890   View the full value of this property.  This is useful if the width
   5891   of the column is smaller than that of the value.
   5892 
   5893 - {{{kbd(a)}}} (~org-columns-edit-allowed~) ::
   5894 
   5895   #+kindex: a
   5896   #+findex: org-columns-edit-allowed
   5897   Edit the list of allowed values for this property.  If the list is
   5898   found in the hierarchy, the modified values is stored there.  If no
   5899   list is found, the new value is stored in the first entry that is
   5900   part of the current column view.
   5901 
   5902 **** Modifying column view on-the-fly
   5903 :PROPERTIES:
   5904 :UNNUMBERED: notoc
   5905 :END:
   5906 
   5907 #+attr_texinfo: :sep and
   5908 - {{{kbd(<)}}} (~org-columns-narrow~) and {{{kbd(>)}}} (~org-columns-widen~) ::
   5909 
   5910   #+kindex: <
   5911   #+kindex: >
   5912   #+findex: org-columns-narrow
   5913   #+findex: org-columns-widen
   5914   Make the column narrower/wider by one character.
   5915 
   5916 - {{{kbd(S-M-RIGHT)}}} (~org-columns-new~) ::
   5917 
   5918   #+kindex: S-M-RIGHT
   5919   #+findex: org-columns-new
   5920   Insert a new column, to the left of the current column.
   5921 
   5922 - {{{kbd(S-M-LEFT)}}} (~org-columns-delete~) ::
   5923 
   5924   #+kindex: S-M-LEFT
   5925   #+findex: org-columns-delete
   5926   Delete the current column.
   5927 
   5928 - {{{kbd(M-LEFT)}}} (~org-columns-move-left~) ::
   5929 
   5930   #+kindex: M-LEFT
   5931   #+findex: org-columns-move-left
   5932   Move the current column left.
   5933 
   5934 - {{{kbd(M-RIGHT)}}} (~org-columns-move-right~) ::
   5935 
   5936   #+kindex: M-RIGHT
   5937   #+findex: org-columns-move-right
   5938   Move the current column right.
   5939 
   5940 - {{{kbd(M-UP)}}} (~org-columns-move-row-up~) ::
   5941 
   5942   #+kindex: M-UP
   5943   #+findex: org-columns-move-row-up
   5944   Move the current row up.
   5945 
   5946 - {{{kbd(M-DOWN)}}} (~org-columns-move-row-down~) ::
   5947 
   5948   #+kindex: M-DOWN
   5949   #+findex: org-columns-move-row-down
   5950   Move the current row down.
   5951 
   5952 *** Capturing column view
   5953 :PROPERTIES:
   5954 :DESCRIPTION: A dynamic block for column view.
   5955 :END:
   5956 
   5957 Since column view is just an overlay over a buffer, it cannot be
   5958 exported or printed directly.  If you want to capture a column view,
   5959 use a =columnview= dynamic block (see [[*Dynamic Blocks]]).  The frame of
   5960 this block looks like this:
   5961 
   5962 #+cindex: @samp{BEGIN columnview}
   5963 #+begin_example
   5964 ,* The column view
   5965 ,#+BEGIN: columnview :hlines 1 :id "label"
   5966 
   5967 ,#+END:
   5968 #+end_example
   5969 
   5970 This dynamic block has the following parameters:
   5971 
   5972 - =:id= ::
   5973 
   5974   This is the most important parameter.  Column view is a feature that
   5975   is often localized to a certain (sub)tree, and the capture block
   5976   might be at a different location in the file.  To identify the tree
   5977   whose view to capture, you can use four values:
   5978 
   5979   - =local= ::
   5980 
   5981     Use the tree in which the capture block is located.
   5982 
   5983   - =global= ::
   5984 
   5985     Make a global view, including all headings in the file.
   5986 
   5987   - =file:FILENAME= ::
   5988 
   5989     Run column view at the top of the {{{var(FILENAME)}}} file.
   5990 
   5991   - =LABEL= ::
   5992 
   5993     #+cindex: @samp{ID}, property
   5994     Call column view in the tree that has an =ID= property with the
   5995     value {{{var(LABEL)}}}.  You can use {{{kbd(M-x org-id-copy)}}} to
   5996     create a globally unique ID for the current entry and copy it to
   5997     the kill-ring.
   5998 
   5999 - =:match= ::
   6000 
   6001   When set to a string, use this as a tags/property match filter to
   6002   select only a subset of the headlines in the scope set by the ~:id~
   6003   parameter.
   6004 
   6005 
   6006 - =:hlines= ::
   6007 
   6008   When ~t~, insert an hline after every line.  When a number N, insert
   6009   an hline before each headline with level ~<= N~.
   6010 
   6011 - =:vlines= ::
   6012 
   6013   When non-~nil~, force column groups to get vertical lines.
   6014 
   6015 - =:maxlevel= ::
   6016 
   6017   When set to a number, do not capture entries below this level.
   6018 
   6019 - =:skip-empty-rows= ::
   6020 
   6021   When non-~nil~, skip rows where the only non-empty specifier of
   6022   the column view is =ITEM=.
   6023 
   6024 - =:exclude-tags= ::
   6025 
   6026   List of tags to exclude from column view table: entries with these
   6027   tags will be excluded from the column view.
   6028 
   6029 - =:indent= ::
   6030 
   6031   When non-~nil~, indent each =ITEM= field according to its level.
   6032 
   6033 - =:link= ::
   6034 
   6035   When non-~nil~, link the =ITEM= headlines in the table to their
   6036   origins.
   6037 
   6038 - =:format= ::
   6039 
   6040   Specify a column attribute (see [[*Column attributes]]) for the dynamic
   6041   block.
   6042 
   6043 - =:formatter= ::
   6044 
   6045   #+cindex: @samp{formatter}, dynamic block parameter
   6046   #+vindex: org-columns-dblock-formatter
   6047   A function to format column view data and insert it into the buffer.
   6048   See the option ~org-columns-dblock-formatter~.
   6049 
   6050 The following commands insert or update the dynamic block:
   6051 
   6052 - ~org-columns-insert-dblock~ ::
   6053 
   6054   #+kindex: C-c C-x x
   6055   #+findex: org-columns-insert-dblock
   6056   Insert a dynamic block capturing a column view.  Prompt for the
   6057   scope or ID of the view.
   6058 
   6059   This command can be invoked by calling
   6060   ~org-dynamic-block-insert-dblock~ ({{{kbd(C-c C-x x)}}}) and
   6061   selecting "columnview" (see [[*Dynamic Blocks]]).
   6062 
   6063 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
   6064 
   6065   #+kindex: C-c C-c
   6066   #+kindex: C-c C-x C-u
   6067   #+findex: org-dblock-update
   6068   Update dynamic block at point.  Point needs to be on the =#+BEGIN=
   6069   line of the dynamic block.
   6070 
   6071 - {{{kbd(C-u C-c C-x C-u)}}} (~org-update-all-dblocks~) ::
   6072 
   6073   #+kindex: C-u C-c C-x C-u
   6074   Update all dynamic blocks (see [[*Dynamic Blocks]]).  This is useful if
   6075   you have several clock table blocks, column-capturing blocks or
   6076   other dynamic blocks in a buffer.
   6077 
   6078 You can add formulas to the column view table and you may add plotting
   6079 instructions in front of the table---these survive an update of the
   6080 block.  If there is a =TBLFM= keyword after the table, the table is
   6081 recalculated automatically after an update.
   6082 
   6083 An alternative way to capture and process property values into a table
   6084 is provided by Eric Schulte's =org-collector.el=, which is a package
   6085 in =org-contrib=[fn:: Contributed packages are not part of Emacs, but
   6086 are distributed with the main distribution of Org---visit
   6087 [[https://orgmode.org]].].  It provides a general API to collect
   6088 properties from entries in a certain scope, and arbitrary Lisp
   6089 expressions to process these values before inserting them into a table
   6090 or a dynamic block.
   6091 
   6092 * Dates and Times
   6093 :PROPERTIES:
   6094 :DESCRIPTION: Making items useful for planning.
   6095 :END:
   6096 #+cindex: dates
   6097 #+cindex: times
   6098 #+cindex: timestamp
   6099 #+cindex: date stamp
   6100 
   6101 To assist project planning, TODO items can be labeled with a date
   6102 and/or a time.  The specially formatted string carrying the date and
   6103 time information is called a /timestamp/ in Org mode.  This may be
   6104 a little confusing because timestamp is often used as indicating when
   6105 something was created or last changed.  However, in Org mode this term
   6106 is used in a much wider sense.
   6107 
   6108 Timestamps can be used to plan appointments, schedule tasks, set
   6109 deadlines, track time, and more.  The following sections describe
   6110 the timestamp format and tooling that Org mode provides for common
   6111 use cases dealing with time and time intervals.
   6112 
   6113 ** Timestamps
   6114 :PROPERTIES:
   6115 :DESCRIPTION: Assigning a time to a tree entry.
   6116 :END:
   6117 #+cindex: timestamps
   6118 #+cindex: ranges, time
   6119 #+cindex: date stamps
   6120 #+cindex: deadlines
   6121 #+cindex: scheduling
   6122 
   6123 A timestamp is a specification of a date---possibly with a time or
   6124 time range---in a special format, either =<2003-09-16 Tue>= or
   6125 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:19].
   6126 A timestamp can appear anywhere in the headline or body of an Org tree
   6127 entry.  Its presence causes entries to be shown on specific dates in
   6128 the agenda (see [[*Weekly/daily agenda]]).  We distinguish:
   6129 
   6130 - Plain timestamp; Event; Appointment ::
   6131 
   6132   #+cindex: timestamp
   6133   #+cindex: appointment
   6134   A simple timestamp just assigns a date/time to an item.  This is
   6135   just like writing down an appointment or event in a paper agenda.
   6136   In the agenda display, the headline of an entry associated with
   6137   a plain timestamp is shown exactly on that date.  There can be
   6138   multiple timestamps in an item.
   6139 
   6140   #+begin_example
   6141   ,* Meet Peter at the movies
   6142     <2006-11-01 Wed 19:15>
   6143   ,* Discussion on climate change
   6144     <2006-11-02 Thu 10:00-12:00>
   6145   ,* My days off
   6146     <2006-11-03 Fri>
   6147     <2006-11-06 Mon>
   6148   #+end_example
   6149 
   6150 - Timestamp with repeater interval ::
   6151 
   6152   #+cindex: timestamp, with repeater interval
   6153   A timestamp may contain a /repeater interval/, indicating that it
   6154   applies not only on the given date, but again and again after
   6155   a certain interval of N hours (h), days (d), weeks (w), months (m),
   6156   or years (y).  The following shows up in the agenda every Wednesday:
   6157 
   6158   #+begin_example
   6159   ,* Pick up Sam at school
   6160     <2007-05-16 Wed 12:30 +1w>
   6161   #+end_example
   6162 
   6163 - Diary-style expression entries ::
   6164 
   6165   #+cindex: diary style timestamps
   6166   #+cindex: sexp timestamps
   6167   # Mentioned inside the footnote.
   6168   #+findex: org-date
   6169   #+findex: org-anniversary
   6170   #+findex: org-cyclic
   6171   #+findex: org-block
   6172 
   6173   For more complex date specifications, Org mode supports using the
   6174   special expression diary entries implemented in the
   6175   [[info:emacs#Special Diary Entries][Emacs Calendar package]][fn:20].
   6176   For example, with optional time:
   6177 
   6178   #+begin_example
   6179   ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
   6180     <%%(diary-float t 4 2) 22:00-23:00>
   6181   #+end_example
   6182 
   6183 - Time range ::
   6184   #+cindex: time range
   6185 
   6186   Time range is a timestamp having two time units connected by =-=
   6187 
   6188   #+begin_example
   6189 ,* Discussion on climate change
   6190    <2006-11-02 Thu 10:00-12:00>
   6191   #+end_example
   6192 
   6193 - Time/Date range ::
   6194 
   6195   #+cindex: time range
   6196   #+cindex: timerange
   6197   #+cindex: date range
   6198   Two timestamps connected by =--= denote a range.  In the agenda, the
   6199   headline is shown on the first and last day of the range, and on any
   6200   dates that are displayed and fall in the range.  The first example
   6201   specifies just the dates of the range while the second example
   6202   specifies a time range for each date.
   6203 
   6204   #+begin_example
   6205   ,** Meeting in Amsterdam
   6206      <2004-08-23 Mon>--<2004-08-26 Thu>
   6207   ,** This weeks committee meetings
   6208      <2004-08-23 Mon 10:00-11:00>--<2004-08-26 Thu 10:00-11:00>
   6209   #+end_example
   6210 
   6211 - Inactive timestamp ::
   6212 
   6213   #+cindex: timestamp, inactive
   6214   #+cindex: inactive timestamp
   6215   Just like a plain timestamp, but with square brackets instead of
   6216   angular ones.  These timestamps are inactive in the sense that they
   6217   do /not/ trigger an entry to show up in the agenda.
   6218 
   6219   #+begin_example
   6220   ,* Gillian comes late for the fifth time
   6221     [2006-11-01 Wed]
   6222   #+end_example
   6223 
   6224 ** Creating Timestamps
   6225 :PROPERTIES:
   6226 :DESCRIPTION: Commands to insert timestamps.
   6227 :END:
   6228 
   6229 For Org mode to recognize timestamps, they need to be in the specific
   6230 format.  All commands listed below produce timestamps in the correct
   6231 format.
   6232 
   6233 #+attr_texinfo: :sep ,
   6234 - {{{kbd(C-c .)}}} (~org-timestamp~) ::
   6235 
   6236   #+kindex: C-c .
   6237   #+findex: org-time-stamp
   6238   #+findex: org-timestamp
   6239   Prompt for a date and insert a corresponding timestamp.  When point
   6240   is at an existing timestamp in the buffer, the command is used to
   6241   modify this timestamp instead of inserting a new one.  When this
   6242   command is used twice in succession, a time range is inserted.
   6243 
   6244   #+kindex: C-u C-c .
   6245   #+vindex: org-time-stamp-rounding-minutes
   6246   #+vindex: org-timestamp-rounding-minutes
   6247   When called with a prefix argument, use the alternative format which
   6248   contains date and time.  The default time can be rounded to
   6249   multiples of 5 minutes.  See the option
   6250   ~org-timestamp-rounding-minutes~.
   6251 
   6252   #+kindex: C-u C-u C-c .
   6253   With two prefix arguments, insert an active timestamp with the
   6254   current time without prompting.
   6255 
   6256 - {{{kbd(C-c !)}}} (~org-timestamp-inactive~) ::
   6257 
   6258   #+kindex: C-c !
   6259   #+kindex: C-u C-c !
   6260   #+kindex: C-u C-u C-c !
   6261   #+findex: org-time-stamp-inactive
   6262   #+findex: org-timestamp-inactive
   6263   Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does
   6264   not cause an agenda entry.
   6265 
   6266 - {{{kbd(C-c C-c)}}} ::
   6267 
   6268   #+kindex: C-c C-c
   6269   Normalize timestamp, insert or fix day name if missing or wrong.
   6270 
   6271 - {{{kbd(C-c <)}}} (~org-date-from-calendar~) ::
   6272 
   6273   #+kindex: C-c <
   6274   #+findex: org-date-from-calendar
   6275   Insert a timestamp corresponding to point date in the calendar.
   6276 
   6277 - {{{kbd(C-c >)}}} (~org-goto-calendar~) ::
   6278 
   6279   #+kindex: C-c >
   6280   #+findex: org-goto-calendar
   6281   Access the Emacs calendar for the current date.  If there is
   6282   a timestamp in the current line, go to the corresponding date
   6283   instead.
   6284 
   6285 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
   6286 
   6287   #+kindex: C-c C-o
   6288   #+findex: org-open-at-point
   6289   Access the agenda for the date given by the timestamp or -range at
   6290   point (see [[*Weekly/daily agenda]]).
   6291 
   6292 - {{{kbd(S-LEFT)}}} (~org-timestamp-down-day~), {{{kbd(S-RIGHT)}}} (~org-timestamp-up-day~) ::
   6293 
   6294   #+kindex: S-LEFT
   6295   #+kindex: S-RIGHT
   6296   #+findex: org-timestamp-down-day
   6297   #+findex: org-timestamp-up-day
   6298   Change date at point by one day.  These key bindings conflict with
   6299   shift-selection and related modes (see [[*Packages that conflict with
   6300   Org mode]]).
   6301 
   6302 - {{{kbd(S-UP)}}} (~org-timestamp-up~), {{{kbd(S-DOWN)}}} (~org-timestamp-down~) ::
   6303 
   6304   #+kindex: S-UP
   6305   #+kindex: S-DOWN
   6306   On the beginning or enclosing bracket of a timestamp, change its
   6307   type.  Within a timestamp, change the item under point.  Point can
   6308   be on a year, month, day, hour or minute.  When the timestamp
   6309   contains a time range like =15:30-16:30=, modifying the first time
   6310   also shifts the second, shifting the time block with constant
   6311   length.  To change the length, modify the second time.  Note that if
   6312   point is in a headline and not at a timestamp, these same keys
   6313   modify the priority of an item (see [[*Priorities]]).  The key bindings
   6314   also conflict with shift-selection and related modes (see [[*Packages
   6315   that conflict with Org mode]]).
   6316 
   6317 - {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
   6318 
   6319   #+kindex: C-c C-y
   6320   #+findex: org-evaluate-time-range
   6321   #+cindex: evaluate time range
   6322   Evaluate a time range by computing the difference between start and
   6323   end.  With a prefix argument, insert result after the time range (in
   6324   a table: into the following column).
   6325 
   6326 *** The date/time prompt
   6327 :PROPERTIES:
   6328 :DESCRIPTION: How Org mode helps you enter dates and times.
   6329 :END:
   6330 #+cindex: date, reading in minibuffer
   6331 #+cindex: time, reading in minibuffer
   6332 
   6333 #+vindex: org-read-date-prefer-future
   6334 When Org mode prompts for a date/time, the default is shown in default
   6335 date/time format, and the prompt therefore seems to ask for a specific
   6336 format.  But it in fact accepts date/time information in a variety of
   6337 formats.  Generally, the information should start at the beginning of
   6338 the string.  Org mode finds whatever information is in there and
   6339 derives anything you have not specified from the /default date and
   6340 time/.  The default is usually the current date and time, but when
   6341 modifying an existing timestamp, or when entering the second stamp of
   6342 a range, it is taken from the stamp in the buffer.  When filling in
   6343 information, Org mode assumes that most of the time you want to enter
   6344 a date in the future: if you omit the month/year and the given
   6345 day/month is /before/ today, it assumes that you mean a future
   6346 date[fn:21].  If the date has been automatically shifted into the
   6347 future, the time prompt shows this with =(=>F)=.
   6348 
   6349 For example, let's assume that today is *June 13, 2006*.  Here is how
   6350 various inputs are interpreted, the items filled in by Org mode are in
   6351 *bold*.
   6352 
   6353 | =3-2-5=        | \rArr{} 2003-02-05                              |
   6354 | =2/5/3=        | \rArr{} 2003-02-05                              |
   6355 | =14=           | \rArr{} *2006*-*06*-14                          |
   6356 | =12=           | \rArr{} *2006*-*07*-12                          |
   6357 | =2/5=          | \rArr{} *2007*-02-05                            |
   6358 | =Fri=          | \rArr{} nearest Friday (default date or later)  |
   6359 | =sep 15=       | \rArr{} *2006*-09-15                            |
   6360 | =feb 15=       | \rArr{} *2007*-02-15                            |
   6361 | =sep 12 9=     | \rArr{} 2009-09-12                              |
   6362 | =12:45=        | \rArr{} *2006*-*06*-*13* 12:45                  |
   6363 | =22 sept 0:34= | \rArr{} *2006*-09-22 0:34                       |
   6364 | =w4=           | \rArr{} ISO week for of the current year *2006* |
   6365 | =2012 w4 fri=  | \rArr{} Friday of ISO week 4 in 2012            |
   6366 | =2012-w04-5=   | \rArr{} Same as above                           |
   6367 
   6368 Furthermore you can specify a relative date by giving, as the /first/
   6369 thing in the input: a plus/minus sign, a number and a letter---=h=,
   6370 =d=, =w=, =m= or =y=---to indicate a change in hours, days, weeks,
   6371 months, or years.  With =h= the date is relative to the current time,
   6372 with the other letters and a single plus or minus, the date is
   6373 relative to today at 00:00.  With a double plus or minus, it is
   6374 relative to the default date.  If instead of a single letter, you use
   6375 the abbreviation of day name, the date is the Nth such day, e.g.:
   6376 
   6377 | =+0=    | \rArr{} today                       |
   6378 | =.=     | \rArr{} today                       |
   6379 | =+2h=   | \rArr{} two hours from now          |
   6380 | =+4d=   | \rArr{} four days from today        |
   6381 | =+4=    | \rArr{} same as +4d                 |
   6382 | =+2w=   | \rArr{} two weeks from today        |
   6383 | =++5=   | \rArr{} five days from default date |
   6384 | =+2tue= | \rArr{} second Tuesday from now     |
   6385 
   6386 #+vindex: parse-time-months
   6387 #+vindex: parse-time-weekdays
   6388 The function understands English month and weekday abbreviations.  If
   6389 you want to use un-abbreviated names and/or other languages, configure
   6390 the variables ~parse-time-months~ and ~parse-time-weekdays~.
   6391 
   6392 #+vindex: org-read-date-force-compatible-dates
   6393 Not all dates can be represented in a given Emacs implementation.  By
   6394 default Org mode forces dates into the compatibility range 1970--2037
   6395 which works on all Emacs implementations.  If you want to use dates
   6396 outside of this range, read the docstring of the variable
   6397 ~org-read-date-force-compatible-dates~.
   6398 
   6399 You can specify a time range by giving start and end times or by
   6400 giving a start time and a duration (in HH:MM format).  Use one or two
   6401 dash(es) as the separator in the former case and use =+= as the
   6402 separator in the latter case, e.g.:
   6403 
   6404 | =11am-1:15pm=  | \rArr{} 11:00-13:15   |
   6405 | =11h-13h15=    | \rArr{} same as above |
   6406 | =11am--1:15pm= | \rArr{} same as above |
   6407 | =11am+2:15=    | \rArr{} same as above |
   6408 
   6409 #+cindex: calendar, for selecting date
   6410 #+vindex: org-popup-calendar-for-date-prompt
   6411 Parallel to the minibuffer prompt, a calendar is popped up[fn:: If you
   6412 do not need/want the calendar, configure the variable
   6413 ~org-popup-calendar-for-date-prompt~.].  When you exit the date
   6414 prompt, either by clicking on a date in the calendar, or by pressing
   6415 {{{kbd(RET)}}}, the date selected in the calendar is combined with the
   6416 information entered at the prompt.  You can control the calendar fully
   6417 from the minibuffer:
   6418 
   6419 #+kindex: <
   6420 #+kindex: >
   6421 #+kindex: M-v
   6422 #+kindex: C-v
   6423 #+kindex: mouse-1
   6424 #+kindex: S-RIGHT
   6425 #+kindex: S-LEFT
   6426 #+kindex: S-DOWN
   6427 #+kindex: S-UP
   6428 #+kindex: M-S-RIGHT
   6429 #+kindex: M-S-LEFT
   6430 #+kindex: RET
   6431 #+kindex: .
   6432 #+kindex: C-.
   6433 #+attr_texinfo: :columns 0.25 0.55
   6434 | {{{kbd(RET)}}}       | Choose date at point in calendar.      |
   6435 | {{{kbd(mouse-1)}}}   | Select date by clicking on it.         |
   6436 | {{{kbd(S-RIGHT)}}}   | One day forward.                       |
   6437 | {{{kbd(S-LEFT)}}}    | One day backward.                      |
   6438 | {{{kbd(S-DOWN)}}}    | One week forward.                      |
   6439 | {{{kbd(S-UP)}}}      | One week backward.                     |
   6440 | {{{kbd(M-S-RIGHT)}}} | One month forward.                     |
   6441 | {{{kbd(M-S-LEFT)}}}  | One month backward.                    |
   6442 | {{{kbd(>)}}}         | Scroll calendar forward by one month.  |
   6443 | {{{kbd(<)}}}         | Scroll calendar backward by one month. |
   6444 | {{{kbd(M-v)}}}       | Scroll calendar forward by 3 months.   |
   6445 | {{{kbd(C-v)}}}       | Scroll calendar backward by 3 months.  |
   6446 | {{{kbd(C-.)}}}       | Select today's date[fn:22]             |
   6447 
   6448 #+vindex: org-read-date-display-live
   6449 The actions of the date/time prompt may seem complex, but I assure you
   6450 they will grow on you, and you will start getting annoyed by pretty
   6451 much any other way of entering a date/time out there.  To help you
   6452 understand what is going on, the current interpretation of your input
   6453 is displayed live in the minibuffer[fn:: If you find this distracting,
   6454 turn off the display with ~org-read-date-display-live~.].
   6455 
   6456 *** Custom time format
   6457 :PROPERTIES:
   6458 :DESCRIPTION: Making dates look different.
   6459 :END:
   6460 #+cindex: custom date/time format
   6461 #+cindex: time format, custom
   6462 #+cindex: date format, custom
   6463 
   6464 #+vindex: org-display-custom-times
   6465 #+vindex: org-time-stamp-custom-formats
   6466 #+vindex: org-timestamp-custom-formats
   6467 Org mode uses the standard ISO notation for dates and times as it is
   6468 defined in ISO 8601.  If you cannot get used to this and require
   6469 another representation of date and time to keep you happy, you can get
   6470 it by customizing the variables ~org-display-custom-times~ and
   6471 ~org-timestamp-custom-formats~.
   6472 
   6473 - {{{kbd(C-c C-x C-t)}}} (~org-toggle-timestamp-overlays~) ::
   6474 
   6475   #+kindex: C-c C-x C-t
   6476   #+findex: org-toggle-time-stamp-overlays
   6477   #+findex: org-toggle-timestamp-overlays
   6478   Toggle the display of custom formats for dates and times.
   6479 
   6480 Org mode needs the default format for scanning, so the custom
   6481 date/time format does not /replace/ the default format.  Instead, it
   6482 is put /over/ the default format using text properties.  This has the
   6483 following consequences:
   6484 
   6485 - You cannot place point onto a timestamp anymore, only before or
   6486   after.
   6487 
   6488 - The {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} keys can no longer be used
   6489   to adjust each component of a timestamp.  If point is at the
   6490   beginning of the stamp, {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} change
   6491   the stamp by one day, just like {{{kbd(S-LEFT)}}}
   6492   {{{kbd(S-RIGHT)}}}.  At the end of the stamp, change the time by one
   6493   minute.
   6494 
   6495 - If the timestamp contains a range of clock times or a repeater,
   6496   these are not overlaid, but remain in the buffer as they were.
   6497 
   6498 - When you delete a timestamp character-by-character, it only
   6499   disappears from the buffer after /all/ (invisible) characters
   6500   belonging to the ISO timestamp have been removed.
   6501 
   6502 - If the custom timestamp format is longer than the default and you
   6503   are using dates in tables, table alignment will be messed up.  If
   6504   the custom format is shorter, things do work as expected.
   6505 
   6506 ** Deadlines and Scheduling
   6507 :PROPERTIES:
   6508 :DESCRIPTION: Planning your work.
   6509 :END:
   6510 
   6511 A timestamp may be preceded by special keywords to facilitate
   6512 planning.  Both the timestamp and the keyword have to be positioned
   6513 immediately after the task they refer to.
   6514 
   6515 - =DEADLINE= ::
   6516 
   6517   #+cindex: @samp{DEADLINE} marker
   6518   Meaning: the task---most likely a TODO item, though not
   6519   necessarily---is supposed to be finished on that date.
   6520 
   6521   #+vindex: org-deadline-warning-days
   6522   On the deadline date, the task is listed in the agenda.  In
   6523   addition, the agenda for /today/ carries a warning about the
   6524   approaching or missed deadline, starting ~org-deadline-warning-days~
   6525   before the due date, and continuing until the entry is marked as
   6526   done.  An example:
   6527 
   6528   #+begin_example
   6529   ,*** TODO write article about the Earth for the Guide
   6530       DEADLINE: <2004-02-29 Sun>
   6531       The editor in charge is [[bbdb:Ford Prefect]]
   6532   #+end_example
   6533 
   6534   #+vindex: org-agenda-skip-deadline-prewarning-if-scheduled
   6535   You can specify a different lead time for warnings for a specific
   6536   deadlines using the following syntax.  Here is an example with
   6537   a warning period of 5 days =DEADLINE: <2004-02-29 Sun -5d>=.  This
   6538   warning is deactivated if the task gets scheduled and you set
   6539   ~org-agenda-skip-deadline-prewarning-if-scheduled~ to ~t~.
   6540 
   6541 - =SCHEDULED= ::
   6542 
   6543   #+cindex: @samp{SCHEDULED} marker
   6544   Meaning: you are planning to start working on that task on the given
   6545   date.
   6546 
   6547   #+vindex: org-agenda-skip-scheduled-if-done
   6548   The headline is listed under the given date[fn:23].  In addition,
   6549   a reminder that the scheduled date has passed is present in the
   6550   compilation for /today/, until the entry is marked as done, i.e.,
   6551   the task is automatically forwarded until completed.
   6552 
   6553   #+begin_example
   6554   ,*** TODO Call Trillian for a date on New Years Eve.
   6555       SCHEDULED: <2004-12-25 Sat>
   6556   #+end_example
   6557 
   6558   #+vindex: org-scheduled-delay-days
   6559   #+vindex: org-agenda-skip-scheduled-delay-if-deadline
   6560   If you want to /delay/ the display of this task in the agenda, use
   6561   =SCHEDULED: <2004-12-25 Sat -2d>=: the task is still scheduled on
   6562   the 25th but will appear two days later.  In case the task contains
   6563   a repeater, the delay is considered to affect all occurrences; if
   6564   you want the delay to only affect the first scheduled occurrence of
   6565   the task, use =--2d= instead.  See ~org-scheduled-delay-days~ and
   6566   ~org-agenda-skip-scheduled-delay-if-deadline~ for details on how to
   6567   control this globally or per agenda.
   6568 
   6569   #+attr_texinfo: :tag Important
   6570   #+begin_quote
   6571   Scheduling an item in Org mode should /not/ be understood in the
   6572   same way that we understand /scheduling a meeting/.  Setting a date
   6573   for a meeting is just a simple appointment, you should mark this
   6574   entry with a simple plain timestamp, to get this item shown on the
   6575   date where it applies.  This is a frequent misunderstanding by Org
   6576   users.  In Org mode, /scheduling/ means setting a date when you want
   6577   to start working on an action item.
   6578   #+end_quote
   6579 
   6580 You may use timestamps with repeaters in scheduling and deadline
   6581 entries.  Org mode issues early and late warnings based on the
   6582 assumption that the timestamp represents the /nearest instance/ of the
   6583 repeater.  However, the use of diary expression entries like
   6584 
   6585 : <%%(diary-float t 42)>
   6586 
   6587 #+texinfo: @noindent
   6588 in scheduling and deadline timestamps is limited.  Org mode does not
   6589 know enough about the internals of each function to issue early and
   6590 late warnings.  However, it shows the item on each day where the
   6591 expression entry matches.
   6592 
   6593 *** Inserting deadlines or schedules
   6594 :PROPERTIES:
   6595 :DESCRIPTION: Planning items.
   6596 :ALT_TITLE: Inserting deadline/schedule
   6597 :END:
   6598 
   6599 The following commands allow you to quickly insert a deadline or to
   6600 schedule an item:[fn:24]
   6601 
   6602 - {{{kbd(C-c C-d)}}} (~org-deadline~) ::
   6603 
   6604   #+kindex: C-c C-d
   6605   #+findex: org-deadline
   6606   #+vindex: org-log-redeadline
   6607   Insert =DEADLINE= keyword along with a stamp.  The insertion happens
   6608   in the line directly following the headline.  Remove any =CLOSED=
   6609   timestamp .  When called with a prefix argument, also remove any
   6610   existing deadline from the entry.  Depending on the variable
   6611   ~org-log-redeadline~, take a note when changing an existing
   6612   deadline[fn:: Note the corresponding =STARTUP= options
   6613   =logredeadline=, =lognoteredeadline=, and =nologredeadline=.].
   6614 
   6615 - {{{kbd(C-c C-s)}}} (~org-schedule~) ::
   6616 
   6617   #+kindex: C-c C-s
   6618   #+findex: org-schedule
   6619   #+vindex: org-log-reschedule
   6620   Insert =SCHEDULED= keyword along with a stamp.  The insertion
   6621   happens in the line directly following the headline.  Remove any
   6622   =CLOSED= timestamp.  When called with a prefix argument, also remove
   6623   the scheduling date from the entry.  Depending on the variable
   6624   ~org-log-reschedule~, take a note when changing an existing
   6625   scheduling time[fn:: Note the corresponding =STARTUP= options
   6626   =logreschedule=, =lognotereschedule=, and =nologreschedule=.].
   6627 
   6628 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
   6629 
   6630   #+kindex: C-c / d
   6631   #+findex: org-check-deadlines
   6632   #+cindex: sparse tree, for deadlines
   6633   #+vindex: org-deadline-warning-days
   6634   Create a sparse tree with all deadlines that are either past-due, or
   6635   which will become due within ~org-deadline-warning-days~.  With
   6636   {{{kbd(C-u)}}} prefix, show all deadlines in the file.  With
   6637   a numeric prefix, check that many days.  For example, {{{kbd(C-1 C-c
   6638   / d)}}} shows all deadlines due tomorrow.
   6639 
   6640 - {{{kbd(C-c / b)}}} (~org-check-before-date~) ::
   6641 
   6642   #+kindex: C-c / b
   6643   #+findex: org-check-before-date
   6644   Sparse tree for deadlines and scheduled items before a given date.
   6645 
   6646 - {{{kbd(C-c / a)}}} (~org-check-after-date~) ::
   6647 
   6648   #+kindex: C-c / a
   6649   #+findex: org-check-after-date
   6650   Sparse tree for deadlines and scheduled items after a given date.
   6651 
   6652 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
   6653 by indicating a relative time e.g., =+1d= sets the date to the next
   6654 day after today, and =--1w= sets the date to the previous week before
   6655 any current timestamp.
   6656 
   6657 *** Repeated tasks
   6658 :PROPERTIES:
   6659 :DESCRIPTION: Items that show up again and again.
   6660 :END:
   6661 #+cindex: tasks, repeated
   6662 #+cindex: repeated tasks
   6663 
   6664 Some tasks need to be repeated again and again.  Org mode helps to
   6665 organize such tasks using a so-called repeater in a =DEADLINE=,
   6666 =SCHEDULED=, or plain timestamps[fn:25].  In the following example:
   6667 
   6668 #+begin_example
   6669 ,** TODO Pay the rent
   6670    DEADLINE: <2005-10-01 Sat +1m>
   6671 #+end_example
   6672 
   6673 #+texinfo: @noindent
   6674 the =+1m= is a repeater; the intended interpretation is that the task
   6675 has a deadline on =<2005-10-01>= and repeats itself every (one) month
   6676 starting from that time.  You can use yearly, monthly, weekly, daily
   6677 and hourly repeat cookies by using the =y=, =m=, =w=, =d= and =h=
   6678 letters.  If you need both a repeater and a special warning period in
   6679 a deadline entry, the repeater should come first and the warning
   6680 period last
   6681 
   6682 : DEADLINE: <2005-10-01 Sat +1m -3d>
   6683 
   6684 #+vindex: org-todo-repeat-to-state
   6685 Deadlines and scheduled items produce entries in the agenda when they
   6686 are over-due, so it is important to be able to mark such an entry as
   6687 done once you have done so.  When you mark a =DEADLINE= or a
   6688 =SCHEDULED= with the TODO keyword =DONE=, it no longer produces
   6689 entries in the agenda.  The problem with this is, however, is that
   6690 then also the /next/ instance of the repeated entry will not be
   6691 active.  Org mode deals with this in the following way: when you try
   6692 to mark such an entry as done, using {{{kbd(C-c C-t)}}}, it shifts the
   6693 base date of the repeating timestamp by the repeater interval, and
   6694 immediately sets the entry state back to TODO[fn:: In fact, the target
   6695 state is taken from, in this sequence, the =REPEAT_TO_STATE= property,
   6696 the variable ~org-todo-repeat-to-state~ if it is a string, the
   6697 previous TODO state if ~org-todo-repeat-to-state~ is ~t~, or the first
   6698 state of the TODO state sequence.].  In the example above, setting the
   6699 state to =DONE= would actually switch the date like this:
   6700 
   6701 #+begin_example
   6702 ,** TODO Pay the rent
   6703    DEADLINE: <2005-11-01 Tue +1m>
   6704 #+end_example
   6705 
   6706 When task contains multiple timestamps with repeater interval, all
   6707 these timestamps are shifted.
   6708 
   6709 To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}},
   6710 i.e., ~org-todo~ with a numeric prefix argument of =-1=.
   6711 
   6712 #+vindex: org-log-repeat
   6713 A timestamp[fn:26] is added under the deadline, to keep a record that
   6714 you actually acted on the previous instance of this deadline.
   6715 
   6716 As a consequence of shifting the base date, this entry is no longer
   6717 visible in the agenda when checking past dates, but all future
   6718 instances will be visible.
   6719 
   6720 With the =+1m= cookie, the date shift is always exactly one month.  So
   6721 if you have not paid the rent for three months, marking this entry
   6722 DONE still keeps it as an overdue deadline.  Depending on the task,
   6723 this may not be the best way to handle it.  For example, if you forgot
   6724 to call your father for 3 weeks, it does not make sense to call him
   6725 3 times in a single day to make up for it.  Finally, there are tasks,
   6726 like changing batteries, which should always repeat a certain time
   6727 /after/ the last time you did it.  For these tasks, Org mode has
   6728 special repeaters =++= and =.+=.  For example:
   6729 
   6730 #+begin_example
   6731 ,** TODO Call Father
   6732    DEADLINE: <2008-02-10 Sun ++1w>
   6733    Marking this DONE shifts the date by at least one week, but also
   6734    by as many weeks as it takes to get this date into the future.
   6735    However, it stays on a Sunday, even if you called and marked it
   6736    done on Saturday.
   6737 
   6738 ,** TODO Empty kitchen trash
   6739    DEADLINE: <2008-02-08 Fri 20:00 ++1d>
   6740    Marking this DONE shifts the date by at least one day, and also
   6741    by as many days as it takes to get the timestamp into the future.
   6742    Since there is a time in the timestamp, the next deadline in the
   6743    future will be on today's date if you complete the task before
   6744    20:00.
   6745 
   6746 ,** TODO Check the batteries in the smoke detectors
   6747    DEADLINE: <2005-11-01 Tue .+1m>
   6748    Marking this DONE shifts the date to one month after today.
   6749 
   6750 ,** TODO Wash my hands
   6751    DEADLINE: <2019-04-05 08:00 Fri .+1h>
   6752    Marking this DONE shifts the date to exactly one hour from now.
   6753 #+end_example
   6754 
   6755 #+vindex: org-agenda-skip-scheduled-repeats-after-deadline
   6756 You may have both scheduling and deadline information for a specific
   6757 task.  If the repeater is set for the scheduling information only, you
   6758 probably want the repeater to be ignored after the deadline.  If so,
   6759 set the variable ~org-agenda-skip-scheduled-repeats-after-deadline~ to
   6760 ~t~.  However, any scheduling information without a repeater is no
   6761 longer relevant once the task is done, and thus, removed upon
   6762 repeating the task.  If you want both scheduling and deadline
   6763 information to repeat after the same interval, set the same repeater
   6764 for both timestamps.
   6765 
   6766 An alternative to using a repeater is to create a number of copies of
   6767 a task subtree, with dates shifted in each copy.  The command
   6768 {{{kbd(C-c C-x c)}}} was created for this purpose; it is described in
   6769 [[*Structure Editing]].
   6770 
   6771 ** Clocking Work Time
   6772 :PROPERTIES:
   6773 :DESCRIPTION: Tracking how long you spend on a task.
   6774 :END:
   6775 #+cindex: clocking time
   6776 #+cindex: time clocking
   6777 
   6778 Org mode allows you to clock the time you spend on specific tasks in
   6779 a project.  When you start working on an item, you can start the
   6780 clock.  When you stop working on that task, or when you mark the task
   6781 done, the clock is stopped and the corresponding time interval is
   6782 recorded.  It also computes the total time spent on each
   6783 subtree[fn:27] of a project.  And it remembers a history or tasks
   6784 recently clocked, so that you can jump quickly between a number of
   6785 tasks absorbing your time.
   6786 
   6787 To save the clock history across Emacs sessions, use:
   6788 
   6789 #+begin_src emacs-lisp
   6790 (setq org-clock-persist 'history)
   6791 (org-clock-persistence-insinuate)
   6792 #+end_src
   6793 
   6794 #+vindex: org-clock-persist
   6795 When you clock into a new task after resuming Emacs, the incomplete
   6796 clock[fn:: To resume the clock under the assumption that you have
   6797 worked on this task while outside Emacs, use =(setq org-clock-persist
   6798 t)=.] is retrieved (see [[*Resolving idle time]]) and you are prompted
   6799 about what to do with it.
   6800 
   6801 *** Clocking commands
   6802 :PROPERTIES:
   6803 :DESCRIPTION: Starting and stopping a clock.
   6804 :END:
   6805 
   6806 #+attr_texinfo: :sep ,
   6807 - {{{kbd(C-c C-x C-i)}}} (~org-clock-in~) ::
   6808 
   6809   #+kindex: C-c C-x C-i
   6810   #+findex: org-clock-in
   6811   #+vindex: org-clock-into-drawer
   6812   #+vindex: org-clock-continuously
   6813   #+cindex: @samp{LOG_INTO_DRAWER}, property
   6814   Start the clock on the current item (clock-in).  This inserts the
   6815   =CLOCK= keyword together with a timestamp.  If this is not the first
   6816   clocking of this item, the multiple =CLOCK= lines are wrapped into
   6817   a =LOGBOOK= drawer (see also the variable ~org-clock-into-drawer~).
   6818   You can also overrule the setting of this variable for a subtree by
   6819   setting a =CLOCK_INTO_DRAWER= or =LOG_INTO_DRAWER= property.  When
   6820   called with a {{{kbd(C-u)}}} prefix argument, select the task from
   6821   a list of recently clocked tasks.  With two {{{kbd(C-u C-u)}}}
   6822   prefixes, clock into the task at point and mark it as the default
   6823   task; the default task is always be available with letter
   6824   {{{kbd(d)}}} when selecting a clocking task.  With three {{{kbd(C-u
   6825   C-u C-u)}}} prefixes, force continuous clocking by starting the
   6826   clock when the last clock stopped.
   6827 
   6828   #+cindex: @samp{CLOCK_MODELINE_TOTAL}, property
   6829   #+cindex: @samp{LAST_REPEAT}, property
   6830   #+vindex: org-clock-mode-line-total
   6831   #+vindex: org-clock-in-prepare-hook
   6832   While the clock is running, Org shows the current clocking time in
   6833   the mode line, along with the title of the task.  The clock time
   6834   shown is all time ever clocked for this task and its children.  If
   6835   the task has an effort estimate (see [[*Effort Estimates]]), the
   6836   mode line displays the current clocking time against it[fn:: To add
   6837   an effort estimate "on the fly", hook a function doing this to
   6838   ~org-clock-in-prepare-hook~.].  If the task is a repeating one (see
   6839   [[*Repeated tasks]]), show only the time since the last reset of the
   6840   task[fn:: The last reset of the task is recorded by the
   6841   =LAST_REPEAT= property.].  You can exercise more control over show
   6842   time with the =CLOCK_MODELINE_TOTAL= property.  It may have the
   6843   values =current= to show only the current clocking instance, =today=
   6844   to show all time clocked on this tasks today---see also the variable
   6845   ~org-extend-today-until~, ~all~ to include all time, or ~auto~ which
   6846   is the default[fn:: See also the variable
   6847   ~org-clock-mode-line-total~.].  Clicking with {{{kbd(mouse-1)}}}
   6848   onto the mode line entry pops up a menu with clocking options.
   6849 
   6850 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
   6851 
   6852   #+kindex: C-c C-x C-o
   6853   #+findex: org-clock-out
   6854   #+vindex: org-log-note-clock-out
   6855   Stop the clock (clock-out).  This inserts another timestamp at the
   6856   same location where the clock was last started.  It also directly
   6857   computes the resulting time in inserts it after the time range as
   6858   ==>HH:MM=.  See the variable ~org-log-note-clock-out~ for the
   6859   possibility to record an additional note together with the clock-out
   6860   timestamp[fn:: The corresponding in-buffer setting is: =#+STARTUP:
   6861   lognoteclock-out=.].
   6862 
   6863 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
   6864 
   6865   #+kindex: C-c C-x C-x
   6866   #+findex: org-clock-in-last
   6867   #+vindex: org-clock-continuously
   6868   Re-clock the last clocked task.  With one {{{kbd(C-u)}}} prefix
   6869   argument, select the task from the clock history.  With two
   6870   {{{kbd(C-u)}}} prefixes, force continuous clocking by starting the
   6871   clock when the last clock stopped.
   6872 
   6873 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
   6874 
   6875   #+kindex: C-c C-x C-e
   6876   #+findex: org-clock-modify-effort-estimate
   6877   Update the effort estimate for the current clock task.
   6878 
   6879 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
   6880 
   6881   #+kindex: C-c C-c
   6882   #+kindex: C-c C-y
   6883   #+findex: org-evaluate-time-range
   6884   Recompute the time interval after changing one of the timestamps.
   6885   This is only necessary if you edit the timestamps directly.  If you
   6886   change them with {{{kbd(S-<cursor>)}}} keys, the update is
   6887   automatic.
   6888 
   6889 - {{{kbd(C-S-UP)}}} (~org-clock-timestamps-up~), {{{kbd(C-S-DOWN)}}} (~org-clock-timestamps-down~) ::
   6890 
   6891   #+kindex: C-S-UP
   6892   #+findex: org-clock-timestamps-up
   6893   #+findex: org-shiftcontrolup
   6894   #+kindex: C-S-DOWN
   6895   #+findex: org-clock-timestamps-down
   6896   #+findex: org-shiftcontroldown
   6897   On CLOCK log lines, increase/decrease both timestamps so that the
   6898   clock duration keeps the same value.
   6899 
   6900 - {{{kbd(S-M-UP)}}} (~org-timestamp-up~), {{{kbd(S-M-DOWN)}}} (~org-timestamp-down~) ::
   6901 
   6902   #+kindex: S-M-UP
   6903   #+findex: org-timestamp-up
   6904   #+findex: org-shiftmetaup
   6905   #+kindex: S-M-DOWN
   6906   #+findex: org-timestamp-down
   6907   #+findex: org-shiftmetadown
   6908   On =CLOCK= log lines, increase/decrease the timestamp at point and
   6909   the one of the previous, or the next, clock timestamp by the same
   6910   duration.  For example, if you hit {{{kbd(S-M-UP)}}} to increase
   6911   a clocked-out timestamp by five minutes, then the clocked-in
   6912   timestamp of the next clock is increased by five minutes.
   6913 
   6914   Only =CLOCK= logs created during current Emacs session are
   6915   considered when adjusting next/previous timestamp.
   6916 
   6917 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
   6918 
   6919   #+kindex: C-c C-t
   6920   #+findex: org-todo
   6921   Changing the TODO state of an item to DONE automatically stops the
   6922   clock if it is running in this same item.
   6923 
   6924 - {{{kbd(C-c C-x C-q)}}} (~org-clock-cancel~) ::
   6925 
   6926   #+kindex: C-c C-x C-q
   6927   #+findex: org-clock-cancel
   6928   Cancel the current clock.  This is useful if a clock was started by
   6929   mistake, or if you ended up working on something else.
   6930 
   6931 - {{{kbd(C-c C-x C-j)}}} (~org-clock-goto~) ::
   6932 
   6933   #+kindex: C-c C-x C-j
   6934   #+findex: or-clock-goto
   6935   Jump to the headline of the currently clocked in task.  With
   6936   a {{{kbd(C-u)}}} prefix argument, select the target task from a list
   6937   of recently clocked tasks.
   6938 
   6939 - {{{kbd(C-c C-x C-d)}}} (~org-clock-display~) ::
   6940 
   6941   #+kindex: C-c C-x C-d
   6942   #+findex: org-clock-display
   6943   #+vindex: org-remove-highlights-with-change
   6944   Display time summaries for each subtree in the current buffer.  This
   6945   puts overlays at the end of each headline, showing the total time
   6946   recorded under that heading, including the time of any subheadings.
   6947   You can use visibility cycling to study the tree, but the overlays
   6948   disappear when you change the buffer (see variable
   6949   ~org-remove-highlights-with-change~) or press {{{kbd(C-c C-c)}}}.
   6950 
   6951 The {{{kbd(l)}}} key may be used in the agenda (see [[*Weekly/daily
   6952 agenda]]) to show which tasks have been worked on or closed during
   6953 a day.
   6954 
   6955 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
   6956 can have a global keybinding and do not modify the window disposition.
   6957 
   6958 *** The clock table
   6959 :PROPERTIES:
   6960 :DESCRIPTION: Detailed reports.
   6961 :END:
   6962 #+cindex: clocktable, dynamic block
   6963 #+cindex: report, of clocked time
   6964 
   6965 Org mode can produce quite complex reports based on the time clocking
   6966 information.  Such a report is called a /clock table/, because it is
   6967 formatted as one or several Org tables.
   6968 
   6969 #+attr_texinfo: :sep ,
   6970 - ~org-clock-report~ ::
   6971 
   6972   #+kindex: C-c C-x x
   6973   #+findex: org-clock-report
   6974   Insert or update a clock table.  When called with a prefix argument,
   6975   jump to the first clock table in the current document and update it.
   6976   The clock table includes archived trees.
   6977 
   6978   This command can be invoked by calling
   6979   ~org-dynamic-block-insert-dblock~ ({{{kbd(C-c C-x x)}}}) and
   6980   selecting "clocktable" (see [[*Dynamic Blocks]]).
   6981 
   6982 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
   6983 
   6984   #+kindex: C-c C-c
   6985   #+kindex: C-c C-x C-u
   6986   #+findex: org-dblock-update
   6987   Update dynamic block at point.  Point needs to be in the =BEGIN=
   6988   line of the dynamic block.
   6989 
   6990 - {{{kbd(C-u C-c C-x C-u)}}} ::
   6991 
   6992   #+kindex: C-u C-c C-x C-u
   6993   Update all dynamic blocks (see [[*Dynamic Blocks]]).  This is useful if
   6994   you have several clock table blocks in a buffer.
   6995 
   6996 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} (~org-clocktable-try-shift~) ::
   6997 
   6998   #+kindex: S-LEFT
   6999   #+kindex: S-RIGHT
   7000   #+findex: org-clocktable-try-shift
   7001   Shift the current =:block= interval and update the table.  Point
   7002   needs to be in the =#+BEGIN: clocktable= line for this command.  If
   7003   =:block= is =today=, it is shifted to =today-1=, etc.
   7004 
   7005 Here is an example of the frame for a clock table as it is inserted
   7006 into the buffer by ~org-clock-report~:
   7007 
   7008 #+cindex: @samp{BEGIN clocktable}
   7009 #+begin_example
   7010 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
   7011 ,#+END:
   7012 #+end_example
   7013 
   7014 #+vindex: org-clocktable-defaults
   7015 The =#+BEGIN= line contains options to define the scope, structure,
   7016 and formatting of the report.  Defaults for all these options can be
   7017 configured in the variable ~org-clocktable-defaults~.
   7018 
   7019 First there are options that determine which clock entries are to
   7020 be selected:
   7021 
   7022 - =:maxlevel= ::
   7023 
   7024   Maximum level depth to which times are listed in the table.  Clocks
   7025   at deeper levels are summed into the upper level.
   7026 
   7027 - =:scope= ::
   7028 
   7029   The scope to consider.  This can be any of the following:
   7030 
   7031   | =nil=                  | the current buffer or narrowed region                               |
   7032   | =file=                 | the full current buffer                                             |
   7033   | =subtree=              | the subtree where the clocktable is located                         |
   7034   | =treeN=                | the surrounding level N tree, for example =tree3=                   |
   7035   | =tree=                 | the surrounding level 1 tree                                        |
   7036   | =agenda=               | all agenda files                                                    |
   7037   | =("file" ...)=         | scan these files                                                    |
   7038   | =FUNCTION=             | scan files returned by calling {{{var(FUNCTION)}}} with no argument |
   7039   | =file-with-archives=   | current file and its archives                                       |
   7040   | =agenda-with-archives= | all agenda files, including archives                                |
   7041 
   7042 - =:block= ::
   7043 
   7044   The time block to consider.  This block is specified either
   7045   absolutely, or relative to the current time and may be any of these
   7046   formats:
   7047 
   7048   | =2007-12-31=                            | New year eve 2007     |
   7049   | =2007-12=                               | December 2007         |
   7050   | =2007-W50=                              | ISO-week 50 in 2007   |
   7051   | =2007-Q2=                               | 2nd quarter in 2007   |
   7052   | =2007=                                  | the year 2007         |
   7053   | =today=, =yesterday=, =today-N=         | a relative day        |
   7054   | =thisweek=, =lastweek=, =thisweek-N=    | a relative week       |
   7055   | =thismonth=, =lastmonth=, =thismonth-N= | a relative month      |
   7056   | =thisyear=, =lastyear=, =thisyear-N=    | a relative year       |
   7057   | =untilnow=[fn:28]                       | all clocked time ever |
   7058 
   7059   #+vindex: org-clock-display-default-range
   7060   When this option is not set, Org falls back to the value in
   7061   ~org-clock-display-default-range~, which defaults to the current
   7062   year.
   7063 
   7064   Use {{{kbd(S-LEFT)}}} or {{{kbd(S-RIGHT)}}} to shift the time
   7065   interval.
   7066 
   7067 - =:tstart= ::
   7068 
   7069   A time string specifying when to start considering times.  Relative
   7070   times like ="<-2w>"= can also be used.  See [[*Matching tags and
   7071   properties]] for relative time syntax.
   7072 
   7073 - =:tend= ::
   7074 
   7075   A time string specifying when to stop considering times.  Relative
   7076   times like ="<now>"= can also be used.  See [[*Matching tags and
   7077   properties]] for relative time syntax.
   7078 
   7079 - =:wstart= ::
   7080 
   7081   The starting day of the week.  The default is 1 for Monday.
   7082 
   7083 - =:mstart= ::
   7084 
   7085   The starting day of the month.  The default is 1 for the first.
   7086 
   7087 - =:step= ::
   7088 
   7089   Set to =day=, =week=, =semimonth=, =month=, =quarter=, or =year= to split the
   7090   table into chunks.  To use this, either =:block=, or =:tstart= and
   7091   =:tend= are required.
   7092 
   7093 - =:stepskip0= ::
   7094 
   7095   When non-~nil~, do not show steps that have zero time.
   7096 
   7097 - =:fileskip0= ::
   7098 
   7099   When non-~nil~, do not show table sections from files which did not
   7100   contribute.
   7101 
   7102 - =:match= ::
   7103 
   7104   A tags match to select entries that should contribute.  See
   7105   [[*Matching tags and properties]] for the match syntax.
   7106 
   7107 #+findex: org-clocktable-write-default
   7108 Then there are options that determine the formatting of the table.
   7109 There options are interpreted by the function
   7110 ~org-clocktable-write-default~, but you can specify your own function
   7111 using the =:formatter= parameter.
   7112 
   7113 - =:emphasize= ::
   7114 
   7115   When non-~nil~, emphasize level one and level two items.
   7116 
   7117 - =:lang= ::
   7118 
   7119   Language[fn:: Language terms can be set through the variable
   7120   ~org-clock-clocktable-language-setup~.] to use for descriptive cells
   7121   like "Task".
   7122 
   7123 - =:link= ::
   7124 
   7125   Link the item headlines in the table to their origins.
   7126 
   7127 - =:narrow= ::
   7128 
   7129   An integer to limit the width of the headline column in the Org
   7130   table.  If you write it like =50!=, then the headline is also
   7131   shortened in export.
   7132 
   7133 - =:indent= ::
   7134 
   7135   Indent each headline field according to its level.
   7136 
   7137 - =:filetitle= ::
   7138 
   7139   Show title in the file column if the file has a =#+title=.
   7140 
   7141 - =:hidefiles= ::
   7142 
   7143   Hide the file column when multiple files are used to produce the
   7144   table.
   7145 
   7146 - =:tcolumns= ::
   7147 
   7148   Number of columns to be used for times.  If this is smaller than
   7149   =:maxlevel=, lower levels are lumped into one column.
   7150 
   7151 - =:level= ::
   7152 
   7153   Should a level number column be included?
   7154 
   7155 - =:sort= ::
   7156 
   7157   A cons cell containing the column to sort and a sorting type.  E.g.,
   7158   =:sort (1 . ?a)= sorts the first column alphabetically.
   7159 
   7160 - =:compact= ::
   7161 
   7162   Abbreviation for =:level nil :indent t :narrow 40! :tcolumns 1=.
   7163   All are overwritten except if there is an explicit =:narrow=.
   7164 
   7165 - =:timestamp= ::
   7166 
   7167   A timestamp for the entry, when available.  Look for =SCHEDULED=,
   7168   =DEADLINE=, =TIMESTAMP= and =TIMESTAMP_IA= special properties (see
   7169   [[*Special Properties]]), in this order.
   7170 
   7171 - =:tags= ::
   7172 
   7173   When this flag is non-~nil~, show the headline's tags.
   7174 
   7175 - =:properties= ::
   7176 
   7177   List of properties shown in the table.  Each property gets its own
   7178   column.
   7179 
   7180 - =:inherit-props= ::
   7181 
   7182   When this flag is non-~nil~, the values for =:properties= are
   7183   inherited.
   7184 
   7185 - =:formula= ::
   7186 
   7187   Content of a =TBLFM= keyword to be added and evaluated.  As
   7188   a special case, =:formula %= adds a column with % time.  If you do
   7189   not specify a formula here, any existing formula below the clock
   7190   table survives updates and is evaluated.
   7191 
   7192 - =:formatter= ::
   7193 
   7194   A function to format clock data and insert it into the buffer.
   7195 
   7196 To get a clock summary of the current level 1 tree, for the current
   7197 day, you could write:
   7198 
   7199 #+begin_example
   7200 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
   7201 ,#+END:
   7202 #+end_example
   7203 
   7204 #+texinfo: @noindent
   7205 To use a specific time range you could write[fn:: Note that all
   7206 parameters must be specified in a single line---the line is broken
   7207 here only to fit it into the manual.]
   7208 
   7209 #+begin_example
   7210 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
   7211                     :tend "<2006-08-10 Thu 12:00>"
   7212 ,#+END:
   7213 #+end_example
   7214 
   7215 #+texinfo: @noindent
   7216 A range starting a week ago and ending right now could be written as
   7217 
   7218 #+begin_example
   7219 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
   7220 ,#+END:
   7221 #+end_example
   7222 
   7223 #+texinfo: @noindent
   7224 A summary of the current subtree with % times would be
   7225 
   7226 #+begin_example
   7227 ,#+BEGIN: clocktable :scope subtree :link t :formula %
   7228 ,#+END:
   7229 #+end_example
   7230 
   7231 #+texinfo: @noindent
   7232 A horizontally compact representation of everything clocked during
   7233 last week would be
   7234 
   7235 #+begin_example
   7236 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
   7237 ,#+END:
   7238 #+end_example
   7239 
   7240 *** Resolving idle time and continuous clocking
   7241 :PROPERTIES:
   7242 :DESCRIPTION: Resolving time when you've been idle.
   7243 :ALT_TITLE: Resolving idle time
   7244 :END:
   7245 
   7246 **** Resolving idle time
   7247 :PROPERTIES:
   7248 :UNNUMBERED: notoc
   7249 :END:
   7250 
   7251 #+cindex: resolve idle time
   7252 #+cindex: idle, resolve, dangling
   7253 
   7254 If you clock in on a work item, and then walk away from your
   7255 computer---perhaps to take a phone call---you often need to
   7256 "resolve" the time you were away by either subtracting it from the
   7257 current clock, or applying it to another one.
   7258 
   7259 #+vindex: org-clock-idle-time
   7260 #+vindex: org-clock-x11idle-program-name
   7261 By customizing the variable ~org-clock-idle-time~ to some integer,
   7262 such as 10 or 15, Emacs can alert you when you get back to your
   7263 computer after being idle for that many minutes[fn:29], and ask what
   7264 you want to do with the idle time.  There will be a question waiting
   7265 for you when you get back, indicating how much idle time has passed
   7266 constantly updated with the current amount, as well as a set of
   7267 choices to correct the discrepancy:
   7268 
   7269 - {{{kbd(k)}}} ::
   7270 
   7271   #+kindex: k
   7272   To keep some or all of the minutes and stay clocked in, press
   7273   {{{kbd(k)}}}.  Org asks how many of the minutes to keep.  Press
   7274   {{{kbd(RET)}}} to keep them all, effectively changing nothing, or
   7275   enter a number to keep that many minutes.
   7276 
   7277 - {{{kbd(K)}}} ::
   7278 
   7279   #+kindex: K
   7280   If you use the shift key and press {{{kbd(K)}}}, it keeps however
   7281   many minutes you request and then immediately clock out of that
   7282   task.  If you keep all of the minutes, this is the same as just
   7283   clocking out of the current task.
   7284 
   7285 - {{{kbd(s)}}} ::
   7286 
   7287   #+kindex: s
   7288   To keep none of the minutes, use {{{kbd(s)}}} to subtract all the
   7289   away time from the clock, and then check back in from the moment you
   7290   returned.
   7291 
   7292 - {{{kbd(S)}}} ::
   7293 
   7294   #+kindex: S
   7295   To keep none of the minutes and just clock out at the start of the
   7296   away time, use the shift key and press {{{kbd(S)}}}.  Remember that
   7297   using shift always leave you clocked out, no matter which option you
   7298   choose.
   7299 
   7300 - {{{kbd(C)}}} ::
   7301 
   7302   #+kindex: C
   7303   To cancel the clock altogether, use {{{kbd(C)}}}.  Note that if
   7304   instead of canceling you subtract the away time, and the resulting
   7305   clock amount is less than a minute, the clock is still canceled
   7306   rather than cluttering up the log with an empty entry.
   7307 
   7308 What if you subtracted those away minutes from the current clock, and
   7309 now want to apply them to a new clock?  Simply clock in to any task
   7310 immediately after the subtraction.  Org will notice that you have
   7311 subtracted time "on the books", so to speak, and will ask if you want
   7312 to apply those minutes to the next task you clock in on.
   7313 
   7314 There is one other instance when this clock resolution magic occurs.
   7315 Say you were clocked in and hacking away, and suddenly your cat chased
   7316 a mouse who scared a hamster that crashed into your UPS's power
   7317 button!  You suddenly lose all your buffers, but thanks to auto-save
   7318 you still have your recent Org mode changes, including your last clock
   7319 in.
   7320 
   7321 If you restart Emacs and clock into any task, Org will notice that you
   7322 have a dangling clock which was never clocked out from your last
   7323 session.  Using that clock's starting time as the beginning of the
   7324 unaccounted-for period, Org will ask how you want to resolve that
   7325 time.  The logic and behavior is identical to dealing with away time
   7326 due to idleness; it is just happening due to a recovery event rather
   7327 than a set amount of idle time.
   7328 
   7329 You can also check all the files visited by your Org agenda for
   7330 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks
   7331 RET)}}} (or {{{kbd(C-c C-x C-z)}}}).
   7332 
   7333 **** Continuous clocking
   7334 :PROPERTIES:
   7335 :UNNUMBERED: notoc
   7336 :END:
   7337 #+cindex: continuous clocking
   7338 
   7339 #+vindex: org-clock-continuously
   7340 You may want to start clocking from the time when you clocked out the
   7341 previous task.  To enable this systematically, set
   7342 ~org-clock-continuously~ to non-~nil~.  Each time you clock in, Org
   7343 retrieves the clock-out time of the last clocked entry for this
   7344 session, and start the new clock from there.
   7345 
   7346 If you only want this from time to time, use three universal prefix
   7347 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
   7348 ~org-clock-in-last~.
   7349 
   7350 **** Clocking out automatically after some idle time
   7351 :PROPERTIES:
   7352 :UNNUMBERED: notoc
   7353 :END:
   7354 #+cindex: auto clocking out after idle time
   7355 
   7356 #+vindex: org-clock-auto-clockout-timer
   7357 When you often forget to clock out before being idle and you don't
   7358 want to manually set the clocking time to take into account, you can
   7359 set ~org-clock-auto-clockout-timer~ to a number of seconds and add
   7360 =(org-clock-auto-clockout-insinuate)= to your =.emacs= file.
   7361 
   7362 When the clock is running and Emacs is idle for more than this number
   7363 of seconds, the clock will be clocked out automatically.
   7364 
   7365 Use =M-x org-clock-toggle-auto-clockout RET= to temporarily turn this
   7366 on or off.
   7367 
   7368 ** Effort Estimates
   7369 :PROPERTIES:
   7370 :DESCRIPTION: Planning work effort in advance.
   7371 :END:
   7372 #+cindex: effort estimates
   7373 #+cindex: @samp{EFFORT}, property
   7374 #+vindex: org-effort-property
   7375 
   7376 If you want to plan your work in a very detailed way, or if you need
   7377 to produce offers with quotations of the estimated work effort, you
   7378 may want to assign effort estimates to entries.  If you are also
   7379 clocking your work, you may later want to compare the planned effort
   7380 with the actual working time, a great way to improve planning
   7381 estimates.
   7382 
   7383 Effort estimates are stored in a special property =EFFORT=.  Multiple
   7384 formats are supported, such as =3:12=, =1:23:45=, or =1d3h5min=; see
   7385 the file =org-duration.el= for more detailed information about the
   7386 format.
   7387 
   7388 You can set the effort for an entry with the following commands:
   7389 
   7390 - {{{kbd(C-c C-x e)}}}  (~org-set-effort~) ::
   7391 
   7392   #+kindex: C-c C-x e
   7393   #+findex: org-set-effort
   7394   Set the effort estimate for the current entry.  With a prefix
   7395   argument, set it to the next allowed value---see below.  This
   7396   command is also accessible from the agenda with the {{{kbd(e)}}}
   7397   key.
   7398 
   7399 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
   7400 
   7401   #+kindex: C-c C-x C-e
   7402   #+findex: org-clock-modify-effort-estimate
   7403   Modify the effort estimate of the item currently being clocked.
   7404 
   7405 Clearly the best way to work with effort estimates is through column
   7406 view (see [[*Column View]]).  You should start by setting up discrete
   7407 values for effort estimates, and a =COLUMNS= format that displays
   7408 these values together with clock sums---if you want to clock your
   7409 time.  For a specific buffer you can use:
   7410 
   7411 #+begin_example
   7412 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
   7413 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
   7414 #+end_example
   7415 
   7416 #+texinfo: @noindent
   7417 #+vindex: org-global-properties
   7418 #+vindex: org-columns-default-format
   7419 or, even better, you can set up these values globally by customizing
   7420 the variables ~org-global-properties~ and
   7421 ~org-columns-default-format~.  In particular if you want to use this
   7422 setup also in the agenda, a global setup may be advised.
   7423 
   7424 The way to assign estimates to individual items is then to switch to
   7425 column mode, and to use {{{kbd(S-RIGHT)}}} and {{{kbd(S-LEFT)}}} to
   7426 change the value.  The values you enter are immediately summed up in
   7427 the hierarchy.  In the column next to it, any clocked time is
   7428 displayed.
   7429 
   7430 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
   7431 If you switch to column view in the daily/weekly agenda, the effort
   7432 column summarizes the estimated work effort for each day[fn:: Please
   7433 note the pitfalls of summing hierarchical data in a flat list (see
   7434 [[*Using Column View in the Agenda]]).], and you can use this to find
   7435 space in your schedule.  To get an overview of the entire part of the
   7436 day that is committed, you can set the option
   7437 ~org-agenda-columns-add-appointments-to-effort-sum~.  The appointments
   7438 on a day that take place over a specified time interval are then also
   7439 added to the load estimate of the day.
   7440 
   7441 Effort estimates can be used in secondary agenda filtering that is
   7442 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in
   7443 the Agenda Buffer]]).  If you have these estimates defined consistently,
   7444 two or three key presses narrow down the list to stuff that fits into
   7445 an available time slot.
   7446 
   7447 ** Taking Notes with a Relative Timer
   7448 :PROPERTIES:
   7449 :DESCRIPTION: Notes with a running timer.
   7450 :ALT_TITLE: Timers
   7451 :END:
   7452 #+cindex: relative timer
   7453 #+cindex: countdown timer
   7454 
   7455 Org provides two types of timers.  There is a relative timer that
   7456 counts up, which can be useful when taking notes during, for example,
   7457 a meeting or a video viewing.  There is also a countdown timer.
   7458 
   7459 The relative and countdown are started with separate commands.
   7460 
   7461 - {{{kbd(C-c C-x 0)}}} (~org-timer-start~) ::
   7462 
   7463   #+kindex: C-c C-x 0
   7464   #+findex: org-timer-start
   7465   Start or reset the relative timer.  By default, the timer is set
   7466   to 0.  When called with a {{{kbd(C-u)}}} prefix, prompt the user for
   7467   a starting offset.  The prompt will default to a timer string at
   7468   point (if any), providing a convenient way to restart taking notes
   7469   after a break in the process.  When called with a double prefix
   7470   argument {{{kbd(C-u C-u)}}}, change all timer strings in the active
   7471   region by a certain amount.  This can be used to fix timer strings
   7472   if the timer was not started at exactly the right moment.
   7473 
   7474 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
   7475 
   7476   #+kindex: C-c C-x ;
   7477   #+findex: org-timer-set-timer
   7478   #+vindex: org-timer-default-timer
   7479   Start a countdown timer.  The user is prompted for a duration.
   7480   ~org-timer-default-timer~ sets the default countdown value.  Giving
   7481   a numeric prefix argument overrides this default value.  This
   7482   command is available as {{{kbd(;)}}} in agenda buffers.
   7483 
   7484 Once started, relative and countdown timers are controlled with the
   7485 same commands.
   7486 
   7487 - {{{kbd(C-c C-x .)}}} (~org-timer~) ::
   7488 
   7489   #+kindex: C-c C-x .
   7490   #+findex: org-timer
   7491   Insert a relative time into the buffer.  The first time you use
   7492   this, the timer starts.  Using a prefix argument restarts it.
   7493 
   7494 - {{{kbd(C-c C-x -)}}} (~org-timer-item~) ::
   7495 
   7496   #+kindex: C-c C-x -
   7497   #+findex: org-timer-item
   7498   Insert a description list item with the current relative time.  With
   7499   a prefix argument, first reset the timer to 0.
   7500 
   7501 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
   7502 
   7503   #+kindex: M-RET
   7504   #+findex: org-insert-heading
   7505   Once the timer list is started, you can also use {{{kbd(M-RET)}}} to
   7506   insert new timer items.
   7507 
   7508 - {{{kbd(C-c C-x \,)}}} (~org-timer-pause-or-continue~) ::
   7509 
   7510   #+kindex: C-c C-x ,
   7511   #+findex: org-timer-pause-or-continue
   7512   Pause the timer, or continue it if it is already paused.
   7513 
   7514 - {{{kbd(C-c C-x _)}}} (~org-timer-stop~) ::
   7515 
   7516   #+kindex: C-c C-x _
   7517   #+findex: org-timer-stop
   7518   Stop the timer.  After this, you can only start a new timer, not
   7519   continue the old one.  This command also removes the timer from the
   7520   mode line.
   7521 
   7522 * Refiling and Archiving
   7523 :PROPERTIES:
   7524 :DESCRIPTION: Moving and copying information with ease.
   7525 :END:
   7526 #+cindex: refiling notes
   7527 #+cindex: copying notes
   7528 #+cindex: archiving
   7529 
   7530 Once information is in the system, it may need to be moved around.
   7531 Org provides Refile, Copy and Archive commands for this.  Refile and
   7532 Copy helps with moving and copying outlines.  Archiving helps to keep
   7533 the system compact and fast.
   7534 
   7535 ** Refile and Copy
   7536 :PROPERTIES:
   7537 :DESCRIPTION: Moving/copying a tree from one place to another.
   7538 :END:
   7539 #+cindex: refiling notes
   7540 #+cindex: copying notes
   7541 
   7542 When reviewing the captured data, you may want to refile or to copy
   7543 some of the entries into a different list, for example into a project.
   7544 Cutting, finding the right location, and then pasting the note is
   7545 cumbersome.  To simplify this process, you can use the following
   7546 special command:
   7547 
   7548 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
   7549 
   7550   #+kindex: C-c C-w
   7551   #+findex: org-refile
   7552   #+vindex: org-reverse-note-order
   7553   #+vindex: org-refile-targets
   7554   #+vindex: org-refile-use-outline-path
   7555   #+vindex: org-outline-path-complete-in-steps
   7556   #+vindex: org-refile-allow-creating-parent-nodes
   7557   #+vindex: org-log-refile
   7558   Refile the entry or region at point.  This command offers possible
   7559   locations for refiling the entry and lets you select one with
   7560   completion.  The item (or all items in the region) is filed below
   7561   the target heading as a subitem.  Depending on
   7562   ~org-reverse-note-order~, it is either the first or last subitem.
   7563 
   7564   By default, all level 1 headlines in the current buffer are
   7565   considered to be targets, but you can have more complex definitions
   7566   across a number of files.  See the variable ~org-refile-targets~ for
   7567   details.  If you would like to select a location via a
   7568   file-path-like completion along the outline path, see the variables
   7569   ~org-refile-use-outline-path~ and
   7570   ~org-outline-path-complete-in-steps~.  If you would like to be able
   7571   to create new nodes as new parents for refiling on the fly, check
   7572   the variable ~org-refile-allow-creating-parent-nodes~.  When the
   7573   variable ~org-log-refile~[fn:: Note the corresponding =STARTUP=
   7574   options =logrefile=, =lognoterefile=, and =nologrefile=.] is set, a
   7575   timestamp or a note is recorded whenever an entry is refiled.
   7576 
   7577 - {{{kbd(C-u C-c C-w)}}} ::
   7578 
   7579   #+kindex: C-u C-c C-w
   7580   Use the refile interface to jump to a heading.
   7581 
   7582 - {{{kbd(C-u C-u C-c C-w)}}} (~org-refile-goto-last-stored~) ::
   7583 
   7584   #+kindex: C-u C-u C-c C-w
   7585   #+findex: org-refile-goto-last-stored
   7586   Jump to the location where ~org-refile~ last moved a tree to.
   7587 
   7588 - {{{kbd(C-2 C-c C-w)}}} ::
   7589 
   7590   #+kindex: C-2 C-c C-w
   7591   Refile as the child of the item currently being clocked.
   7592 
   7593 - {{{kbd(C-3 C-c C-w)}}} ::
   7594 
   7595   #+kindex: C-3 C-c C-w
   7596   #+vindex: org-refile-keep
   7597   Refile and keep the entry in place.  Also see ~org-refile-keep~ to
   7598   make this the default behavior, and beware that this may result in
   7599   duplicated =ID= properties.
   7600 
   7601 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}} (~org-refile-cache-clear~) ::
   7602 
   7603   #+kindex: C-u C-u C-u C-c C-w
   7604   #+kindex: C-0 C-c C-w
   7605   #+findex: org-refile-cache-clear
   7606   #+vindex: org-refile-use-cache
   7607   Clear the target cache.  Caching of refile targets can be turned on
   7608   by setting ~org-refile-use-cache~.  To make the command see new
   7609   possible targets, you have to clear the cache with this command.
   7610 
   7611 - {{{kbd(C-c M-w)}}} (~org-refile-copy~) ::
   7612 
   7613   #+kindex: C-c M-w
   7614   #+findex: org-refile-copy
   7615   Copying works like refiling, except that the original note is not
   7616   deleted.
   7617 
   7618 - {{{kbd(C-c C-M-w)}}} (~org-refile-reverse~) ::
   7619 
   7620   #+kindex: C-c C-M-w
   7621   #+findex: org-refile-reverse
   7622   Works like refiling, except that it temporarily toggles how the
   7623   value of ~org-reverse-note-order~ applies to the current buffer.  So
   7624   if ~org-refile~ would append the entry as the last entry under the
   7625   target header, ~org-refile-reverse~ will prepend it as the first
   7626   entry, and vice-versa.
   7627 
   7628 ** Archiving
   7629 :PROPERTIES:
   7630 :DESCRIPTION: What to do with finished products.
   7631 :END:
   7632 #+cindex: archiving
   7633 
   7634 When a project represented by a (sub)tree is finished, you may want to
   7635 move the tree out of the way and to stop it from contributing to the
   7636 agenda.  Archiving is important to keep your working files compact and
   7637 global searches like the construction of agenda views fast.
   7638 
   7639 - {{{kbd(C-c C-x C-a)}}} (~org-archive-subtree-default~) ::
   7640 
   7641   #+kindex: C-c C-x C-a
   7642   #+findex: org-archive-subtree-default
   7643   #+vindex: org-archive-default-command
   7644   Archive the current entry using the command specified in the
   7645   variable ~org-archive-default-command~.
   7646 
   7647 *** Moving a tree to an archive file
   7648 :PROPERTIES:
   7649 :DESCRIPTION: Moving a tree to an archive file.
   7650 :ALT_TITLE: Moving subtrees
   7651 :END:
   7652 #+cindex: external archiving
   7653 
   7654 The most common archiving action is to move a project tree to another
   7655 file, the archive file.
   7656 
   7657 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} (~org-archive-subtree~) ::
   7658 
   7659   #+kindex: C-c C-x C-s
   7660   #+kindex: C-c $
   7661   #+findex: org-archive-subtree
   7662   #+vindex: org-archive-location
   7663   Archive the subtree starting at point position to the location given
   7664   by ~org-archive-location~.
   7665 
   7666 - {{{kbd(C-u C-c C-x C-s)}}} ::
   7667 
   7668   #+kindex: C-u C-c C-x C-s
   7669   Check if any direct children of the current headline could be moved
   7670   to the archive.  To do this, check each subtree for open TODO
   7671   entries.  If none is found, the command offers to move it to the
   7672   archive location.  If point is /not/ on a headline when this command
   7673   is invoked, check level 1 trees.
   7674 
   7675 - {{{kbd(C-u C-u C-c C-x C-s)}}} ::
   7676 
   7677   #+kindex: C-u C-u C-c C-x C-s
   7678   As above, but check subtree for timestamps instead of TODO entries.
   7679   The command offers to archive the subtree if it /does/ contain
   7680   a timestamp, and that timestamp is in the past.
   7681 
   7682 #+cindex: archive locations
   7683 The default archive location is a file in the same directory as the
   7684 current file, with the name derived by appending =_archive= to the
   7685 current file name.  You can also choose what heading to file archived
   7686 items under, with the possibility to add them to a datetree in a file.
   7687 For information and examples on how to specify the file and the
   7688 heading, see the documentation string of the variable
   7689 ~org-archive-location~.
   7690 
   7691 There is also an in-buffer option for setting this variable, for
   7692 example:
   7693 
   7694 #+cindex: @samp{ARCHIVE}, keyword
   7695 : #+ARCHIVE: %s_done::
   7696 
   7697 #+cindex: ARCHIVE, property
   7698 If you would like to have a special archive location for a single
   7699 entry or a (sub)tree, give the entry an =ARCHIVE= property with the
   7700 location as the value (see [[*Properties and Columns]]).
   7701 
   7702 #+vindex: org-archive-save-context-info
   7703 When a subtree is moved, it receives a number of special properties
   7704 that record context information like the file from where the entry
   7705 came, its outline path the archiving time etc.  Configure the variable
   7706 ~org-archive-save-context-info~ to adjust the amount of information
   7707 added.
   7708 
   7709 #+vindex: org-archive-subtree-save-file-p
   7710 When ~org-archive-subtree-save-file-p~ is non-~nil~, save the target
   7711 archive buffer.
   7712 
   7713 *** Internal archiving
   7714 :PROPERTIES:
   7715 :DESCRIPTION: Switch off a tree but keep it in the file.
   7716 :END:
   7717 
   7718 #+cindex: @samp{ARCHIVE}, tag
   7719 If you want to just switch off---for agenda views---certain subtrees
   7720 without moving them to a different file, you can use the =ARCHIVE=
   7721 tag.
   7722 
   7723 A headline that is marked with the =ARCHIVE= tag (see [[*Tags]]) stays at
   7724 its location in the outline tree, but behaves in the following way:
   7725 
   7726 -
   7727   #+vindex: org-cycle-open-archived-trees
   7728   It does not open when you attempt to do so with a visibility cycling
   7729   command (see [[*Visibility Cycling]]).  You can force cycling archived
   7730   subtrees with {{{kbd(C-c C-TAB)}}}, or by setting the option
   7731   ~org-cycle-open-archived-trees~.  Also normal outline commands, like
   7732   ~org-show-all~, open archived subtrees.
   7733 
   7734 -
   7735   #+vindex: org-sparse-tree-open-archived-trees
   7736   During sparse tree construction (see [[*Sparse Trees]]), matches in
   7737   archived subtrees are not exposed, unless you configure the option
   7738   ~org-sparse-tree-open-archived-trees~.
   7739 
   7740 -
   7741   #+vindex: org-agenda-skip-archived-trees
   7742   During agenda view construction (see [[*Agenda Views]]), the content of
   7743   archived trees is ignored unless you configure the option
   7744   ~org-agenda-skip-archived-trees~, in which case these trees are
   7745   always included.  In the agenda you can press {{{kbd(v a)}}} to get
   7746   archives temporarily included.
   7747 
   7748 -
   7749   #+vindex: org-export-with-archived-trees
   7750   Archived trees are not exported (see [[*Exporting]]), only the headline
   7751   is.  Configure the details using the variable
   7752   ~org-export-with-archived-trees~.
   7753 
   7754 -
   7755   #+vindex: org-columns-skip-archived-trees
   7756   Archived trees are excluded from column view unless the variable
   7757   ~org-columns-skip-archived-trees~ is configured to ~nil~.
   7758 
   7759 The following commands help manage the =ARCHIVE= tag:
   7760 
   7761 - {{{kbd(C-c C-x a)}}} (~org-toggle-archive-tag~) ::
   7762 
   7763   #+kindex: C-c C-x a
   7764   #+findex: org-toggle-archive-tag
   7765   Toggle the archive tag for the current headline.  When the tag is
   7766   set, the headline changes to a shadowed face, and the subtree below
   7767   it is hidden.
   7768 
   7769 - {{{kbd(C-u C-c C-x a)}}} ::
   7770 
   7771   #+kindex: C-u C-c C-x a
   7772   Check if any direct children of the current headline should be
   7773   archived.  To do this, check each subtree for open TODO entries.  If
   7774   none is found, the command offers to set the =ARCHIVE= tag for the
   7775   child.  If point is /not/ on a headline when this command is
   7776   invoked, check the level 1 trees.
   7777 
   7778 - {{{kbd(C-c C-TAB)}}} (~org-cycle-force-archived~) ::
   7779 
   7780   #+kindex: C-c C-TAB
   7781   Cycle a tree even if it is tagged with =ARCHIVE=.
   7782 
   7783 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
   7784 
   7785   #+kindex: C-c C-x A
   7786   #+findex: org-archive-to-archive-sibling
   7787   Move the current entry to the /Archive Sibling/.  This is a sibling
   7788   of the entry with the heading =Archive= and the archive tag.  The
   7789   entry becomes a child of that sibling and in this way retains a lot
   7790   of its original context, including inherited tags and approximate
   7791   position in the outline.
   7792 
   7793 * Capture and Attachments
   7794 :PROPERTIES:
   7795 :DESCRIPTION: Dealing with external data.
   7796 :END:
   7797 #+cindex: capture
   7798 #+cindex: attachments
   7799 #+cindex: RSS feeds
   7800 #+cindex: Atom feeds
   7801 #+cindex: protocols, for external access
   7802 
   7803 An important part of any organization system is the ability to quickly
   7804 capture new ideas and tasks, and to associate reference material with
   7805 them.  Org does this using a process called /capture/.  It also can
   7806 store files related to a task (/attachments/) in a special directory.
   7807 Finally, it can parse RSS feeds for information.  To learn how to let
   7808 external programs (for example a web browser) trigger Org to capture
   7809 material, see [[*Protocols for External Access]].
   7810 
   7811 ** Capture
   7812 :PROPERTIES:
   7813 :DESCRIPTION: Capturing new stuff.
   7814 :END:
   7815 #+cindex: capture
   7816 
   7817 Capture lets you quickly store notes with little interruption of your
   7818 work flow.  Org's method for capturing new items is heavily inspired
   7819 by John Wiegley's excellent Remember package.
   7820 
   7821 *** Setting up capture
   7822 :PROPERTIES:
   7823 :DESCRIPTION: Where notes will be stored.
   7824 :END:
   7825 
   7826 The following customization sets a default target file for notes.
   7827 
   7828 #+vindex: org-default-notes-file
   7829 #+begin_src emacs-lisp
   7830 (setq org-default-notes-file (concat org-directory "/notes.org"))
   7831 #+end_src
   7832 
   7833 You may also define a global key for capturing new material (see
   7834 [[*Activation]]).
   7835 
   7836 *** Using capture
   7837 :PROPERTIES:
   7838 :DESCRIPTION: Commands to invoke and terminate capture.
   7839 :END:
   7840 
   7841 - {{{kbd(M-x org-capture)}}} (~org-capture~) ::
   7842 
   7843   #+findex: org-capture
   7844   Display the capture templates menu.  If you have templates defined
   7845   (see [[*Capture templates]]), it offers these templates for selection or
   7846   use a new Org outline node as the default template.  It inserts the
   7847   template into the target file and switch to an indirect buffer
   7848   narrowed to this new node.  You may then insert the information you
   7849   want.
   7850 
   7851 - {{{kbd(C-c C-c)}}} (~org-capture-finalize~) ::
   7852 
   7853   #+kindex: C-c C-c @r{(Capture buffer)}
   7854   #+findex: org-capture-finalize
   7855   Once you have finished entering information into the capture buffer,
   7856   {{{kbd(C-c C-c)}}} returns you to the window configuration before
   7857   the capture process, so that you can resume your work without
   7858   further distraction.  When called with a prefix argument, finalize
   7859   and then jump to the captured item.
   7860 
   7861 - {{{kbd(C-c C-w)}}} (~org-capture-refile~) ::
   7862 
   7863   #+kindex: C-c C-w @r{(Capture buffer)}
   7864   #+findex: org-capture-refile
   7865   Finalize the capture process by refiling the note to a different
   7866   place (see [[*Refile and Copy]]).  Please realize that this is a normal
   7867   refiling command that will be executed---so point position at the
   7868   moment you run this command is important.  If you have inserted
   7869   a tree with a parent and children, first move point back to the
   7870   parent.  Any prefix argument given to this command is passed on to
   7871   the ~org-refile~ command.
   7872 
   7873 - {{{kbd(C-c C-k)}}} (~org-capture-kill~) ::
   7874 
   7875   #+kindex: C-c C-k @r{(Capture buffer)}
   7876   #+findex: org-capture-kill
   7877   Abort the capture process and return to the previous state.
   7878 
   7879 #+kindex: k c @r{(Agenda)}
   7880 You can also call ~org-capture~ in a special way from the agenda,
   7881 using the {{{kbd(k c)}}} key combination.  With this access, any
   7882 timestamps inserted by the selected capture template defaults to the
   7883 date at point in the agenda, rather than to the current date.
   7884 
   7885 To find the locations of the last stored capture, use ~org-capture~
   7886 with prefix commands:
   7887 
   7888 - {{{kbd(C-u M-x org-capture)}}} ::
   7889 
   7890   Visit the target location of a capture template.  You get to select
   7891   the template in the usual way.
   7892 
   7893 - {{{kbd(C-u C-u M-x org-capture)}}} ::
   7894 
   7895   Visit the last stored capture item in its buffer.
   7896 
   7897 #+vindex: org-bookmark-names-plist
   7898 #+vindex: org-capture-last-stored
   7899 You can also jump to the bookmark ~org-capture-last-stored~, which is
   7900 automatically created unless you customize ~org-bookmark-names-plist~.
   7901 
   7902 To insert the capture at point in an Org buffer, call ~org-capture~
   7903 with a {{{kbd(C-0)}}} prefix argument.
   7904 
   7905 *** Capture templates
   7906 :PROPERTIES:
   7907 :DESCRIPTION: Define the outline of different note types.
   7908 :END:
   7909 #+cindex: templates, for Capture
   7910 
   7911 You can use templates for different types of capture items, and for
   7912 different target locations.  The easiest way to create such templates
   7913 is through the customize interface.
   7914 
   7915 - {{{kbd(C)}}} ::
   7916 
   7917   #+kindex: C @r{(Capture menu}
   7918   #+vindex: org-capture-templates
   7919   Customize the variable ~org-capture-templates~.
   7920 
   7921 Before we give the formal description of template definitions, let's
   7922 look at an example.  Say you would like to use one template to create
   7923 general TODO entries, and you want to put these entries under the
   7924 heading =Tasks= in your file =~/org/gtd.org=.  Also, a date tree in
   7925 the file =journal.org= should capture journal entries.  A possible
   7926 configuration would look like:
   7927 
   7928 #+begin_src emacs-lisp
   7929 (setq org-capture-templates
   7930       '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
   7931          "* TODO %?\n  %i\n  %a")
   7932         ("j" "Journal" entry (file+datetree "~/org/journal.org")
   7933          "* %?\nEntered on %U\n  %i\n  %a")))
   7934 #+end_src
   7935 
   7936 If you then press {{{kbd(t)}}} from the capture menu, Org will prepare
   7937 the template for you like this:
   7938 
   7939 #+begin_example
   7940 ,* TODO
   7941   [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
   7942 #+end_example
   7943 
   7944 #+texinfo: @noindent
   7945 During expansion of the template, =%a= has been replaced by a link to
   7946 the location from where you called the capture command.  This can be
   7947 extremely useful for deriving tasks from emails, for example.  You
   7948 fill in the task definition, press {{{kbd(C-c C-c)}}} and Org returns
   7949 you to the same place where you started the capture process.
   7950 
   7951 To define special keys to capture to a particular template without
   7952 going through the interactive template selection, you can create your
   7953 key binding like this:
   7954 
   7955 #+begin_src emacs-lisp
   7956 (define-key global-map (kbd "C-c x")
   7957   (lambda () (interactive) (org-capture nil "x")))
   7958 #+end_src
   7959 
   7960 **** Template elements
   7961 :PROPERTIES:
   7962 :DESCRIPTION: What is needed for a complete template entry.
   7963 :END:
   7964 
   7965 Now lets look at the elements of a template definition.  Each entry in
   7966 ~org-capture-templates~ is a list with the following items:
   7967 
   7968 - keys ::
   7969 
   7970   The keys that selects the template, as a string, characters only,
   7971   for example ="a"=, for a template to be selected with a single key,
   7972   or ="bt"= for selection with two keys.  When using several keys,
   7973   keys using the same prefix key must be sequential in the list and
   7974   preceded by a 2-element entry explaining the prefix key, for
   7975   example:
   7976 
   7977   #+begin_src emacs-lisp
   7978   ("b" "Templates for marking stuff to buy")
   7979   #+end_src
   7980 
   7981   If you do not define a template for the {{{kbd(C)}}} key, this key
   7982   opens the Customize buffer for this complex variable.
   7983 
   7984 - description ::
   7985 
   7986   A short string describing the template, shown during selection.
   7987 
   7988 - type ::
   7989 
   7990   The type of entry, a symbol.  Valid values are:
   7991 
   7992   - ~entry~ ::
   7993 
   7994     An Org mode node, with a headline.  Will be filed as the child of
   7995     the target entry or as a top-level entry.  The target file should
   7996     be an Org file.
   7997 
   7998   - ~item~ ::
   7999 
   8000     A plain list item, placed in the first plain list at the target
   8001     location.  Again the target file should be an Org file.
   8002 
   8003   - ~checkitem~ ::
   8004 
   8005     A checkbox item.  This only differs from the plain list item by
   8006     the default template.
   8007 
   8008   - ~table-line~ ::
   8009 
   8010     A new line in the first table at the target location.  Where
   8011     exactly the line will be inserted depends on the properties
   8012     ~:prepend~ and ~:table-line-pos~ (see below).
   8013 
   8014   - ~plain~ ::
   8015 
   8016     Text to be inserted as it is.
   8017 
   8018 - target ::
   8019 
   8020   #+vindex: org-default-notes-file
   8021   #+vindex: org-directory
   8022   #+cindex: date tree
   8023   Specification of where the captured item should be placed.  In Org
   8024   files, targets usually define a node.  Entries will become children
   8025   of this node.  Other types will be added to the table or list in the
   8026   body of this node.  Most target specifications contain a file name.
   8027   If that file name is the empty string, it defaults to
   8028   ~org-default-notes-file~.  A file can also be given as a variable or
   8029   as a function called with no argument.  When an absolute path is not
   8030   specified for a target, it is taken as relative to ~org-directory~.
   8031 
   8032   Valid values are:
   8033 
   8034   - =(file "path/to/file")= ::
   8035 
   8036     Text will be placed at the beginning or end of that file.
   8037 
   8038   - =(id "id of existing org entry")= ::
   8039 
   8040     Filing as child of this entry, or in the body of the entry.
   8041 
   8042   - =(file+headline "filename" "node headline")= ::
   8043 
   8044     Fast configuration if the target heading is unique in the file.
   8045 
   8046   - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= ::
   8047 
   8048     For non-unique headings, the full path is safer.
   8049 
   8050   - =(file+regexp "filename" "regexp to find location")= ::
   8051 
   8052     Use a regular expression to position point.
   8053 
   8054   - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
   8055 
   8056     This target[fn:30] creates a heading in a date tree[fn:31] for
   8057     today's date.  If the optional outline path is given, the tree
   8058     will be built under the node it is pointing to, instead of at top
   8059     level.  Check out the ~:time-prompt~ and ~:tree-type~ properties
   8060     below for additional options.
   8061 
   8062   - =(file+function "filename" function-finding-location)= ::
   8063 
   8064     A function to find the right location in the file.
   8065 
   8066   - =(clock)= ::
   8067 
   8068     File to the entry that is currently being clocked.
   8069 
   8070   - =(here)= ::
   8071 
   8072     The position of =point=.
   8073 
   8074   - =(function function-finding-location)= ::
   8075 
   8076     Most general way: write your own function which both visits the
   8077     file and moves point to the right location.
   8078 
   8079 - template ::
   8080 
   8081   The template for creating the capture item.  If you leave this
   8082   empty, an appropriate default template will be used.  Otherwise this
   8083   is a string with escape codes, which will be replaced depending on
   8084   time and context of the capture call.  You may also get this
   8085   template string from a file[fn:: When the file name is not absolute,
   8086   Org assumes it is relative to ~org-directory~.], or dynamically,
   8087   from a function using either syntax:
   8088 
   8089   : (file "/path/to/template-file")
   8090   : (function FUNCTION-RETURNING-THE-TEMPLATE)
   8091 
   8092 - properties ::
   8093 
   8094   The rest of the entry is a property list of additional options.
   8095   Recognized properties are:
   8096 
   8097   - ~:prepend~ ::
   8098 
   8099     Normally new captured information will be appended at the target
   8100     location (last child, last table line, last list item, ...).
   8101     Setting this property changes that.
   8102 
   8103   - ~:immediate-finish~ ::
   8104 
   8105     When set, do not offer to edit the information, just file it away
   8106     immediately.  This makes sense if the template only needs
   8107     information that can be added automatically.
   8108 
   8109   - ~:jump-to-captured~ ::
   8110 
   8111     When set, jump to the captured entry when finished.
   8112 
   8113   - ~:empty-lines~ ::
   8114 
   8115     Set this to the number of lines to insert before and after the new
   8116     item.  Default 0, and the only other common value is 1.
   8117 
   8118   - ~:empty-lines-after~ ::
   8119 
   8120     Set this to the number of lines that should be inserted after the
   8121     new item.  Overrides ~:empty-lines~ for the number of lines
   8122     inserted after.
   8123 
   8124   - ~:empty-lines-before~ ::
   8125 
   8126     Set this to the number of lines that should be inserted before the
   8127     new item.  Overrides ~:empty-lines~ for the number lines inserted
   8128     before.
   8129 
   8130   - ~:clock-in~ ::
   8131 
   8132     Start the clock in this item.
   8133 
   8134   - ~:clock-keep~ ::
   8135 
   8136     Keep the clock running when filing the captured entry.
   8137 
   8138   - ~:clock-resume~ ::
   8139 
   8140     If starting the capture interrupted a clock, restart that clock
   8141     when finished with the capture.  Note that ~:clock-keep~ has
   8142     precedence over ~:clock-resume~.  When setting both to non-~nil~,
   8143     the current clock will run and the previous one will not be
   8144     resumed.
   8145 
   8146   - ~:time-prompt~ ::
   8147 
   8148     Prompt for a date/time to be used for date/week trees and when
   8149     filling the template.  Without this property, capture uses the
   8150     current date and time.  Even if this property has not been set,
   8151     you can force the same behavior by calling ~org-capture~ with
   8152     a {{{kbd(C-1)}}} prefix argument.
   8153 
   8154   - ~:tree-type~ ::
   8155 
   8156     Use ~week~ to make a week tree instead of the month-day tree,
   8157     i.e., place the headings for each day under a heading with the
   8158     current ISO week.  Use ~month~ to group entries by month
   8159     only.  Default is to group entries by day.
   8160 
   8161   - ~:unnarrowed~ ::
   8162 
   8163     Do not narrow the target buffer, simply show the full buffer.
   8164     Default is to narrow it so that you only see the new material.
   8165 
   8166   - ~:table-line-pos~ ::
   8167 
   8168     Specification of the location in the table where the new line
   8169     should be inserted.  It should be a string like =II-3= meaning
   8170     that the new line should become the third line before the second
   8171     horizontal separator line.
   8172 
   8173   - ~:kill-buffer~ ::
   8174 
   8175     If the target file was not yet visited when capture was invoked,
   8176     kill the buffer again after capture is completed.
   8177 
   8178   - ~:no-save~ ::
   8179 
   8180     Do not save the target file after finishing the capture.
   8181 
   8182   - ~:refile-targets~ :: Temporarily set ~org-refile-targets~ to the
   8183     value of this property.
   8184 
   8185   - ~:hook~ ::
   8186 
   8187     A nullary function or list of nullary functions run before
   8188     ~org-capture-mode-hook~ when the template is selected.
   8189 
   8190  - ~:prepare-finalize~ ::
   8191 
   8192     A nullary function or list of nullary functions run before
   8193     ~org-capture-prepare-finalize-hook~ when the template is selected.
   8194 
   8195  - ~:before-finalize~ ::
   8196 
   8197     A nullary function or list of nullary functions run before
   8198     ~org-capture-before-finalize-hook~ when the template is selected.
   8199 
   8200  - ~:after-finalize~ ::
   8201 
   8202     A nullary function or list of nullary functions run before
   8203     ~org-capture-after-finalize-hook~ when the template is selected.
   8204 
   8205 **** Template expansion
   8206 :PROPERTIES:
   8207 :DESCRIPTION: Filling in information about time and context.
   8208 :END:
   8209 
   8210 In the template itself, special "%-escapes"[fn:: If you need one of
   8211 these sequences literally, escape the =%= with a backslash.] allow
   8212 dynamic insertion of content.  The templates are expanded in the order
   8213 given here:
   8214 
   8215 - =%[FILE]= ::
   8216 
   8217   Insert the contents of the file given by {{{var(FILE)}}}.
   8218 
   8219 - =%(EXP)= ::
   8220 
   8221   Evaluate Elisp expression {{{var(EXP)}}} and replace it with the
   8222   result.  The {{{var(EXP)}}} form must return a string.  Only
   8223   placeholders pre-existing within the template, or introduced with
   8224   =%[file]=, are expanded this way.  Since this happens after
   8225   expanding non-interactive "%-escapes", those can be used to fill the
   8226   expression.
   8227 
   8228 - =%<FORMAT>= ::
   8229 
   8230   The result of format-time-string on the {{{var(FORMAT)}}}
   8231   specification.
   8232 
   8233 - =%t= ::
   8234 
   8235   Timestamp, date only.
   8236 
   8237 - =%T= ::
   8238 
   8239   Timestamp, with date and time.
   8240 
   8241 - =%u=, =%U= ::
   8242 
   8243   Like =%t=, =%T= above, but inactive timestamps.
   8244 
   8245 - =%i= ::
   8246 
   8247   Initial content, the region when capture is called while the region
   8248   is active.  If there is text before =%i= on the same line, such as
   8249   indentation, and =%i= is not inside a =%(exp)= form, that prefix is
   8250   added before every line in the inserted text.
   8251 
   8252 - =%a= ::
   8253 
   8254   Annotation, normally the link created with ~org-store-link~.
   8255 
   8256 - =%A= ::
   8257 
   8258   Like =%a=, but prompt for the description part.
   8259 
   8260 - =%l= ::
   8261 
   8262   Like =%a=, but only insert the literal link.
   8263 
   8264 - =%L= ::
   8265 
   8266   Like =%l=, but without brackets (the link content itself).
   8267 
   8268 - =%c= ::
   8269 
   8270   Current kill ring head.
   8271 
   8272 - =%x= ::
   8273 
   8274   Content of the X clipboard.
   8275 
   8276 - =%k= ::
   8277 
   8278   Title of the currently clocked task.
   8279 
   8280 - =%K= ::
   8281 
   8282   Link to the currently clocked task.
   8283 
   8284 - =%n= ::
   8285 
   8286   User name (taken from ~user-full-name~).
   8287 
   8288 - =%f= ::
   8289 
   8290   File visited by current buffer when org-capture was called.
   8291 
   8292 - =%F= ::
   8293 
   8294   Full path of the file or directory visited by current buffer.
   8295 
   8296 - =%:keyword= ::
   8297 
   8298   Specific information for certain link types, see below.
   8299 
   8300 - =%^g= ::
   8301 
   8302   Prompt for tags, with completion on tags in target file.
   8303 
   8304 - =%^G= ::
   8305 
   8306   Prompt for tags, with completion all tags in all agenda files.
   8307 
   8308 - =%^t= ::
   8309 
   8310   Like =%t=, but prompt for date.  Similarly =%^T=, =%^u=, =%^U=.  You
   8311   may define a prompt like =%^{Birthday}t=.
   8312 
   8313 - =%^C= ::
   8314 
   8315   Interactive selection of which kill or clip to use.
   8316 
   8317 - =%^L= ::
   8318 
   8319   Like =%^C=, but insert as link.
   8320 
   8321 - =%^{PROP}p= ::
   8322 
   8323   Prompt the user for a value for property {{{var(PROP)}}}.  You may
   8324   specify a default value with =%^{PROP|default}=.
   8325 
   8326 - =%^{PROMPT}X=, X is one of g,G,t,T,u,U,C,L ::
   8327 
   8328   Prompt the user as in =%^X=, but use the custom prompt string.  You
   8329   may specify a default value and completions with
   8330   =%^{PROMPT|default|completion1|completion2|completion3...}X=.
   8331 
   8332 - =%^{PROMPT}= ::
   8333 
   8334   Prompt the user for a string and replace this sequence with it.  You
   8335   may specify a default value and a completion table with
   8336   =%^{prompt|default|completion2|completion3...}=.  The arrow keys
   8337   access a prompt-specific history.
   8338 
   8339 - =%\N= ::
   8340 
   8341   Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}=, where
   8342   {{{var(N)}}} is a number, starting from 1.
   8343 
   8344 - =%?= ::
   8345 
   8346   After completing the template, position point here.
   8347 
   8348 #+vindex: org-store-link-props
   8349 For specific link types, the following keywords are defined[fn:: If
   8350 you define your own link types (see [[*Adding Hyperlink Types]]), any
   8351 property you store with ~org-store-link-props~ can be accessed in
   8352 capture templates in a similar way.]:
   8353 
   8354 #+vindex: org-link-from-user-regexp
   8355 | Link type    | Available keywords                                       |
   8356 |--------------+----------------------------------------------------------|
   8357 | bbdb         | =%:name=, =%:company=                                    |
   8358 | irc          | =%:server=, =%:port=, =%:nick=                           |
   8359 | mh, rmail    | =%:type=, =%:subject=, =%:message-id=                    |
   8360 |              | =%:from=, =%:fromname=, =%:fromaddress=                  |
   8361 |              | =%:to=, =%:toname=, =%:toaddress=                        |
   8362 |              | =%:date= (message date header field)                     |
   8363 |              | =%:date-timestamp= (date as active timestamp)            |
   8364 |              | =%:date-timestamp-inactive= (date as inactive timestamp) |
   8365 |              | =%:fromto= (either "to NAME" or "from NAME")[fn:32]      |
   8366 | gnus         | =%:group=, for messages also all email fields            |
   8367 | w3, w3m      | =%:url=                                                  |
   8368 | info         | =%:file=, =%:node=                                       |
   8369 | calendar     | =%:date=                                                 |
   8370 | org-protocol | =%:link=, =%:description=, =%:annotation=                |
   8371 
   8372 **** Templates in contexts
   8373 :PROPERTIES:
   8374 :DESCRIPTION: Only show a template in a specific context.
   8375 :END:
   8376 
   8377 #+vindex: org-capture-templates-contexts
   8378 To control whether a capture template should be accessible from
   8379 a specific context, you can customize
   8380 ~org-capture-templates-contexts~.  Let's say, for example, that you
   8381 have a capture template "p" for storing Gnus emails containing
   8382 patches.  Then you would configure this option like this:
   8383 
   8384 #+begin_src emacs-lisp
   8385 (setq org-capture-templates-contexts
   8386       '(("p" ((in-mode . "message-mode")))))
   8387 #+end_src
   8388 
   8389 You can also tell that the command key {{{kbd(p)}}} should refer to
   8390 another template.  In that case, add this command key like this:
   8391 
   8392 #+begin_src emacs-lisp
   8393 (setq org-capture-templates-contexts
   8394       '(("p" "q" ((in-mode . "message-mode")))))
   8395 #+end_src
   8396 
   8397 See the docstring of the variable for more information.
   8398 
   8399 ** Attachments
   8400 :PROPERTIES:
   8401 :DESCRIPTION: Attach files to outlines.
   8402 :END:
   8403 #+cindex: attachments
   8404 
   8405 It is often useful to associate reference material with an outline
   8406 node.  Small chunks of plain text can simply be stored in the subtree
   8407 of a project.  Hyperlinks (see [[*Hyperlinks]]) can establish associations
   8408 with files that live elsewhere on a local, or even remote, computer,
   8409 like emails or source code files belonging to a project.
   8410 
   8411 Another method is /attachments/, which are files located in a
   8412 directory belonging to an outline node.  Org uses directories either
   8413 named by a unique ID of each entry, or by a =DIR= property.
   8414 
   8415 *** Attachment defaults and dispatcher
   8416 :PROPERTIES:
   8417 :DESCRIPTION: How to access attachment commands
   8418 :END:
   8419 
   8420 By default, Org attach uses ID properties when adding attachments to
   8421 outline nodes.  This makes working with attachments fully automated.
   8422 There is no decision needed for folder-name or location.  ID-based
   8423 directories are by default located in the =data/= directory, which
   8424 lives in the same directory where your Org file lives[fn:: If you move
   8425 entries or Org files from one directory to another, you may want to
   8426 configure ~org-attach-id-dir~ to contain an absolute path.].
   8427 
   8428 When attachments are made using ~org-attach~ a default tag =ATTACH= is
   8429 added to the node that gets the attachments.
   8430 
   8431 For more control over the setup, see [[*Attachment options]].
   8432 
   8433 The following commands deal with attachments:
   8434 
   8435 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
   8436 
   8437   #+kindex: C-c C-a
   8438   #+findex: org-attach
   8439   The dispatcher for commands related to the attachment system.  After
   8440   these keys, a list of commands is displayed and you must press an
   8441   additional key to select a command:
   8442 
   8443   - {{{kbd(a)}}} (~org-attach-attach~) ::
   8444 
   8445     #+kindex: C-c C-a a
   8446     #+findex: org-attach-attach
   8447     #+vindex: org-attach-method
   8448     Select a file and move it into the task's attachment directory.
   8449     The file is copied, moved, or linked, depending on
   8450     ~org-attach-method~.  Note that hard links are not supported on
   8451     all systems.
   8452 
   8453   - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
   8454 
   8455     #+kindex: C-c C-a c
   8456     #+kindex: C-c C-a m
   8457     #+kindex: C-c C-a l
   8458     Attach a file using the copy/move/link method.  Note that hard
   8459     links are not supported on all systems.
   8460 
   8461   - {{{kbd(b)}}} (~org-attach-buffer~) ::
   8462 
   8463     #+kindex: C-c C-a b
   8464     #+findex: org-attach-buffer
   8465     Select a buffer and save it as a file in the task's attachment
   8466     directory.
   8467 
   8468   - {{{kbd(n)}}} (~org-attach-new~) ::
   8469 
   8470     #+kindex: C-c C-a n
   8471     #+findex: org-attach-new
   8472     Create a new attachment as an Emacs buffer.
   8473 
   8474   - {{{kbd(z)}}} (~org-attach-sync~) ::
   8475 
   8476     #+kindex: C-c C-a z
   8477     #+findex: org-attach-sync
   8478     Synchronize the current task with its attachment directory, in
   8479     case you added attachments yourself.
   8480 
   8481   - {{{kbd(o)}}} (~org-attach-open~) ::
   8482 
   8483     #+kindex: C-c C-a o
   8484     #+findex: org-attach-open
   8485     #+vindex: org-file-apps
   8486     Open current task's attachment.  If there is more than one, prompt
   8487     for a file name first.  Opening follows the rules set by
   8488     ~org-file-apps~.  For more details, see the information on
   8489     following hyperlinks (see [[*Handling Links]]).
   8490 
   8491   - {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
   8492 
   8493     #+kindex: C-c C-a O
   8494     #+findex: org-attach-open-in-emacs
   8495     Also open the attachment, but force opening the file in Emacs.
   8496 
   8497   - {{{kbd(f)}}} (~org-attach-reveal~) ::
   8498 
   8499     #+kindex: C-c C-a f
   8500     #+findex: org-attach-reveal
   8501     Open the current task's attachment directory.
   8502 
   8503   - {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
   8504 
   8505     #+kindex: C-c C-a F
   8506     #+findex: org-attach-reveal-in-emacs
   8507     Also open the directory, but force using Dired in Emacs.
   8508 
   8509   - {{{kbd(d)}}} (~org-attach-delete-one~) ::
   8510 
   8511     #+kindex: C-c C-a d
   8512     Select and delete a single attachment.
   8513 
   8514   - {{{kbd(D)}}} (~org-attach-delete-all~) ::
   8515 
   8516     #+kindex: C-c C-a D
   8517     Delete all of a task's attachments.  A safer way is to open the
   8518     directory in Dired and delete from there.
   8519 
   8520   - {{{kbd(s)}}} (~org-attach-set-directory~) ::
   8521 
   8522     #+kindex: C-c C-a s
   8523     #+cindex: @samp{DIR}, property
   8524     Set a specific directory as the entry's attachment directory.
   8525     This works by putting the directory path into the =DIR=
   8526     property.
   8527 
   8528   - {{{kbd(S)}}} (~org-attach-unset-directory~) ::
   8529 
   8530     #+kindex: C-c C-a S
   8531     #+cindex: @samp{DIR}, property
   8532     Remove the attachment directory.  This command removes the =DIR=
   8533     property and asks the user to either move content inside that
   8534     folder, if an =ID= property is set, delete the content, or to
   8535     leave the attachment directory as is but no longer attached to the
   8536     outline node.
   8537 
   8538 *** Attachment options
   8539 :PROPERTIES:
   8540 :DESCRIPTION: Configuring the attachment system
   8541 :END:
   8542 
   8543 There are a couple of options for attachments that are worth
   8544 mentioning.
   8545 
   8546 - ~org-attach-id-dir~ ::
   8547   #+vindex: org-attach-id-dir
   8548   The directory where attachments are stored when =ID= is used as
   8549   method.
   8550 
   8551 - ~org-attach-dir-relative~ ::
   8552   #+vindex: org-attach-dir-relative
   8553   When setting the =DIR= property on a node using {{{kbd(C-c C-a s)}}}
   8554   (~org-attach-set-directory~), absolute links are entered by default.
   8555   This option changes that to relative links.
   8556 
   8557 - ~org-attach-use-inheritance~ ::
   8558   #+vindex: org-attach-use-inheritance
   8559   By default folders attached to an outline node are inherited from
   8560   parents according to ~org-use-property-inheritance~.  If one instead
   8561   want to set inheritance specifically for Org attach that can be done
   8562   using ~org-attach-use-inheritance~.  Inheriting documents through
   8563   the node hierarchy makes a lot of sense in most cases.  Especially
   8564   when using attachment links (see [[*Attachment links]]).  The following
   8565   example shows one use case for attachment inheritance:
   8566 
   8567   #+begin_example
   8568   ,* Chapter A ...
   8569     :PROPERTIES:
   8570     :DIR: Chapter A/
   8571     :END:
   8572   ,** Introduction
   8573   Some text
   8574 
   8575   #+NAME: Image 1
   8576   [[attachment:image 1.jpg]]
   8577   #+end_example
   8578 
   8579   Without inheritance one would not be able to resolve the link to
   8580   =image 1.jpg=, since the link is inside a sub-heading to =Chapter
   8581   A=.
   8582 
   8583   Inheritance works the same way for both =ID= and =DIR= property.  If
   8584   both properties are defined on the same headline then =DIR= takes
   8585   precedence.  This is also true if inheritance is enabled.  If =DIR=
   8586   is inherited from a parent node in the outline, that property still
   8587   takes precedence over an =ID= property defined on the node itself.
   8588 
   8589 - ~org-attach-method~ ::
   8590   #+vindex: org-attach-method
   8591   When attaching files using the dispatcher {{{kbd(C-c C-a)}}} it
   8592   defaults to copying files.  The behavior can be changed by
   8593   customizing ~org-attach-method~.  Options are Copy, Move/Rename,
   8594   Hard link or Symbolic link.
   8595 
   8596 - ~org-attach-preferred-new-method~ ::
   8597   #+vindex: org-attach-preferred-new-method
   8598   This customization lets you choose the default way to attach to
   8599   nodes without existing =ID= and =DIR= property.  It defaults to ~id~
   8600   but can also be set to ~dir~, ~ask~ or ~nil~.
   8601 
   8602 - ~org-attach-archive-delete~ ::
   8603   #+vindex: org-attach-archive-delete
   8604   Configure this to determine if attachments should be deleted or not
   8605   when a subtree that has attachments is archived.
   8606 
   8607 - ~org-attach-auto-tag~ ::
   8608   #+vindex: org-attach-auto-tag
   8609   When attaching files to a heading it will be assigned a tag
   8610   according to what is set here.
   8611 
   8612 - ~org-attach-id-to-path-function-list~ ::
   8613   #+vindex: org-attach-id-to-path-function-list
   8614   When =ID= is used for attachments, the ID is parsed into a part of a
   8615   directory-path.  See ~org-attach-id-uuid-folder-format~ for the
   8616   default function.  Define a new one and add it as first element in
   8617   ~org-attach-id-to-path-function-list~ if you want the folder
   8618   structure in any other way.  All functions in this list will be
   8619   tried when resolving existing ID's into paths, to maintain backward
   8620   compatibility with existing folders in your system.
   8621 
   8622 - ~org-attach-store-link-p~ ::
   8623   #+vindex: org-attach-store-link-p
   8624   Stores a link to the file that is being attached.  The link is
   8625   stored in ~org-stored-links~ for later insertion with {{{kbd(C-c
   8626   C-l)}}} (see [[*Handling Links]]).  Depending on what option is set in
   8627   ~org-attach-store-link-p~, the link is stored to either the original
   8628   location as a file link, the attachment location as an attachment
   8629   link or to the attachment location as a file link.
   8630 
   8631 - ~org-attach-commands~ ::
   8632   #+vindex: org-attach-commands
   8633   List of all commands used in the attach dispatcher.
   8634 
   8635 - ~org-attach-expert~ ::
   8636   #+vindex: org-attach-expert
   8637   Do not show the splash buffer with the attach dispatcher when
   8638   ~org-attach-expert~ is set to non-~nil~.
   8639 
   8640 See customization group =Org Attach= if you want to change the
   8641 default settings.
   8642 
   8643 *** Attachment links
   8644 :PROPERTIES:
   8645 :DESCRIPTION: Hyperlink access to attachments
   8646 :END:
   8647 
   8648 Attached files and folders can be referenced using attachment links.
   8649 This makes it easy to refer to the material added to an outline node.
   8650 Especially if it was attached using the unique ID of the entry!
   8651 
   8652 #+begin_example
   8653 ,* TODO Some task
   8654   :PROPERTIES:
   8655   :ID:       95d50008-c12e-479f-a4f2-cc0238205319
   8656   :END:
   8657 See attached document for more information: [[attachment:info.org]]
   8658 #+end_example
   8659 
   8660 See [[*External Links]] for more information about these links.
   8661 
   8662 *** Automatic version-control with Git
   8663 :PROPERTIES:
   8664 :DESCRIPTION: Everything safely stored away
   8665 :END:
   8666 
   8667 If the directory attached to an outline node is a Git repository, Org
   8668 can be configured to automatically commit changes to that repository
   8669 when it sees them.
   8670 
   8671 To make Org mode take care of versioning of attachments for you, add
   8672 the following to your Emacs config:
   8673 
   8674 #+begin_src emacs-lisp
   8675 (require 'org-attach-git)
   8676 #+end_src
   8677 
   8678 *** Attach from Dired
   8679 :PROPERTIES:
   8680 :DESCRIPTION: Using dired to select an attachment
   8681 :END:
   8682 #+cindex: attach from Dired
   8683 #+findex: org-attach-dired-to-subtree
   8684 
   8685 It is possible to attach files to a subtree from a Dired buffer.  To
   8686 use this feature, have one window in Dired mode containing the file(s)
   8687 to be attached and another window with point in the subtree that shall
   8688 get the attachments.  In the Dired window, with point on a file,
   8689 {{{kbd(M-x org-attach-dired-to-subtree)}}} attaches the file to the
   8690 subtree using the attachment method set by variable
   8691 ~org-attach-method~.  When files are marked in the Dired window then
   8692 all marked files get attached.
   8693 
   8694 Add the following lines to the Emacs init file to have {{{kbd(C-c C-x
   8695 a)}}} attach files in Dired buffers.
   8696 
   8697 #+begin_src emacs-lisp
   8698 (add-hook 'dired-mode-hook
   8699           (lambda ()
   8700             (define-key dired-mode-map
   8701               (kbd "C-c C-x a")
   8702               #'org-attach-dired-to-subtree)))
   8703 #+end_src
   8704 
   8705 The following code shows how to bind the previous command with
   8706 a specific attachment method.
   8707 
   8708 #+begin_src emacs-lisp
   8709 (add-hook 'dired-mode-hook
   8710           (lambda ()
   8711             (define-key dired-mode-map (kbd "C-c C-x c")
   8712               (lambda ()
   8713                 (interactive)
   8714                 (let ((org-attach-method 'cp))
   8715                   (call-interactively #'org-attach-dired-to-subtree))))))
   8716 #+end_src
   8717 
   8718 ** RSS Feeds
   8719 :PROPERTIES:
   8720 :DESCRIPTION: Getting input from RSS feeds.
   8721 :END:
   8722 #+cindex: RSS feeds
   8723 #+cindex: Atom feeds
   8724 
   8725 Org can add and change entries based on information found in RSS feeds
   8726 and Atom feeds.  You could use this to make a task out of each new
   8727 podcast in a podcast feed.  Or you could use a phone-based
   8728 note-creating service on the web to import tasks into Org.  To access
   8729 feeds, configure the variable ~org-feed-alist~.  The docstring of this
   8730 variable has detailed information.  With the following
   8731 
   8732 #+begin_src emacs-lisp
   8733 (setq org-feed-alist
   8734       '(("Slashdot"
   8735          "https://rss.slashdot.org/Slashdot/slashdot"
   8736          "~/txt/org/feeds.org" "Slashdot Entries")))
   8737 #+end_src
   8738 
   8739 #+texinfo: @noindent
   8740 new items from the feed provided by =rss.slashdot.org= result in new
   8741 entries in the file =~/org/feeds.org= under the heading =Slashdot
   8742 Entries=, whenever the following command is used:
   8743 
   8744 - {{{kbd(C-c C-x g)}}} (~org-feed-update-all~) ::
   8745 
   8746   #+kindex: C-c C-x g
   8747   Collect items from the feeds configured in ~org-feed-alist~ and act
   8748   upon them.
   8749 
   8750 - {{{kbd(C-c C-x G)}}} (~org-feed-goto-inbox~) ::
   8751 
   8752   #+kindex: C-c C-x G
   8753   Prompt for a feed name and go to the inbox configured for this feed.
   8754 
   8755 Under the same headline, Org creates a drawer =FEEDSTATUS= in which it
   8756 stores information about the status of items in the feed, to avoid
   8757 adding the same item several times.
   8758 
   8759 For more information, including how to read atom feeds, see
   8760 =org-feed.el= and the docstring of ~org-feed-alist~.
   8761 
   8762 * Agenda Views
   8763 :PROPERTIES:
   8764 :DESCRIPTION: Collecting information into views.
   8765 :END:
   8766 #+cindex: agenda views
   8767 
   8768 Due to the way Org works, TODO items, time-stamped items, and tagged
   8769 headlines can be scattered throughout a file or even a number of
   8770 files.  To get an overview of open action items, or of events that are
   8771 important for a particular date, this information must be collected,
   8772 sorted and displayed in an organized way.
   8773 
   8774 Org can select items based on various criteria and display them in
   8775 a separate buffer.  Six different view types are provided:
   8776 
   8777 - an /agenda/ that is like a calendar and shows information for
   8778   specific dates,
   8779 
   8780 - a /TODO list/ that covers all unfinished action items,
   8781 
   8782 - a /match view/, showings headlines based on the tags, properties,
   8783   and TODO state associated with them,
   8784 
   8785 - a /text search view/ that shows all entries from multiple files that
   8786   contain specified keywords,
   8787 
   8788 - a /stuck projects view/ showing projects that currently do not move
   8789   along, and
   8790 
   8791 - /custom views/ that are special searches and combinations of
   8792   different views.
   8793 
   8794 The extracted information is displayed in a special /agenda buffer/.
   8795 This buffer is read-only, but provides commands to visit the
   8796 corresponding locations in the original Org files, and even to edit
   8797 these files remotely.
   8798 
   8799 #+vindex: org-agenda-skip-comment-trees
   8800 #+vindex: org-agenda-skip-archived-trees
   8801 #+cindex: commented entries, in agenda views
   8802 #+cindex: archived entries, in agenda views
   8803 By default, the report ignores commented (see [[*Comment Lines]]) and
   8804 archived (see [[*Internal archiving]]) entries.  You can override this by
   8805 setting ~org-agenda-skip-comment-trees~ and
   8806 ~org-agenda-skip-archived-trees~ to ~nil~.
   8807 
   8808 #+vindex: org-agenda-window-setup
   8809 #+vindex: org-agenda-restore-windows-after-quit
   8810 Two variables control how the agenda buffer is displayed and whether
   8811 the window configuration is restored when the agenda exits:
   8812 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
   8813 
   8814 ** Agenda Files
   8815 :PROPERTIES:
   8816 :DESCRIPTION: Files being searched for agenda information.
   8817 :END:
   8818 #+cindex: agenda files
   8819 #+cindex: files for agenda
   8820 
   8821 #+vindex: org-agenda-files
   8822 The information to be shown is normally collected from all /agenda
   8823 files/, the files listed in the variable ~org-agenda-files~[fn:: If
   8824 the value of that variable is not a list, but a single file name, then
   8825 the list of agenda files in maintained in that external file.].  If a
   8826 directory is part of this list, all files with the extension =.org= in
   8827 this directory are part of the list.
   8828 
   8829 Thus, even if you only work with a single Org file, that file should
   8830 be put into the list[fn:: When using the dispatcher, pressing
   8831 {{{kbd(<)}}} before selecting a command actually limits the command to
   8832 the current file, and ignores ~org-agenda-files~ until the next
   8833 dispatcher command.].  You can customize ~org-agenda-files~, but the
   8834 easiest way to maintain it is through the following commands
   8835 
   8836 #+attr_texinfo: :sep and
   8837 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
   8838 
   8839   #+kindex: C-c [
   8840   #+findex: org-agenda-file-to-front
   8841   #+cindex: files, adding to agenda list
   8842   Add current file to the list of agenda files.  The file is added to
   8843   the front of the list.  If it was already in the list, it is moved
   8844   to the front.  With a prefix argument, file is added/moved to the
   8845   end.
   8846 
   8847 - {{{kbd(C-c ])}}} (~org-remove-file~) ::
   8848 
   8849   #+kindex: C-c ]
   8850   #+findex: org-remove-file
   8851   Remove current file from the list of agenda files.
   8852 
   8853 - {{{kbd(C-')}}} and {{{kbd(C-\,)}}} (~org-cycle-agenda-files~) ::
   8854 
   8855   #+kindex: C-'
   8856   #+kindex: C-,
   8857   #+findex: org-cycle-agenda-files
   8858   #+cindex: cycling, of agenda files
   8859   Cycle through agenda file list, visiting one file after the other.
   8860 
   8861 - {{{kbd(M-x org-switchb)}}} ::
   8862 
   8863   #+findex: org-switchb
   8864   Command to use an Iswitchb-like interface to switch to and between
   8865   Org buffers.
   8866 
   8867 #+texinfo: @noindent
   8868 The Org menu contains the current list of files and can be used to
   8869 visit any of them.
   8870 
   8871 If you would like to focus the agenda temporarily on a file not in
   8872 this list, or on just one file in the list, or even on only a subtree
   8873 in a file, then this can be done in different ways.  For a single
   8874 agenda command, you may press {{{kbd(<)}}} once or several times in
   8875 the dispatcher (see [[*The Agenda Dispatcher]]).  To restrict the agenda
   8876 scope for an extended period, use the following commands:
   8877 
   8878 - {{{kbd(C-c C-x <)}}} (~org-agenda-set-restriction-lock~) ::
   8879 
   8880   #+kindex: C-c C-x <
   8881   #+findex: org-agenda-set-restriction-lock
   8882   Restrict the agenda to the current subtree.  If there already is
   8883   a restriction at point, remove it.  When called with a universal
   8884   prefix argument or with point before the first headline in a file,
   8885   set the agenda scope to the entire file.  This restriction remains
   8886   in effect until removed with {{{kbd(C-c C-x >)}}}, or by typing
   8887   either {{{kbd(<)}}} or {{{kbd(>)}}} in the agenda dispatcher.  If
   8888   there is a window displaying an agenda view, the new restriction
   8889   takes effect immediately.
   8890 
   8891 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
   8892 
   8893   #+kindex: C-c C-x >
   8894   #+findex: org-agenda-remove-restriction-lock
   8895   Remove the restriction created by {{{kbd(C-c C-x <)}}}.
   8896 
   8897 When working with Speedbar, you can use the following commands in the
   8898 Speedbar frame:
   8899 
   8900 - {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) ::
   8901 
   8902   #+findex: org-speedbar-set-agenda-restriction
   8903   Restrict the agenda to the item---either an Org file or a subtree in
   8904   such a file---at point in the Speedbar frame.  If agenda is already
   8905   restricted there, remove the restriction.  If there is a window
   8906   displaying an agenda view, the new restriction takes effect
   8907   immediately.
   8908 
   8909 - {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) ::
   8910 
   8911   #+findex: org-agenda-remove-restriction-lock
   8912   Remove the restriction.
   8913 
   8914 ** The Agenda Dispatcher
   8915 :PROPERTIES:
   8916 :DESCRIPTION: Keyboard access to agenda views.
   8917 :ALT_TITLE: Agenda Dispatcher
   8918 :END:
   8919 #+cindex: agenda dispatcher
   8920 #+cindex: dispatching agenda commands
   8921 
   8922 The views are created through a dispatcher, accessible with {{{kbd(M-x
   8923 org-agenda)}}}, or, better, bound to a global key (see [[*Activation]]).
   8924 It displays a menu from which an additional letter is required to
   8925 execute a command.  The dispatcher offers the following default
   8926 commands:
   8927 
   8928 #+attr_texinfo: :sep ,
   8929 - {{{kbd(a)}}} ::
   8930 
   8931   Create the calendar-like agenda (see [[*Weekly/daily agenda]]).
   8932 
   8933 - {{{kbd(t)}}}, {{{kbd(T)}}} ::
   8934 
   8935   Create a list of all TODO items (see [[*The global TODO list]]).
   8936 
   8937 - {{{kbd(m)}}}, {{{kbd(M)}}} ::
   8938 
   8939   Create a list of headlines matching a given expression (see
   8940   [[*Matching tags and properties]]).
   8941 
   8942 - {{{kbd(s)}}} ::
   8943 
   8944   #+kindex: s @r{(Agenda dispatcher)}
   8945   Create a list of entries selected by a boolean expression of
   8946   keywords and/or regular expressions that must or must not occur in
   8947   the entry.
   8948 
   8949 - {{{kbd(/)}}} ::
   8950 
   8951   #+kindex: / @r{(Agenda dispatcher)}
   8952   #+vindex: org-agenda-text-search-extra-files
   8953   Search for a regular expression in all agenda files and additionally
   8954   in the files listed in ~org-agenda-text-search-extra-files~.  This
   8955   uses the Emacs command ~multi-occur~.  A prefix argument can be used
   8956   to specify the number of context lines for each match, the default
   8957   is 1.
   8958 
   8959 - {{{kbd(#)}}} ::
   8960 
   8961   Create a list of stuck projects (see [[*Stuck projects]]).
   8962 
   8963 - {{{kbd(!)}}} ::
   8964 
   8965   Configure the list of stuck projects (see [[*Stuck projects]]).
   8966 
   8967 - {{{kbd(<)}}} ::
   8968 
   8969   #+kindex: < @r{(Agenda dispatcher)}
   8970   Restrict an agenda command to the current buffer[fn:: For backward
   8971   compatibility, you can also press {{{kbd(1)}}} to restrict to the
   8972   current buffer.].  If narrowing is in effect restrict to the
   8973   narrowed part of the buffer.  After pressing {{{kbd(<)}}}, you still
   8974   need to press the character selecting the command.
   8975 
   8976 - {{{kbd(< <)}}} ::
   8977 
   8978   #+kindex: < < @r{(Agenda dispatcher)}
   8979   If there is an active region, restrict the following agenda command
   8980   to the region.  Otherwise, restrict it to the current subtree.
   8981   After pressing {{{kbd(< <)}}}, you still need to press the character
   8982   selecting the command.
   8983 
   8984 - {{{kbd(*)}}} ::
   8985 
   8986   #+kindex: * @r{(Agenda dispatcher)}
   8987   #+vindex: org-agenda-sticky
   8988   #+findex: org-toggle-sticky-agenda
   8989   Toggle sticky agenda views.  By default, Org maintains only a single
   8990   agenda buffer and rebuilds it each time you change the view, to make
   8991   sure everything is always up to date.  If you switch between views
   8992   often and the build time bothers you, you can turn on sticky agenda
   8993   buffers (make this the default by customizing the variable
   8994   ~org-agenda-sticky~).  With sticky agendas, the dispatcher only
   8995   switches to the selected view, you need to update it by hand with
   8996   {{{kbd(r)}}} or {{{kbd(g)}}}.  You can toggle sticky agenda view any
   8997   time with ~org-toggle-sticky-agenda~.
   8998 
   8999 You can also define custom commands that are accessible through the
   9000 dispatcher, just like the default commands.  This includes the
   9001 possibility to create extended agenda buffers that contain several
   9002 blocks together, for example the weekly agenda, the global TODO list
   9003 and a number of special tags matches.  See [[*Custom Agenda Views]].
   9004 
   9005 ** The Built-in Agenda Views
   9006 :PROPERTIES:
   9007 :DESCRIPTION: What is available out of the box?
   9008 :ALT_TITLE: Built-in Agenda Views
   9009 :END:
   9010 
   9011 In this section we describe the built-in views.
   9012 
   9013 *** Weekly/daily agenda
   9014 :PROPERTIES:
   9015 :DESCRIPTION: The calendar page with current tasks.
   9016 :END:
   9017 #+cindex: agenda
   9018 #+cindex: weekly agenda
   9019 #+cindex: daily agenda
   9020 
   9021 The purpose of the weekly/daily /agenda/ is to act like a page of
   9022 a paper agenda, showing all the tasks for the current week or day.
   9023 
   9024 - {{{kbd(M-x org-agenda a)}}} (~org-agenda-list~) ::
   9025 
   9026   #+kindex: a @r{(Agenda dispatcher)}
   9027   #+findex: org-agenda-list
   9028   #+cindex: org-agenda, command
   9029   Compile an agenda for the current week from a list of Org files.
   9030   The agenda shows the entries for each day.  With a numeric prefix
   9031   argument[fn:33]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
   9032   set the number of days to be displayed.
   9033 
   9034 #+vindex: org-agenda-span
   9035 #+vindex: org-agenda-start-day
   9036 #+vindex: org-agenda-start-on-weekday
   9037 The default number of days displayed in the agenda is set by the
   9038 variable ~org-agenda-span~.  This variable can be set to any number of
   9039 days you want to see by default in the agenda, or to a span name, such
   9040 a ~day~, ~week~, ~month~ or ~year~.  For weekly agendas, the default
   9041 is to start on the previous Monday (see
   9042 ~org-agenda-start-on-weekday~).  You can also set the start date using
   9043 a date shift: =(setq org-agenda-start-day "+10d")= starts the agenda
   9044 ten days from today in the future.  ~org-agenda-start-on-weekday~
   9045 takes precedence over ~org-agenda-start-day~ in weekly and bi-weekly
   9046 agendas.
   9047 
   9048 Remote editing from the agenda buffer means, for example, that you can
   9049 change the dates of deadlines and appointments from the agenda buffer.
   9050 The commands available in the Agenda buffer are listed in [[*Commands in
   9051 the Agenda Buffer]].
   9052 
   9053 **** Calendar/Diary integration
   9054 :PROPERTIES:
   9055 :UNNUMBERED: notoc
   9056 :END:
   9057 #+cindex: calendar integration
   9058 #+cindex: diary integration
   9059 
   9060 Emacs contains the calendar and diary by Edward\nbsp{}M.\nbsp{}Reingold.  The
   9061 calendar displays a three-month calendar with holidays from different
   9062 countries and cultures.  The diary allows you to keep track of
   9063 anniversaries, lunar phases, sunrise/set, recurrent appointments
   9064 (weekly, monthly) and more.  In this way, it is quite complementary to
   9065 Org.  It can be very useful to combine output from Org with the diary.
   9066 
   9067 In order to include entries from the Emacs diary into Org mode's
   9068 agenda, you only need to customize the variable
   9069 
   9070 #+begin_src emacs-lisp
   9071 (setq org-agenda-include-diary t)
   9072 #+end_src
   9073 
   9074 #+texinfo: @noindent
   9075 After that, everything happens automatically.  All diary entries
   9076 including holidays, anniversaries, etc., are included in the agenda
   9077 buffer created by Org mode.  {{{kbd(SPC)}}}, {{{kbd(TAB)}}}, and
   9078 {{{kbd(RET)}}} can be used from the agenda buffer to jump to the diary
   9079 file in order to edit existing diary entries.  The {{{kbd(i)}}}
   9080 command to insert new entries for the current date works in the agenda
   9081 buffer, as well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and
   9082 {{{kbd(C)}}} to display Sunrise/Sunset times, show lunar phases and to
   9083 convert to other calendars, respectively.  {{{kbd(c)}}} can be used to
   9084 switch back and forth between calendar and agenda.
   9085 
   9086 If you are using the diary only for expression entries and holidays,
   9087 it is faster to not use the above setting, but instead to copy or even
   9088 move the entries into an Org file.  Org mode evaluates diary-style
   9089 expression entries, and does it faster because there is no overhead
   9090 for first creating the diary display.  Note that the expression
   9091 entries must start at the left margin, no whitespace is allowed before
   9092 them, as seen in the following segment of an Org file:[fn:: The
   9093 variable ~org-anniversary~ used in the example is just like
   9094 ~diary-anniversary~, but the argument order is always according to ISO
   9095 and therefore independent of the value of ~calendar-date-style~.]
   9096 
   9097 #+begin_example
   9098 ,* Holidays
   9099   :PROPERTIES:
   9100   :CATEGORY: Holiday
   9101   :END:
   9102 %%(org-calendar-holiday)   ; special function for holiday names
   9103 
   9104 ,* Birthdays
   9105   :PROPERTIES:
   9106   :CATEGORY: Ann
   9107   :END:
   9108 %%(org-anniversary 1956  5 14) Arthur Dent is %d years old
   9109 %%(org-anniversary 1869 10  2) Mahatma Gandhi would be %d years old
   9110 #+end_example
   9111 
   9112 **** Anniversaries from BBDB
   9113 :PROPERTIES:
   9114 :UNNUMBERED: notoc
   9115 :END:
   9116 #+cindex: BBDB, anniversaries
   9117 #+cindex: anniversaries, from BBDB
   9118 
   9119 #+findex: org-bbdb-anniversaries
   9120 If you are using the Insidious Big Brother Database to store your
   9121 contacts, you very likely prefer to store anniversaries in BBDB rather
   9122 than in a separate Org or diary file.  Org supports this and can show
   9123 BBDB anniversaries as part of the agenda.  All you need to do is to
   9124 add the following to one of your agenda files:
   9125 
   9126 #+begin_example
   9127 ,* Anniversaries
   9128   :PROPERTIES:
   9129   :CATEGORY: Anniv
   9130   :END:
   9131 %%(org-bbdb-anniversaries)
   9132 #+end_example
   9133 
   9134 You can then go ahead and define anniversaries for a BBDB record.
   9135 Basically, you need a field named =anniversary= for the BBDB record
   9136 which contains the date in the format =YYYY-MM-DD= or =MM-DD=,
   9137 followed by a space and the class of the anniversary (=birthday=,
   9138 =wedding=, or a format string).  If you omit the class, it defaults to
   9139 =birthday=.  Here are a few examples, the header for the file
   9140 =ol-bbdb.el= contains more detailed information.
   9141 
   9142 #+begin_example
   9143 1973-06-22
   9144 06-22
   9145 1955-08-02 wedding
   9146 2008-04-14 %s released version 6.01 of Org mode, %d years ago
   9147 #+end_example
   9148 
   9149 After a change to BBDB, or for the first agenda display during an
   9150 Emacs session, the agenda display suffers a short delay as Org updates
   9151 its hash with anniversaries.  However, from then on things will be
   9152 very fast, much faster in fact than a long list of
   9153 =%%(diary-anniversary)= entries in an Org or Diary file.
   9154 
   9155 #+findex: org-bbdb-anniversaries-future
   9156 If you would like to see upcoming anniversaries with a bit of
   9157 forewarning, you can use the following instead:
   9158 
   9159 #+begin_example
   9160 ,* Anniversaries
   9161   :PROPERTIES:
   9162   :CATEGORY: Anniv
   9163   :END:
   9164 %%(org-bbdb-anniversaries-future 3)
   9165 #+end_example
   9166 
   9167 That will give you three days' warning: on the anniversary date itself
   9168 and the two days prior.  The argument is optional: if omitted, it
   9169 defaults to 7.
   9170 
   9171 **** Appointment reminders
   9172 :PROPERTIES:
   9173 :UNNUMBERED: notoc
   9174 :END:
   9175 #+cindex: @file{appt.el}
   9176 #+cindex: appointment reminders
   9177 #+cindex: appointment
   9178 #+cindex: reminders
   9179 
   9180 #+cindex: APPT_WARNTIME, keyword
   9181 Org can interact with Emacs appointments notification facility.  To
   9182 add the appointments of your agenda files, use the command
   9183 ~org-agenda-to-appt~.  This command lets you filter through the list
   9184 of your appointments and add only those belonging to a specific
   9185 category or matching a regular expression.  It also reads
   9186 a =APPT_WARNTIME= property which overrides the value of
   9187 ~appt-message-warning-time~ for this appointment.  See the docstring
   9188 for details.
   9189 
   9190 *** The global TODO list
   9191 :PROPERTIES:
   9192 :DESCRIPTION: All unfinished action items.
   9193 :ALT_TITLE: Global TODO list
   9194 :END:
   9195 #+cindex: global TODO list
   9196 #+cindex: TODO list, global
   9197 
   9198 The global TODO list contains all unfinished TODO items formatted and
   9199 collected into a single place.
   9200 
   9201 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
   9202 
   9203   #+kindex: t @r{(Agenda dispatcher)}
   9204   #+findex: org-todo-list
   9205   Show the global TODO list.  This collects the TODO items from all
   9206   agenda files (see [[*Agenda Views]]) into a single buffer.  By default,
   9207   this lists items with a state that is not a DONE state.  The buffer
   9208   is in Agenda mode, so there are commands to examine and manipulate
   9209   the TODO entries directly from that buffer (see [[*Commands in the
   9210   Agenda Buffer]]).
   9211 
   9212 - {{{kbd(M-x org-agenda T)}}} (~org-todo-list~) ::
   9213 
   9214   #+kindex: T @r{(Agenda dispatcher)}
   9215   #+findex: org-todo-list
   9216   #+cindex: TODO keyword matching
   9217   #+vindex: org-todo-keywords
   9218   Like the above, but allows selection of a specific TODO keyword.
   9219   You can also do this by specifying a prefix argument to
   9220   {{{kbd(t)}}}.  You are prompted for a keyword, and you may also
   9221   specify several keywords by separating them with =|= as the boolean
   9222   OR operator.  With a numeric prefix, the Nth keyword in
   9223   ~org-todo-keywords~ is selected.
   9224 
   9225   #+kindex: r
   9226   The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you
   9227   can give a prefix argument to this command to change the selected
   9228   TODO keyword, for example {{{kbd(3 r)}}}.  If you often need
   9229   a search for a specific keyword, define a custom command for it (see
   9230   [[*The Agenda Dispatcher]]).
   9231 
   9232   Matching specific TODO keywords can also be done as part of a tags
   9233   search (see [[*Tag Searches]]).
   9234 
   9235 Remote editing of TODO items means that you can change the state of
   9236 a TODO entry with a single key press.  The commands available in the
   9237 TODO list are described in [[*Commands in the Agenda Buffer]].
   9238 
   9239 #+cindex: sublevels, inclusion into TODO list
   9240 Normally the global TODO list simply shows all headlines with TODO
   9241 keywords.  This list can become very long.  There are two ways to keep
   9242 it more compact:
   9243 
   9244 -
   9245   #+vindex: org-agenda-todo-ignore-scheduled
   9246   #+vindex: org-agenda-todo-ignore-deadlines
   9247   #+vindex: org-agenda-todo-ignore-timestamp
   9248   #+vindex: org-agenda-todo-ignore-with-date
   9249   Some people view a TODO item that has been /scheduled/ for execution
   9250   or have a /deadline/ (see [[*Timestamps]]) as no longer /open/.
   9251   Configure the variables ~org-agenda-todo-ignore-scheduled~ to
   9252   exclude some or all scheduled items from the global TODO list,
   9253   ~org-agenda-todo-ignore-deadlines~ to exclude some or all items with
   9254   a deadline set, ~org-agenda-todo-ignore-timestamp~ to exclude some
   9255   or all items with an active timestamp other than a DEADLINE or
   9256   a SCHEDULED timestamp and/or ~org-agenda-todo-ignore-with-date~ to
   9257   exclude items with at least one active timestamp.
   9258 
   9259 -
   9260   #+vindex: org-agenda-todo-list-sublevels
   9261   TODO items may have sublevels to break up the task into subtasks.
   9262   In such cases it may be enough to list only the highest level TODO
   9263   headline and omit the sublevels from the global list.  Configure the
   9264   variable ~org-agenda-todo-list-sublevels~ to get this behavior.
   9265 
   9266 *** Matching tags and properties
   9267 :PROPERTIES:
   9268 :DESCRIPTION: Structured information with fine-tuned search.
   9269 :END:
   9270 #+cindex: matching, of tags
   9271 #+cindex: matching, of properties
   9272 #+cindex: tags view
   9273 #+cindex: match view
   9274 
   9275 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]),
   9276 or have properties (see [[*Properties and Columns]]), you can select
   9277 headlines based on this metadata and collect them into an agenda
   9278 buffer.  The match syntax described here also applies when creating
   9279 sparse trees with {{{kbd(C-c / m)}}}.
   9280 
   9281 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
   9282 
   9283   #+kindex: m @r{(Agenda dispatcher)}
   9284   #+findex: org-tags-view
   9285   Produce a list of all headlines that match a given set of tags.  The
   9286   command prompts for a selection criterion, which is a boolean logic
   9287   expression with tags, like =+work+urgent-withboss= or =work|home=
   9288   (see [[*Tags]]).  If you often need a specific search, define a custom
   9289   command for it (see [[*The Agenda Dispatcher]]).
   9290 
   9291 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
   9292 
   9293   #+kindex: M @r{(Agenda dispatcher)}
   9294   #+findex: org-tags-view
   9295   #+vindex: org-agenda-tags-todo-honor-ignore-options
   9296   Like {{{kbd(m)}}}, but only select headlines that are also TODO
   9297   items.  To exclude scheduled/deadline items, see the variable
   9298   ~org-agenda-tags-todo-honor-ignore-options~.  Matching specific TODO
   9299   keywords together with a tags match is also possible, see [[*Tag
   9300   Searches]].
   9301 
   9302 The commands available in the tags list are described in [[*Commands in
   9303 the Agenda Buffer]].
   9304 
   9305 #+cindex: boolean logic, for agenda searches
   9306 A search string can use Boolean operators =&= for AND and =|= for OR.
   9307 =&= binds more strongly than =|=.  Parentheses are currently not
   9308 implemented.  Each element in the search is either a tag, a regular
   9309 expression matching tags, or an expression like =PROPERTY OPERATOR
   9310 VALUE= with a comparison operator, accessing a property value.  Each
   9311 element may be preceded by =-= to select against it, and =+= is
   9312 syntactic sugar for positive selection.  The AND operator =&= is
   9313 optional when =+= or =-= is present.  Here are some examples, using
   9314 only tags.
   9315 
   9316 - =+work-boss= ::
   9317 
   9318   Select headlines tagged =work=, but discard those also tagged
   9319   =boss=.
   9320 
   9321 - =work|laptop= ::
   9322 
   9323   Selects lines tagged =work= or =laptop=.
   9324 
   9325 - =work|laptop+night= ::
   9326 
   9327   Like before, but require the =laptop= lines to be tagged also
   9328   =night=.
   9329 
   9330 #+cindex: regular expressions, with tags search
   9331 Instead of a tag, you may also specify a regular expression enclosed
   9332 in curly braces (see [[*Regular Expressions]]).  For example,
   9333 =work+{^boss.*}= matches headlines that contain the tag =:work:= and
   9334 any tag /starting/ with =boss=.
   9335 
   9336 #+cindex: group tags, as regular expressions
   9337 Group tags (see [[*Tag Hierarchy]]) are expanded as regular expressions.
   9338 E.g., if =work= is a group tag for the group =:work:lab:conf:=, then
   9339 searching for =work= also searches for ={\(?:work\|lab\|conf\)}= and
   9340 searching for =-work= searches for all headlines but those with one of
   9341 the tags in the group (i.e., =-{\(?:work\|lab\|conf\)}=).
   9342 
   9343 #+cindex: TODO keyword matching, with tags search
   9344 #+cindex: level, for tags/property match
   9345 #+cindex: category, for tags/property match
   9346 #+vindex: org-odd-levels-only
   9347 You may also test for properties (see [[*Properties and Columns]]) at the
   9348 same time as matching tags.  The properties may be real properties, or
   9349 special properties that represent other metadata (see [[*Special
   9350 Properties]]).  For example, the property =TODO= represents the TODO
   9351 keyword of the entry.  Or, the property =LEVEL= represents the level
   9352 of an entry.  So searching =+LEVEL=3+boss-TODO​="DONE"= lists all level
   9353 three headlines that have the tag =boss= and are /not/ marked with the
   9354 TODO keyword =DONE=.  In buffers with ~org-odd-levels-only~ set,
   9355 =LEVEL= does not count the number of stars, but =LEVEL=2= corresponds
   9356 to 3 stars etc.
   9357 
   9358 Here are more examples:
   9359 
   9360 - =work+TODO​="WAITING"= ::
   9361 
   9362   Select =work=-tagged TODO lines with the specific TODO keyword
   9363   =WAITING=.
   9364 
   9365 - =work+TODO​="WAITING"|home+TODO​="WAITING"= ::
   9366 
   9367   Waiting tasks both at work and at home.
   9368 
   9369 When matching properties, a number of different operators can be used
   9370 to test the value of a property.  Here is a complex example:
   9371 
   9372 #+begin_example
   9373 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<*2
   9374          +With={Sarah\|Denny}+SCHEDULED>="<2008-10-11>"
   9375 #+end_example
   9376 
   9377 #+cindex: operator, for property search
   9378 #+texinfo: @noindent
   9379 The type of comparison depends on how the comparison value is written:
   9380 
   9381 - If the comparison value is a plain number, a numerical comparison is
   9382   done, and the allowed operators are =<=, ===, =>=, =<==, =>==, and
   9383   =<>=.  As a synonym for the equality operator ===, there is also
   9384   ====; =!== and =/== are synonyms of the inequality operator =<>=.
   9385 
   9386 - If the comparison value is enclosed in double-quotes, a string
   9387   comparison is done, and the same operators are allowed.
   9388 
   9389 - If the comparison value is enclosed in double-quotes /and/ angular
   9390   brackets (like =DEADLINE<​="<2008-12-24 18:30>"=), both values are
   9391   assumed to be date/time specifications in the standard Org way, and
   9392   the comparison is done accordingly.  Valid values also include
   9393   ="<now>"= for now (including time), ="<today>"=, and ="<tomorrow>"=
   9394   for these days at 0:00 hours, i.e., without a time specification.
   9395   You can also use strings like ="<+5d>"= or ="<-2m>"= with units =d=,
   9396   =w=, =m=, and =y= for day, week, month, and year, respectively.
   9397 
   9398 - If the comparison value is enclosed in curly braces, a regexp match
   9399   is performed, with === meaning that the regexp matches the property
   9400   value, and =<>= meaning that it does not match.
   9401 
   9402 - All operators may be optionally followed by an asterisk =*=, like in
   9403   =<*=, =!=*=, etc.  Such /starred operators/ work like their regular,
   9404   unstarred counterparts except that they match only headlines where
   9405   the tested property is actually present.  This is most useful for
   9406   search terms that logically exclude results, like the inequality
   9407   operator.
   9408 
   9409 So the search string in the example finds entries tagged =work= but
   9410 not =boss=, which also have a priority value =A=, a =Coffee= property
   9411 with the value =unlimited=, an =EFFORT= property that is numerically
   9412 smaller than 2, a =With= property that is matched by the regular
   9413 expression =Sarah\|Denny=, and that are scheduled on or after October
   9414 11, 2008.
   9415 
   9416 Note that the test on the =EFFORT= property uses operator =<*=, so
   9417 that the search result will include only entries that actually have an
   9418 =EFFORT= property defined and with numerical value smaller than 2.
   9419 With the regular =<= operator, the search would handle entries without
   9420 an =EFFORT= property as having a zero effort and would include them in
   9421 the result as well.
   9422 
   9423 You can use all characters valid in property names when matching
   9424 properties.  However, you have to quote some characters in property
   9425 names with backslashes when using them in search strings, namely all
   9426 characters different from alphanumerics and underscores[fn:: If you
   9427 quote alphanumeric characters or underscores with a backslash, that
   9428 backslash is ignored.].  For example, to search for all entries having
   9429 a property =boss-prio=, =boss:prio=, or =boss\prio=, respectively,
   9430 with value =C=, use search strings
   9431 
   9432 #+begin_example
   9433 boss\-prio="C"
   9434 boss\:prio="C"
   9435 boss\\prio="C"
   9436 #+end_example
   9437 
   9438 You can configure Org mode to use property inheritance during
   9439 a search, but beware that this can slow down searches considerably.
   9440 See [[*Property Inheritance]], for details.
   9441 
   9442 For backward compatibility, and also for typing speed, there is also
   9443 a different way to test TODO states in a search.  For this, terminate
   9444 the tags/property part of the search string (which may include several
   9445 terms connected with =|=) with a =/= and then specify a Boolean
   9446 expression just for TODO keywords.  The syntax is then similar to that
   9447 for tags, but should be applied with care: for example, a positive
   9448 selection on several TODO keywords cannot meaningfully be combined
   9449 with boolean AND.  However, /negative selection/ combined with AND can
   9450 be meaningful.  To make sure that only lines are checked that actually
   9451 have any TODO keyword (resulting in a speed-up), use {{{kbd(M-x
   9452 org-agenda M)}}}, or equivalently start the TODO part after the slash
   9453 with =!=.  Using {{{kbd(M-x org-agenda M)}}} or =/!= does not match
   9454 TODO keywords in a DONE state.  Examples:
   9455 
   9456 - =work/WAITING= ::
   9457 
   9458   Same as =work+TODO​="WAITING"=.
   9459 
   9460 - =work/!-WAITING-NEXT= ::
   9461 
   9462   Select =work=-tagged TODO lines that are neither =WAITING= nor
   9463   =NEXT=.
   9464 
   9465 - =work/!+WAITING|+NEXT= ::
   9466 
   9467   Select =work=-tagged TODO lines that are either =WAITING= or =NEXT=.
   9468 
   9469 *** Search view
   9470 :PROPERTIES:
   9471 :DESCRIPTION: Find entries by searching for text.
   9472 :END:
   9473 #+cindex: search view
   9474 #+cindex: text search
   9475 #+cindex: searching, for text
   9476 
   9477 This agenda view is a general text search facility for Org mode
   9478 entries.  It is particularly useful to find notes.
   9479 
   9480 - {{{kbd(M-x org-agenda s)}}} (~org-search-view~) ::
   9481 
   9482   #+kindex: s @r{(Agenda dispatcher)}
   9483   #+findex: org-search-view
   9484   This is a special search that lets you select entries by matching
   9485   a substring or specific words using a boolean logic.
   9486 
   9487 For example, the search string =computer equipment= matches entries
   9488 that contain =computer equipment= as a substring, even if the two
   9489 words are separated by more space or a line break.
   9490 
   9491 Search view can also search for specific keywords in the entry, using
   9492 Boolean logic.  The search string =+computer
   9493 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the
   9494 keywords =computer= and =wifi=, but not the keyword =ethernet=, and
   9495 which are also not matched by the regular expression =8\.11[bg]=,
   9496 meaning to exclude both =8.11b= and =8.11g=.  The first =+= is
   9497 necessary to turn on boolean search, other =+= characters are
   9498 optional.  For more details, see the docstring of the command
   9499 ~org-search-view~.
   9500 
   9501 You can incrementally and conveniently adjust a boolean search from
   9502 the agenda search view with the following keys
   9503 
   9504 #+attr_texinfo: :columns 0.1 0.6
   9505 | {{{kbd([)}}} | Add a positive search word        |
   9506 | {{{kbd(])}}} | Add a negative search word        |
   9507 | {{{kbd({)}}} | Add a positive regular expression |
   9508 | {{{kbd(})}}} | Add a negative regular expression |
   9509 
   9510 #+vindex: org-agenda-text-search-extra-files
   9511 Note that in addition to the agenda files, this command also searches
   9512 the files listed in ~org-agenda-text-search-extra-files~.
   9513 
   9514 *** Stuck projects
   9515 :PROPERTIES:
   9516 :DESCRIPTION: Find projects you need to review.
   9517 :END:
   9518 #+pindex: GTD, Getting Things Done
   9519 
   9520 If you are following a system like David Allen's GTD to organize your
   9521 work, one of the "duties" you have is a regular review to make sure
   9522 that all projects move along.  A /stuck/ project is a project that has
   9523 no defined next actions, so it never shows up in the TODO lists Org
   9524 mode produces.  During the review, you need to identify such projects
   9525 and define next actions for them.
   9526 
   9527 - {{{kbd(M-x org-agenda #)}}} (~org-agenda-list-stuck-projects~) ::
   9528 
   9529   #+kindex: # @r{(Agenda dispatcher)}
   9530   #+findex: org-agenda-list-stuck-projects
   9531   List projects that are stuck.
   9532 
   9533 - {{{kbd(M-x org-agenda !)}}} ::
   9534 
   9535   #+kindex: ! @r{(Agenda dispatcher)}
   9536   #+vindex: org-stuck-projects
   9537   Customize the variable ~org-stuck-projects~ to define what a stuck
   9538   project is and how to find it.
   9539 
   9540 You almost certainly need to configure this view before it works for
   9541 you.  The built-in default assumes that all your projects are level-2
   9542 headlines, and that a project is not stuck if it has at least one
   9543 entry marked with a TODO keyword =TODO= or =NEXT= or =NEXTACTION=.
   9544 
   9545 Let's assume that you, in your own way of using Org mode, identify
   9546 projects with a tag =:PROJECT:=, and that you use a TODO keyword
   9547 =MAYBE= to indicate a project that should not be considered yet.
   9548 Let's further assume that the TODO keyword =DONE= marks finished
   9549 projects, and that =NEXT= and =TODO= indicate next actions.  The tag
   9550 =:@shop:= indicates shopping and is a next action even without the
   9551 NEXT tag.  Finally, if the project contains the special word =IGNORE=
   9552 anywhere, it should not be listed either.  In this case you would
   9553 start by identifying eligible projects with a tags/TODO match (see
   9554 [[*Tag Searches]]) =+PROJECT/-MAYBE-DONE=, and then check for =TODO=,
   9555 =NEXT=, =@shop=, and =IGNORE= in the subtree to identify projects that
   9556 are not stuck.  The correct customization for this is:
   9557 
   9558 #+begin_src emacs-lisp
   9559 (setq org-stuck-projects
   9560       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop")
   9561         "\\<IGNORE\\>"))
   9562 #+end_src
   9563 
   9564 Note that if a project is identified as non-stuck, the subtree of this
   9565 entry is searched for stuck projects.
   9566 
   9567 ** Presentation and Sorting
   9568 :PROPERTIES:
   9569 :DESCRIPTION: How agenda items are prepared for display.
   9570 :END:
   9571 #+cindex: presentation, of agenda items
   9572 
   9573 #+vindex: org-agenda-prefix-format
   9574 #+vindex: org-agenda-tags-column
   9575 Before displaying items in an agenda view, Org mode visually prepares
   9576 the items and sorts them.  Each item occupies a single line.  The line
   9577 starts with a /prefix/ that contains the /category/ (see [[*Categories]])
   9578 of the item and other important information.  You can customize in
   9579 which column tags are displayed through ~org-agenda-tags-column~.  You
   9580 can also customize the prefix using the option
   9581 ~org-agenda-prefix-format~.  This prefix is followed by a cleaned-up
   9582 version of the outline headline associated with the item.
   9583 
   9584 *** Categories
   9585 :PROPERTIES:
   9586 :DESCRIPTION: Not all tasks are equal.
   9587 :END:
   9588 #+cindex: category
   9589 #+cindex: @samp{CATEGORY}, keyword
   9590 
   9591 The category is a broad label assigned to each agenda item.  By
   9592 default, the category is simply derived from the file name, but you
   9593 can also specify it with a special line in the buffer, like
   9594 this:
   9595 
   9596 : #+CATEGORY: Thesis
   9597 
   9598 #+cindex: @samp{CATEGORY}, property
   9599 If you would like to have a special category for a single entry or
   9600 a (sub)tree, give the entry a =CATEGORY= property with the special
   9601 category you want to apply as the value.
   9602 
   9603 #+vindex: org-agenda-category-icon-alist
   9604 The display in the agenda buffer looks best if the category is not
   9605 longer than 10 characters.  You can set up icons for category by
   9606 customizing the ~org-agenda-category-icon-alist~ variable.
   9607 
   9608 *** Time-of-day specifications
   9609 :PROPERTIES:
   9610 :DESCRIPTION: How the agenda knows the time.
   9611 :END:
   9612 #+cindex: time-of-day specification
   9613 
   9614 Org mode checks each agenda item for a time-of-day specification.  The
   9615 time can be part of the timestamp that triggered inclusion into the
   9616 agenda, for example
   9617 
   9618 : <2005-05-10 Tue 19:00>
   9619 
   9620 #+texinfo: @noindent
   9621 Time ranges can be specified with two timestamps:
   9622 
   9623 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
   9624 
   9625 #+vindex: org-agenda-search-headline-for-time
   9626 In the headline of the entry itself, a time(range)---like =12:45= or a
   9627 =8:30-1pm=---may also appear as plain text[fn:: You can, however,
   9628 disable this by setting ~org-agenda-search-headline-for-time~ variable
   9629 to a ~nil~ value.].
   9630 
   9631 If the agenda integrates the Emacs diary (see [[*Weekly/daily agenda]]),
   9632 time specifications in diary entries are recognized as well.
   9633 
   9634 For agenda display, Org mode extracts the time and displays it in
   9635 a standard 24 hour format as part of the prefix.  The example times in
   9636 the previous paragraphs would end up in the agenda like this:
   9637 
   9638 #+begin_example
   9639  8:30-13:00 Arthur Dent lies in front of the bulldozer
   9640 12:45...... Ford Prefect arrives and takes Arthur to the pub
   9641 19:00...... The Vogon reads his poem
   9642 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
   9643 #+end_example
   9644 
   9645 #+cindex: time grid
   9646 If the agenda is in single-day mode, or for the display of today, the
   9647 timed entries are embedded in a time grid, like
   9648 
   9649 #+begin_example
   9650  8:00...... ------------------
   9651  8:30-13:00 Arthur Dent lies in front of the bulldozer
   9652 10:00...... ------------------
   9653 12:00...... ------------------
   9654 12:45...... Ford Prefect arrives and takes Arthur to the pub
   9655 14:00...... ------------------
   9656 16:00...... ------------------
   9657 18:00...... ------------------
   9658 19:00...... The Vogon reads his poem
   9659 20:00...... ------------------
   9660 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
   9661 #+end_example
   9662 
   9663 #+vindex: org-agenda-use-time-grid
   9664 #+vindex: org-agenda-time-grid
   9665 The time grid can be turned on and off with the variable
   9666 ~org-agenda-use-time-grid~, and can be configured with
   9667 ~org-agenda-time-grid~.
   9668 
   9669 *** Sorting of agenda items
   9670 :PROPERTIES:
   9671 :DESCRIPTION: The order of things.
   9672 :END:
   9673 #+cindex: sorting, of agenda items
   9674 #+cindex: priorities, of agenda items
   9675 
   9676 Before being inserted into a view, the items are sorted.  How this is
   9677 done depends on the type of view.
   9678 
   9679 -
   9680   #+vindex: org-agenda-files
   9681   For the daily/weekly agenda, the items for each day are sorted.  The
   9682   default order is to first collect all items containing an explicit
   9683   time-of-day specification.  These entries are shown at the beginning
   9684   of the list, as a /schedule/ for the day.  After that, items remain
   9685   grouped in categories, in the sequence given by ~org-agenda-files~.
   9686   Within each category, items are sorted by urgency, which is composed
   9687   of the base priority (see [[*Priorities]]; 2000 for priority =A=, 1000
   9688   for =B=, and 0 for =C=), plus additional increments for overdue
   9689   scheduled or deadline items.
   9690 
   9691 - For the TODO list, items remain in the order of categories, but
   9692   within each category, sorting takes place according to urgency.  The
   9693   urgency used for sorting derives from the priority cookie, with
   9694   additions depending on how close an item is to its due or scheduled
   9695   date.
   9696 
   9697 - For tags matches, items are not sorted at all, but just appear in
   9698   the sequence in which they are found in the agenda files.
   9699 
   9700 #+vindex: org-agenda-sorting-strategy
   9701 Sorting can be customized using the variable
   9702 ~org-agenda-sorting-strategy~, and may also include criteria based on
   9703 the estimated effort of an entry (see [[*Effort Estimates]]).
   9704 
   9705 *** Filtering/limiting agenda items
   9706 :PROPERTIES:
   9707 :DESCRIPTION: Dynamically narrow the agenda.
   9708 :END:
   9709 
   9710 #+vindex: org-agenda-category-filter-preset
   9711 #+vindex: org-agenda-tag-filter-preset
   9712 #+vindex: org-agenda-effort-filter-preset
   9713 #+vindex: org-agenda-regexp-filter-preset
   9714 Agenda built-in or custom commands are statically defined.  Agenda
   9715 filters and limits allow flexibly narrowing down the list of agenda
   9716 entries.
   9717 
   9718 /Filters/ only change the visibility of items, are very fast and are
   9719 mostly used interactively[fn:34].  You can switch quickly between
   9720 different filters without having to recreate the agenda.  /Limits/ on
   9721 the other hand take effect before the agenda buffer is populated, so
   9722 they are mostly useful when defined as local variables within custom
   9723 agenda commands.
   9724 
   9725 **** Filtering in the agenda
   9726 :PROPERTIES:
   9727 :UNNUMBERED: notoc
   9728 :END:
   9729 #+cindex: agenda filtering
   9730 #+cindex: filtering entries, in agenda
   9731 #+cindex: tag filtering, in agenda
   9732 #+cindex: category filtering, in agenda
   9733 #+cindex: top headline filtering, in agenda
   9734 #+cindex: effort filtering, in agenda
   9735 #+cindex: query editing, in agenda
   9736 
   9737 The general filtering command is ~org-agenda-filter~, bound to
   9738 {{{kbd(/)}}}.  Before we introduce it, we describe commands for
   9739 individual filter types.  All filtering commands handle prefix
   9740 arguments in the same way:  A single {{{kbd(C-u)}}} prefix negates the
   9741 filter, so it removes lines selected by the filter.  A double prefix
   9742 adds the new filter condition to the one(s) already in place, so
   9743 filter elements are accumulated.
   9744 
   9745 - {{{kbd(\)}}} (~org-agenda-filter-by-tag~) ::
   9746 
   9747   #+findex: org-agenda-filter-by-tag
   9748   Filter the agenda view with respect to a tag.  You are prompted for
   9749   a tag selection letter; {{{kbd(SPC)}}} means any tag at all.
   9750   Pressing {{{kbd(TAB)}}} at that prompt offers completion to select a
   9751   tag, including any tags that do not have a selection character.  The
   9752   command then hides all entries that do not contain or inherit this
   9753   tag.  Pressing {{{kbd(+)}}} or {{{kbd(-)}}} at the prompt switches
   9754   between filtering for and against the next tag.  To clear the
   9755   filter, press {{{kbd(\)}}} twice (once to call the command again,
   9756   and once at the prompt).
   9757 
   9758 - {{{kbd(<)}}} (~org-agenda-filter-by-category~) ::
   9759 
   9760   #+findex: org-agenda-filter-by-category
   9761   Filter by category of the line at point, and show only entries with
   9762   this category.  When called with a prefix argument, hide all entries
   9763   with the category at point.  To clear the filter, call this command
   9764   again by pressing {{{kbd(<)}}}.
   9765 
   9766 - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) ::
   9767 
   9768   #+findex: org-agenda-filter-by-regexp
   9769   Filter the agenda view by a regular expression: only show agenda
   9770   entries matching the regular expression the user entered.  To clear
   9771   the filter, call the command again by pressing {{{kbd(=)}}}.
   9772 
   9773 - {{{kbd(_)}}} (~org-agenda-filter-by-effort~) ::
   9774 
   9775   #+findex: org-agenda-filter-by-effort
   9776   Filter the agenda view with respect to effort estimates, so select
   9777   tasks that take the right amount of time.  You first need to set up
   9778   a list of efforts globally, for example
   9779 
   9780   #+begin_src emacs-lisp
   9781   (setq org-global-properties
   9782         '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
   9783   #+end_src
   9784 
   9785   #+vindex: org-sort-agenda-noeffort-is-high
   9786   You can then filter for an effort by first typing an operator, one
   9787   of {{{kbd(<)}}}, {{{kbd(>)}}} and {{{kbd(=)}}}, and then the
   9788   one-digit index of an effort estimate in your array of allowed
   9789   values, where {{{kbd(0)}}} means the 10th value.  The filter then
   9790   restricts to entries with effort smaller-or-equal, equal, or
   9791   larger-or-equal than the selected value.  For application of the
   9792   operator, entries without a defined effort are treated according to
   9793   the value of ~org-sort-agenda-noeffort-is-high~.  To clear the
   9794   filter, press {{{kbd(_)}}} twice (once to call the command again,
   9795   and once at the first prompt).
   9796 
   9797 - {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) ::
   9798 
   9799   #+findex: org-agenda-filter-by-top-headline
   9800   Filter the current agenda view and only display items that fall
   9801   under the same top-level headline as the current entry.  To clear
   9802   the filter, call this command again by pressing {{{kbd(^)}}}.
   9803 
   9804 - {{{kbd(/)}}} (~org-agenda-filter~) ::
   9805 
   9806   #+findex: org-agenda-filter
   9807   This is the unified interface to four of the five filter methods
   9808   described above.  At the prompt, specify different filter elements
   9809   in a single string, with full completion support.  For example,
   9810 
   9811   : +work-John+<0:10-/plot/
   9812 
   9813   selects entries with category =work= and effort estimates below 10
   9814   minutes, and deselects entries with tag =John= or matching the
   9815   regexp =plot= (see [[*Regular Expressions]]).  You can leave =+= out if
   9816   that does not lead to ambiguities.  The sequence of elements is
   9817   arbitrary.  The filter syntax assumes that there is no overlap
   9818   between categories and tags.  Otherwise, tags take priority.  If you
   9819   reply to the prompt with the empty string, all filtering is removed.
   9820   If a filter is specified, it replaces all current filters.  But if
   9821   you call the command with a double prefix argument, or if you add an
   9822   additional =+= (e.g., =++work=) to the front of the string, the new
   9823   filter elements are added to the active ones.  A single prefix
   9824   argument applies the entire filter in a negative sense.
   9825 
   9826 - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) ::
   9827 
   9828   Remove all filters in the current agenda view.
   9829 
   9830 **** Computed tag filtering
   9831 :PROPERTIES:
   9832 :UNNUMBERED: notoc
   9833 :END:
   9834 
   9835 #+vindex: org-agenda-auto-exclude-function
   9836 If the variable ~org-agenda-auto-exclude-function~ is set to
   9837 a user-defined function, that function can select tags that should be
   9838 used as a tag filter when requested.  The function will be called with
   9839 lower-case versions of all tags represented in the current view.  The
   9840 function should return ="-tag"= if the filter should remove
   9841 entries with that tag, ="+tag"= if only entries with this tag should
   9842 be kept, or =nil= if that tag is irrelevant.  For example, let's say
   9843 you use a =Net= tag to identify tasks which need network access, an
   9844 =Errand= tag for errands in town, and a =Call= tag for making phone
   9845 calls.  You could auto-exclude these tags based on the availability of
   9846 the Internet, and outside of business hours, with something like this:
   9847 
   9848 #+begin_src emacs-lisp
   9849 (defun my-auto-exclude-fn (tag)
   9850   (when (cond ((string= tag "net")
   9851                (/= 0 (call-process "/sbin/ping" nil nil nil
   9852                                    "-c1" "-q" "-t1" "mail.gnu.org")))
   9853               ((member tag '("errand" "call"))
   9854                (let ((hr (nth 2 (decode-time))))
   9855                  (or (< hr 8) (> hr 21)))))
   9856     (concat "-" tag)))
   9857 
   9858 (setq org-agenda-auto-exclude-function #'my-auto-exclude-fn)
   9859 #+end_src
   9860 
   9861 You can apply this self-adapting filter by using a triple prefix
   9862 argument to ~org-agenda-filter~, i.e.\nbsp{}press {{{kbd(C-u C-u C-u /)}}},
   9863 or by pressing {{{kbd(RET)}}} in ~org-agenda-filter-by-tag~.
   9864 
   9865 **** Setting limits for the agenda
   9866 :PROPERTIES:
   9867 :UNNUMBERED: notoc
   9868 :END:
   9869 #+cindex: limits, in agenda
   9870 
   9871 Here is a list of options that you can set, either globally, or
   9872 locally in your custom agenda views (see [[*Custom Agenda Views]]).
   9873 
   9874 - ~org-agenda-max-entries~ ::
   9875 
   9876   #+vindex: org-agenda-max-entries
   9877   Limit the number of entries.
   9878 
   9879 - ~org-agenda-max-effort~ ::
   9880 
   9881   #+vindex: org-agenda-max-effort
   9882   Limit the duration of accumulated efforts (as minutes).
   9883 
   9884 - ~org-agenda-max-todos~ ::
   9885 
   9886   #+vindex: org-agenda-max-todos
   9887   Limit the number of entries with TODO keywords.
   9888 
   9889 - ~org-agenda-max-tags~ ::
   9890 
   9891   #+vindex: org-agenda-max-tags
   9892   Limit the number of tagged entries.
   9893 
   9894 When set to a positive integer, each option excludes entries from
   9895 other categories: for example, =(setq org-agenda-max-effort 100)=
   9896 limits the agenda to 100 minutes of effort and exclude any entry that
   9897 has no effort property.  If you want to include entries with no effort
   9898 property, use a negative value for ~org-agenda-max-effort~.  One
   9899 useful setup is to use ~org-agenda-max-entries~ locally in a custom
   9900 command.  For example, this custom command displays the next five
   9901 entries with a =NEXT= TODO keyword.
   9902 
   9903 #+begin_src emacs-lisp
   9904 (setq org-agenda-custom-commands
   9905       '(("n" todo "NEXT"
   9906          ((org-agenda-max-entries 5)))))
   9907 #+end_src
   9908 
   9909 Once you mark one of these five entry as DONE, rebuilding the agenda
   9910 will again the next five entries again, including the first entry that
   9911 was excluded so far.
   9912 
   9913 You can also dynamically set temporary limits, which are lost when
   9914 rebuilding the agenda:
   9915 
   9916 - {{{kbd(~ )}}} (~org-agenda-limit-interactively~) ::
   9917 
   9918   #+findex: org-agenda-limit-interactively
   9919   This prompts for the type of limit to apply and its value.
   9920 
   9921 ** Commands in the Agenda Buffer
   9922 :PROPERTIES:
   9923 :DESCRIPTION: Remote editing of Org trees.
   9924 :ALT_TITLE: Agenda Commands
   9925 :END:
   9926 #+cindex: commands, in agenda buffer
   9927 
   9928 Entries in the agenda buffer are linked back to the Org file or diary
   9929 file where they originate.  You are not allowed to edit the agenda
   9930 buffer itself, but commands are provided to show and jump to the
   9931 original entry location, and to edit the Org files "remotely" from the
   9932 agenda buffer.  In this way, all information is stored only once,
   9933 removing the risk that your agenda and note files may diverge.
   9934 
   9935 Some commands can be executed with mouse clicks on agenda lines.  For
   9936 the other commands, point needs to be in the desired line.
   9937 
   9938 *** Motion
   9939 :PROPERTIES:
   9940 :UNNUMBERED: notoc
   9941 :END:
   9942 #+cindex: motion commands in agenda
   9943 
   9944 - {{{kbd(n)}}} (~org-agenda-next-line~) ::
   9945 
   9946   #+kindex: n
   9947   #+findex: org-agenda-next-line
   9948   Next line (same as {{{kbd(DOWN)}}} and {{{kbd(C-n)}}}).
   9949 
   9950 - {{{kbd(p)}}} (~org-agenda-previous-line~) ::
   9951 
   9952   #+kindex: p
   9953   #+findex: org-agenda-previous-line
   9954   Previous line (same as {{{kbd(UP)}}} and {{{kbd(C-p)}}}).
   9955 
   9956 *** View/Go to Org file
   9957 :PROPERTIES:
   9958 :UNNUMBERED: notoc
   9959 :END:
   9960 #+cindex: view file commands in agenda
   9961 
   9962 - {{{kbd(SPC)}}} or {{{kbd(mouse-3)}}} (~org-agenda-show-and-scroll-up~) ::
   9963 
   9964   #+kindex: SPC
   9965   #+kindex: mouse-3
   9966   #+findex: org-agenda-show-and-scroll-up
   9967   Display the original location of the item in another window.
   9968   With a prefix argument, make sure that drawers stay folded.
   9969 
   9970 - {{{kbd(L)}}} (~org-agenda-recenter~) ::
   9971 
   9972   #+findex: org-agenda-recenter
   9973   Display original location and recenter that window.
   9974 
   9975 - {{{kbd(TAB)}}} or {{{kbd(mouse-2)}}} (~org-agenda-goto~) ::
   9976 
   9977   #+kindex: TAB
   9978   #+kindex: mouse-2
   9979   #+findex: org-agenda-goto
   9980   Go to the original location of the item in another window.
   9981 
   9982 - {{{kbd(RET)}}} (~org-agenda-switch-to~) ::
   9983 
   9984   #+kindex: RET
   9985   #+findex: org-agenda-switch-to
   9986   Go to the original location of the item and delete other windows.
   9987 
   9988 - {{{kbd(F)}}} (~org-agenda-follow-mode~) ::
   9989 
   9990   #+kindex: F
   9991   #+findex: org-agenda-follow-mode
   9992   #+vindex: org-agenda-start-with-follow-mode
   9993   Toggle Follow mode.  In Follow mode, as you move point through the
   9994   agenda buffer, the other window always shows the corresponding
   9995   location in the Org file.  The initial setting for this mode in new
   9996   agenda buffers can be set with the variable
   9997   ~org-agenda-start-with-follow-mode~.
   9998 
   9999 - {{{kbd(C-c C-x b)}}} (~org-agenda-tree-to-indirect-buffer~) ::
  10000 
  10001   #+kindex: C-c C-x b
  10002   #+findex: org-agenda-tree-to-indirect-buffer
  10003   Display the entire subtree of the current item in an indirect
  10004   buffer.  With a numeric prefix argument N, go up to level N and then
  10005   take that tree.  If N is negative, go up that many levels.  With
  10006   a {{{kbd(C-u)}}} prefix, do not remove the previously used indirect
  10007   buffer.
  10008 
  10009 - {{{kbd(C-c C-o)}}} (~org-agenda-open-link~) ::
  10010 
  10011   #+kindex: C-c C-o
  10012   #+findex: org-agenda-open-link
  10013   Follow a link in the entry.  This offers a selection of any links in
  10014   the text belonging to the referenced Org node.  If there is only one
  10015   link, follow it without a selection prompt.
  10016 
  10017 *** Change display
  10018 :PROPERTIES:
  10019 :UNNUMBERED: notoc
  10020 :END:
  10021 #+cindex: change agenda display
  10022 #+cindex: display changing, in agenda
  10023 
  10024 #+attr_texinfo: :sep ,
  10025 - {{{kbd(A)}}} ::
  10026 
  10027   #+kindex: A
  10028   Interactively select another agenda view and append it to the
  10029   current view.
  10030 
  10031 - {{{kbd(o)}}} ::
  10032 
  10033   #+kindex: o
  10034   Delete other windows.
  10035 
  10036 - {{{kbd(v d)}}} or short {{{kbd(d)}}} (~org-agenda-day-view~) ::
  10037 
  10038   #+kindex: v d
  10039   #+kindex: d
  10040   #+findex: org-agenda-day-view
  10041   Switch to day view.  When switching to day view, this setting
  10042   becomes the default for subsequent agenda refreshes.  A numeric
  10043   prefix argument may be used to jump directly to a specific day of
  10044   the year.  For example, {{{kbd(32 d)}}} jumps to February 1st.  When
  10045   setting day view, a year may be encoded in the prefix argument as
  10046   well.  For example, {{{kbd(200712 d)}}} jumps to January 12, 2007.
  10047   If such a year specification has only one or two digits, it is
  10048   expanded into one of the 30 next years or the last 69 years.
  10049 
  10050 - {{{kbd(v w)}}} or short {{{kbd(w)}}} (~org-agenda-week-view~) ::
  10051 
  10052   #+kindex: v w
  10053   #+kindex: w
  10054   #+findex: org-agenda-week-view
  10055   Switch to week view.  When switching week view, this setting becomes
  10056   the default for subsequent agenda refreshes.  A numeric prefix
  10057   argument may be used to jump directly to a specific day of the ISO
  10058   week.  For example {{{kbd(9 w)}}} to ISO week number 9.  When
  10059   setting week view, a year may be encoded in the prefix argument as
  10060   well.  For example, {{{kbd(200712 w)}}} jumps to week 12 in 2007.
  10061   If such a year specification has only one or two digits, it is
  10062   expanded into one of the 30 next years or the last 69 years.
  10063 
  10064 - {{{kbd(v m)}}} (~org-agenda-month-view~) ::
  10065 
  10066   #+kindex: v m
  10067   #+findex: org-agenda-month-view
  10068   Switch to month view.  Because month views are slow to create, they
  10069   do not become the default for subsequent agenda refreshes.
  10070   A numeric prefix argument may be used to jump directly to a specific
  10071   day of the month.  When setting month view, a year may be encoded in
  10072   the prefix argument as well.  For example, {{{kbd(200712 m)}}} jumps
  10073   to December, 2007.  If such a year specification has only one or two
  10074   digits, it is expanded into one of the 30 next years or the last 69
  10075   years.
  10076 
  10077 - {{{kbd(v y)}}} (~org-agenda-year-view~) ::
  10078 
  10079   #+kindex: v y
  10080   #+findex: org-agenda-year-view
  10081   Switch to year view.  Because year views are slow to create, they do
  10082   not become the default for subsequent agenda refreshes.  A numeric
  10083   prefix argument may be used to jump directly to a specific day of
  10084   the year.
  10085 
  10086 - {{{kbd(v SPC)}}} (~org-agenda-reset-view~) ::
  10087 
  10088   #+kindex: v SPC
  10089   #+findex: org-agenda-reset-view
  10090   #+vindex: org-agenda-span
  10091   Reset the current view to ~org-agenda-span~.
  10092 
  10093 - {{{kbd(f)}}} (~org-agenda-later~) ::
  10094 
  10095   #+kindex: f
  10096   #+findex: org-agenda-later
  10097   Go forward in time to display the span following the current one.
  10098   For example, if the display covers a week, switch to the following
  10099   week.  With a prefix argument, repeat that many times.
  10100 
  10101 - {{{kbd(b)}}} (~org-agenda-earlier~) ::
  10102 
  10103   #+kindex: b
  10104   #+findex: org-agenda-earlier
  10105   Go backward in time to display earlier dates.
  10106 
  10107 - {{{kbd(.)}}} (~org-agenda-goto-today~) ::
  10108 
  10109   #+kindex: .
  10110   #+findex: org-agenda-goto-today
  10111   Go to today.
  10112 
  10113 - {{{kbd(j)}}} (~org-agenda-goto-date~) ::
  10114 
  10115   #+kindex: j
  10116   #+findex: org-agenda-goto-date
  10117   Prompt for a date and go there.
  10118 
  10119 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
  10120 
  10121   #+kindex: J
  10122   #+findex: org-agenda-clock-goto
  10123   Go to the currently clocked-in task /in the agenda buffer/.
  10124 
  10125 - {{{kbd(D)}}} (~org-agenda-toggle-diary~) ::
  10126 
  10127   #+kindex: D
  10128   #+findex: org-agenda-toggle-diary
  10129   Toggle the inclusion of diary entries.  See [[*Weekly/daily agenda]].
  10130 
  10131 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} (~org-agenda-log-mode~) ::
  10132 
  10133   #+kindex: v l
  10134   #+kindex: l
  10135   #+kindex: v L
  10136   #+findex: org-agenda-log-mode
  10137   #+vindex: org-log-done
  10138   #+vindex: org-agenda-log-mode-items
  10139   Toggle Logbook mode.  In Logbook mode, entries that were marked as
  10140   done while logging was on (see the variable ~org-log-done~) are
  10141   shown in the agenda, as are entries that have been clocked on that
  10142   day.  You can configure the entry types that should be included in
  10143   log mode using the variable ~org-agenda-log-mode-items~.  When
  10144   called with a {{{kbd(C-u)}}} prefix argument, show all possible
  10145   logbook entries, including state changes.  When called with two
  10146   prefix arguments {{{kbd(C-u C-u)}}}, show only logging information,
  10147   nothing else.  {{{kbd(v L)}}} is equivalent to {{{kbd(C-u v l)}}}.
  10148 
  10149 - {{{kbd(v [)}}} or short {{{kbd([)}}} (~org-agenda-manipulate-query-add~) ::
  10150 
  10151   #+kindex: v [
  10152   #+kindex: [
  10153   #+findex: org-agenda-manipulate-query-add
  10154   Include inactive timestamps into the current view.  Only for
  10155   weekly/daily agenda.
  10156 
  10157 - {{{kbd(v a)}}} (~org-agenda-archives-mode~) ::
  10158 
  10159   #+kindex: v a
  10160   #+findex: org-agenda-archives-mode
  10161   #+vindex: org-agenda-start-with-archives-mode
  10162   Toggle Archives mode.  In Archives mode, trees that are archived
  10163   (see [[*Internal archiving]]) are also scanned when producing the
  10164   agenda.  To exit archives mode, press {{{kbd(v a)}}} again.  The
  10165   initial setting for this mode in new agenda buffers can set with the
  10166   variable ~org-agenda-start-with-archives-mode~, which can be set
  10167   with the same values as ~org-agenda-archives-mode~.
  10168 
  10169 - {{{kbd(v A)}}} ::
  10170 
  10171   #+kindex: v A
  10172   Toggle Archives mode.  Include all archive files as well.
  10173 
  10174 - {{{kbd(v R)}}} or short {{{kbd(R)}}} (~org-agenda-clockreport-mode~) ::
  10175 
  10176   #+kindex: v R
  10177   #+kindex: R
  10178   #+findex: org-agenda-clockreport-mode
  10179   #+vindex: org-agenda-start-with-clockreport-mode
  10180   #+vindex: org-clock-report-include-clocking-task
  10181   Toggle Clockreport mode.  In Clockreport mode, the daily/weekly
  10182   agenda always shows a table with the clocked times for the time span
  10183   and file scope covered by the current agenda view.  The initial
  10184   setting for this mode in new agenda buffers can be set with the
  10185   variable ~org-agenda-start-with-clockreport-mode~.  By using a
  10186   prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}),
  10187   the clock table does not show contributions from entries that are
  10188   hidden by agenda filtering[fn:: Only tags filtering is respected
  10189   here, effort filtering is ignored.].  See also the variables
  10190   ~org-clock-report-include-clocking-task~ and
  10191   ~org-agenda-clock-report-header~.
  10192 
  10193 - {{{kbd(v c)}}} ::
  10194 
  10195   #+kindex: v c
  10196   #+vindex: org-agenda-clock-consistency-checks
  10197   Show overlapping clock entries, clocking gaps, and other clocking
  10198   problems in the current agenda range.  You can then visit clocking
  10199   lines and fix them manually.  See the variable
  10200   ~org-agenda-clock-consistency-checks~ for information on how to
  10201   customize the definition of what constituted a clocking problem.  To
  10202   return to normal agenda display, press {{{kbd(l)}}} to exit Logbook
  10203   mode.
  10204 
  10205 - {{{kbd(v E)}}} or short {{{kbd(E)}}} (~org-agenda-entry-text-mode~) ::
  10206 
  10207   #+kindex: v E
  10208   #+kindex: E
  10209   #+findex: org-agenda-entry-text-mode
  10210   #+vindex: org-agenda-start-with-entry-text-mode
  10211   #+vindex: org-agenda-entry-text-maxlines
  10212   Toggle entry text mode.  In entry text mode, a number of lines from
  10213   the Org outline node referenced by an agenda line are displayed
  10214   below the line.  The maximum number of lines is given by the
  10215   variable ~org-agenda-entry-text-maxlines~.  Calling this command
  10216   with a numeric prefix argument temporarily modifies that number to
  10217   the prefix value.
  10218 
  10219 - {{{kbd(G)}}} (~org-agenda-toggle-time-grid~) ::
  10220 
  10221   #+kindex: G
  10222   #+vindex: org-agenda-use-time-grid
  10223   #+vindex: org-agenda-time-grid
  10224   Toggle the time grid on and off.  See also the variables
  10225   ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
  10226 
  10227 - {{{kbd(r)}}} (~org-agenda-redo~), {{{kbd(g)}}} ::
  10228 
  10229   #+kindex: r
  10230   #+kindex: g
  10231   #+findex: org-agenda-redo
  10232   Recreate the agenda buffer, for example to reflect the changes after
  10233   modification of the timestamps of items with {{{kbd(S-LEFT)}}} and
  10234   {{{kbd(S-RIGHT)}}}.  When the buffer is the global TODO list,
  10235   a prefix argument is interpreted to create a selective list for
  10236   a specific TODO keyword.
  10237 
  10238 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}} (~org-save-all-org-buffers~) ::
  10239 
  10240   #+kindex: C-x C-s
  10241   #+findex: org-save-all-org-buffers
  10242   #+kindex: s
  10243   Save all Org buffers in the current Emacs session, and also the
  10244   locations of IDs.
  10245 
  10246 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
  10247 
  10248   #+kindex: C-c C-x C-c
  10249   #+findex: org-agenda-columns
  10250   #+vindex: org-columns-default-format
  10251   Invoke column view (see [[*Column View]]) in the agenda buffer.  The
  10252   column view format is taken from the entry at point, or, if there is
  10253   no entry at point, from the first entry in the agenda view.  So
  10254   whatever the format for that entry would be in the original buffer
  10255   (taken from a property, from a =COLUMNS= keyword, or from the
  10256   default variable ~org-columns-default-format~) is used in the
  10257   agenda.
  10258 
  10259 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
  10260 
  10261   #+kindex: C-c C-x >
  10262   #+findex: org-agenda-remove-restriction-lock
  10263   Remove the restriction lock on the agenda, if it is currently
  10264   restricted to a file or subtree (see [[*Agenda Files]]).
  10265 
  10266 - {{{kbd(M-UP)}}} (~org-agenda-drag-line-backward~) ::
  10267 
  10268   #+kindex: M-UP
  10269   #+findex: org-agenda-drag-line-backward
  10270   Drag the line at point backward one line.  With a numeric prefix
  10271   argument, drag backward by that many lines.
  10272 
  10273   Moving agenda lines does not persist after an agenda refresh and
  10274   does not modify the contributing Org files.
  10275 
  10276 - {{{kbd(M-DOWN)}}} (~org-agenda-drag-line-forward~) ::
  10277 
  10278   #+kindex: M-DOWN
  10279   #+findex: org-agenda-drag-line-forward
  10280   Drag the line at point forward one line.  With a numeric prefix
  10281   argument, drag forward by that many lines.
  10282 
  10283 *** Remote editing
  10284 :PROPERTIES:
  10285 :UNNUMBERED: notoc
  10286 :END:
  10287 #+cindex: remote editing, from agenda
  10288 
  10289 - {{{kbd(0--9)}}} ::
  10290 
  10291   Digit argument.
  10292 
  10293 - {{{kbd(C-_)}}} (~org-agenda-undo~) ::
  10294 
  10295   #+kindex: C-_
  10296   #+findex: org-agenda-undo
  10297   #+cindex: undoing remote-editing events
  10298   #+cindex: remote editing, undo
  10299   Undo a change due to a remote editing command.  The change is undone
  10300   both in the agenda buffer and in the remote buffer.
  10301 
  10302 - {{{kbd(t)}}} (~org-agenda-todo~) ::
  10303 
  10304   #+kindex: t
  10305   #+findex: org-agenda-todo
  10306   Change the TODO state of the item, both in the agenda and in the
  10307   original Org file.  A prefix arg is passed through to the ~org-todo~
  10308   command, so for example a {{{kbd(C-u)}}} prefix are will trigger
  10309   taking a note to document the state change.
  10310 
  10311 - {{{kbd(C-S-RIGHT)}}} (~org-agenda-todo-nextset~) ::
  10312 
  10313   #+kindex: C-S-RIGHT
  10314   #+findex: org-agenda-todo-nextset
  10315   Switch to the next set of TODO keywords.
  10316 
  10317 - {{{kbd(C-S-LEFT)}}}, ~org-agenda-todo-previousset~ ::
  10318 
  10319   #+kindex: C-S-LEFT
  10320   Switch to the previous set of TODO keywords.
  10321 
  10322 - {{{kbd(C-k)}}} (~org-agenda-kill~) ::
  10323 
  10324   #+kindex: C-k
  10325   #+findex: org-agenda-kill
  10326   #+vindex: org-agenda-confirm-kill
  10327   Delete the current agenda item along with the entire subtree
  10328   belonging to it in the original Org file.  If the text to be deleted
  10329   remotely is longer than one line, the kill needs to be confirmed by
  10330   the user.  See variable ~org-agenda-confirm-kill~.
  10331 
  10332 - {{{kbd(C-c C-w)}}} (~org-agenda-refile~) ::
  10333 
  10334   #+kindex: C-c C-w
  10335   #+findex: org-agenda-refile
  10336   Refile the entry at point.
  10337 
  10338 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}} (~org-agenda-archive-default-with-confirmation~) ::
  10339 
  10340   #+kindex: C-c C-x C-a
  10341   #+kindex: a
  10342   #+findex: org-agenda-archive-default-with-confirmation
  10343   #+vindex: org-archive-default-command
  10344   Archive the subtree corresponding to the entry at point using the
  10345   default archiving command set in ~org-archive-default-command~.
  10346   When using the {{{kbd(a)}}} key, confirmation is required.
  10347 
  10348 - {{{kbd(C-c C-x a)}}} (~org-agenda-toggle-archive-tag~) ::
  10349 
  10350   #+kindex: C-c C-x a
  10351   #+findex: org-agenda-toggle-archive-tag
  10352   Toggle the archive tag (see [[*Internal archiving]]) for the current
  10353   headline.
  10354 
  10355 - {{{kbd(C-c C-x A)}}} (~org-agenda-archive-to-archive-sibling~) ::
  10356 
  10357   #+kindex: C-c C-x A
  10358   #+findex: org-agenda-archive-to-archive-sibling
  10359   Move the subtree corresponding to the current entry to its /archive
  10360   sibling/.
  10361 
  10362 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}} (~org-agenda-archive~) ::
  10363 
  10364   #+kindex: C-c C-x C-s
  10365   #+kindex: $
  10366   #+findex: org-agenda-archive
  10367   Archive the subtree corresponding to the current headline.  This
  10368   means the entry is moved to the configured archive location, most
  10369   likely a different file.
  10370 
  10371 - {{{kbd(T)}}} (~org-agenda-show-tags~) ::
  10372 
  10373   #+kindex: T
  10374   #+findex: org-agenda-show-tags
  10375   #+vindex: org-agenda-show-inherited-tags
  10376   Show all tags associated with the current item.  This is useful if
  10377   you have turned off ~org-agenda-show-inherited-tags~, but still want
  10378   to see all tags of a headline occasionally.
  10379 
  10380 - {{{kbd(:)}}} (~org-agenda-set-tags~) ::
  10381 
  10382   #+kindex: :
  10383   #+findex: org-agenda-set-tags
  10384   Set tags for the current headline.  If there is an active region in
  10385   the agenda, change a tag for all headings in the region.
  10386 
  10387 - {{{kbd(\,)}}} (~org-agenda-priority~) ::
  10388 
  10389   #+kindex: ,
  10390   #+findex: org-agenda-priority
  10391   Set the priority for the current item.  Org mode prompts for the
  10392   priority character.  If you reply with {{{kbd(SPC)}}}, the priority
  10393   cookie is removed from the entry.
  10394 
  10395 - {{{kbd(+)}}} or {{{kbd(S-UP)}}} (~org-agenda-priority-up~) ::
  10396 
  10397   #+kindex: +
  10398   #+kindex: S-UP
  10399   #+findex: org-agenda-priority-up
  10400   Increase the priority of the current item.  The priority is changed
  10401   in the original buffer, but the agenda is not resorted.  Use the
  10402   {{{kbd(r)}}} key for this.
  10403 
  10404 - {{{kbd(-)}}} or {{{kbd(S-DOWN)}}} (~org-agenda-priority-down~) ::
  10405 
  10406   #+kindex: -
  10407   #+kindex: S-DOWN
  10408   #+findex: org-agenda-priority-down
  10409   Decrease the priority of the current item.
  10410 
  10411 - {{{kbd(C-c C-x e)}}} or short {{{kbd(e)}}} (~org-agenda-set-effort~) ::
  10412 
  10413   #+kindex: e
  10414   #+kindex: C-c C-x e
  10415   #+findex: org-agenda-set-effort
  10416   Set the effort property for the current item.
  10417 
  10418 - {{{kbd(C-c C-z)}}} or short {{{kbd(z)}}} (~org-agenda-add-note~) ::
  10419 
  10420   #+kindex: z
  10421   #+kindex: C-c C-z
  10422   #+findex: org-agenda-add-note
  10423   #+vindex: org-log-into-drawer
  10424   Add a note to the entry.  This note is recorded, and then filed to
  10425   the same location where state change notes are put.  Depending on
  10426   ~org-log-into-drawer~, this may be inside a drawer.
  10427 
  10428 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
  10429 
  10430   #+kindex: C-c C-a
  10431   #+findex: org-attach
  10432   Dispatcher for all command related to attachments.
  10433 
  10434 - {{{kbd(C-c C-s)}}} (~org-agenda-schedule~) ::
  10435 
  10436   #+kindex: C-c C-s
  10437   #+findex: org-agenda-schedule
  10438   Schedule this item.  With a prefix argument, remove the
  10439   scheduling timestamp
  10440 
  10441 - {{{kbd(C-c C-d)}}} (~org-agenda-deadline~) ::
  10442 
  10443   #+kindex: C-c C-d
  10444   #+findex: org-agenda-deadline
  10445   Set a deadline for this item.  With a prefix argument, remove the
  10446   deadline.
  10447 
  10448 - {{{kbd(S-RIGHT)}}} (~org-agenda-do-date-later~) ::
  10449 
  10450   #+kindex: S-RIGHT
  10451   #+findex: org-agenda-do-date-later
  10452   Change the timestamp associated with the current line by one day
  10453   into the future.  If the date is in the past, the first call to this
  10454   command moves it to today.  With a numeric prefix argument, change
  10455   it by that many days.  For example, {{{kbd(3 6 5 S-RIGHT)}}} changes
  10456   it by a year.  With a {{{kbd(C-u)}}} prefix, change the time by one
  10457   hour.  If you immediately repeat the command, it will continue to
  10458   change hours even without the prefix argument.  With a double
  10459   {{{kbd(C-u C-u)}}} prefix, do the same for changing minutes.  The
  10460   stamp is changed in the original Org file, but the change is not
  10461   directly reflected in the agenda buffer.  Use {{{kbd(r)}}} or
  10462   {{{kbd(g)}}} to update the buffer.
  10463 
  10464 - {{{kbd(S-LEFT)}}} (~org-agenda-do-date-earlier~) ::
  10465 
  10466   #+kindex: S-LEFT
  10467   #+findex: org-agenda-do-date-earlier
  10468   Change the timestamp associated with the current line by one day
  10469   into the past.
  10470 
  10471 - {{{kbd(>)}}} (~org-agenda-date-prompt~) ::
  10472 
  10473   #+kindex: >
  10474   #+findex: org-agenda-date-prompt
  10475   Change the timestamp associated with the current line.  The key
  10476   {{{kbd(>)}}} has been chosen, because it is the same as
  10477   {{{kbd(S-.)}}}  on my keyboard.
  10478 
  10479 - {{{kbd(I)}}} (~org-agenda-clock-in~) ::
  10480 
  10481   #+kindex: I
  10482   #+findex: org-agenda-clock-in
  10483   Start the clock on the current item.  If a clock is running already,
  10484   it is stopped first.
  10485 
  10486 - {{{kbd(O)}}} (~org-agenda-clock-out~) ::
  10487 
  10488   #+kindex: O
  10489   #+findex: org-agenda-clock-out
  10490   Stop the previously started clock.
  10491 
  10492 - {{{kbd(X)}}} (~org-agenda-clock-cancel~) ::
  10493 
  10494   #+kindex: X
  10495   #+findex: org-agenda-clock-cancel
  10496   Cancel the currently running clock.
  10497 
  10498 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
  10499 
  10500   #+kindex: J
  10501   #+findex: org-agenda-clock-goto
  10502   Jump to the running clock in another window.
  10503 
  10504 - {{{kbd(k)}}} (~org-agenda-capture~) ::
  10505 
  10506   #+kindex: k
  10507   #+findex: org-agenda-capture
  10508   #+cindex: capturing, from agenda
  10509   #+vindex: org-capture-use-agenda-date
  10510   Like ~org-capture~, but use the date at point as the default date
  10511   for the capture template.  See ~org-capture-use-agenda-date~ to make
  10512   this the default behavior of ~org-capture~.
  10513 
  10514 *** Bulk remote editing selected entries
  10515 :PROPERTIES:
  10516 :UNNUMBERED: notoc
  10517 :END:
  10518 #+cindex: remote editing, bulk, from agenda
  10519 #+vindex: org-agenda-bulk-custom-functions
  10520 
  10521 - {{{kbd(m)}}} (~org-agenda-bulk-mark~) ::
  10522   #+kindex: m
  10523   #+findex: org-agenda-bulk-mark
  10524 
  10525   Mark the entry at point for bulk action.  If there is an active
  10526   region in the agenda, mark the entries in the region.  With numeric
  10527   prefix argument, mark that many successive entries.
  10528 
  10529 - {{{kbd(*)}}} (~org-agenda-bulk-mark-all~) ::
  10530   #+kindex: *
  10531   #+findex: org-agenda-bulk-mark-all
  10532 
  10533   Mark all visible agenda entries for bulk action.
  10534 
  10535 - {{{kbd(u)}}} (~org-agenda-bulk-unmark~) ::
  10536   #+kindex: u
  10537   #+findex: org-agenda-bulk-unmark
  10538 
  10539   Unmark entry for bulk action.
  10540 
  10541 - {{{kbd(U)}}} (~org-agenda-bulk-unmark-all~) ::
  10542   #+kindex: U
  10543   #+findex: org-agenda-bulk-unmark-all
  10544 
  10545   Unmark all marked entries for bulk action.
  10546 
  10547 - {{{kbd(M-m)}}} (~org-agenda-bulk-toggle~) ::
  10548   #+kindex: M-m
  10549   #+findex: org-agenda-bulk-toggle
  10550 
  10551   Toggle mark of the entry at point for bulk action.
  10552 
  10553 - {{{kbd(M-*)}}} (~org-agenda-bulk-toggle-all~) ::
  10554   #+kindex: M-*
  10555   #+findex: org-agenda-bulk-toggle-all
  10556 
  10557   Toggle mark of every entry for bulk action.
  10558 
  10559 - {{{kbd(%)}}} (~org-agenda-bulk-mark-regexp~) ::
  10560   #+kindex: %
  10561   #+findex: org-agenda-bulk-mark-regexp
  10562 
  10563   Mark entries matching a regular expression for bulk action.
  10564 
  10565 - {{{kbd(B)}}} (~org-agenda-bulk-action~) ::
  10566   #+kindex: B
  10567   #+findex: org-agenda-bulk-action
  10568   #+vindex: org-agenda-bulk-persistent-marks
  10569 
  10570   Bulk action: act on all marked entries in the agenda.  This prompts
  10571   for another key to select the action to be applied.  The prefix
  10572   argument to {{{kbd(B)}}} is passed through to the {{{kbd(s)}}} and
  10573   {{{kbd(d)}}} commands, to bulk-remove these special timestamps.  By
  10574   default, marks are removed after the bulk.  If you want them to
  10575   persist, set ~org-agenda-bulk-persistent-marks~ to ~t~ or hit
  10576   {{{kbd(p)}}} at the prompt.
  10577 
  10578   - {{{kbd(p)}}} ::
  10579 
  10580     Toggle persistent marks.
  10581 
  10582   - {{{kbd($)}}} ::
  10583 
  10584     Archive all selected entries.
  10585 
  10586   - {{{kbd(A)}}} ::
  10587 
  10588     Archive entries by moving them to their respective archive
  10589     siblings.
  10590 
  10591   - {{{kbd(t)}}} ::
  10592 
  10593     Change TODO state.  This prompts for a single TODO keyword and
  10594     changes the state of all selected entries, bypassing blocking and
  10595     suppressing logging notes---but not timestamps.
  10596 
  10597   - {{{kbd(+)}}} ::
  10598 
  10599     Add a tag to all selected entries.
  10600 
  10601   - {{{kbd(-)}}} ::
  10602 
  10603     Remove a tag from all selected entries.
  10604 
  10605   - {{{kbd(s)}}} ::
  10606 
  10607     Schedule all items to a new date.  To shift existing schedule
  10608     dates by a fixed number of days, use something starting with
  10609     double plus at the prompt, for example =++8d= or =++2w=.
  10610 
  10611   - {{{kbd(d)}}} ::
  10612 
  10613     Set deadline to a specific date.
  10614 
  10615   - {{{kbd(r)}}} ::
  10616 
  10617     Prompt for a single refile target and move all entries.  The
  10618     entries are no longer in the agenda; refresh ({{{kbd(g)}}}) to
  10619     bring them back.
  10620 
  10621   - {{{kbd(S)}}} ::
  10622 
  10623     Reschedule randomly into the coming N days.  N is prompted for.
  10624     With a prefix argument ({{{kbd(C-u B S)}}}), scatter only across
  10625     weekdays.
  10626 
  10627   - {{{kbd(f)}}} ::
  10628 
  10629     #+vindex: org-agenda-bulk-custom-functions
  10630     Apply a function[fn:: You can also create persistent custom
  10631     functions through ~org-agenda-bulk-custom-functions~.] to marked
  10632     entries.  For example, the function below sets the =CATEGORY=
  10633     property of the entries to =web=.
  10634 
  10635     #+begin_src emacs-lisp
  10636     (defun set-category ()
  10637       (interactive "P")
  10638       (let ((marker (or (org-get-at-bol 'org-hd-marker)
  10639                         (org-agenda-error))))
  10640         (org-with-point-at marker
  10641           (org-back-to-heading t)
  10642           (org-set-property "CATEGORY" "web"))))
  10643     #+end_src
  10644 
  10645 *** Calendar commands
  10646 :PROPERTIES:
  10647 :UNNUMBERED: notoc
  10648 :END:
  10649 #+cindex: calendar commands, from agenda
  10650 
  10651 - {{{kbd(c)}}} (~org-agenda-goto-calendar~) ::
  10652 
  10653   #+kindex: c
  10654   #+findex: org-agenda-goto-calendar
  10655   Open the Emacs calendar and go to the date at point in the agenda.
  10656 
  10657 - {{{kbd(c)}}} (~org-calendar-goto-agenda~) ::
  10658 
  10659   #+kindex: c
  10660   #+findex: org-calendar-goto-agenda
  10661   When in the calendar, compute and show the Org agenda for the date
  10662   at point.
  10663 
  10664 - {{{kbd(i)}}} (~org-agenda-diary-entry~) ::
  10665   #+kindex: i
  10666   #+findex: org-agenda-diary-entry
  10667 
  10668   #+cindex: diary entries, creating from agenda
  10669   Insert a new entry into the diary, using the date at point and (for
  10670   block entries) the date at the mark.  This adds to the Emacs diary
  10671   file[fn:: This file is parsed for the agenda when
  10672   ~org-agenda-include-diary~ is set.], in a way similar to the
  10673   {{{kbd(i)}}} command in the calendar.  The diary file pops up in
  10674   another window, where you can add the entry.
  10675 
  10676   #+vindex: org-agenda-diary-file
  10677   If you configure ~org-agenda-diary-file~ to point to an Org file,
  10678   Org creates entries in that file instead.  Most entries are stored
  10679   in a date-based outline tree that will later make it easy to archive
  10680   appointments from previous months/years.  The tree is built under an
  10681   entry with a =DATE_TREE= property, or else with years as top-level
  10682   entries.  Emacs prompts you for the entry text---if you specify it,
  10683   the entry is created in ~org-agenda-diary-file~ without further
  10684   interaction.  If you directly press {{{kbd(RET)}}} at the prompt
  10685   without typing text, the target file is shown in another window for
  10686   you to finish the entry there.  See also the {{{kbd(k r)}}} command.
  10687 
  10688 - {{{kbd(M)}}} (~org-agenda-phases-of-moon~) ::
  10689 
  10690   #+kindex: M
  10691   #+findex: org-agenda-phases-of-moon
  10692   Show the phases of the moon for the three months around current
  10693   date.
  10694 
  10695 - {{{kbd(S)}}} (~org-agenda-sunrise-sunset~) ::
  10696 
  10697   #+kindex: S
  10698   #+findex: org-agenda-sunrise-sunset
  10699   Show sunrise and sunset times.  The geographical location must be
  10700   set with calendar variables, see the documentation for the Emacs
  10701   calendar.
  10702 
  10703 - {{{kbd(C)}}} (~org-agenda-convert-date~) ::
  10704 
  10705   #+kindex: C
  10706   #+findex: org-agenda-convert-date
  10707   Convert the date at point into many other cultural and historic
  10708   calendars.
  10709 
  10710 - {{{kbd(H)}}} (~org-agenda-holidays~) ::
  10711 
  10712   #+kindex: H
  10713   #+findex: org-agenda-holidays
  10714   Show holidays for three months around point date.
  10715 
  10716 *** Quit and exit
  10717 :PROPERTIES:
  10718 :UNNUMBERED: notoc
  10719 :END:
  10720 
  10721 - {{{kbd(q)}}} (~org-agenda-quit~) ::
  10722   #+kindex: q
  10723   #+findex: org-agenda-quit
  10724 
  10725   Quit agenda, remove the agenda buffer.
  10726 
  10727 - {{{kbd(x)}}} (~org-agenda-exit~) ::
  10728   #+kindex: x
  10729   #+findex: org-agenda-exit
  10730 
  10731   #+cindex: agenda files, removing buffers
  10732   Exit agenda, remove the agenda buffer and all buffers loaded by
  10733   Emacs for the compilation of the agenda.  Buffers created by the
  10734   user to visit Org files are not removed.
  10735 
  10736 ** Custom Agenda Views
  10737 :PROPERTIES:
  10738 :DESCRIPTION: Defining special searches and views.
  10739 :END:
  10740 #+cindex: custom agenda views
  10741 #+cindex: agenda views, custom
  10742 
  10743 Custom agenda commands serve two purposes: to store and quickly access
  10744 frequently used TODO and tags searches, and to create special
  10745 composite agenda buffers.  Custom agenda commands are accessible
  10746 through the dispatcher (see [[*The Agenda Dispatcher]]), just like the
  10747 default commands.
  10748 
  10749 *** Storing searches
  10750 :PROPERTIES:
  10751 :DESCRIPTION: Type once, use often.
  10752 :END:
  10753 
  10754 The first application of custom searches is the definition of keyboard
  10755 shortcuts for frequently used searches, either creating an agenda
  10756 buffer, or a sparse tree (the latter covering of course only the
  10757 current buffer).
  10758 
  10759 #+kindex: C @r{(Agenda dispatcher)}
  10760 #+vindex: org-agenda-custom-commands
  10761 #+cindex: agenda views, main example
  10762 #+cindex: agenda, as an agenda views
  10763 #+cindex: agenda*, as an agenda views
  10764 #+cindex: tags, as an agenda view
  10765 #+cindex: todo, as an agenda view
  10766 #+cindex: tags-todo
  10767 #+cindex: todo-tree
  10768 #+cindex: occur-tree
  10769 #+cindex: tags-tree
  10770 Custom commands are configured in the variable
  10771 ~org-agenda-custom-commands~.  You can customize this variable, for
  10772 example by pressing {{{kbd(C)}}} from the agenda dispatcher (see [[*The
  10773 Agenda Dispatcher]]).  You can also directly set it with Emacs Lisp in
  10774 the Emacs init file.  The following example contains all valid agenda
  10775 views:
  10776 
  10777 #+begin_src emacs-lisp
  10778 (setq org-agenda-custom-commands
  10779       '(("x" agenda)
  10780         ("y" agenda*)
  10781         ("w" todo "WAITING")
  10782         ("W" todo-tree "WAITING")
  10783         ("u" tags "+boss-urgent")
  10784         ("v" tags-todo "+boss-urgent")
  10785         ("U" tags-tree "+boss-urgent")
  10786         ("f" occur-tree "\\<FIXME\\>")
  10787         ("h" . "HOME+Name tags searches") ;description for "h" prefix
  10788         ("hl" tags "+home+Lisa")
  10789         ("hp" tags "+home+Peter")
  10790         ("hk" tags "+home+Kim")))
  10791 #+end_src
  10792 
  10793 The initial string in each entry defines the keys you have to press
  10794 after the dispatcher command in order to access the command.  Usually
  10795 this is just a single character, but if you have many similar
  10796 commands, you can also define two-letter combinations where the first
  10797 character is the same in several combinations and serves as a prefix
  10798 key[fn:: You can provide a description for a prefix key by inserting a
  10799 cons cell with the prefix and the description.].  The second parameter
  10800 is the search type, followed by the string or regular expression to be
  10801 used for the matching.  The example above will therefore define:
  10802 
  10803 - {{{kbd(x)}}} ::
  10804 
  10805   as a global search for agenda entries planned[fn:35] this week/day.
  10806 
  10807 - {{{kbd(y)}}} ::
  10808 
  10809   as the same search, but only for entries with an hour specification
  10810   like =[h]h:mm=---think of them as appointments.
  10811 
  10812 - {{{kbd(w)}}} ::
  10813 
  10814   as a global search for TODO entries with =WAITING= as the TODO
  10815   keyword.
  10816 
  10817 - {{{kbd(W)}}} ::
  10818 
  10819   as the same search, but only in the current buffer and displaying
  10820   the results as a sparse tree.
  10821 
  10822 - {{{kbd(u)}}} ::
  10823 
  10824   as a global tags search for headlines tagged =boss= but not
  10825   =urgent=.
  10826 
  10827 - {{{kbd(v)}}} ::
  10828 
  10829   The same search, but limiting it to headlines that are also TODO
  10830   items.
  10831 
  10832 - {{{kbd(U)}}} ::
  10833 
  10834   as the same search, but only in the current buffer and displaying
  10835   the result as a sparse tree.
  10836 
  10837 - {{{kbd(f)}}} ::
  10838 
  10839   to create a sparse tree (again, current buffer only) with all
  10840   entries containing the word =FIXME=.
  10841 
  10842 - {{{kbd(h)}}} ::
  10843 
  10844   as a prefix command for a =HOME= tags search where you have to press
  10845   an additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or {{{kbd(k)}}}) to
  10846   select a name (Lisa, Peter, or Kim) as additional tag to match.
  10847 
  10848 Note that ~*-tree~ agenda views need to be called from an Org buffer
  10849 as they operate on the current buffer only.
  10850 
  10851 *** Block agenda
  10852 :PROPERTIES:
  10853 :DESCRIPTION: All the stuff you need in a single buffer.
  10854 :END:
  10855 #+cindex: block agenda
  10856 #+cindex: agenda, with block views
  10857 
  10858 Another possibility is the construction of agenda views that comprise
  10859 the results of /several/ commands, each of which creates a block in
  10860 the agenda buffer.  The available commands include ~agenda~ for the
  10861 daily or weekly agenda (as created with {{{kbd(a)}}}) , ~alltodo~ for
  10862 the global TODO list (as constructed with {{{kbd(t)}}}), ~stuck~ for
  10863 the list of stuck projects (as obtained with {{{kbd(#)}}}) and the
  10864 matching commands discussed above: ~todo~, ~tags~, and ~tags-todo~.
  10865 
  10866 Here are two examples:
  10867 
  10868 #+begin_src emacs-lisp
  10869 (setq org-agenda-custom-commands
  10870       '(("h" "Agenda and Home-related tasks"
  10871          ((agenda "")
  10872           (tags-todo "home")
  10873           (tags "garden")))
  10874         ("o" "Agenda and Office-related tasks"
  10875          ((agenda "")
  10876           (tags-todo "work")
  10877           (tags "office")))))
  10878 #+end_src
  10879 
  10880 #+texinfo: @noindent
  10881 This defines {{{kbd(h)}}} to create a multi-block view for stuff you
  10882 need to attend to at home.  The resulting agenda buffer contains your
  10883 agenda for the current week, all TODO items that carry the tag =home=,
  10884 and also all lines tagged with =garden=.  Finally the command
  10885 {{{kbd(o)}}} provides a similar view for office tasks.
  10886 
  10887 *** Setting options for custom commands
  10888 :PROPERTIES:
  10889 :DESCRIPTION: Changing the rules.
  10890 :ALT_TITLE: Setting options
  10891 :END:
  10892 #+cindex: options, for custom agenda views
  10893 
  10894 #+vindex: org-agenda-custom-commands
  10895 Org mode contains a number of variables regulating agenda construction
  10896 and display.  The global variables define the behavior for all agenda
  10897 commands, including the custom commands.  However, if you want to
  10898 change some settings just for a single custom view, you can do so.
  10899 Setting options requires inserting a list of variable names and values
  10900 at the right spot in ~org-agenda-custom-commands~.  For example:
  10901 
  10902 #+begin_src emacs-lisp
  10903 (setq org-agenda-custom-commands
  10904       '(("w" todo "WAITING"
  10905          ((org-agenda-sorting-strategy '(priority-down))
  10906           (org-agenda-prefix-format "  Mixed: ")))
  10907         ("U" tags-tree "+boss-urgent"
  10908          ((org-show-context-detail 'minimal)))
  10909         ("N" search ""
  10910          ((org-agenda-files '("~org/notes.org"))
  10911           (org-agenda-text-search-extra-files nil)))))
  10912 #+end_src
  10913 
  10914 #+texinfo: @noindent
  10915 Now the {{{kbd(w)}}} command sorts the collected entries only by
  10916 priority, and the prefix format is modified to just say =Mixed:=
  10917 instead of giving the category of the entry.  The sparse tags tree of
  10918 {{{kbd(U)}}} now turns out ultra-compact, because neither the headline
  10919 hierarchy above the match, nor the headline following the match are
  10920 shown.  The command {{{kbd(N)}}} does a text search limited to only
  10921 a single file.
  10922 
  10923 For command sets creating a block agenda, ~org-agenda-custom-commands~
  10924 has two separate spots for setting options.  You can add options that
  10925 should be valid for just a single command in the set, and options that
  10926 should be valid for all commands in the set.  The former are just
  10927 added to the command entry; the latter must come after the list of
  10928 command entries.  Going back to the block agenda example (see [[*Block
  10929 agenda]]), let's change the sorting strategy for the {{{kbd(h)}}}
  10930 commands to ~priority-down~, but let's sort the results for =garden=
  10931 tags query in the opposite order, ~priority-up~.  This would look like
  10932 this:
  10933 
  10934 #+begin_src emacs-lisp
  10935 (setq org-agenda-custom-commands
  10936       '(("h" "Agenda and Home-related tasks"
  10937          ((agenda)
  10938           (tags-todo "home")
  10939           (tags "garden"
  10940                 ((org-agenda-sorting-strategy '(priority-up)))))
  10941          ((org-agenda-sorting-strategy '(priority-down))))
  10942         ("o" "Agenda and Office-related tasks"
  10943          ((agenda)
  10944           (tags-todo "work")
  10945           (tags "office")))))
  10946 #+end_src
  10947 
  10948 As you see, the values and parentheses setting is a little complex.
  10949 When in doubt, use the customize interface to set this variable---it
  10950 fully supports its structure.  Just one caveat: when setting options
  10951 in this interface, the /values/ are just Lisp expressions.  So if the
  10952 value is a string, you need to add the double-quotes around the value
  10953 yourself.
  10954 
  10955 #+vindex: org-agenda-custom-commands-contexts
  10956 To control whether an agenda command should be accessible from
  10957 a specific context, you can customize
  10958 ~org-agenda-custom-commands-contexts~.  Let's say for example that you
  10959 have an agenda command {{{kbd(o)}}} displaying a view that you only
  10960 need when reading emails.  Then you would configure this option like
  10961 this:
  10962 
  10963 #+begin_src emacs-lisp
  10964 (setq org-agenda-custom-commands-contexts
  10965       '(("o" (in-mode . "message-mode"))))
  10966 #+end_src
  10967 
  10968 You can also tell that the command key {{{kbd(o)}}} should refer to
  10969 another command key {{{kbd(r)}}}.  In that case, add this command key
  10970 like this:
  10971 
  10972 #+begin_src emacs-lisp
  10973 (setq org-agenda-custom-commands-contexts
  10974       '(("o" "r" (in-mode . "message-mode"))))
  10975 #+end_src
  10976 
  10977 See the docstring of the variable for more information.
  10978 
  10979 ** Exporting Agenda Views
  10980 :PROPERTIES:
  10981 :DESCRIPTION: Writing a view to a file.
  10982 :END:
  10983 #+cindex: agenda views, exporting
  10984 
  10985 If you are away from your computer, it can be very useful to have a
  10986 printed version of some agenda views to carry around.  Org mode can
  10987 export custom agenda views as plain text, HTML[fn:: For HTML you need
  10988 to install Hrvoje Nikšić's =htmlize.el= as an Emacs package from
  10989 [[https://elpa.nongnu.org/][NonGNU ELPA]] or from
  10990 [[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].],
  10991 Postscript, PDF[fn:36], and iCalendar files.  If you
  10992 want to do this only occasionally, use the following command:
  10993 
  10994 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
  10995   #+kindex: C-x C-w
  10996   #+findex: org-agenda-write
  10997   #+cindex: exporting agenda views
  10998   #+cindex: agenda views, exporting
  10999 
  11000   #+vindex: org-agenda-exporter-settings
  11001   Write the agenda view to a file.
  11002 
  11003 If you need to export certain agenda views frequently, you can
  11004 associate any custom agenda command with a list of output file
  11005 names[fn:: If you want to store standard views like the weekly agenda
  11006 or the global TODO list as well, you need to define custom commands
  11007 for them in order to be able to specify file names.].  Here is an
  11008 example that first defines custom commands for the agenda and the
  11009 global TODO list, together with a number of files to which to export
  11010 them.  Then we define two block agenda commands and specify file names
  11011 for them as well.  File names can be relative to the current working
  11012 directory, or absolute.
  11013 
  11014 #+begin_src emacs-lisp
  11015 (setq org-agenda-custom-commands
  11016       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  11017         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  11018         ("h" "Agenda and Home-related tasks"
  11019          ((agenda "")
  11020           (tags-todo "home")
  11021           (tags "garden"))
  11022          nil
  11023          ("~/views/home.html"))
  11024         ("o" "Agenda and Office-related tasks"
  11025          ((agenda)
  11026           (tags-todo "work")
  11027           (tags "office"))
  11028          nil
  11029          ("~/views/office.ps" "~/calendars/office.ics"))))
  11030 #+end_src
  11031 
  11032 The extension of the file name determines the type of export.  If it
  11033 is =.html=, Org mode uses the htmlize package to convert the buffer to
  11034 HTML and save it to this file name.  If the extension is =.ps=,
  11035 ~ps-print-buffer-with-faces~ is used to produce Postscript output.  If
  11036 the extension is =.ics=, iCalendar export is run export over all files
  11037 that were used to construct the agenda, and limit the export to
  11038 entries listed in the agenda.  Any other extension produces a plain
  11039 ASCII file.
  11040 
  11041 The export files are /not/ created when you use one of those
  11042 commands interactively because this might use too much overhead.
  11043 Instead, there is a special command to produce /all/ specified
  11044 files in one step:
  11045 
  11046 - {{{kbd(e)}}} (~org-store-agenda-views~) ::
  11047 
  11048   #+kindex: e @r{(Agenda dispatcher)}
  11049   #+findex: org-store-agenda-views
  11050   Export all agenda views that have export file names associated with
  11051   them.
  11052 
  11053 You can use the options section of the custom agenda commands to also
  11054 set options for the export commands.  For example:
  11055 
  11056 #+begin_src emacs-lisp
  11057 (setq org-agenda-custom-commands
  11058       '(("X" agenda ""
  11059          ((ps-number-of-columns 2)
  11060           (ps-landscape-mode t)
  11061           (org-agenda-prefix-format " [ ] ")
  11062           (org-agenda-with-colors nil)
  11063           (org-agenda-remove-tags t))
  11064          ("theagenda.ps"))))
  11065 #+end_src
  11066 
  11067 #+texinfo: @noindent
  11068 #+vindex: org-agenda-exporter-settings
  11069 This command sets two options for the Postscript exporter, to make it
  11070 print in two columns in landscape format---the resulting page can be
  11071 cut in two and then used in a paper agenda.  The remaining settings
  11072 modify the agenda prefix to omit category and scheduling information,
  11073 and instead include a checkbox to check off items.  We also remove the
  11074 tags to make the lines compact, and we do not want to use colors for
  11075 the black-and-white printer.  Settings specified in
  11076 ~org-agenda-exporter-settings~ also apply, e.g.,
  11077 
  11078 #+begin_src emacs-lisp
  11079 (setq org-agenda-exporter-settings
  11080       '((ps-number-of-columns 2)
  11081         (ps-landscape-mode t)
  11082         (org-agenda-add-entry-text-maxlines 5)
  11083         (htmlize-output-type 'css)))
  11084 #+end_src
  11085 
  11086 #+texinfo: @noindent
  11087 but the settings in ~org-agenda-custom-commands~ take precedence.
  11088 
  11089 From the command line you may also use:
  11090 
  11091 #+begin_src shell
  11092 emacs -eval (org-batch-store-agenda-views) -kill
  11093 #+end_src
  11094 
  11095 #+texinfo: @noindent
  11096 or, if you need to modify some parameters[fn:: Quoting depends on the
  11097 system you use, please check the FAQ for examples.]
  11098 
  11099 #+begin_src shell
  11100 emacs -eval '(org-batch-store-agenda-views                      \
  11101               org-agenda-span (quote month)                     \
  11102               org-agenda-start-day "2007-11-01"                 \
  11103               org-agenda-include-diary nil                      \
  11104               org-agenda-files (quote ("~/org/project.org")))'  \
  11105       -kill
  11106 #+end_src
  11107 
  11108 #+texinfo: @noindent
  11109 which creates the agenda views restricted to the file
  11110 =~/org/project.org=, without diary entries and with a 30-day extent.
  11111 
  11112 You can also extract agenda information in a way that allows further
  11113 processing by other programs.  See [[*Extracting Agenda Information]], for
  11114 more information.
  11115 
  11116 ** Using Column View in the Agenda
  11117 :PROPERTIES:
  11118 :DESCRIPTION: Using column view for collected entries.
  11119 :ALT_TITLE: Agenda Column View
  11120 :END:
  11121 #+cindex: column view, in agenda
  11122 #+cindex: agenda, column view
  11123 
  11124 Column view (see [[*Column View]]) is normally used to view and edit
  11125 properties embedded in the hierarchical structure of an Org file.  It
  11126 can be quite useful to use column view also from the agenda, where
  11127 entries are collected by certain criteria.
  11128 
  11129 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
  11130   #+kindex: C-c C-x C-c
  11131   #+findex: org-agenda-columns
  11132 
  11133   Turn on column view in the agenda.
  11134 
  11135 To understand how to use this properly, it is important to realize
  11136 that the entries in the agenda are no longer in their proper outline
  11137 environment.  This causes the following issues:
  11138 
  11139 1.
  11140    #+vindex: org-columns-default-format-for-agenda
  11141    #+vindex: org-columns-default-format
  11142    Org needs to make a decision which columns format to use.  Since
  11143    the entries in the agenda are collected from different files, and
  11144    different files may have different columns formats, this is a
  11145    non-trivial problem.  Org first checks if
  11146    ~org-overriding-columns-format~ is currently set, and if so, takes
  11147    the format from there.  You should set this variable only in the
  11148    /local settings section/ of a custom agenda command (see [[*Custom
  11149    Agenda Views]]) to make it valid for that specific agenda view.  If
  11150    no such binding exists, it checks, in sequence,
  11151    ~org-columns-default-format-for-agenda~, the format associated with
  11152    the first item in the agenda (through a property or a =#+COLUMNS=
  11153    setting in that buffer) and finally ~org-columns-default-format~.
  11154 
  11155 2.
  11156    #+cindex: @samp{CLOCKSUM}, special property
  11157    If any of the columns has a summary type defined (see [[*Column
  11158    attributes]]), turning on column view in the agenda visits all
  11159    relevant agenda files and make sure that the computations of this
  11160    property are up to date.  This is also true for the special
  11161    =CLOCKSUM= property.  Org then sums the values displayed in the
  11162    agenda.  In the daily/weekly agenda, the sums cover a single day;
  11163    in all other views they cover the entire block.
  11164 
  11165    It is important to realize that the agenda may show the same entry
  11166    /twice/---for example as scheduled and as a deadline---and it may
  11167    show two entries from the same hierarchy (for example a /parent/
  11168    and its /child/).  In these cases, the summation in the agenda
  11169    leads to incorrect results because some values count double.
  11170 
  11171 3. When the column view in the agenda shows the =CLOCKSUM= property,
  11172    that is always the entire clocked time for this item.  So even in
  11173    the daily/weekly agenda, the clocksum listed in column view may
  11174    originate from times outside the current view.  This has the
  11175    advantage that you can compare these values with a column listing
  11176    the planned total effort for a task---one of the major
  11177    applications for column view in the agenda.  If you want
  11178    information about clocked time in the displayed period use clock
  11179    table mode (press {{{kbd(R)}}} in the agenda).
  11180 
  11181 4.
  11182    #+cindex: @samp{CLOCKSUM_T}, special property
  11183    When the column view in the agenda shows the =CLOCKSUM_T= property,
  11184    that is always today's clocked time for this item.  So even in the
  11185    weekly agenda, the clocksum listed in column view only originates
  11186    from today.  This lets you compare the time you spent on a task for
  11187    today, with the time already spent---via =CLOCKSUM=---and with
  11188    the planned total effort for it.
  11189 
  11190 * Markup for Rich Contents
  11191 :PROPERTIES:
  11192 :DESCRIPTION: Compose beautiful documents.
  11193 :END:
  11194 
  11195 Org is primarily about organizing and searching through your
  11196 plain-text notes.  However, it also provides a lightweight yet robust
  11197 markup language for rich text formatting and more.  For instance, you
  11198 may want to center or emphasize text.  Or you may need to insert
  11199 a formula or image in your writing.  Org offers syntax for all of this
  11200 and more.  Used in conjunction with the export framework (see
  11201 [[*Exporting]]), you can author beautiful documents in Org---like the fine
  11202 manual you are currently reading.
  11203 
  11204 ** Paragraphs
  11205 :PROPERTIES:
  11206 :DESCRIPTION: The basic unit of text.
  11207 :END:
  11208 
  11209 #+cindex: paragraphs, markup rules
  11210 Paragraphs are separated by at least one empty line.  If you need to
  11211 enforce a line break within a paragraph, use =\\= at the end of
  11212 a line.
  11213 
  11214 #+cindex: line breaks, markup rules
  11215 To preserve the line breaks, indentation and blank lines in a region,
  11216 but otherwise use normal formatting, you can use this construct, which
  11217 can also be used to format poetry.
  11218 
  11219 #+cindex: @samp{BEGIN_VERSE}
  11220 #+cindex: verse blocks
  11221 #+begin_example
  11222 ,#+BEGIN_VERSE
  11223  Great clouds overhead
  11224  Tiny black birds rise and fall
  11225  Snow covers Emacs
  11226 
  11227     ---AlexSchroeder
  11228 ,#+END_VERSE
  11229 #+end_example
  11230 
  11231 When quoting a passage from another document, it is customary to
  11232 format this as a paragraph that is indented on both the left and the
  11233 right margin.  You can include quotations in Org documents like this:
  11234 
  11235 #+cindex: @samp{BEGIN_QUOTE}
  11236 #+cindex: quote blocks
  11237 #+begin_example
  11238 ,#+BEGIN_QUOTE
  11239 Everything should be made as simple as possible,
  11240 but not any simpler ---Albert Einstein
  11241 ,#+END_QUOTE
  11242 #+end_example
  11243 
  11244 If you would like to center some text, do it like this:
  11245 
  11246 #+cindex: @samp{BEGIN_CENTER}
  11247 #+cindex: center blocks
  11248 #+begin_example
  11249 ,#+BEGIN_CENTER
  11250 Everything should be made as simple as possible, \\
  11251 but not any simpler
  11252 ,#+END_CENTER
  11253 #+end_example
  11254 
  11255 ** Emphasis and Monospace
  11256 :PROPERTIES:
  11257 :DESCRIPTION: Bold, italic, etc.
  11258 :END:
  11259 #+cindex: underlined text, markup rules
  11260 #+cindex: bold text, markup rules
  11261 #+cindex: italic text, markup rules
  11262 #+cindex: verbatim text, markup rules
  11263 #+cindex: code text, markup rules
  11264 #+cindex: strike-through text, markup rules
  11265 
  11266 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
  11267 and =~code~=, and, if you must, =+strike-through+=.  Text in the code
  11268 and verbatim string is not processed for Org specific syntax; it is
  11269 exported verbatim.  Org provides a single command as entry point for
  11270 inserting the marker character.
  11271 
  11272 - {{{kbd(C-c C-x C-f)}}} (~org-emphasize~) ::
  11273 
  11274   #+kindex: C-c C-x C-f
  11275   #+findex: org-emphasize
  11276   Prompt for a marker character and insert or change an emphasis.  If
  11277   there is an active region, change that region to a new emphasis.  If
  11278   there is no region, just insert the marker characters and position
  11279   the cursor between them.
  11280 
  11281 #+vindex: org-fontify-emphasized-text
  11282 To turn off fontification for marked up text, you can set
  11283 ~org-fontify-emphasized-text~ to ~nil~.  To narrow down the list of
  11284 the fontified markup syntax, you can customize
  11285 ~org-emphasis-alist~[fn:: The markup will still be recognized.  Just
  11286 not highlighted visually in Emacs.].
  11287 
  11288 #+vindex: org-hide-emphasis-markers
  11289 To hide the emphasis markup characters in your buffers, set
  11290 ~org-hide-emphasis-markers~ to ~t~.
  11291 
  11292 Sometimes, when marked text also contains the marker character itself,
  11293 the result may be unsettling.  For example,
  11294 
  11295 #+begin_example
  11296 /One may expect this whole sentence to be italicized, but the
  11297 following ~user/?variable~ contains =/= character, which effectively
  11298 stops emphasis there./
  11299 #+end_example
  11300 
  11301 You can use zero width space to help Org sorting out the ambiguity.
  11302 See [[*Escape Character]] for more details.
  11303 
  11304 ** Subscripts and Superscripts
  11305 :PROPERTIES:
  11306 :DESCRIPTION: Simple syntax for raising/lowering text.
  11307 :END:
  11308 #+cindex: subscript
  11309 #+cindex: superscript
  11310 
  11311 =^= and =_= are used to indicate super- and subscripts.  To increase
  11312 the readability of ASCII text, it is not necessary, but OK, to
  11313 surround multi-character sub- and superscripts with curly braces.  For
  11314 example
  11315 
  11316 #+begin_example
  11317 The radius of the sun is R_sun = 6.96 x 10^8 m.  On the other hand,
  11318 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
  11319 #+end_example
  11320 
  11321 #+vindex: org-use-sub-superscripts
  11322 #+vindex: org-export-with-sub-superscripts
  11323 If you write a text where the underscore is often used in a different
  11324 context, Org's convention to always interpret these as subscripts can
  11325 get in your way.  Configure the variable ~org-use-sub-superscripts~
  11326 and/or ~org-export-with-sub-superscripts~ to change this convention.
  11327 For example, when setting these variables to ~{}~, =a_b= is not
  11328 displayed/exported[fn::The underlying markup still remains a
  11329 sub/superscript.  Only the visual display and export behavior
  11330 changes.] as a subscript, but =a_{b}= is.
  11331 
  11332 You can set both ~org-use-sub-superscripts~
  11333 ~org-export-with-sub-superscripts~ in a file using the export option
  11334 =^:= (see [[*Export Settings][Export Settings]]).  For example,
  11335 =#+OPTIONS: ^:{}= sets the two options to ~{}~ and limits super- and
  11336 subscripts to the curly bracket notation.
  11337 
  11338 You can also toggle the visual display of super- and subscripts:
  11339 
  11340 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
  11341 
  11342   #+kindex: C-c C-x \
  11343   #+findex: org-toggle-pretty-entities
  11344   This command formats sub- and superscripts in a WYSIWYM way.
  11345 
  11346 #+vindex: org-pretty-entities
  11347 #+vindex: org-pretty-entities-include-sub-superscripts
  11348 Set both ~org-pretty-entities~ and
  11349 ~org-pretty-entities-include-sub-superscripts~ to ~t~ to start with
  11350 super- and subscripts /visually/ interpreted as specified by the
  11351 option ~org-use-sub-superscripts~.
  11352 
  11353 ** Special Symbols
  11354 :PROPERTIES:
  11355 :DESCRIPTION: Greek letters and other symbols.
  11356 :END:
  11357 #+cindex: math symbols
  11358 #+cindex: special symbols
  11359 #+cindex: entities
  11360 
  11361 You can use LaTeX-like syntax to insert special symbols---named
  11362 entities---like =\alpha= to indicate the Greek letter, or =\to= to indicate
  11363 an arrow.  Completion for these symbols is available, just type =\=
  11364 and maybe a few letters, and press {{{kbd(M-TAB)}}} to see possible
  11365 completions.  If you need such a symbol inside a word, terminate it
  11366 with a pair of curly brackets.  For example
  11367 
  11368 #+begin_example
  11369 Pro tip: Given a circle \Gamma of diameter d, the length of its
  11370 circumference is \pi{}d.
  11371 #+end_example
  11372 
  11373 #+findex: org-entities-help
  11374 #+vindex: org-entities-user
  11375 A large number of entities is provided, with names taken from both
  11376 HTML and LaTeX; you can comfortably browse the complete list from
  11377 a dedicated buffer using the command ~org-entities-help~.  It is also
  11378 possible to provide your own special symbols in the variable
  11379 ~org-entities-user~.
  11380 
  11381 During export, these symbols are transformed into the native format of
  11382 the exporter backend.  Strings like =\alpha= are exported as =&alpha;= in
  11383 the HTML output, and as =\(\alpha\)= in the LaTeX output.  Similarly, =\nbsp=
  11384 becomes =&nbsp;= in HTML and =~= in LaTeX.
  11385 
  11386 #+cindex: special symbols, in-buffer display
  11387 If you would like to see entities displayed as UTF-8 characters, use
  11388 the following command[fn:: You can turn this on by default by setting
  11389 the variable ~org-pretty-entities~, or on a per-file base with the
  11390 =STARTUP= option =entitiespretty=.]:
  11391 
  11392 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
  11393   #+kindex: C-c C-x \
  11394   #+findex: org-toggle-pretty-entities
  11395 
  11396   Toggle display of entities as UTF-8 characters.  This does not
  11397   change the buffer content which remains plain ASCII, but it overlays
  11398   the UTF-8 character for display purposes only.
  11399 
  11400 #+cindex: shy hyphen, special symbol
  11401 #+cindex: dash, special symbol
  11402 #+cindex: ellipsis, special symbol
  11403 In addition to regular entities defined above, Org exports in a
  11404 special way[fn:: This behavior can be disabled with =-= export setting
  11405 (see [[*Export Settings]]).] the following commonly used character
  11406 combinations: =\-= is treated as a shy hyphen, =--= and =---= are
  11407 converted into dashes, and =...= becomes a compact set of dots.
  11408 
  11409 ** Embedded LaTeX
  11410 :PROPERTIES:
  11411 :DESCRIPTION: LaTeX can be freely used inside Org documents.
  11412 :END:
  11413 #+cindex: @TeX{} interpretation
  11414 #+cindex: @LaTeX{} interpretation
  11415 
  11416 Plain ASCII is normally sufficient for almost all note taking.
  11417 Exceptions include scientific notes, which often require mathematical
  11418 symbols and the occasional formula.  LaTeX[fn:37] is widely used to
  11419 typeset scientific documents.  Org mode supports embedding LaTeX code
  11420 into its files, because many academics are used to writing and reading
  11421 LaTeX source code, and because it can be readily processed to produce
  11422 pretty output for a number of export backends.
  11423 
  11424 *** LaTeX fragments
  11425 :PROPERTIES:
  11426 :DESCRIPTION: Complex formulas made easy.
  11427 :END:
  11428 #+cindex: @LaTeX{} fragments
  11429 
  11430 #+vindex: org-format-latex-header
  11431 Org mode can contain LaTeX math fragments, and it supports ways to
  11432 process these for several export backends.  When exporting to LaTeX,
  11433 the code is left as it is.  When exporting to HTML, Org can use either
  11434 [[https://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math
  11435 into images (see [[*Previewing LaTeX fragments]]).
  11436 
  11437 LaTeX fragments do not need any special marking at all.  The following
  11438 snippets are identified as LaTeX source code:
  11439 
  11440 - Environments of any kind[fn:38].  The only requirement is that the
  11441   =\begin= statement appears on a new line, preceded by only
  11442   whitespace.
  11443 
  11444 - Text within the usual LaTeX math delimiters.  Prefer =\(...\)= for
  11445   inline fragments.  The =$...$= alternative has some restrictions and
  11446   may be a source of confusion.  To avoid conflicts with currency
  11447   specifications, single =$= characters are only recognized as math
  11448   delimiters if the enclosed text contains at most two line breaks, is
  11449   directly attached to the =$= characters with no whitespace in
  11450   between, and if the closing =$= is followed by whitespace or
  11451   punctuation (but not a dash).
  11452 
  11453   Sometimes, it may necessary to have a literal dollar symbol even
  11454   when it is recognized as LaTeX math delimiter.  Org provides =\dollar= and
  11455   =\USD= entities (see [[*Special Symbols]]) that are rendered as =$= for
  11456   such scenarios.  Also, see [[*Escape Character]].
  11457 
  11458 #+texinfo: @noindent
  11459 For example:
  11460 
  11461 #+begin_example
  11462 \begin{equation}                        % arbitrary environments,
  11463 x=\sqrt{b}                              % even tables, figures, etc
  11464 \end{equation}
  11465 
  11466 If $a^2=b$ and \( b=2 \), then the solution must be
  11467 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
  11468 #+end_example
  11469 
  11470 #+vindex: org-export-with-latex
  11471 LaTeX processing can be configured with the variable
  11472 ~org-export-with-latex~.  The default setting is ~t~ which means
  11473 MathJax for HTML, and no processing for ASCII and LaTeX backends.
  11474 You can also set this variable on a per-file basis using one of these
  11475 lines:
  11476 
  11477 | =#+OPTIONS: tex:t=        | Do the right thing automatically (MathJax) |
  11478 | =#+OPTIONS: tex:nil=      | Do not process LaTeX fragments at all      |
  11479 | =#+OPTIONS: tex:verbatim= | Verbatim export, for jsMath or so          |
  11480 
  11481 *** Previewing LaTeX fragments
  11482 :PROPERTIES:
  11483 :DESCRIPTION: What will this snippet look like?
  11484 :END:
  11485 #+cindex: @LaTeX{} fragments, preview
  11486 
  11487 #+vindex: org-preview-latex-default-process
  11488 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
  11489 =convert= installed[fn:39], LaTeX fragments can be processed to
  11490 produce images of the typeset expressions to be used for inclusion
  11491 while exporting to HTML (see [[*LaTeX fragments]]), or for inline
  11492 previewing within Org mode.
  11493 
  11494 #+vindex: org-format-latex-options
  11495 #+vindex: org-format-latex-header
  11496 You can customize the variables ~org-format-latex-options~ and
  11497 ~org-format-latex-header~ to influence some aspects of the preview.
  11498 In particular, the ~:scale~ (and for HTML export, ~:html-scale~)
  11499 property of the former can be used to adjust the size of the preview
  11500 images.
  11501 
  11502 - {{{kbd(C-c C-x C-l)}}} (~org-latex-preview~) ::
  11503   #+kindex: C-c C-x C-l
  11504   #+findex: org-latex-preview
  11505 
  11506   Produce a preview image of the LaTeX fragment at point and overlay
  11507   it over the source code.  If there is no fragment at point, process
  11508   all fragments in the current entry---between two headlines.
  11509 
  11510   When called with a single prefix argument, clear all images in the
  11511   current entry.  Two prefix arguments produce a preview image for all
  11512   fragments in the buffer, while three of them clear all the images in
  11513   that buffer.
  11514 
  11515 #+vindex: org-startup-with-latex-preview
  11516 You can turn on the previewing of all LaTeX fragments in a file with
  11517 
  11518 : #+STARTUP: latexpreview
  11519 
  11520 To disable it, simply use
  11521 
  11522 : #+STARTUP: nolatexpreview
  11523 
  11524 *** Using CDLaTeX to enter math
  11525 :PROPERTIES:
  11526 :DESCRIPTION: Speed up entering of formulas.
  11527 :ALT_TITLE: CDLaTeX mode
  11528 :END:
  11529 #+cindex: CD@LaTeX{}
  11530 
  11531 CDLaTeX mode is a minor mode that is normally used in combination with
  11532 a major LaTeX mode like AUCTeX in order to speed-up insertion of
  11533 environments and math templates.  Inside Org mode, you can make use of
  11534 some of the features of CDLaTeX mode.  You need to install
  11535 =cdlatex.el= and =texmathp.el= (the latter comes also with AUCTeX)
  11536 from [[https://elpa.nongnu.org/][NonGNU ELPA]] with the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html][Emacs packaging system]] or alternatively from
  11537 [[https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/]].  Do not use
  11538 CDLaTeX mode itself under Org mode, but use the special version Org
  11539 CDLaTeX minor mode that comes as part of Org.  Turn it on for the
  11540 current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org
  11541 files with
  11542 
  11543 #+begin_src emacs-lisp
  11544 (add-hook 'org-mode-hook #'turn-on-org-cdlatex)
  11545 #+end_src
  11546 
  11547 When this mode is enabled, the following features are present (for
  11548 more details see the documentation of CDLaTeX mode):
  11549 
  11550 #+attr_texinfo: :sep ,
  11551 - {{{kbd(C-c {)}}} ::
  11552   #+kindex: C-c @{
  11553 
  11554   Insert an environment template.
  11555 
  11556 - {{{kbd(TAB)}}} ::
  11557   #+kindex: TAB
  11558 
  11559   The {{{kbd(TAB)}}} key expands the template if point is inside a
  11560   LaTeX fragment[fn:: Org mode has a method to test if point is inside
  11561   such a fragment, see the documentation of the function
  11562   ~org-inside-LaTeX-fragment-p~.].  For example, {{{kbd(TAB)}}}
  11563   expands =fr= to =\frac{}{}= and position point correctly inside the
  11564   first brace.  Another {{{kbd(TAB)}}} gets you into the second brace.
  11565 
  11566   Even outside fragments, {{{kbd(TAB)}}} expands environment
  11567   abbreviations at the beginning of a line.  For example, if you write
  11568   =equ= at the beginning of a line and press {{{kbd(TAB)}}}, this
  11569   abbreviation is expanded to an =equation= environment.  To get
  11570   a list of all abbreviations, type {{{kbd(M-x
  11571   cdlatex-command-help)}}}.
  11572 
  11573 - {{{kbd(^)}}}, {{{kbd(_)}}} ::
  11574   #+kindex: _
  11575   #+kindex: ^
  11576   #+vindex: cdlatex-simplify-sub-super-scripts
  11577 
  11578   Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment
  11579   inserts these characters together with a pair of braces.  If you use
  11580   {{{kbd(TAB)}}} to move out of the braces, and if the braces surround
  11581   only a single character or macro, they are removed again (depending
  11582   on the variable ~cdlatex-simplify-sub-super-scripts~).
  11583 
  11584 - {{{kbd(`)}}} ::
  11585   #+kindex: `
  11586 
  11587   Pressing the backquote followed by a character inserts math macros,
  11588   also outside LaTeX fragments.  If you wait more than 1.5 seconds
  11589   after the backquote, a help window pops up.
  11590 
  11591 - {{{kbd(')}}} ::
  11592   #+kindex: '
  11593 
  11594   Pressing the single-quote followed by another character modifies the
  11595   LaTeX symbol before point with an accent or a font.  If you wait
  11596   more than 1.5 seconds after the single-quote, a help window pops up.
  11597   Character modification works only inside LaTeX fragments; outside
  11598   the quote is normal.
  11599 
  11600 ** Literal Examples
  11601 :PROPERTIES:
  11602 :DESCRIPTION: Source code examples with special formatting.
  11603 :END:
  11604 #+cindex: literal examples, markup rules
  11605 #+cindex: code line references, markup rules
  11606 
  11607 You can include literal examples that should not be subjected to
  11608 markup.  Such examples are typeset in monospace, so this is well
  11609 suited for source code and similar examples.
  11610 
  11611 #+cindex: @samp{BEGIN_EXAMPLE}
  11612 #+cindex: example block
  11613 #+begin_example
  11614 ,#+BEGIN_EXAMPLE
  11615   Some example from a text file.
  11616 ,#+END_EXAMPLE
  11617 #+end_example
  11618 
  11619 #+cindex: comma escape, in literal examples
  11620 There is one limitation, however.  You must insert a comma right
  11621 before lines starting with either =*=, =,*=, =#+= or =,#+=, as those
  11622 may be interpreted as outlines nodes or some other special syntax.
  11623 Org transparently strips these additional commas whenever it accesses
  11624 the contents of the block.
  11625 
  11626 #+begin_example
  11627 ,#+BEGIN_EXAMPLE
  11628 ,,* I am no real headline
  11629 ,#+END_EXAMPLE
  11630 #+end_example
  11631 
  11632 For simplicity when using small examples, you can also start the
  11633 example lines with a colon followed by a space.  There may also be
  11634 additional whitespace before the colon:
  11635 
  11636 #+begin_example
  11637 Here is an example
  11638    : Some example from a text file.
  11639 #+end_example
  11640 
  11641 #+cindex: formatting source code, markup rules
  11642 #+vindex: org-latex-src-block-backend
  11643 If the example is source code from a programming language, or any
  11644 other text that can be marked up by Font Lock in Emacs, you can ask
  11645 for the example to look like the fontified Emacs buffer[fn:40].  This
  11646 is done with the code block, where you also need to specify the name
  11647 of the major mode that should be used to fontify the example[fn:41],
  11648 see [[*Structure Templates]] for shortcuts to easily insert code blocks.
  11649 
  11650 #+cindex: @samp{BEGIN_SRC}
  11651 #+cindex: source block
  11652 #+begin_example
  11653 ,#+BEGIN_SRC emacs-lisp
  11654   (defun org-xor (a b)
  11655     "Exclusive or."
  11656     (if a (not b) b))
  11657 ,#+END_SRC
  11658 #+end_example
  11659 
  11660 Both in =example= and in =src= snippets, you can add a =-n= switch to
  11661 the =#+BEGIN= line[fn::In the =src= snippets, switches must be placed
  11662 right after the language name and before the [[*Structure of Code
  11663 Blocks][header arguments]]], to get the lines of the example numbered.
  11664 The =-n= takes an optional numeric argument specifying the starting
  11665 line number of the block.  If you use a =+n= switch, the numbering
  11666 from the previous numbered snippet is continued in the current one.
  11667 The =+n= switch can also take a numeric argument.  This adds the value
  11668 of the argument to the last line of the previous block to determine
  11669 the starting line number.
  11670 
  11671 #+begin_example
  11672 ,#+BEGIN_SRC emacs-lisp -n 20
  11673   ;; This exports with line number 20.
  11674   (message "This is line 21")
  11675 ,#+END_SRC
  11676 
  11677 ,#+BEGIN_SRC emacs-lisp +n 10
  11678   ;; This is listed as line 31.
  11679   (message "This is line 32")
  11680 ,#+END_SRC
  11681 #+end_example
  11682 
  11683 In literal examples, Org interprets strings like =(ref:name)= as
  11684 labels, and use them as targets for special hyperlinks like
  11685 =[[(name)]]=---i.e., the reference name enclosed in single
  11686 parentheses.  In HTML, hovering the mouse over such a link
  11687 remote-highlights the corresponding code line[fn:: This requires some
  11688 Javascript which is /not/ automatically included in the HTML output:
  11689 you have to customize the variable =org-html-head-include-scripts= to
  11690 ~t~ to have it included (it is ~nil~ by default).], which is kind of cool.
  11691 
  11692 You can also add a =-r= switch which /removes/ the labels from the
  11693 source code[fn:: Adding =-k= to =-n -r= /keeps/ the labels in the
  11694 source code while using line numbers for the links, which might be
  11695 useful to explain those in an Org mode example code.].  With the =-n=
  11696 switch, links to these references are labeled by the line numbers from
  11697 the code listing.  Otherwise links use the labels with no parentheses.
  11698 Here is an example:
  11699 
  11700 #+begin_example -l "(dumb-reference:%s)"
  11701 ,#+BEGIN_SRC emacs-lisp -n -r
  11702   (save-excursion                 (ref:sc)
  11703      (goto-char (point-min))      (ref:jump)
  11704 ,#+END_SRC
  11705 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  11706 jumps to point-min.
  11707 #+end_example
  11708 
  11709 #+cindex: indentation, in source blocks
  11710 Source code and examples may be /indented/ in order to align nicely
  11711 with the surrounding text, and in particular with plain list structure
  11712 (see [[*Plain Lists]]).  By default, Org only retains the relative
  11713 indentation between lines, e.g., when exporting the contents of the
  11714 block.  However, you can use the =-i= switch to also preserve the
  11715 global indentation, if it does matter.  See [[*Editing Source Code]].
  11716 
  11717 #+vindex: org-coderef-label-format
  11718 If the syntax for the label format conflicts with the language syntax,
  11719 use a =-l= switch to change the format, for example
  11720 
  11721 : #+BEGIN_SRC pascal -n -r -l "((%s))"
  11722 
  11723 #+texinfo: @noindent
  11724 See also the variable ~org-coderef-label-format~.
  11725 
  11726 HTML export also allows examples to be published as text areas (see
  11727 [[*Text areas in HTML export]]).
  11728 
  11729 Because the =#+BEGIN= ... =#+END= patterns need to be added so often,
  11730 a shortcut is provided (see [[*Structure Templates]]).
  11731 
  11732 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
  11733 
  11734   #+kindex: C-c '
  11735   #+findex: org-edit-special
  11736   Edit the source code example at point in its native mode.  This
  11737   works by switching to a temporary buffer with the source code.  You
  11738   need to exit by pressing {{{kbd(C-c ')}}} again.  The edited version
  11739   then replaces the old version in the Org buffer.  Fixed-width
  11740   regions---where each line starts with a colon followed by a
  11741   space---are edited using Artist mode[fn:: You may select a different
  11742   mode with the variable ~org-edit-fixed-width-region-mode~.] to allow
  11743   creating ASCII drawings easily.  Using this command in an empty line
  11744   creates a new fixed-width region.
  11745 
  11746 #+cindex: storing link, in a source code buffer
  11747 Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source
  11748 code example in a temporary buffer created with {{{kbd(C-c ')}}}
  11749 prompts for a label.  Make sure that it is unique in the current
  11750 buffer, and insert it with the proper formatting like =(ref:label)= at
  11751 the end of the current line.  Then the label is stored as a link
  11752 =(label)=, for retrieval with {{{kbd(C-c C-l)}}}.
  11753 
  11754 ** Images
  11755 :PROPERTIES:
  11756 :DESCRIPTION: Display an image.
  11757 :END:
  11758 
  11759 #+cindex: inlining images
  11760 #+cindex: images, markup rules
  11761 An image is a link to an image file[fn:: What Emacs considers to be an
  11762 image depends on ~image-file-name-extensions~ and
  11763 ~image-file-name-regexps~.] that does not have a description part, for
  11764 example
  11765 
  11766 : ./img/cat.jpg
  11767 
  11768 If you wish to define a caption for the image (see [[*Captions]]) and
  11769 maybe a label for internal cross-references (see [[*Internal Links]]),
  11770 make sure that the link is on a line by itself and precede it with
  11771 =CAPTION= and =NAME= keywords as follows:
  11772 
  11773 #+begin_example
  11774 ,#+CAPTION: This is the caption for the next figure link (or table)
  11775 ,#+NAME:   fig:SED-HR4049
  11776 [[./img/a.jpg]]
  11777 #+end_example
  11778 
  11779 Such images can be displayed within the buffer with the following
  11780 command:
  11781 
  11782 - {{{kbd(C-c C-x C-v)}}} (~org-toggle-inline-images~) ::
  11783 
  11784   #+kindex: C-c C-x C-v
  11785   #+findex: org-toggle-inline-images
  11786   #+vindex: org-startup-with-inline-images
  11787   Toggle the inline display of linked images.  When called with a
  11788   prefix argument, also display images that do have a link
  11789   description.  You can ask for inline images to be displayed at
  11790   startup by configuring the variable
  11791   ~org-startup-with-inline-images~[fn:: The variable
  11792   ~org-startup-with-inline-images~ can be set within a buffer with the
  11793   =STARTUP= options =inlineimages= and =noinlineimages=.].
  11794 
  11795 
  11796   #+vindex: org-image-actual-width
  11797   #+vindex: org-image-max-width
  11798   #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property
  11799   By default, Org mode displays inline images according to their
  11800   actual width, but no wider than ~fill-column~ characters.
  11801 
  11802   You can customize the displayed image width using
  11803   ~org-image-actual-width~ variable (globally) or
  11804   =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:: The width can
  11805   be customized in Emacs >= 24.1, built with imagemagick support.].
  11806   Their value can be the following:
  11807   - (default) Non-~nil~, use the actual width of images when inlining
  11808     them.  If the actual width is too wide, limit it according to
  11809     ~org-image-max-width~.
  11810   - When set to a number, use imagemagick (when available) to set the
  11811     image's width to this value.
  11812   - When set to a number in a list, try to get the width from any
  11813     =#+ATTR.*= keyword if it matches a width specification like:
  11814     #+begin_example
  11815     ,#+ATTR_HTML: :width 300px
  11816     #+end_example
  11817     and fall back on that number if none is found.
  11818   - When set to ~nil~, try to get the width from an =#+ATTR.*= keyword
  11819     and fall back on the original width or ~org-image-max-width~ if
  11820     none is found.
  11821 
  11822   ~org-image-max-width~ limits the maximum displayed image width, but
  11823   only when the image width is not set explicitly.  Possible maximum
  11824   width can be set to:
  11825   - (default) ~fill-column~, limit width to ~fill-column~ number of
  11826     characters.
  11827   - ~window~, limit width to current window width.
  11828   - integer number, limit width to that specified number of pixels.
  11829   - ~nil~, do not limit the width.
  11830 
  11831   #+vindex: org-image-align
  11832   Org mode can left-align, center or right-align the display of inline
  11833   images.  This setting is controlled (globally) by ~org-image-align~.
  11834   Only standalone images are affected, corresponding to links with no
  11835   surrounding text in their paragraph except for whitespace.  Its
  11836   value can be the following:
  11837   - (default) The symbol ~left~, which inserts the image where the
  11838     link appears in the buffer.
  11839   - The symbol ~center~, which will preview links centered in the
  11840     Emacs window.
  11841   - The symbol ~right~, which will preview links right-aligned in the
  11842     Emacs window.
  11843 
  11844   Inline image alignment can be specified for each link using the
  11845   =#+ATTR.*= keyword if it matches an alignment specification like:
  11846   #+begin_example
  11847   ,#+ATTR_HTML: :align center
  11848   #+end_example
  11849   Org will use the alignment specification from any =#+ATTR.*=
  11850   keyword, such as =#+ATTR_HTML= or =#+ATTR_LATEX=, but =#+ATTR_ORG=
  11851   (if present) will override the others.  For instance, this link
  11852   #+begin_example
  11853   ,#+ATTR_HTML: :align right
  11854   ,#+ATTR_ORG: :align center
  11855   [[/path/to/image/file.png]]
  11856   #+end_example
  11857   will be displayed centered in Emacs but exported right-aligned to
  11858   HTML.
  11859 
  11860   When =#+ATTR_ORG= is not set, inline image alignment is also read
  11861   from the =:center= attribute supported by some export backends (like
  11862   HTML, LaTeX and Beamer.)
  11863 
  11864 #+vindex: org-cycle-inline-images-display
  11865 Inline images can also be displayed when cycling the folding state.
  11866 When custom option ~org-cycle-inline-images-display~ is set, the
  11867 visible inline images under subtree will be displayed automatically.
  11868 
  11869 ** Captions
  11870 :PROPERTIES:
  11871 :DESCRIPTION: Describe tables, images...
  11872 :END:
  11873 #+cindex: captions, markup rules
  11874 #+cindex: @samp{CAPTION}, keyword
  11875 
  11876 You can assign a caption to a specific part of a document by inserting
  11877 a =CAPTION= keyword immediately before it:
  11878 
  11879 #+begin_example
  11880 ,#+CAPTION: This is the caption for the next table (or link)
  11881 | ... | ... |
  11882 |-----+-----|
  11883 #+end_example
  11884 
  11885 Optionally, the caption can take the form:
  11886 
  11887 : #+CAPTION[Short caption]: Longer caption.
  11888 
  11889 Even though images and tables are prominent examples of captioned
  11890 structures, the same caption mechanism can apply to many
  11891 others---e.g., LaTeX equations, source code blocks.  Depending on the
  11892 export backend, those may or may not be handled.
  11893 
  11894 ** Horizontal Rules
  11895 :PROPERTIES:
  11896 :DESCRIPTION: Make a line.
  11897 :END:
  11898 
  11899 #+cindex: horizontal rules, markup rules
  11900 A line consisting of only dashes, and at least 5 of them, is exported
  11901 as a horizontal line.
  11902 
  11903 ** Creating Footnotes
  11904 :PROPERTIES:
  11905 :DESCRIPTION: Edit and read footnotes.
  11906 :END:
  11907 #+cindex: footnotes
  11908 
  11909 A footnote is started by a footnote marker in square brackets in
  11910 column 0, no indentation allowed.  It ends at the next footnote
  11911 definition, headline, or after two consecutive empty lines.  The
  11912 footnote reference is simply the marker in square brackets, inside
  11913 text.  Markers always start with =fn:=.  For example:
  11914 
  11915 #+begin_example
  11916 The Org website[fn:1] now looks a lot better than it used to.
  11917 ...
  11918 [fn:50] The link is: https://orgmode.org
  11919 #+end_example
  11920 
  11921 Org mode extends the number-based syntax to /named/ footnotes and
  11922 optional inline definition.  Here are the valid references:
  11923 
  11924 - =[fn:NAME]= ::
  11925 
  11926   A named footnote reference, where {{{var(NAME)}}} is a unique
  11927   label word, or, for simplicity of automatic creation, a number.
  11928 
  11929 - =[fn:: This is the inline definition of this footnote]= ::
  11930 
  11931   An anonymous footnote where the definition is given directly at the
  11932   reference point.
  11933 
  11934 - =[fn:NAME: a definition]= ::
  11935 
  11936   An inline definition of a footnote, which also specifies a name for
  11937   the note.  Since Org allows multiple references to the same note,
  11938   you can then use =[fn:NAME]= to create additional references.
  11939 
  11940 #+vindex: org-footnote-auto-label
  11941 Footnote labels can be created automatically, or you can create names
  11942 yourself.  This is handled by the variable ~org-footnote-auto-label~
  11943 and its corresponding =STARTUP= keywords.  See the docstring of that
  11944 variable for details.
  11945 
  11946 The following command handles footnotes:
  11947 
  11948 - {{{kbd(C-c C-x f)}}} ::
  11949 
  11950   The footnote action command.
  11951 
  11952   #+kindex: C-c C-x f
  11953   When point is on a footnote reference, jump to the definition.  When
  11954   it is at a definition, jump to the---first---reference.
  11955 
  11956   #+vindex: org-footnote-define-inline
  11957   #+vindex: org-footnote-section
  11958   Otherwise, create a new footnote.  Depending on the variable
  11959   ~org-footnote-define-inline~[fn:: The corresponding in-buffer
  11960   setting is: =#+STARTUP: fninline= or =#+STARTUP: nofninline=.], the
  11961   definition is placed right into the text as part of the reference,
  11962   or separately into the location determined by the variable
  11963   ~org-footnote-section~.
  11964 
  11965   When this command is called with a prefix argument, a menu of
  11966   additional options is offered:
  11967 
  11968   #+attr_texinfo: :columns 0.1 0.9
  11969   | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence.               |
  11970   | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes.                              |
  11971   | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action.                        |
  11972   | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence.            |
  11973   | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. |
  11974 
  11975   #+vindex: org-footnote-auto-adjust
  11976   Depending on the variable ~org-footnote-auto-adjust~[fn:: The
  11977   corresponding in-buffer options are =#+STARTUP: fnadjust= and
  11978   =#+STARTUP: nofnadjust=.], renumbering and sorting footnotes can be
  11979   automatic after each insertion or deletion.
  11980 
  11981 - {{{kbd(C-c C-c)}}} ::
  11982 
  11983   #+kindex: C-c C-c
  11984   If point is on a footnote reference, jump to the definition.  If it
  11985   is at the definition, jump back to the reference.  When called at
  11986   a footnote location with a prefix argument, offer the same menu as
  11987   {{{kbd(C-c C-x f)}}}.
  11988 
  11989 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} ::
  11990 
  11991   #+kindex: C-c C-o
  11992   #+kindex: mouse-1
  11993   #+kindex: mouse-2
  11994   Footnote labels are also links to the corresponding definition or
  11995   reference, and you can use the usual commands to follow these links.
  11996 
  11997 * Exporting
  11998 :PROPERTIES:
  11999 :DESCRIPTION: Sharing and publishing notes.
  12000 :END:
  12001 #+cindex: exporting
  12002 
  12003 At some point you might want to print your notes, publish them on the
  12004 web, or share them with people not using Org.  Org can convert and
  12005 export documents to a variety of other formats while retaining as much
  12006 structure (see [[*Document Structure]]) and markup (see [[*Markup for Rich
  12007 Contents]]) as possible.
  12008 
  12009 #+cindex: export backend
  12010 #+cindex: export back-end
  12011 The libraries responsible for translating Org files to other formats
  12012 are called /backends/.  Org ships with support for the following
  12013 backends:
  12014 
  12015 - /ascii/ (ASCII format)
  12016 - /beamer/ (LaTeX Beamer format)
  12017 - /html/ (HTML format)
  12018 - /icalendar/ (iCalendar format)
  12019 - /latex/ (LaTeX format)
  12020 - /md/ (Markdown format)
  12021 - /odt/ (OpenDocument Text format)
  12022 - /org/ (Org format)
  12023 - /texinfo/ (Texinfo format)
  12024 - /man/ (Man page format)
  12025 
  12026 Users can install libraries for additional formats from the Emacs
  12027 packaging system.  For easy discovery, these packages have a common
  12028 naming scheme: ~ox-NAME~, where {{{var(NAME)}}} is a format.  For
  12029 example, ~ox-koma-letter~ for /koma-letter/ backend.  More libraries
  12030 can be found in the =org-contrib= repository (see [[*Installation]]).
  12031 
  12032 #+vindex: org-export-backends
  12033 Org only loads backends for the following formats by default: ASCII,
  12034 HTML, iCalendar, LaTeX, and ODT.  Additional backends can be loaded
  12035 in either of two ways: by configuring the ~org-export-backends~
  12036 variable, or by requiring libraries in the Emacs init file.  For
  12037 example, to load the Markdown backend, add this to your Emacs config:
  12038 
  12039 #+begin_src emacs-lisp
  12040 (require 'ox-md)
  12041 #+end_src
  12042 
  12043 ** The Export Dispatcher
  12044 :PROPERTIES:
  12045 :DESCRIPTION: The main interface.
  12046 :END:
  12047 #+cindex: dispatcher, for export commands
  12048 #+cindex: export, dispatcher
  12049 
  12050 The export dispatcher is the main interface for Org's exports.
  12051 A hierarchical menu presents the currently configured export formats.
  12052 Options are shown as easy toggle switches on the same screen.
  12053 
  12054 #+vindex: org-export-dispatch-use-expert-ui
  12055 Org also has a minimal prompt interface for the export dispatcher.
  12056 When the variable ~org-export-dispatch-use-expert-ui~ is set to
  12057 a non-~nil~ value, Org prompts in the minibuffer.  To switch back to
  12058 the hierarchical menu, press {{{kbd(?)}}}.
  12059 
  12060 - {{{kbd(C-c C-e)}}} (~org-export-dispatch~) ::
  12061   #+kindex: C-c C-e
  12062   #+findex: org-export-dispatch
  12063 
  12064   Invokes the export dispatcher interface.  The options show default
  12065   settings.  The {{{kbd(C-u)}}} prefix argument preserves options from
  12066   the previous export, including any subtree selections.
  12067 
  12068 Org exports the entire buffer by default.  If the Org buffer has an
  12069 active region, then Org exports just that region.
  12070 
  12071 Within the dispatcher interface, the following key combinations can
  12072 further alter what is exported, and how.
  12073 
  12074 - {{{kbd(C-a)}}} ::
  12075   #+kindex: C-c C-e C-a
  12076 
  12077   Toggle asynchronous export.  Asynchronous export uses an external
  12078   Emacs process with a specially configured initialization file to
  12079   complete the exporting process in the background, without tying-up
  12080   Emacs.  This is particularly useful when exporting long documents.
  12081 
  12082   Output from an asynchronous export is saved on the /export stack/.
  12083   To view this stack, call the export dispatcher with a double
  12084   {{{kbd(C-u)}}} prefix argument.  If already in the export dispatcher
  12085   menu, {{{kbd(&)}}} displays the stack.
  12086 
  12087   #+vindex: org-export-in-background
  12088   You can make asynchronous export the default by setting
  12089   ~org-export-in-background~.
  12090 
  12091   #+vindex: org-export-async-init-file
  12092   You can set the initialization file used by the background process
  12093   by setting ~org-export-async-init-file~.
  12094 
  12095 - {{{kbd(C-b)}}} ::
  12096   #+kindex: C-c C-e C-b
  12097 
  12098   Toggle body-only export.  Useful for excluding headers and footers
  12099   in the export.  Affects only those backend formats that have
  12100   sections like =<head>...</head>= in HTML.
  12101 
  12102   #+vindex: org-export-body-only
  12103   To make body-only export the default, customize the variable
  12104   ~org-export-body-only~.
  12105 
  12106 - {{{kbd(C-f)}}} ::
  12107   #+kindex: C-c C-e C-f
  12108 
  12109   Toggle force-publishing export.  Publish functions normally only
  12110   publish changed files (see [[**Triggering Publication]]).  Forced
  12111   publishing causes files to be published even if their timestamps do
  12112   not indicate the file has been changed.
  12113 
  12114   #+vindex: org-export-force-publishing
  12115   To make forced publishing the default, customize the variable
  12116   ~org-export-force-publishing~.  (This is similar to
  12117   ~org-publish-use-timestamps-flag~, but only affects the export
  12118   dispatcher.)
  12119 
  12120 - {{{kbd(C-s)}}} ::
  12121   #+kindex: C-c C-e C-s
  12122 
  12123   Toggle subtree export.  When turned on, Org exports only the
  12124   subtree starting from point position at the time the export
  12125   dispatcher was invoked.  Org uses the top heading of this subtree
  12126   as the document's title.  If point is not on a heading, Org uses the
  12127   nearest enclosing header.  If point is in the document preamble, Org
  12128   signals an error and aborts export.
  12129 
  12130   #+vindex: org-export-initial-scope
  12131   To make subtree export the default, customize the variable
  12132   ~org-export-initial-scope~.
  12133 
  12134 - {{{kbd(C-v)}}} ::
  12135   #+kindex: C-c C-e C-v
  12136 
  12137   Toggle visible-only export.  This is useful for exporting only
  12138   certain parts of an Org document by adjusting the visibility of
  12139   particular headings.  See also [[*Sparse Trees]].
  12140 
  12141   #+vindex: org-export-visible-only
  12142   To make visible-only export the default, customize the variable
  12143   ~org-export-visible-only~.
  12144 
  12145 ** Export Settings
  12146 :PROPERTIES:
  12147 :DESCRIPTION: Common export settings.
  12148 :END:
  12149 #+cindex: options, for export
  12150 #+cindex: Export, settings
  12151 
  12152 #+cindex: @samp{OPTIONS}, keyword
  12153 Export options can be set: globally with variables; for an individual
  12154 file by making variables buffer-local with in-buffer settings (see
  12155 [[*Summary of In-Buffer Settings]]); by setting individual keywords or
  12156 specifying them in compact form with the =OPTIONS= keyword; or for
  12157 a tree by setting properties (see [[*Properties and Columns]]).  Options
  12158 set at a specific level override options set at a more general level.
  12159 
  12160 #+cindex: @samp{SETUPFILE}, keyword
  12161 In-buffer settings may appear anywhere in the file, either directly or
  12162 indirectly through a file included using =#+SETUPFILE: filename or
  12163 URL= syntax.  Option keyword sets tailored to a particular backend
  12164 can be inserted from the export dispatcher (see [[*The Export
  12165 Dispatcher]]) using the =Insert template= command by pressing
  12166 {{{kbd(#)}}}.  To insert keywords individually, a good way to make
  12167 sure the keyword is correct is to type =#+= and then to use
  12168 {{{kbd(M-TAB)}}}[fn:6] for completion.
  12169 
  12170 The export keywords available for every backend, and their equivalent
  12171 global variables, include:
  12172 
  12173 - =AUTHOR= ::
  12174 
  12175   #+cindex: @samp{AUTHOR}, keyword
  12176   #+vindex: user-full-name
  12177   The document author (~user-full-name~).
  12178 
  12179 - =CREATOR= ::
  12180 
  12181   #+cindex: @samp{CREATOR}, keyword
  12182   #+vindex: org-expot-creator-string
  12183   Entity responsible for output generation
  12184   (~org-export-creator-string~).
  12185 
  12186 - =DATE= ::
  12187 
  12188   #+cindex: @samp{DATE}, keyword
  12189   #+vindex: org-export-date-timestamp-format
  12190   A date or a timestamp[fn:: The variable
  12191   ~org-export-date-timestamp-format~ defines how this timestamp are
  12192   exported.].
  12193 
  12194 - =EMAIL= ::
  12195 
  12196   #+cindex: @samp{EMAIL}, keyword
  12197   #+vindex: user-mail-address
  12198   The email address (~user-mail-address~).
  12199 
  12200 - =LANGUAGE= ::
  12201 
  12202   #+cindex: @samp{LANGUAGE}, keyword
  12203   #+vindex: org-export-default-language
  12204   Language to use for translating certain strings
  12205   (~org-export-default-language~).  With =#+LANGUAGE: fr=, for
  12206   example, Org translates =Table of contents= to the French =Table des
  12207   matières=[fn:42].
  12208 
  12209 - =SELECT_TAGS= ::
  12210 
  12211   #+cindex: @samp{SELECT_TAGS}, keyword
  12212   #+vindex: org-export-select-tags
  12213   List of tags that will, if present, be selected for export.  The
  12214   default value is ~org-export-select-tags~ =("export")=.  When a tree
  12215   is tagged with =export=, Org selects that tree and its subtrees for
  12216   export, ignoring all the other sections that do not possess the
  12217   =export= tag.
  12218 
  12219   When selectively exporting files with =export= tags set, Org does
  12220   not export any text that appears before the first headline.
  12221 
  12222   Note that a file without the =export= tags will export all its
  12223   sections.
  12224 
  12225   To select non-default tags for export, customize
  12226   ~org-export-select-tags~ (globally) or add =#+SELECT_TAGS: tag1
  12227   tag2= to the document.
  12228 
  12229 - =EXCLUDE_TAGS= ::
  12230 
  12231   #+cindex: @samp{EXCLUDE_TAGS}, keyword
  12232   #+vindex: org-export-exclude-tags
  12233   List of tags that will be excluded from export.  The default value is
  12234   ~org-export-exclude-tags~ =("noexport")=.  When a tree is tagged
  12235   with =noexport=, Org excludes that tree and its subtrees from
  12236   export.
  12237 
  12238   Entries tagged with =noexport= are unconditionally excluded from the
  12239   export, even if they have an =export= tag.  Even if a subtree is not
  12240   exported, Org executes any code blocks contained there.
  12241 
  12242   To select non-default tags for the exclusion, customize
  12243   ~org-export-exclude-tags~ (globally) or add =#+EXCLUDE_TAGS: tag1
  12244   tag2= to the document.
  12245 
  12246 - =TITLE= ::
  12247 
  12248   #+cindex: @samp{TITLE}, keyword
  12249   #+cindex: document title
  12250   Org displays this title.  For long titles, use multiple =#+TITLE=
  12251   lines.
  12252 
  12253 - =EXPORT_FILE_NAME= ::
  12254 
  12255   #+cindex: @samp{EXPORT_FILE_NAME}, keyword
  12256   The name of the output file to be generated.  Otherwise, Org
  12257   generates the file name based on the buffer name and the extension
  12258   based on the backend format.
  12259 
  12260 The =OPTIONS= keyword is a compact form.  To configure multiple
  12261 options, use several =OPTIONS= lines.  =OPTIONS= recognizes the
  12262 following arguments.
  12263 
  12264 - ~'~ ::
  12265 
  12266   #+vindex: org-export-with-smart-quotes
  12267   Toggle smart quotes (~org-export-with-smart-quotes~).  Depending on
  12268   the language used, when activated, Org treats pairs of double quotes
  12269   as primary quotes, pairs of single quotes as secondary quotes, and
  12270   single quote marks as apostrophes.
  12271 
  12272 - ~*~ ::
  12273 
  12274   #+vindex: org-export-with-emphasize
  12275   Toggle emphasized text (~org-export-with-emphasize~).
  12276 
  12277 - ~-~ ::
  12278 
  12279   #+vindex: org-export-with-special-strings
  12280   Toggle conversion of special strings
  12281   (~org-export-with-special-strings~).
  12282 
  12283 - ~:~ ::
  12284 
  12285   #+vindex: org-export-with-fixed-width
  12286   Toggle fixed-width sections (~org-export-with-fixed-width~).
  12287 
  12288 - ~<~ ::
  12289 
  12290   #+vindex: org-export-with-timestamps
  12291   Toggle inclusion of time/date active/inactive stamps
  12292   (~org-export-with-timestamps~).
  12293 
  12294 - ~\n~ ::
  12295 
  12296   #+vindex: org-export-preserve-breaks
  12297   Toggles whether to preserve line breaks
  12298   (~org-export-preserve-breaks~).
  12299 
  12300 - ~^~ ::
  12301 
  12302   #+vindex: org-export-with-sub-superscripts
  12303   Toggle TeX-like syntax for sub- and superscripts.  If you write
  12304   =^:{}=, =a_{b}= is interpreted, but the simple =a_b= is left as it
  12305   is (~org-export-with-sub-superscripts~).
  12306 
  12307 - ~arch~ ::
  12308 
  12309   #+vindex: org-export-with-archived-trees
  12310   Configure how archived trees are exported.  When set to ~headline~,
  12311   the export process skips the contents and processes only the
  12312   headlines (~org-export-with-archived-trees~).
  12313 
  12314 - ~author~ ::
  12315 
  12316   #+vindex: org-export-with-author
  12317   Toggle inclusion of author name into exported file
  12318   (~org-export-with-author~).
  12319 
  12320 - ~expand-links~ ::
  12321 
  12322   #+vindex: org-export-expand-links
  12323   Toggle expansion of environment variables in file paths
  12324   (~org-export-expand-links~).
  12325 
  12326 - ~broken-links~ ::
  12327 
  12328   #+vindex: org-export-with-broken-links
  12329   Toggles if Org should continue exporting upon finding a broken
  12330   internal link.  When set to ~mark~, Org clearly marks the problem
  12331   link in the output (~org-export-with-broken-links~).
  12332 
  12333 - ~c~ ::
  12334 
  12335   #+vindex: org-export-with-clocks
  12336   Toggle inclusion of =CLOCK= keywords (~org-export-with-clocks~).
  12337 
  12338 - ~creator~ ::
  12339 
  12340   #+vindex: org-export-with-creator
  12341   Toggle inclusion of creator information in the exported file
  12342   (~org-export-with-creator~).
  12343 
  12344 - ~d~ ::
  12345 
  12346   #+vindex: org-export-with-drawers
  12347   Toggles inclusion of drawers, or list of drawers to include, or list
  12348   of drawers to exclude (~org-export-with-drawers~).
  12349 
  12350 - ~date~ ::
  12351 
  12352   #+vindex: org-export-with-date
  12353   Toggle inclusion of a date into exported file
  12354   (~org-export-with-date~).
  12355 
  12356 - ~e~ ::
  12357 
  12358   #+vindex: org-export-with-entities
  12359   Toggle inclusion of entities (~org-export-with-entities~).
  12360 
  12361 - ~email~ ::
  12362 
  12363   #+vindex: org-export-with-email
  12364   Toggle inclusion of the author's e-mail into exported file
  12365   (~org-export-with-email~).
  12366 
  12367 - ~f~ ::
  12368 
  12369   #+vindex: org-export-with-footnotes
  12370   Toggle the inclusion of footnotes (~org-export-with-footnotes~).
  12371 
  12372 - ~H~ ::
  12373 
  12374   #+vindex: org-export-headline-levels
  12375   Set the number of headline levels for export
  12376   (~org-export-headline-levels~).  Below that level, headlines are
  12377   treated differently.  In most backends, they become list items.
  12378 
  12379 - ~inline~ ::
  12380 
  12381   #+vindex: org-export-with-inlinetasks
  12382   Toggle inclusion of inlinetasks (~org-export-with-inlinetasks~).
  12383 
  12384 - ~num~ ::
  12385 
  12386   #+vindex: org-export-with-section-numbers
  12387   #+cindex: @samp{UNNUMBERED}, property
  12388   Toggle section-numbers (~org-export-with-section-numbers~).  When
  12389   set to number N, Org numbers only those headlines at level N or
  12390   above.  Set =UNNUMBERED= property to non-~nil~ to disable numbering
  12391   of heading and subheadings entirely.  Moreover, when the value is
  12392   =notoc= the headline, and all its children, do not appear in the
  12393   table of contents either (see [[*Table of Contents]]).
  12394 
  12395 - ~p~ ::
  12396 
  12397   #+vindex: org-export-with-planning
  12398   Toggle export of planning information (~org-export-with-planning~).
  12399   "Planning information" comes from lines located right after the
  12400   headline and contain any combination of these cookies: =SCHEDULED=,
  12401   =DEADLINE=, or =CLOSED=.
  12402 
  12403 - ~pri~ ::
  12404 
  12405   #+vindex: org-export-with-priority
  12406   Toggle inclusion of priority cookies
  12407   (~org-export-with-priority~).
  12408 
  12409 - ~prop~ ::
  12410 
  12411   #+vindex: org-export-with-properties
  12412   Toggle inclusion of property drawers, or list the properties to
  12413   include (~org-export-with-properties~).
  12414 
  12415 - ~stat~ ::
  12416 
  12417   #+vindex: org-export-with-statistics-cookies
  12418   Toggle inclusion of statistics cookies
  12419   (~org-export-with-statistics-cookies~).
  12420 
  12421 - ~tags~ ::
  12422 
  12423   #+vindex: org-export-with-tags
  12424   Toggle inclusion of tags, may also be ~not-in-toc~
  12425   (~org-export-with-tags~).
  12426 
  12427 - ~tasks~ ::
  12428 
  12429   #+vindex: org-export-with-tasks
  12430   Toggle inclusion of tasks (TODO items); or ~nil~ to remove all
  12431   tasks; or ~todo~ to remove done tasks; or list the keywords to keep
  12432   (~org-export-with-tasks~).
  12433 
  12434 - ~tex~ ::
  12435 
  12436   #+vindex: org-export-with-latex
  12437   ~nil~ does not export; ~t~ exports; ~verbatim~ keeps everything in
  12438   verbatim (~org-export-with-latex~).
  12439 
  12440 - ~timestamp~ ::
  12441 
  12442   #+vindex: org-export-time-stamp-file
  12443   #+vindex: org-export-timestamp-file
  12444   Toggle inclusion of the creation time in the exported file
  12445   (~org-export-timestamp-file~).
  12446 
  12447 - ~title~ ::
  12448 
  12449   #+vindex: org-export-with-title
  12450   Toggle inclusion of title (~org-export-with-title~).
  12451 
  12452 - ~toc~ ::
  12453 
  12454   #+vindex: org-export-with-toc
  12455   Toggle inclusion of the table of contents, or set the level limit
  12456   (~org-export-with-toc~).
  12457 
  12458 - ~todo~ ::
  12459 
  12460   #+vindex: org-export-with-todo-keywords
  12461   Toggle inclusion of TODO keywords into exported text
  12462   (~org-export-with-todo-keywords~).
  12463 
  12464 - ~|~ ::
  12465 
  12466   #+vindex: org-export-with-tables
  12467   Toggle inclusion of tables (~org-export-with-tables~).
  12468 
  12469 When exporting subtrees, special node properties can override the
  12470 above keywords.  These properties have an =EXPORT_= prefix.  For
  12471 example, =DATE= becomes, =EXPORT_DATE= when used for a specific
  12472 subtree.  Except for =SETUPFILE=, all other keywords listed above
  12473 have an =EXPORT_= equivalent.
  12474 
  12475 #+cindex: @samp{BIND}, keyword
  12476 #+vindex: org-export-allow-bind-keywords
  12477 If ~org-export-allow-bind-keywords~ is non-~nil~, Emacs variables can
  12478 become buffer-local during export by using the =BIND= keyword.  Its
  12479 syntax is =#+BIND: variable value=.  This is particularly useful for
  12480 in-buffer settings that cannot be changed using keywords.
  12481 
  12482 ** Table of Contents
  12483 :PROPERTIES:
  12484 :DESCRIPTION: The if and where of the table of contents.
  12485 :END:
  12486 #+cindex: table of contents
  12487 #+cindex: list of tables
  12488 #+cindex: list of listings
  12489 
  12490 #+cindex: @samp{toc}, in @samp{OPTIONS} keyword
  12491 #+vindex: org-export-with-toc
  12492 The table of contents includes all headlines in the document.  Its
  12493 depth is therefore the same as the headline levels in the file.  If
  12494 you need to use a different depth, or turn it off entirely, set the
  12495 ~org-export-with-toc~ variable accordingly.  You can achieve the same
  12496 on a per file basis, using the following =toc= item in =OPTIONS=
  12497 keyword:
  12498 
  12499 #+begin_example
  12500 ,#+OPTIONS: toc:2          (only include two levels in TOC)
  12501 ,#+OPTIONS: toc:nil        (no default TOC at all)
  12502 #+end_example
  12503 
  12504 #+cindex: excluding entries from table of contents
  12505 #+cindex: table of contents, exclude entries
  12506 Org includes both numbered and unnumbered headlines in the table of
  12507 contents[fn:43].  If you need to exclude an unnumbered headline,
  12508 along with all its children, set the =UNNUMBERED= property to =notoc=
  12509 value.
  12510 
  12511 #+begin_example
  12512 ,* Subtree not numbered, not in table of contents either
  12513   :PROPERTIES:
  12514   :UNNUMBERED: notoc
  12515   :END:
  12516 #+end_example
  12517 
  12518 #+cindex: @samp{TOC}, keyword
  12519 Org normally inserts the table of contents in front of the exported
  12520 document.  To move the table of contents to a different location,
  12521 first turn off the default with ~org-export-with-toc~ variable or with
  12522 =#+OPTIONS: toc:nil=.  Then insert =#+TOC: headlines N= at the desired
  12523 location(s).
  12524 
  12525 #+begin_example
  12526 ,#+OPTIONS: toc:nil
  12527 ...
  12528 ,#+TOC: headlines 2
  12529 #+end_example
  12530 
  12531 To adjust the table of contents depth for a specific section of the
  12532 Org document, append an additional =local= parameter.  This parameter
  12533 becomes a relative depth for the current level.  The following example
  12534 inserts a local table of contents, with direct children only.
  12535 
  12536 #+begin_example
  12537 ,* Section
  12538 ,#+TOC: headlines 1 local
  12539 #+end_example
  12540 
  12541 Note that for this feature to work properly in LaTeX export, the Org
  12542 file requires the inclusion of the titletoc package.  Because of
  12543 compatibility issues, titletoc has to be loaded /before/ hyperref.
  12544 Customize the ~org-latex-default-packages-alist~ variable.
  12545 
  12546 The following example inserts a table of contents that links to the
  12547 children of the specified target.
  12548 
  12549 #+begin_example
  12550 ,* Target
  12551   :PROPERTIES:
  12552   :CUSTOM_ID: TargetSection
  12553   :END:
  12554 ,** Heading A
  12555 ,** Heading B
  12556 ,* Another section
  12557 ,#+TOC: headlines 1 :target #TargetSection
  12558 #+end_example
  12559 
  12560 The =:target= attribute is supported in HTML, Markdown, ODT, and ASCII export.
  12561 
  12562 Use the =TOC= keyword to generate list of tables---respectively, all
  12563 listings---with captions.
  12564 
  12565 #+begin_example
  12566 ,#+TOC: listings
  12567 ,#+TOC: tables
  12568 #+end_example
  12569 
  12570 #+cindex: @samp{ALT_TITLE}, property
  12571 Normally Org uses the headline for its entry in the table of contents.
  12572 But with =ALT_TITLE= property, a different entry can be specified for
  12573 the table of contents.
  12574 
  12575 ** Include Files
  12576 :PROPERTIES:
  12577 :DESCRIPTION: Include additional files into a document.
  12578 :END:
  12579 #+cindex: include files, during export
  12580 #+cindex: export, include files
  12581 #+cindex: @samp{INCLUDE}, keyword
  12582 
  12583 [[*Summary of the export process][During export]], you can include the content of another file.  For
  12584 example, to include your =.emacs= file, you could use:
  12585 
  12586 : #+INCLUDE: "~/.emacs" src emacs-lisp
  12587 
  12588 #+texinfo: @noindent
  12589 There are three positional arguments after the include keyword, they are:
  12590 1. The file name, this is the sole mandatory argument.  Org neither
  12591    checks for correctness or validates the content in any way.
  12592 2. The block name to wrap the file content in.  When this is
  12593    =example=, =export=, or =src= the content is escaped by
  12594    ~org-escape-code-in-string~.  Arbitrary block names may be given,
  12595    however block names starting with =:= must be quoted, i.e. =":name"=.
  12596 3. The source code language to use for formatting the contents.  This is relevant
  12597    to both =export= and =src= block types.
  12598 
  12599 #+cindex: @samp{minlevel}, include
  12600 If an included file is not specified as having any markup language,
  12601 Org assumes it be in Org format and proceeds as usual with a few
  12602 exceptions.  Org makes the footnote labels (see [[*Creating Footnotes]])
  12603 in the included file local to that file.  The contents of the included
  12604 file belong to the same structure---headline, item---containing the
  12605 =INCLUDE= keyword.  In particular, headlines within the file become
  12606 children of the current section.  That behavior can be changed by
  12607 providing an additional keyword parameter, =:minlevel=.  It shifts the
  12608 headlines in the included file to become the lowest level.  For
  12609 example, this syntax makes the included file a sibling of the current
  12610 top-level headline:
  12611 
  12612 : #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
  12613 
  12614 #+cindex: @samp{lines}, include
  12615 Inclusion of only portions of files are specified using ranges
  12616 parameter with =:lines= keyword.  The line at the upper end of the
  12617 range will not be included.  The start and/or the end of the range may
  12618 be omitted to use the obvious defaults.
  12619 
  12620 | =#+INCLUDE: "~/.emacs" :lines "5-10"= | Include lines 5 to 10, 10 excluded |
  12621 | =#+INCLUDE: "~/.emacs" :lines "-10"=  | Include lines 1 to 10, 10 excluded |
  12622 | =#+INCLUDE: "~/.emacs" :lines "10-"=  | Include lines from 10 to EOF       |
  12623 
  12624 Inclusions may specify a file-link to extract an object matched by
  12625 ~org-link-search~[fn:44] (see [[*Search Options in File Links]]).  The
  12626 ranges for =:lines= keyword are relative to the requested element.
  12627 Therefore,
  12628 
  12629 : #+INCLUDE: "./paper.org::*conclusion" :lines "1-20"
  12630 
  12631 #+texinfo: @noindent
  12632 includes the first 20 lines of the headline named =conclusion=.
  12633 
  12634 #+cindex: @samp{only-contents}, include
  12635 To extract only the contents of the matched object, set
  12636 =:only-contents= property to non-~nil~.  This omits any planning lines
  12637 or property drawers.  For example, to include the body of the heading
  12638 with the custom ID =theory=, you can use
  12639 
  12640 : #+INCLUDE: "./paper.org::#theory" :only-contents t
  12641 
  12642 The following command allows navigating to the included document:
  12643 
  12644 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
  12645   #+kindex: C-c '
  12646   #+findex: org-edit-special
  12647 
  12648   Visit the included file at point.
  12649 
  12650 ** Macro Replacement
  12651 :PROPERTIES:
  12652 :DESCRIPTION: Use macros to create templates.
  12653 :END:
  12654 #+cindex: macro replacement, during export
  12655 #+cindex: @samp{MACRO}, keyword
  12656 
  12657 #+vindex: org-export-global-macros
  12658 Macros replace text snippets during export.  Macros are defined
  12659 globally in ~org-export-global-macros~, or document-wise with the
  12660 following syntax:
  12661 
  12662 : #+MACRO: name   replacement text; $1, $2 are arguments
  12663 
  12664 #+texinfo: @noindent
  12665 which can be referenced using ={{{name(arg1, arg2)}}}=[fn:45].  For
  12666 example
  12667 
  12668 #+begin_example
  12669 ,#+MACRO: poem Rose is $1, violet's $2. Life's ordered: Org assists you.
  12670 {{{poem(red,blue)}}}
  12671 #+end_example
  12672 
  12673 #+texinfo: @noindent
  12674 becomes
  12675 
  12676 : Rose is red, violet's blue.  Life's ordered: Org assists you.
  12677 
  12678 As a special case, Org parses any replacement text starting with
  12679 =(eval= as an Emacs Lisp expression and evaluates it accordingly.
  12680 Within such templates, arguments become strings.  Thus, the following
  12681 macro
  12682 
  12683 : #+MACRO: gnustamp (eval (concat "GNU/" (capitalize $1)))
  12684 
  12685 #+texinfo: @noindent
  12686 turns ={{{gnustamp(linux)}}}= into =GNU/Linux= during export.
  12687 
  12688 Org recognizes macro references in following Org markup areas:
  12689 paragraphs, headlines, verse blocks, tables cells and lists.  Org also
  12690 recognizes macro references in keywords, such as =CAPTION=, =TITLE=,
  12691 =AUTHOR=, =DATE=, and for some backend specific export options.
  12692 
  12693 Org comes with following pre-defined macros:
  12694 
  12695 #+attr_texinfo: :sep ;
  12696 - ={{{keyword(NAME)}}}=; ={{{title}}}=; ={{{author}}}=; ={{{email}}}= ::
  12697 
  12698   #+cindex: @samp{keyword}, macro
  12699   #+cindex: @samp{title}, macro
  12700   #+cindex: @samp{author}, macro
  12701   #+cindex: @samp{email}, macro
  12702   The =keyword= macro collects all values from {{{var(NAME)}}}
  12703   keywords throughout the buffer, separated with white space.
  12704   =title=, =author= and =email= macros are shortcuts for,
  12705   respectively, ={{{keyword(TITLE)}}}=, ={{{keyword(AUTHOR)}}}= and
  12706   ={{{keyword(EMAIL)}}}=.
  12707 
  12708 - ={{{date}}}=; ={{{date(FORMAT)}}}= ::
  12709 
  12710   #+cindex: @samp{date}, macro
  12711   This macro refers to the =DATE= keyword.  {{{var(FORMAT)}}} is an
  12712   optional argument to the =date= macro that is used only if =DATE= is
  12713   a single timestamp.  {{{var(FORMAT)}}} should be a format string
  12714   understood by ~format-time-string~.
  12715 
  12716 - ={{{time(FORMAT)}}}=; ={{{modification-time(FORMAT, VC)}}}= ::
  12717 
  12718   #+cindex: @samp{time}, macro
  12719   #+cindex: @samp{modification-time}, macro
  12720   These macros refer to the document's date and time of export and
  12721   date and time of modification.  {{{var(FORMAT)}}} is a string
  12722   understood by ~format-time-string~.  If the second argument to the
  12723   ~modification-time~ macro is non-~nil~, Org uses =vc.el= to retrieve
  12724   the document's modification time from the version control system.
  12725   Otherwise Org reads the file attributes.
  12726 
  12727 - ={{{input-file}}}= ::
  12728 
  12729   #+cindex: @samp{input-file}, macro
  12730   This macro refers to the filename of the exported file.
  12731 
  12732 - ={{{property(PROPERTY-NAME)}}}=; ={{{property(PROPERTY-NAME, SEARCH OPTION)}}}= ::
  12733 
  12734   #+cindex: @samp{property}, macro
  12735   This macro returns the value of property {{{var(PROPERTY-NAME)}}} in
  12736   the current entry.  If {{{var(SEARCH-OPTION)}}} (see [[*Search
  12737   Options in File Links]]) refers to a remote entry, use it instead.
  12738 
  12739 - ={{{n}}}=; ={{{n(NAME)}}}=; ={{{n(NAME, ACTION)}}}= ::
  12740 
  12741   #+cindex: @samp{n}, macro
  12742   #+cindex: counter, macro
  12743   This macro implements custom counters by returning the number of
  12744   times the macro has been expanded so far while exporting the buffer.
  12745   You can create more than one counter using different {{{var(NAME)}}}
  12746   values.  If {{{var(ACTION)}}} is =-=, previous value of the counter
  12747   is held, i.e., the specified counter is not incremented.  If the
  12748   value is a number, the specified counter is set to that value.  If
  12749   it is any other non-empty string, the specified counter is reset
  12750   to 1.  You may leave {{{var(NAME)}}} empty to reset the default
  12751   counter.
  12752 
  12753 #+cindex: @samp{results}, macro
  12754 Moreover, inline source blocks (see [[*Structure of Code Blocks]]) use the
  12755 special =results= macro to mark their output.  As such, you are
  12756 advised against re-defining it, unless you know what you are doing.
  12757 
  12758 #+vindex: org-hide-macro-markers
  12759 The surrounding brackets can be made invisible by setting
  12760 ~org-hide-macro-markers~ to a non-~nil~ value.
  12761 
  12762 Org expands macros at the very beginning of the export process.
  12763 
  12764 ** Comment Lines
  12765 :PROPERTIES:
  12766 :DESCRIPTION: What will not be exported.
  12767 :END:
  12768 #+cindex: exporting, not
  12769 
  12770 #+cindex: comment lines
  12771 Lines starting with zero or more whitespace characters followed by one
  12772 =#= and a whitespace are treated as comments and, as such, are not
  12773 exported.
  12774 
  12775 #+cindex: @samp{BEGIN_COMMENT}
  12776 #+cindex: comment block
  12777 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT=
  12778 are not exported.
  12779 
  12780 #+cindex: comment trees
  12781 Finally, a =COMMENT= keyword at the beginning of an entry, but after
  12782 any other keyword or priority cookie, comments out the entire subtree.
  12783 In this case, the subtree is not exported and no code block within it
  12784 is executed either[fn:: For a less drastic behavior, consider using a
  12785 select tag (see [[*Export Settings]]) instead.].  The command below
  12786 helps changing the comment status of a headline.
  12787 
  12788 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
  12789   #+kindex: C-c ;
  12790   #+findex: org-toggle-comment
  12791 
  12792   Toggle the =COMMENT= keyword at the beginning of an entry.
  12793 
  12794 ** ASCII/Latin-1/UTF-8 export
  12795 :PROPERTIES:
  12796 :DESCRIPTION: Exporting to flat files with encoding.
  12797 :END:
  12798 #+cindex: ASCII export
  12799 #+cindex: Latin-1 export
  12800 #+cindex: UTF-8 export
  12801 
  12802 ASCII export produces an output file containing only plain ASCII
  12803 characters.  This is the simplest and most direct text output.  It
  12804 does not contain any Org markup.  Latin-1 and UTF-8 export use
  12805 additional characters and symbols available in these encoding
  12806 standards.  All three of these export formats offer the most basic of
  12807 text output for maximum portability.
  12808 
  12809 #+vindex: org-ascii-text-width
  12810 On export, Org fills and justifies text according to the text width
  12811 set in ~org-ascii-text-width~.
  12812 
  12813 #+vindex: org-ascii-links-to-notes
  12814 Org exports links using a footnote-like style where the descriptive
  12815 part is in the text and the link is in a note before the next heading.
  12816 See the variable ~org-ascii-links-to-notes~ for details.
  12817 
  12818 *** ASCII export commands
  12819 :PROPERTIES:
  12820 :UNNUMBERED: notoc
  12821 :END:
  12822 
  12823 #+attr_texinfo: :sep ,
  12824 - {{{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)}}} ::
  12825   #+kindex: C-c C-e t a
  12826   #+kindex: C-c C-e t l
  12827   #+kindex: C-c C-e t u
  12828   #+findex: org-ascii-export-to-ascii
  12829 
  12830   Export as an ASCII file with a =.txt= extension.  For =myfile.org=,
  12831   Org exports to =myfile.txt=, overwriting without warning.  For
  12832   =myfile.txt=, Org exports to =myfile.txt.txt= in order to prevent
  12833   data loss.
  12834 
  12835 - {{{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)}}} ::
  12836   #+kindex: C-c C-e t A
  12837   #+kindex: C-c C-e t L
  12838   #+kindex: C-c C-e t U
  12839   #+findex: org-ascii-export-as-ascii
  12840 
  12841   Export to a temporary buffer.  Does not create a file.
  12842 
  12843 *** ASCII specific export settings
  12844 :PROPERTIES:
  12845 :UNNUMBERED: notoc
  12846 :END:
  12847 
  12848 The ASCII export backend has one extra keyword for customizing ASCII
  12849 output.  Setting this keyword works similar to the general options
  12850 (see [[*Export Settings]]).
  12851 
  12852 - =SUBTITLE= ::
  12853 
  12854   #+cindex: @samp{SUBTITLE}, keyword
  12855   The document subtitle.  For long subtitles, use multiple
  12856   =#+SUBTITLE= lines in the Org file.  Org prints them on one
  12857   continuous line, wrapping into multiple lines if necessary.
  12858 
  12859 *** Header and sectioning structure
  12860 :PROPERTIES:
  12861 :UNNUMBERED: notoc
  12862 :END:
  12863 
  12864 Org converts the first three outline levels into headlines for ASCII
  12865 export.  The remaining levels are turned into lists.  To change this
  12866 cut-off point where levels become lists, see [[*Export Settings]].
  12867 
  12868 *** Quoting ASCII text
  12869 :PROPERTIES:
  12870 :UNNUMBERED: notoc
  12871 :END:
  12872 
  12873 To insert text within the Org file by the ASCII backend, use one the
  12874 following constructs, inline, keyword, or export block:
  12875 
  12876 #+cindex: @samp{ASCII}, keyword
  12877 #+cindex: @samp{BEGIN_EXPORT ascii}
  12878 #+begin_example
  12879 Inline text @@ascii:and additional text@@ within a paragraph.
  12880 
  12881 ,#+ASCII: Some text
  12882 
  12883 ,#+BEGIN_EXPORT ascii
  12884 Org exports text in this block only when using ASCII backend.
  12885 ,#+END_EXPORT
  12886 #+end_example
  12887 
  12888 *** ASCII specific attributes
  12889 :PROPERTIES:
  12890 :UNNUMBERED: notoc
  12891 :END:
  12892 #+cindex: @samp{ATTR_ASCII}, keyword
  12893 #+cindex: horizontal rules, in ASCII export
  12894 
  12895 ASCII backend recognizes only one attribute, =:width=, which
  12896 specifies the width of a horizontal rule in number of characters.  The
  12897 keyword and syntax for specifying widths is:
  12898 
  12899 #+begin_example
  12900 ,#+ATTR_ASCII: :width 10
  12901 -----
  12902 #+end_example
  12903 
  12904 *** ASCII special blocks
  12905 :PROPERTIES:
  12906 :UNNUMBERED: notoc
  12907 :END:
  12908 #+cindex: special blocks, in ASCII export
  12909 #+cindex: @samp{BEGIN_JUSTIFYLEFT}
  12910 #+cindex: @samp{BEGIN_JUSTIFYRIGHT}
  12911 
  12912 Besides =#+BEGIN_CENTER= blocks (see [[*Paragraphs]]), ASCII backend has
  12913 these two left and right justification blocks:
  12914 
  12915 #+begin_example
  12916 ,#+BEGIN_JUSTIFYLEFT
  12917 It's just a jump to the left...
  12918 ,#+END_JUSTIFYLEFT
  12919 
  12920 ,#+BEGIN_JUSTIFYRIGHT
  12921 ...and then a step to the right.
  12922 ,#+END_JUSTIFYRIGHT
  12923 #+end_example
  12924 
  12925 ** Beamer Export
  12926 :PROPERTIES:
  12927 :DESCRIPTION: Producing presentations and slides.
  12928 :END:
  12929 #+cindex: Beamer export
  12930 
  12931 Org uses Beamer export to convert an Org file tree structure into
  12932 high-quality interactive slides for presentations.  Beamer is a LaTeX
  12933 document class for creating presentations in PDF, HTML, and other
  12934 popular display formats.
  12935 
  12936 *** Beamer export commands
  12937 :PROPERTIES:
  12938 :DESCRIPTION: For creating Beamer documents.
  12939 :END:
  12940 
  12941 - {{{kbd(C-c C-e l b)}}} (~org-beamer-export-to-latex~) ::
  12942   #+kindex: C-c C-e l b
  12943   #+findex: org-beamer-export-to-latex
  12944 
  12945   Export as LaTeX file with a =.tex= extension.  For =myfile.org=, Org
  12946   exports to =myfile.tex=, overwriting without warning.
  12947 
  12948 - {{{kbd(C-c C-e l B)}}} (~org-beamer-export-as-latex~) ::
  12949   #+kindex: C-c C-e l B
  12950   #+findex: org-beamer-export-as-latex
  12951 
  12952   Export to a temporary buffer.  Does not create a file.
  12953 
  12954 - {{{kbd(C-c C-e l P)}}} (~org-beamer-export-to-pdf~) ::
  12955   #+kindex: C-c C-e l P
  12956   #+findex: org-beamer-export-to-pdf
  12957 
  12958   Export as LaTeX file and then convert it to PDF format.
  12959 
  12960 - {{{kbd(C-c C-e l O)}}} ::
  12961   #+kindex: C-c C-e l O
  12962 
  12963   Export as LaTeX file, convert it to PDF format, and then open the
  12964   PDF file.
  12965 
  12966 *** Beamer specific export settings
  12967 :PROPERTIES:
  12968 :DESCRIPTION: For customizing Beamer export.
  12969 :END:
  12970 
  12971 Beamer export backend has several additional keywords for customizing
  12972 Beamer output.  These keywords work similar to the general options
  12973 settings (see [[*Export Settings]]).
  12974 
  12975 - =BEAMER_THEME= ::
  12976 
  12977   #+cindex: @samp{BEAMER_THEME}, keyword
  12978   #+vindex: org-beamer-theme
  12979   The Beamer layout theme (~org-beamer-theme~).  Use square brackets
  12980   for options.  For example:
  12981 
  12982   : #+BEAMER_THEME: Rochester [height=20pt]
  12983 
  12984 - =BEAMER_FONT_THEME= ::
  12985 
  12986   #+cindex: @samp{BEAMER_FONT_THEME}, keyword
  12987   The Beamer font theme.
  12988 
  12989 - =BEAMER_INNER_THEME= ::
  12990 
  12991   #+cindex: @samp{BEAMER_INNER_THEME}, keyword
  12992   The Beamer inner theme.
  12993 
  12994 - =BEAMER_OUTER_THEME= ::
  12995 
  12996   #+cindex: @samp{BEAMER_OUTER_THEME}, keyword
  12997   The Beamer outer theme.
  12998 
  12999 - =BEAMER_HEADER= ::
  13000 
  13001   #+cindex: @samp{BEAMER_HEADER}, keyword
  13002   Arbitrary lines inserted in the preamble, just before the =hyperref=
  13003   settings.
  13004 
  13005 - =DESCRIPTION= ::
  13006 
  13007   #+cindex: @samp{DESCRIPTION}, keyword
  13008   The document description.  For long descriptions, use multiple
  13009   =DESCRIPTION= keywords.  By default, =hyperref= inserts
  13010   =DESCRIPTION= as metadata.  Use ~org-latex-hyperref-template~ to
  13011   configure document metadata.  Use ~org-latex-title-command~ to
  13012   configure typesetting of description as part of front matter.
  13013 
  13014 - =KEYWORDS= ::
  13015 
  13016   #+cindex: @samp{KEYWORDS}, keyword
  13017   The keywords for defining the contents of the document.  Use
  13018   multiple =KEYWORDS= lines if necessary.  By default, =hyperref=
  13019   inserts =KEYWORDS= as metadata.  Use ~org-latex-hyperref-template~
  13020   to configure document metadata.  Use ~org-latex-title-command~ to
  13021   configure typesetting of keywords as part of front matter.
  13022 
  13023 - =SUBTITLE= ::
  13024 
  13025   #+cindex: @samp{SUBTITLE}, keyword
  13026   Document's subtitle.  For typesetting, use
  13027   ~org-beamer-subtitle-format~ string.  Use
  13028   ~org-latex-hyperref-template~ to configure document metadata.  Use
  13029   ~org-latex-title-command~ to configure typesetting of subtitle as
  13030   part of front matter.
  13031 
  13032 *** Frames and Blocks in Beamer
  13033 :PROPERTIES:
  13034 :DESCRIPTION: For composing Beamer slides.
  13035 :END:
  13036 
  13037 Org transforms heading levels into Beamer's sectioning elements,
  13038 frames and blocks.  Any Org tree with a not-too-deep-level nesting
  13039 should in principle be exportable as a Beamer presentation.
  13040 
  13041 -
  13042   #+vindex: org-beamer-frame-level
  13043   Org headlines become Beamer frames when the heading level in Org is
  13044   equal to ~org-beamer-frame-level~ or =H= value in a =OPTIONS= line
  13045   (see [[*Export Settings]]).
  13046 
  13047   #+cindex: @samp{BEAMER_ENV}, property
  13048   Org overrides headlines to frames conversion for the current tree of
  13049   an Org file if it encounters the =BEAMER_ENV= property set to
  13050   =frame= or =fullframe=.  Org ignores whatever
  13051   ~org-beamer-frame-level~ happens to be for that headline level in
  13052   the Org tree.  In Beamer terminology, a full frame is a frame
  13053   without its title.
  13054 
  13055 - Org exports a Beamer frame's objects as block environments.  Org can
  13056   enforce wrapping in special block types when =BEAMER_ENV= property
  13057   is set[fn:46].  For valid values see
  13058   ~org-beamer-environments-default~.  To add more values, see
  13059   ~org-beamer-environments-extra~.
  13060   #+vindex: org-beamer-environments-default
  13061   #+vindex: org-beamer-environments-extra
  13062 
  13063 -
  13064   #+cindex: @samp{BEAMER_REF}, property
  13065   If =BEAMER_ENV= is set to =appendix=, Org exports the entry as an
  13066   appendix.  When set to =note=, Org exports the entry as a note
  13067   within the frame or between frames, depending on the entry's heading
  13068   level.  When set to =noteNH=, Org exports the entry as a note
  13069   without its title.  When set to =againframe=, Org exports the entry
  13070   with =\againframe= command, which makes setting the =BEAMER_REF=
  13071   property mandatory because =\againframe= needs frame to resume.
  13072 
  13073   When =ignoreheading= is set, Org export ignores the entry's headline
  13074   but not its content.  This is useful for inserting content between
  13075   frames.  It is also useful for properly closing a =column=
  13076   environment.
  13077 
  13078   #+cindex: @samp{BEAMER_ACT}, property
  13079   #+cindex: @samp{BEAMER_OPT}, property
  13080   When =BEAMER_ACT= is set for a headline, Org export translates that
  13081   headline as an overlay or action specification.  When enclosed in
  13082   square brackets, Org export makes the overlay specification
  13083   a default.  Use =BEAMER_OPT= to set any options applicable to the
  13084   current Beamer frame or block.  The Beamer export backend wraps
  13085   with appropriate angular or square brackets.  It also adds the
  13086   =fragile= option for any code that may require a verbatim block.
  13087 
  13088   #+cindex: @samp{BEAMER_COL}, property
  13089   To create a column on the Beamer slide, use the =BEAMER_COL=
  13090   property for its headline in the Org file.  Set the value of
  13091   =BEAMER_COL= to a decimal number representing the fraction of the
  13092   total text width.  Beamer export uses this value to set the column's
  13093   width and fills the column with the contents of the Org entry.  If
  13094   the Org entry has no specific environment defined, Beamer export
  13095   ignores the heading.  If the Org entry has a defined environment,
  13096   Beamer export uses the heading as title.  Behind the scenes, Beamer
  13097   export automatically handles LaTeX column separations for contiguous
  13098   headlines.  To manually adjust them for any unique configurations
  13099   needs, use the =BEAMER_ENV= property.
  13100 
  13101 *** Beamer specific syntax
  13102 :PROPERTIES:
  13103 :DESCRIPTION: For using in Org documents.
  13104 :END:
  13105 
  13106 Since Org's Beamer export backend is an extension of the LaTeX
  13107 backend, it recognizes other LaTeX specific syntax---for example,
  13108 =#+LATEX:= or =#+ATTR_LATEX:=.  See [[*LaTeX Export]], for details.
  13109 
  13110 Beamer export wraps the table of contents generated with =toc:t=
  13111 =OPTION= keyword in a =frame= environment.  Beamer export does not
  13112 wrap the table of contents generated with =TOC= keyword (see [[*Table of
  13113 Contents]]).  Use square brackets for specifying options.
  13114 
  13115 : #+TOC: headlines [currentsection]
  13116 
  13117 Insert Beamer-specific code using the following constructs:
  13118 
  13119 #+cindex: @samp{BEAMER}, keyword
  13120 #+cindex: @samp{BEGIN_EXPORT beamer}
  13121 #+begin_example
  13122 ,#+BEAMER: \pause
  13123 
  13124 ,#+BEGIN_EXPORT beamer
  13125   Only Beamer export backend exports this.
  13126 ,#+END_EXPORT
  13127 
  13128 Text @@beamer:some code@@ within a paragraph.
  13129 #+end_example
  13130 
  13131 Inline constructs, such as the last one above, are useful for adding
  13132 overlay specifications to objects with ~bold~, ~item~, ~link~,
  13133 ~radio-target~ and ~target~ types.  Enclose the value in angular
  13134 brackets and place the specification at the beginning of the object as
  13135 shown in this example:
  13136 
  13137 :  A *@@beamer:<2->@@useful* feature
  13138 
  13139 #+cindex: @samp{ATTR_BEAMER}, keyword
  13140 Beamer export recognizes the =ATTR_BEAMER= keyword with the following
  13141 attributes from Beamer configurations: =:environment= for changing
  13142 local Beamer environment, =:overlay= for specifying Beamer overlays in
  13143 angular or square brackets, and =:options= for inserting optional
  13144 arguments.
  13145 
  13146 #+begin_example
  13147 ,#+ATTR_BEAMER: :environment nonindentlist
  13148 - item 1, not indented
  13149 - item 2, not indented
  13150 - item 3, not indented
  13151 #+end_example
  13152 
  13153 #+begin_example
  13154 ,#+ATTR_BEAMER: :overlay <+->
  13155 - item 1
  13156 - item 2
  13157 #+end_example
  13158 
  13159 #+begin_example
  13160 ,#+ATTR_BEAMER: :options [Lagrange]
  13161 Let $G$ be a finite group, and let $H$ be
  13162 a subgroup of $G$.  Then the order of $H$ divides the order of $G$.
  13163 #+end_example
  13164 
  13165 *** Editing support
  13166 :PROPERTIES:
  13167 :DESCRIPTION: Editing support.
  13168 :END:
  13169 
  13170 Org Beamer mode is a special minor mode for faster editing of Beamer
  13171 documents.
  13172 
  13173 : #+STARTUP: beamer
  13174 
  13175 - {{{kbd(C-c C-b)}}} (~org-beamer-select-environment~) ::
  13176   #+kindex: C-c C-b
  13177   #+findex: org-beamer-select-environment
  13178 
  13179   Org Beamer mode provides this key for quicker selections in Beamer
  13180   normal environments, and for selecting the =BEAMER_COL= property.
  13181 
  13182 *** A Beamer example
  13183 :PROPERTIES:
  13184 :DESCRIPTION: A complete presentation.
  13185 :END:
  13186 
  13187 Here is an example of an Org document ready for Beamer export.
  13188 
  13189 #+begin_example
  13190 ,#+TITLE: Example Presentation
  13191 ,#+AUTHOR: Carsten Dominik
  13192 ,#+OPTIONS: H:2 toc:t num:t
  13193 ,#+LATEX_CLASS: beamer
  13194 ,#+LATEX_CLASS_OPTIONS: [presentation]
  13195 ,#+BEAMER_THEME: Madrid
  13196 ,#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col)
  13197 
  13198 ,* This is the first structural section
  13199 
  13200 ,** Frame 1
  13201 ,*** Thanks to Eric Fraga                                           :B_block:
  13202     :PROPERTIES:
  13203     :BEAMER_COL: 0.48
  13204     :BEAMER_ENV: block
  13205     :END:
  13206     for the first viable Beamer setup in Org
  13207 ,*** Thanks to everyone else                                        :B_block:
  13208     :PROPERTIES:
  13209     :BEAMER_COL: 0.48
  13210     :BEAMER_ACT: <2->
  13211     :BEAMER_ENV: block
  13212     :END:
  13213     for contributing to the discussion
  13214 ,**** This will be formatted as a beamer note                       :B_note:
  13215      :PROPERTIES:
  13216      :BEAMER_env: note
  13217      :END:
  13218 ,** Frame 2 (where we will not use columns)
  13219 ,*** Request
  13220     Please test this stuff!
  13221 #+end_example
  13222 
  13223 ** HTML Export
  13224 :PROPERTIES:
  13225 :DESCRIPTION: Exporting to HTML.
  13226 :END:
  13227 #+cindex: HTML export
  13228 
  13229 Org mode contains an HTML exporter with extensive HTML formatting
  13230 compatible with XHTML 1.0 strict standard.
  13231 
  13232 *** HTML export commands
  13233 :PROPERTIES:
  13234 :DESCRIPTION: Invoking HTML export.
  13235 :END:
  13236 
  13237 - {{{kbd(C-c C-e h h)}}} (~org-html-export-to-html~) ::
  13238   #+kindex: C-c C-e h h
  13239   #+kindex: C-c C-e h o
  13240   #+findex: org-html-export-to-html
  13241 
  13242   Export as HTML file with a =.html= extension.  For =myfile.org=, Org
  13243   exports to =myfile.html=, overwriting without warning.  {{{kbd(C-c
  13244   C-e h o)}}} exports to HTML and opens it in a web browser.
  13245 
  13246 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) ::
  13247   #+kindex: C-c C-e h H
  13248   #+findex: org-html-export-as-html
  13249 
  13250   Exports to a temporary buffer.  Does not create a file.
  13251 
  13252 *** HTML specific export settings
  13253 :PROPERTIES:
  13254 :DESCRIPTION: Settings for HTML export.
  13255 :END:
  13256 
  13257 HTML export has a number of keywords, similar to the general options
  13258 settings described in [[*Export Settings]].
  13259 
  13260 - =DESCRIPTION= ::
  13261 
  13262   #+cindex: @samp{DESCRIPTION}, keyword
  13263   This is the document's description, which the HTML exporter inserts
  13264   it as a HTML meta tag in the HTML file.  For long descriptions, use
  13265   multiple =DESCRIPTION= lines.  The exporter takes care of wrapping
  13266   the lines properly.
  13267 
  13268   The exporter includes a number of other meta tags, which can be customized
  13269   by modifying ~org-html-meta-tags~.
  13270 
  13271 - =HTML_DOCTYPE= ::
  13272 
  13273   #+cindex: @samp{HTML_DOCTYPE}, keyword
  13274   #+vindex: org-html-doctype
  13275   Specify the document type, for example: HTML5 (~org-html-doctype~).
  13276 
  13277 - =HTML_CONTAINER= ::
  13278 
  13279   #+cindex: @samp{HTML_CONTAINER}, keyword
  13280   #+vindex: org-html-container-element
  13281   Specify the HTML container, such as =div=, for wrapping sections and
  13282   elements (~org-html-container-element~).
  13283 
  13284 - =HTML_LINK_HOME= ::
  13285 
  13286   #+cindex: @samp{HTML_LINK_HOME}, keyword
  13287   #+vindex: org-html-link-home
  13288   The URL for home link (~org-html-link-home~).
  13289 
  13290 - =HTML_LINK_UP= ::
  13291 
  13292   #+cindex: @samp{HTML_LINK_UP}, keyword
  13293   #+vindex: org-html-link-up
  13294   The URL for the up link of exported HTML pages (~org-html-link-up~).
  13295 
  13296 - =HTML_MATHJAX= ::
  13297 
  13298   #+cindex: @samp{HTML_MATHJAX}, keyword
  13299   #+vindex: org-html-mathjax-options
  13300   Options for MathJax (~org-html-mathjax-options~).  MathJax is used
  13301   to typeset LaTeX math in HTML documents.  See [[*Math formatting in
  13302   HTML export]], for an example.
  13303 
  13304 - =HTML_HEAD= ::
  13305 
  13306   #+cindex: @samp{HTML_HEAD}, keyword
  13307   #+vindex: org-html-head
  13308   Arbitrary lines for appending to the HTML document's head
  13309   (~org-html-head~).
  13310 
  13311 - =HTML_HEAD_EXTRA= ::
  13312 
  13313   #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
  13314   #+vindex: org-html-head-extra
  13315   More arbitrary lines for appending to the HTML document's head
  13316   (~org-html-head-extra~).
  13317 
  13318 - =KEYWORDS= ::
  13319 
  13320   #+cindex: @samp{KEYWORDS}, keyword
  13321   Keywords to describe the document's content.  HTML exporter inserts
  13322   these keywords as HTML meta tags.  For long keywords, use multiple
  13323   =KEYWORDS= lines.
  13324 
  13325 - =LATEX_HEADER= ::
  13326 
  13327   #+cindex: @samp{LATEX_HEADER}, keyword
  13328   Arbitrary lines for appending to the preamble; HTML exporter appends
  13329   when transcoding LaTeX fragments to images (see [[*Math formatting in
  13330   HTML export]]).
  13331 
  13332 - =SUBTITLE= ::
  13333 
  13334   #+cindex: @samp{SUBTITLE}, keyword
  13335   The document's subtitle.  HTML exporter formats subtitle if document
  13336   type is =HTML5= and the CSS has a =subtitle= class.
  13337 
  13338 Some of these keywords are explained in more detail in the following
  13339 sections of the manual.
  13340 
  13341 *** HTML doctypes
  13342 :PROPERTIES:
  13343 :DESCRIPTION: Exporting various (X)HTML flavors.
  13344 :END:
  13345 
  13346 Org can export to various (X)HTML flavors.
  13347 
  13348 #+vindex: org-html-doctype
  13349 #+vindex: org-html-doctype-alist
  13350 Set the ~org-html-doctype~ variable for different (X)HTML variants.
  13351 Depending on the variant, the HTML exporter adjusts the syntax of HTML
  13352 conversion accordingly.  Org includes the following ready-made
  13353 variants:
  13354 
  13355 - ~"html4-strict"~
  13356 - ~"html4-transitional"~
  13357 - ~"html4-frameset"~
  13358 - ~"xhtml-strict"~
  13359 - ~"xhtml-transitional"~
  13360 - ~"xhtml-frameset"~
  13361 - ~"xhtml-11"~
  13362 - ~"html5"~
  13363 - ~"xhtml5"~
  13364 
  13365 #+texinfo: @noindent
  13366 See the variable ~org-html-doctype-alist~ for details.  The default is
  13367 ~"xhtml-strict"~.
  13368 
  13369 #+vindex: org-html-html5-fancy
  13370 #+cindex: @samp{HTML5}, export new elements
  13371 Org's HTML exporter does not by default enable new block elements
  13372 introduced with the HTML5 standard.  To enable them, set
  13373 ~org-html-html5-fancy~ to non-~nil~.  Or use an =OPTIONS= line in the
  13374 file to set =html5-fancy=.
  13375 
  13376 HTML5 documents can have arbitrary =#+BEGIN= ... =#+END= blocks.
  13377 For example:
  13378 
  13379 #+begin_example
  13380 ,#+BEGIN_aside
  13381   Lorem ipsum
  13382 ,#+END_aside
  13383 #+end_example
  13384 
  13385 #+texinfo: @noindent
  13386 exports to:
  13387 
  13388 #+begin_src html
  13389 <aside>
  13390   <p>Lorem ipsum</p>
  13391 </aside>
  13392 #+end_src
  13393 
  13394 #+texinfo: @noindent
  13395 while this:
  13396 
  13397 #+begin_example
  13398 ,#+ATTR_HTML: :controls controls :width 350
  13399 ,#+BEGIN_video
  13400 ,#+HTML: <source src="movie.mp4" type="video/mp4">
  13401 ,#+HTML: <source src="movie.ogg" type="video/ogg">
  13402 Your browser does not support the video tag.
  13403 ,#+END_video
  13404 #+end_example
  13405 
  13406 #+texinfo: @noindent
  13407 exports to:
  13408 
  13409 #+begin_src html
  13410 <video controls="controls" width="350">
  13411   <source src="movie.mp4" type="video/mp4">
  13412   <source src="movie.ogg" type="video/ogg">
  13413   <p>Your browser does not support the video tag.</p>
  13414 </video>
  13415 #+end_src
  13416 
  13417 #+vindex: org-html-html5-elements
  13418 When special blocks do not have a corresponding HTML5 element, the
  13419 HTML exporter reverts to standard translation (see
  13420 ~org-html-html5-elements~).  For example, =#+BEGIN_lederhosen= exports
  13421 to ~<div class="lederhosen">~.
  13422 
  13423 Special blocks cannot have headlines.  For the HTML exporter to wrap
  13424 the headline and its contents in ~<section>~ or ~<article>~ tags, set
  13425 the =HTML_CONTAINER= property for the headline.
  13426 
  13427 *** HTML preamble and postamble
  13428 :PROPERTIES:
  13429 :DESCRIPTION: Inserting preamble and postamble.
  13430 :END:
  13431 #+vindex: org-html-preamble
  13432 #+vindex: org-html-postamble
  13433 #+vindex: org-html-preamble-format
  13434 #+vindex: org-html-postamble-format
  13435 #+vindex: org-html-validation-link
  13436 #+vindex: org-export-creator-string
  13437 #+vindex: org-export-time-stamp-file
  13438 
  13439 The HTML exporter has delineations for preamble and postamble.  The
  13440 default value for ~org-html-preamble~ is ~t~, which makes the HTML
  13441 exporter insert the preamble.  See the variable
  13442 ~org-html-preamble-format~ for the format string.
  13443 
  13444 Set ~org-html-preamble~ to a string to override the default format
  13445 string.  If set to a function, the HTML exporter expects the function
  13446 to return a string upon execution.  The HTML exporter inserts this
  13447 string in the preamble.  The HTML exporter does not insert a preamble
  13448 if ~org-html-preamble~ is set ~nil~.
  13449 
  13450 The above also applies to ~org-html-postamble~ and
  13451 ~org-html-postamble-format~.  In addition, ~org-html-postamble~ can be
  13452 set to ~auto~ (its default value), which makes the HTML exporter build
  13453 a postamble from looking up author's name, email address, creator's
  13454 name, and date.
  13455 
  13456 
  13457 *** Exporting to minimal HTML
  13458 :PROPERTIES:
  13459 :DESCRIPTION: Exporting HTML without CSS, Javascript, etc.
  13460 :ALT_TITLE: Bare HTML
  13461 :END:
  13462 
  13463 If you want to output a minimal HTML file, with no CSS, no Javascript,
  13464 no preamble or postamble, here are the variable you would need to set:
  13465 
  13466 #+vindex: org-html-head
  13467 #+vindex: org-html-head-extra
  13468 #+vindex: org-html-head-include-default-style
  13469 #+vindex: org-html-head-include-scripts
  13470 #+vindex: org-html-preamble
  13471 #+vindex: org-html-postamble
  13472 #+vindex: org-html-use-infojs
  13473 #+begin_src emacs-lisp
  13474 (setq org-html-head ""
  13475       org-html-head-extra ""
  13476       org-html-head-include-default-style nil
  13477       org-html-head-include-scripts nil
  13478       org-html-preamble nil
  13479       org-html-postamble nil
  13480       org-html-use-infojs nil)
  13481 #+end_src
  13482 
  13483 *** Quoting HTML tags
  13484 :PROPERTIES:
  13485 :DESCRIPTION: Using direct HTML in Org files.
  13486 :END:
  13487 
  13488 The HTML export backend transforms =<= and =>= to =&lt;= and =&gt;=.
  13489 To include raw HTML code in the Org file so the HTML export backend
  13490 can insert that HTML code in the output, use this inline syntax:
  13491 =@@html:...@@=.  For example:
  13492 
  13493 : @@html:<b>@@bold text@@html:</b>@@
  13494 
  13495 #+cindex: @samp{HTML}, keyword
  13496 #+cindex: @samp{BEGIN_EXPORT html}
  13497 For larger raw HTML code blocks, use these HTML export code blocks:
  13498 
  13499 #+begin_example
  13500 ,#+HTML: Literal HTML code for export
  13501 
  13502 ,#+BEGIN_EXPORT html
  13503   All lines between these markers are exported literally
  13504 ,#+END_EXPORT
  13505 #+end_example
  13506 
  13507 *** Headlines in HTML export
  13508 :PROPERTIES:
  13509 :DESCRIPTION: Formatting headlines.
  13510 :END:
  13511 #+cindex: headlines, in HTML export
  13512 
  13513 Headlines are exported to =<h1>=, =<h2>=, etc.  Each headline gets the
  13514 =id= attribute from =CUSTOM_ID= property, or a unique generated value,
  13515 see [[*Internal Links]].
  13516 
  13517 #+vindex: org-html-self-link-headlines
  13518 When ~org-html-self-link-headlines~ is set to a non-~nil~ value, the
  13519 text of the headlines is also wrapped in =<a>= tags.  These tags have
  13520 a =href= attribute making the headlines link to themselves.
  13521 
  13522 *** Links in HTML export
  13523 :PROPERTIES:
  13524 :DESCRIPTION: Inserting and formatting links.
  13525 :END:
  13526 #+cindex: links, in HTML export
  13527 #+cindex: internal links, in HTML export
  13528 #+cindex: external links, in HTML export
  13529 
  13530 The HTML export backend transforms Org's internal links (see
  13531 [[*Internal Links]]) to equivalent HTML links in the output.  The backend
  13532 similarly handles Org's automatic links created by radio targets (see
  13533 [[*Radio Targets]]) similarly.  For Org links to external files, the
  13534 backend transforms the links to /relative/ paths.
  13535 
  13536 #+vindex: org-html-link-org-files-as-html
  13537 For Org links to other =.org= files, the backend automatically
  13538 changes the file extension to =.html= and makes file paths relative.
  13539 If the =.org= files have an equivalent =.html= version at the same
  13540 location, then the converted links should work without any further
  13541 manual intervention.  However, to disable this automatic path
  13542 translation, set ~org-html-link-org-files-as-html~ to ~nil~.  When
  13543 disabled, the HTML export backend substitutes the ID-based links in
  13544 the HTML output.  For more about linking files when publishing to
  13545 a directory, see [[*Publishing links]].
  13546 
  13547 Org files can also have special directives to the HTML export
  13548 backend.  For example, by using =#+ATTR_HTML= lines to specify new
  13549 format attributes to ~<a>~ or ~<img>~ tags.  This example shows
  13550 changing the link's title and style:
  13551 
  13552 #+cindex: @samp{ATTR_HTML}, keyword
  13553 #+begin_example
  13554 ,#+ATTR_HTML: :title The Org mode website :style color:red;
  13555 [[https://orgmode.org]]
  13556 #+end_example
  13557 
  13558 *** Tables in HTML export
  13559 :PROPERTIES:
  13560 :DESCRIPTION: How to modify the formatting of tables.
  13561 :END:
  13562 #+cindex: tables, in HTML
  13563 #+vindex: org-export-html-table-tag
  13564 
  13565 The HTML export backend uses ~org-html-table-default-attributes~ when
  13566 exporting Org tables to HTML.  By default, the exporter does not draw
  13567 frames and cell borders.  To change for this for a table, use the
  13568 following lines before the table in the Org file:
  13569 
  13570 #+cindex: @samp{CAPTION}, keyword
  13571 #+cindex: @samp{ATTR_HTML}, keyword
  13572 #+begin_example
  13573 ,#+CAPTION: This is a table with lines around and between cells
  13574 ,#+ATTR_HTML: :border 2 :rules all :frame border
  13575 #+end_example
  13576 
  13577 The HTML export backend preserves column groupings in Org tables (see
  13578 [[*Column Groups]]) when exporting to HTML.
  13579 
  13580 Additional options for customizing tables for HTML export.
  13581 
  13582 - ~org-html-table-align-individual-fields~ ::
  13583 
  13584   #+vindex: org-html-table-align-individual-fields
  13585   Non-~nil~ attaches style attributes for alignment to each table
  13586   field.
  13587 
  13588 - ~org-html-table-caption-above~ ::
  13589 
  13590   #+vindex: org-html-table-caption-above
  13591   Non-~nil~ places caption string at the beginning of the table.
  13592 
  13593 - ~org-html-table-data-tags~ ::
  13594 
  13595   #+vindex: org-html-table-data-tags
  13596   Opening and ending tags for table data fields.
  13597 
  13598 - ~org-html-table-default-attributes~ ::
  13599 
  13600   #+vindex: org-html-table-default-attributes
  13601   Default attributes and values for table tags.
  13602 
  13603 - ~org-html-table-header-tags~ ::
  13604 
  13605   #+vindex: org-html-table-header-tags
  13606   Opening and ending tags for table's header fields.
  13607 
  13608 - ~org-html-table-row-tags~ ::
  13609 
  13610   #+vindex: org-html-table-row-tags
  13611   Opening and ending tags for table rows.
  13612 
  13613 - ~org-html-table-use-header-tags-for-first-column~ ::
  13614 
  13615   #+vindex: org-html-table-use-header-tags-for-first-column
  13616   Non-~nil~ formats column one in tables with header tags.
  13617 
  13618 *** Images in HTML export
  13619 :PROPERTIES:
  13620 :DESCRIPTION: How to insert figures into HTML output.
  13621 :END:
  13622 #+cindex: images, inline in HTML
  13623 #+cindex: inlining images in HTML
  13624 
  13625 The HTML export backend has features to convert Org image links to
  13626 HTML inline images and HTML clickable image links.
  13627 
  13628 #+vindex: org-html-inline-images
  13629 When the link in the Org file has no description, the HTML export
  13630 backend by default in-lines that image.  For example:
  13631 =[[file:myimg.jpg]]= is in-lined, while =[[file:myimg.jpg][the image]]= links to the text,
  13632 =the image=.  For more details, see the variable
  13633 ~org-html-inline-images~.
  13634 
  13635 On the other hand, if the description part of the Org link is itself
  13636 another link, such as =file:= or =http:= URL pointing to an image, the
  13637 HTML export backend in-lines this image and links to the main image.
  13638 This Org syntax enables the backend to link low-resolution thumbnail
  13639 to the high-resolution version of the image, as shown in this example:
  13640 
  13641 : [[file:highres.jpg][file:thumb.jpg]]
  13642 
  13643 To change attributes of in-lined images, use =#+ATTR_HTML= lines in
  13644 the Org file.  This example shows realignment to right, and adds ~alt~
  13645 and ~title~ attributes in support of text viewers and modern web
  13646 accessibility standards.
  13647 
  13648 #+cindex: @samp{CAPTION}, keyword
  13649 #+cindex: @samp{ATTR_HTML}, keyword
  13650 #+begin_example
  13651 ,#+CAPTION: A black cat stalking a spider
  13652 ,#+ATTR_HTML: :alt cat/spider image :title Action! :align right
  13653 [[./img/a.jpg]]
  13654 #+end_example
  13655 
  13656 The HTML export backend copies the =http= links from the Org file
  13657 as-is.
  13658 
  13659 *** Math formatting in HTML export
  13660 :PROPERTIES:
  13661 :DESCRIPTION: Beautiful math also on the web.
  13662 :END:
  13663 #+cindex: MathJax
  13664 #+cindex: dvipng
  13665 #+cindex: dvisvgm
  13666 #+cindex: ImageMagick
  13667 
  13668 #+vindex: org-html-mathjax-options~
  13669 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
  13670 different ways on HTML pages.  The default is to use the
  13671 [[https://www.mathjax.org][MathJax]], which should work out of the box
  13672 with Org[fn:: By default, Org loads MathJax from
  13673 [[https://www.jsdelivr.com/][jsDelivr]], as recommended in
  13674 [[https://docs.mathjax.org/en/latest/web/start.html][Getting Started
  13675 with MathJax Components]].][fn:47].  Some MathJax display options can
  13676 be configured via ~org-html-mathjax-options~, or in the buffer.  For
  13677 example, with the following settings,
  13678 
  13679 #+begin_example
  13680 ,#+HTML_MATHJAX: align: left indent: 5em tagside: left
  13681 #+end_example
  13682 
  13683 #+texinfo: @noindent
  13684 equation labels are displayed on the left margin and equations are
  13685 five em from the left margin.
  13686 
  13687 #+vindex: org-html-mathjax-template
  13688 See the docstring of ~org-html-mathjax-options~ for all supported
  13689 variables.  The MathJax template can be configure via
  13690 ~org-html-mathjax-template~.
  13691 
  13692 If you prefer, you can also request that LaTeX fragments are processed
  13693 into small images that will be inserted into the browser page.  Before
  13694 the availability of MathJax, this was the default method for Org
  13695 files.  This method requires that the dvipng program, dvisvgm or
  13696 ImageMagick suite is available on your system.  You can still get this
  13697 processing with
  13698 
  13699 : #+OPTIONS: tex:dvipng
  13700 
  13701 : #+OPTIONS: tex:dvisvgm
  13702 
  13703 #+texinfo: @noindent
  13704 or
  13705 
  13706 : #+OPTIONS: tex:imagemagick
  13707 
  13708 *** Text areas in HTML export
  13709 :PROPERTIES:
  13710 :DESCRIPTION: An alternate way to show an example.
  13711 :END:
  13712 
  13713 #+cindex: text areas, in HTML
  13714 Before Org mode's Babel, one popular approach to publishing code in
  13715 HTML was by using =:textarea=.  The advantage of this approach was
  13716 that copying and pasting was built into browsers with simple
  13717 JavaScript commands.  Even editing before pasting was made simple.
  13718 
  13719 The HTML export backend can create such text areas.  It requires an
  13720 =#+ATTR_HTML= line as shown in the example below with the =:textarea=
  13721 option.  This must be followed by either an example or a source code
  13722 block.  Other Org block types do not honor the =:textarea= option.
  13723 
  13724 By default, the HTML export backend creates a text area 80 characters
  13725 wide and height just enough to fit the content.  Override these
  13726 defaults with =:width= and =:height= options on the =#+ATTR_HTML=
  13727 line.
  13728 
  13729 #+begin_example
  13730 ,#+ATTR_HTML: :textarea t :width 40
  13731 ,#+BEGIN_EXAMPLE
  13732   (defun org-xor (a b)
  13733      "Exclusive or."
  13734      (if a (not b) b))
  13735 ,#+END_EXAMPLE
  13736 #+end_example
  13737 
  13738 *** CSS support
  13739 :PROPERTIES:
  13740 :DESCRIPTION: Changing the appearance of the output.
  13741 :END:
  13742 #+cindex: CSS, for HTML export
  13743 #+cindex: HTML export, CSS
  13744 
  13745 #+vindex: org-export-html-todo-kwd-class-prefix
  13746 #+vindex: org-export-html-tag-class-prefix
  13747 You can modify the CSS style definitions for the exported file.  The
  13748 HTML exporter assigns the following special CSS classes[fn:: If the
  13749 classes on TODO keywords and tags lead to conflicts, use the variables
  13750 ~org-html-todo-kwd-class-prefix~ and ~org-html-tag-class-prefix~ to
  13751 make them unique.] to appropriate parts of the document---your style
  13752 specifications may change these, in addition to any of the standard
  13753 classes like for headlines, tables, etc.
  13754 
  13755 | ~p.author~           | author information, including email                    |
  13756 | ~p.date~             | publishing date                                        |
  13757 | ~p.creator~          | creator info, about org mode version                   |
  13758 | ~.title~             | document title                                         |
  13759 | ~.subtitle~          | document subtitle                                      |
  13760 | ~.todo~              | TODO keywords, all not-done states                     |
  13761 | ~.done~              | the DONE keywords, all states that count as done       |
  13762 | ~.WAITING~           | each TODO keyword also uses a class named after itself |
  13763 | ~.timestamp~         | timestamp                                              |
  13764 | ~.timestamp-kwd~     | keyword associated with a timestamp, like =SCHEDULED=  |
  13765 | ~.timestamp-wrapper~ | span around keyword plus timestamp                     |
  13766 | ~.tag~               | tag in a headline                                      |
  13767 | ~._HOME~             | each tag uses itself as a class, "@" replaced by "_"   |
  13768 | ~.target~            | target for links                                       |
  13769 | ~.linenr~            | the line number in a code example                      |
  13770 | ~.code-highlighted~  | for highlighting referenced code lines                 |
  13771 | ~div.outline-N~      | div for outline level N (headline plus text)           |
  13772 | ~div.outline-text-N~ | extra div for text at outline level N                  |
  13773 | ~.section-number-N~  | section number in headlines, different for each level  |
  13774 | ~.figure-number~     | label like "Figure 1:"                                 |
  13775 | ~.table-number~      | label like "Table 1:"                                  |
  13776 | ~.listing-number~    | label like "Listing 1:"                                |
  13777 | ~div.figure~         | how to format an in-lined image                        |
  13778 | ~pre.src~            | formatted source code                                  |
  13779 | ~pre.example~        | normal example                                         |
  13780 | ~p.verse~            | verse paragraph                                        |
  13781 | ~div.footnotes~      | footnote section headline                              |
  13782 | ~p.footnote~         | footnote definition paragraph, containing a footnote   |
  13783 | ~.footref~           | a footnote reference number (always a <sup>)           |
  13784 | ~.footnum~           | footnote number in footnote definition (always <sup>)  |
  13785 | ~.org-svg~           | default class for a linked =.svg= image                |
  13786 
  13787 #+vindex: org-html-style-default
  13788 #+vindex: org-html-head
  13789 #+vindex: org-html-head-extra
  13790 #+cindex: @samp{HTML_INCLUDE_STYLE}, keyword
  13791 The HTML export backend includes a compact default style in each
  13792 exported HTML file.  To override the default style with another style,
  13793 use these keywords in the Org file.  They will replace the global
  13794 defaults the HTML exporter uses.
  13795 
  13796 #+cindex: @samp{HTML_HEAD}, keyword
  13797 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
  13798 #+begin_example
  13799 ,#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
  13800 ,#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
  13801 #+end_example
  13802 
  13803 #+vindex: org-html-head-include-default-style
  13804 To just turn off the default style, customize
  13805 ~org-html-head-include-default-style~ variable, or use this option
  13806 line in the Org file.
  13807 
  13808 #+cindex: @samp{html-style}, @samp{OPTIONS} item
  13809 : #+OPTIONS: html-style:nil
  13810 
  13811 For longer style definitions, either use several =HTML_HEAD= and
  13812 =HTML_HEAD_EXTRA= keywords, or use ~<style> ... </style>~ blocks
  13813 around them.  Both of these approaches can avoid referring to an
  13814 external file.
  13815 
  13816 #+cindex: @samp{HTML_CONTAINER_CLASS}, property
  13817 #+cindex: @samp{HTML_HEADLINE_CLASS}, property
  13818 In order to add styles to a subtree, use the =HTML_CONTAINER_CLASS=
  13819 property to assign a class to the tree.  In order to specify CSS
  13820 styles for a particular headline, you can use the ID specified in
  13821 a =CUSTOM_ID= property.  You can also assign a specific class to
  13822 a headline with the =HTML_HEADLINE_CLASS= property.
  13823 
  13824 Never change the ~org-html-style-default~ constant.  Instead use other
  13825 simpler ways of customizing as described above.
  13826 
  13827 *** JavaScript supported display of web pages
  13828 :PROPERTIES:
  13829 :DESCRIPTION: Info and folding in a web browser.
  13830 :ALT_TITLE: JavaScript support
  13831 :END:
  13832 
  13833 Sebastian Rose has written a JavaScript program especially designed to
  13834 allow two different ways of viewing HTML files created with Org.  One
  13835 is an /Info/-like mode where each section is displayed separately and
  13836 navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}} keys, and some other
  13837 keys as well, press {{{kbd(?)}}} for an overview of the available keys.  The
  13838 second one has a /folding/ view, much like Org provides inside Emacs.
  13839 The script is available at https://orgmode.org/org-info.js and the
  13840 documentation at https://orgmode.org/worg/code/org-info-js/.  The
  13841 script is hosted on https://orgmode.org, but for reliability, prefer
  13842 installing it on your own web server.
  13843 
  13844 To use this program, just add this line to the Org file:
  13845 
  13846 #+cindex: @samp{INFOJS_OPT}, keyword
  13847 : #+INFOJS_OPT: view:info toc:nil
  13848 
  13849 #+texinfo: @noindent
  13850 The HTML header now has the code needed to automatically invoke the
  13851 script.  For setting options, use the syntax from the above line for
  13852 options described below:
  13853 
  13854 - =path:= ::
  13855 
  13856   The path to the script.  The default is to grab the script from
  13857   [[https://orgmode.org/org-info.js]], but you might want to have a local
  13858   copy and use a path like =../scripts/org-info.js=.
  13859 
  13860 - =view:= ::
  13861 
  13862   Initial view when the website is first shown.  Possible values are:
  13863 
  13864   | =info=     | Info-like interface with one section per page          |
  13865   | =overview= | Folding interface, initially showing only top-level    |
  13866   | =content=  | Folding interface, starting with all headlines visible |
  13867   | =showall=  | Folding interface, all headlines and text visible      |
  13868 
  13869 - =sdepth:= ::
  13870 
  13871   Maximum headline level still considered as an independent section
  13872   for info and folding modes.  The default is taken from
  13873   ~org-export-headline-levels~, i.e., the =H= switch in =OPTIONS=.  If
  13874   this is smaller than in ~org-export-headline-levels~, each
  13875   info/folding section can still contain child headlines.
  13876 
  13877 - =toc:= ::
  13878 
  13879   Should the table of contents /initially/ be visible?  Even when
  13880   =nil=, you can always get to the "toc" with {{{kbd(i)}}}.
  13881 
  13882 - =tdepth:= ::
  13883 
  13884   The depth of the table of contents.  The defaults are taken from the
  13885   variables ~org-export-headline-levels~ and ~org-export-with-toc~.
  13886 
  13887 - =ftoc:= ::
  13888 
  13889   Does the CSS of the page specify a fixed position for the "toc"?  If
  13890   yes, the toc is displayed as a section.
  13891 
  13892 - =ltoc:= ::
  13893 
  13894   Should there be short contents (children) in each section?  Make
  13895   this =above= if the section should be above initial text.
  13896 
  13897 - =mouse:= ::
  13898 
  13899   Headings are highlighted when the mouse is over them.  Should be
  13900   =underline= (default) or a background color like =#cccccc=.
  13901 
  13902 - =buttons:= ::
  13903 
  13904   Should view-toggle buttons be everywhere?  When =nil= (the default),
  13905   only one such button is present.
  13906 
  13907 #+vindex: org-infojs-options
  13908 #+vindex: org-export-html-use-infojs
  13909 You can choose default values for these options by customizing the
  13910 variable ~org-infojs-options~.  If you always want to apply the script
  13911 to your pages, configure the variable ~org-export-html-use-infojs~.
  13912 
  13913 ** LaTeX Export
  13914 :PROPERTIES:
  13915 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF.
  13916 :END:
  13917 #+cindex: @LaTeX{} export
  13918 #+cindex: PDF export
  13919 
  13920 The LaTeX export backend can handle complex documents, incorporate
  13921 standard or custom LaTeX document classes, generate documents using
  13922 alternate LaTeX engines, and produce fully linked PDF files with
  13923 indexes, bibliographies, and tables of contents, destined for
  13924 interactive online viewing or high-quality print publication.
  13925 
  13926 While the details are covered in-depth in this section, here are some
  13927 quick references to variables for the impatient: for engines, see
  13928 ~org-latex-compiler~; for build sequences, see
  13929 ~org-latex-pdf-process~; for packages, see
  13930 ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~.
  13931 
  13932 An important note about the LaTeX export backend: it is sensitive to
  13933 blank lines in the Org document.  That's because LaTeX itself depends
  13934 on blank lines to tell apart syntactical elements, such as paragraphs.
  13935 
  13936 The following sections expect users to be familiar with common LaTeX
  13937 terminology.  You may refer to https://tug.org/begin.html to get
  13938 familiar with LaTeX basics.  Users with LaTeX installed may also run
  13939 =texdoc latex= from terminal to open LaTeX introduction [fn:: The
  13940 command will open a PDF file, which is also available for download
  13941 from http://mirrors.ctan.org/info/latex-doc-ptr/latex-doc-ptr.pdf]
  13942 
  13943 *** LaTeX/PDF export commands
  13944 :PROPERTIES:
  13945 :DESCRIPTION: For producing @LaTeX{} and PDF documents.
  13946 :END:
  13947 
  13948 - {{{kbd(C-c C-e l l)}}} (~org-latex-export-to-latex~) ::
  13949 
  13950   #+kindex: C-c C-e l l
  13951   #+findex: org-latex-export-to-latex~
  13952   Export to a LaTeX file with a =.tex= extension.  For =myfile.org=,
  13953   Org exports to =myfile.tex=, overwriting without warning.
  13954 
  13955 - {{{kbd(C-c C-e l L)}}} (~org-latex-export-as-latex~) ::
  13956 
  13957   #+kindex: C-c C-e l L
  13958   #+findex: org-latex-export-as-latex
  13959   Export to a temporary buffer.  Do not create a file.
  13960 
  13961 - {{{kbd(C-c C-e l p)}}} (~org-latex-export-to-pdf~) ::
  13962 
  13963   #+kindex: C-c C-e l p
  13964   #+findex: org-latex-export-to-pdf
  13965   Export as LaTeX file and convert it to PDF file.
  13966 
  13967 - {{{kbd(C-c C-e l o)}}} ::
  13968 
  13969   #+kindex: C-c C-e l o
  13970   Export as LaTeX file and convert it to PDF, then open the PDF using
  13971   the default viewer.
  13972 
  13973 - {{{kbd(M-x org-export-region-as-latex)}}} ::
  13974 
  13975   Convert the region to LaTeX under the assumption that it was in Org
  13976   mode syntax before.  This is a global command that can be invoked in
  13977   any buffer.
  13978 
  13979 #+vindex: org-latex-compiler
  13980 #+vindex: org-latex-bibtex-compiler
  13981 #+vindex: org-latex-default-packages-alist
  13982 #+cindex: pdflatex
  13983 #+cindex: xelatex
  13984 #+cindex: lualatex
  13985 #+cindex: @samp{LATEX_COMPILER}, keyword
  13986 The LaTeX export backend can use any of these LaTeX engines:
  13987 =pdflatex=, =xelatex=, and =lualatex=.  These engines compile LaTeX
  13988 files with different compilers, packages, and output options.  The
  13989 LaTeX export backend finds the compiler version to use from
  13990 ~org-latex-compiler~ variable or the =#+LATEX_COMPILER= keyword in the
  13991 Org file.  See the docstring for the
  13992 ~org-latex-default-packages-alist~ for loading packages with certain
  13993 compilers.  Also see ~org-latex-bibtex-compiler~ to set the
  13994 bibliography compiler[fn:48].
  13995 
  13996 *** LaTeX specific export settings
  13997 :PROPERTIES:
  13998 :DESCRIPTION: Unique to this @LaTeX{} backend.
  13999 :END:
  14000 
  14001 The LaTeX export backend has several additional keywords for
  14002 customizing LaTeX output.  Setting these keywords works similar to the
  14003 general options (see [[*Export Settings]]).
  14004 
  14005 #+attr_texinfo: :sep ,
  14006 - =DESCRIPTION= ::
  14007   #+cindex: @samp{DESCRIPTION}, keyword
  14008   #+vindex: org-latex-hyperref-template
  14009   #+vindex: org-latex-title-command
  14010   The document's description.  The description along with author name,
  14011   keywords, and related file metadata are inserted in the output file
  14012   by the hyperref package.  See ~org-latex-hyperref-template~ for
  14013   customizing metadata items.  See ~org-latex-title-command~ for
  14014   typesetting description into the document's front matter.  Use
  14015   multiple =DESCRIPTION= keywords for long descriptions.
  14016 
  14017 - =LANGUAGE= ::
  14018   #+cindex: @samp{LANGUAGE}, keyword
  14019   #+vindex: org-latex-packages-alist
  14020   #+vindex: org-latex-language-alist
  14021   #+vindex: org-export-default-language
  14022 
  14023   Language code of the primary document language.  When =LANGUAGE=
  14024   keyword is not not specified use the value of
  14025   ~org-export-default-language~ (by default - =en=, American English)
  14026 
  14027   The list of language codes supported by Org is stored in the
  14028   variable ~org-latex-language-alist~.
  14029 
  14030   In order to be effective, the =babel= or =polyglossia=
  14031   packages---according to the LaTeX compiler used---must be loaded
  14032   with the appropriate language as argument.  This can be accomplished
  14033   by modifying the ~org-latex-packages-alist~ variable, e.g., with the
  14034   following snippet (note that =polyglossia= does not work with
  14035   pdfLaTeX):
  14036 
  14037   #+begin_src emacs-lisp
  14038   (add-to-list 'org-latex-packages-alist
  14039                '("AUTO" "babel" t ("pdflatex" "xelatex" "lualatex")))
  14040   (add-to-list 'org-latex-packages-alist
  14041                '("AUTO" "polyglossia" t ("xelatex" "lualatex")))
  14042   #+end_src
  14043 
  14044 - =LATEX_CLASS= ::
  14045 
  14046   #+cindex: @samp{LATEX_CLASS}, keyword
  14047   #+vindex: org-latex-default-class
  14048   #+vindex: org-latex-classes
  14049   This is LaTeX document class, such as /article/, /report/, /book/,
  14050   and so on, which contain predefined preamble and headline level
  14051   mapping that the LaTeX export backend needs.  The backend reads
  14052   the default class name from the ~org-latex-default-class~ variable.
  14053   Org has /article/ as the default class.  A valid default class must
  14054   be an element of ~org-latex-classes~.
  14055 
  14056 - =LATEX_CLASS_OPTIONS= ::
  14057 
  14058   #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
  14059   Options the LaTeX export backend uses when calling the LaTeX
  14060   document class.
  14061 
  14062 - =LATEX_COMPILER= ::
  14063 
  14064   #+cindex: @samp{LATEX_COMPILER}, keyword
  14065   #+vindex: org-latex-compiler
  14066   The compiler, such as =pdflatex=, =xelatex=, =lualatex=, for
  14067   producing the PDF.  See ~org-latex-compiler~.
  14068 
  14069 - =LATEX_HEADER=, =LATEX_HEADER_EXTRA= ::
  14070 
  14071   #+cindex: @samp{LATEX_HEADER}, keyword
  14072   #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
  14073   #+vindex: org-latex-classes
  14074   Arbitrary lines to add to the document's preamble, before the
  14075   hyperref settings.  See ~org-latex-classes~ for adjusting the
  14076   structure and order of the LaTeX headers.
  14077 
  14078 - =KEYWORDS= ::
  14079 
  14080   #+cindex: @samp{KEYWORDS}, keyword
  14081   #+vindex: org-latex-hyperref-template
  14082   #+vindex: org-latex-title-command
  14083   The keywords for the document.  The description along with author
  14084   name, keywords, and related file metadata are inserted in the output
  14085   file by the hyperref package.  See ~org-latex-hyperref-template~ for
  14086   customizing metadata items.  See ~org-latex-title-command~ for
  14087   typesetting description into the document's front matter.  Use
  14088   multiple =KEYWORDS= lines if necessary.
  14089 
  14090 - =SUBTITLE= ::
  14091 
  14092   #+cindex: @samp{SUBTITLE}, keyword
  14093   #+vindex: org-latex-subtitle-separate
  14094   #+vindex: org-latex-subtitle-format
  14095   The document's subtitle.  It is typeset as per
  14096   ~org-latex-subtitle-format~.  If ~org-latex-subtitle-separate~ is
  14097   non-~nil~, it is typed outside of the ~\title~ macro.  See
  14098   ~org-latex-hyperref-template~ for customizing metadata items.  See
  14099   ~org-latex-title-command~ for typesetting description into the
  14100   document's front matter.
  14101 
  14102 The following sections have further details.
  14103 
  14104 *** LaTeX header and sectioning structure
  14105 :PROPERTIES:
  14106 :DESCRIPTION: Setting up the export file structure.
  14107 :ALT_TITLE: LaTeX header and sectioning
  14108 :END:
  14109 #+cindex: @LaTeX{} class
  14110 #+cindex: @LaTeX{} sectioning structure
  14111 #+cindex: @LaTeX{} header
  14112 #+cindex: header, for @LaTeX{} files
  14113 #+cindex: sectioning structure, for @LaTeX{} export
  14114 
  14115 The LaTeX export backend converts the first three of Org's outline
  14116 levels into LaTeX headlines.  The remaining Org levels are exported as
  14117 lists.  To change this globally for the cut-off point between levels
  14118 and lists, (see [[*Export Settings]]).
  14119 
  14120 By default, the LaTeX export backend uses the /article/ class.
  14121 
  14122 #+vindex: org-latex-default-class
  14123 #+vindex: org-latex-classes
  14124 #+vindex: org-latex-default-packages-alist
  14125 #+vindex: org-latex-packages-alist
  14126 To change the default class globally, edit ~org-latex-default-class~.
  14127 To change the default class locally in an Org file, add option lines
  14128 =#+LATEX_CLASS: myclass=.  To change the default class for just a part
  14129 of the Org file, set a subtree property, =EXPORT_LATEX_CLASS=.  The
  14130 class name entered here must be valid member of ~org-latex-classes~.
  14131 This variable defines a header template for each class into which the
  14132 exporter splices the values of ~org-latex-default-packages-alist~ and
  14133 ~org-latex-packages-alist~.  Use the same three variables to define
  14134 custom sectioning or custom classes.
  14135 
  14136 #+cindex: @samp{LATEX_CLASS}, keyword
  14137 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
  14138 #+cindex: @samp{EXPORT_LATEX_CLASS}, property
  14139 #+cindex: @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
  14140 The LaTeX export backend sends the =LATEX_CLASS_OPTIONS= keyword and
  14141 =EXPORT_LATEX_CLASS_OPTIONS= property as options to the LaTeX
  14142 ~\documentclass~ macro.  The options and the syntax for specifying
  14143 them, including enclosing them in square brackets, follow LaTeX
  14144 conventions.
  14145 
  14146 : #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
  14147 
  14148 #+cindex: @samp{LATEX_HEADER}, keyword
  14149 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
  14150 The LaTeX export backend appends values from =LATEX_HEADER= and
  14151 =LATEX_HEADER_EXTRA= keywords to the LaTeX header.  The docstring for
  14152 ~org-latex-classes~ explains in more detail.  Also note that LaTeX
  14153 export backend does not append =LATEX_HEADER_EXTRA= to the header
  14154 when previewing LaTeX snippets (see [[*Previewing LaTeX fragments]]).
  14155 
  14156 A sample Org file with the above headers:
  14157 
  14158 #+begin_example
  14159 ,#+LATEX_CLASS: article
  14160 ,#+LATEX_CLASS_OPTIONS: [a4paper]
  14161 ,#+LATEX_HEADER: \usepackage{xyz}
  14162 
  14163 ,* Headline 1
  14164   some text
  14165 ,* Headline 2
  14166   some more text
  14167 #+end_example
  14168 
  14169 #+cindex: @samp{LANGUAGE}, keyword
  14170 #+vindex: org-export-default-language
  14171 LaTeX packages =babel= or =polyglossia= can also be loaded in a
  14172 document.  The "AUTO" string will be replaced in both cases by the
  14173 appropriate value for the =LANGUAGE= keyword, if present in the
  14174 document, or by the value of ~org-export-default-language~.  Let's see
  14175 some examples in one or another case.
  14176 
  14177 =Babel= accepts the classic syntax and (in addition) the new syntax
  14178 with the =\babelprovide= command to load the languages using the new
  14179 =INI= files procedure.  Keep in mind that there are a number of
  14180 languages that are only served in babel using =INI= files, so they
  14181 cannot be declared using the classic syntax, but only using the
  14182 =\babelprovide= command (see
  14183 https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf).
  14184 Valid usage examples could be:
  14185 
  14186 #+begin_example
  14187 ,#+LATEX_HEADER: \usepackage[french,italian,AUTO]{babel}
  14188 #+end_example
  14189 
  14190 where "AUTO" is the main language.  But it can also be loaded using
  14191 the =\babelprovide= command:
  14192 
  14193 #+begin_example
  14194 ,#+LATEX_HEADER: \usepackage[french,italian]{babel}
  14195 ,#+LATEX_HEADER: \babelprovide[import, main]{AUTO}
  14196 #+end_example
  14197 
  14198 =Polyglossia=, for this procedure to be effective, must be loaded
  14199 using the same =babel= classic syntax (but note that /this is not/
  14200 the actual polyglossia syntax).  For example, suppose a document
  14201 declares Polytonic Greek as the primary language, and French as the
  14202 secondary language.  In this case, it would be expressed as:
  14203 
  14204 #+begin_example
  14205 ,#+LANGUAGE: el-polyton
  14206 ,#+LATEX_HEADER: \usepackage[french,AUTO]{polyglossia}
  14207 #+end_example
  14208 
  14209 This would produce in LaTeX (with the actual =polyglossia= syntax):
  14210 
  14211 #+begin_example
  14212 \usepackage{polyglossia}
  14213 \setmainlanguage[variant=polytonic]{greek}
  14214 \setotherlanguage{french}
  14215 #+end_example
  14216 
  14217 *** Quoting LaTeX code
  14218 :PROPERTIES:
  14219 :DESCRIPTION: Incorporating literal @LaTeX{} code.
  14220 :END:
  14221 
  14222 When the available LaTeX export customizations are not sufficient to
  14223 fine-tune the desired output, it is possible to insert any arbitrary
  14224 LaTeX code (see [[*Embedded LaTeX]]).  There are three ways to embed such
  14225 code in the Org file and they all use different quoting syntax.
  14226 
  14227 #+cindex: inline, in @LaTeX{} export
  14228 Inserting in-line quoted with @ symbols:
  14229 
  14230 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph.
  14231 
  14232 #+cindex: @samp{LATEX}, keyword
  14233 Inserting as one or more keyword lines in the Org file:
  14234 
  14235 : #+LATEX: any arbitrary LaTeX code
  14236 
  14237 #+cindex: @samp{BEGIN_EXPORT latex}
  14238 Inserting as an export block in the Org file, where the backend
  14239 exports any code between begin and end markers:
  14240 
  14241 #+begin_example
  14242 ,#+BEGIN_EXPORT latex
  14243   any arbitrary LaTeX code
  14244 ,#+END_EXPORT
  14245 #+end_example
  14246 
  14247 *** Tables in LaTeX export
  14248 :PROPERTIES:
  14249 :DESCRIPTION: Options for exporting tables to @LaTeX{}.
  14250 :END:
  14251 #+cindex: tables, in @LaTeX{} export
  14252 
  14253 The LaTeX export backend can pass several LaTeX attributes for table
  14254 contents and layout.  Besides specifying a label (see [[*Internal Links]])
  14255 and a caption (see [[*Captions]]), the other valid LaTeX attributes
  14256 include:
  14257 
  14258 #+attr_texinfo: :sep ,
  14259 - =:mode= ::
  14260 
  14261   #+vindex: org-latex-default-table-mode
  14262   The LaTeX export backend wraps the table differently depending on
  14263   the mode for accurate rendering of math symbols.  Mode is either
  14264   =table=, =math=, =inline-math=, =verbatim= or =tabbing=.
  14265 
  14266   For =math= or =inline-math= mode, LaTeX export backend wraps the
  14267   table in a math environment, but every cell in it is exported as-is.
  14268   For =tabbing= the LaTeX tabbing environment is used and the correct
  14269   tabbing delimiters =\>= are used.
  14270   The LaTeX export backend determines the default mode from
  14271   ~org-latex-default-table-mode~.  The LaTeX export backend merges
  14272   contiguous tables in the same mode into a single environment.
  14273 
  14274 - =:environment= ::
  14275 
  14276   #+vindex: org-latex-default-table-environment
  14277   Set the default LaTeX table environment for the LaTeX export
  14278   backend to use when exporting Org tables.  Common LaTeX table
  14279   environments are provided by these packages: tabularx, longtable,
  14280   array, tabu, and bmatrix.  For packages, such as tabularx and tabu,
  14281   or any newer replacements, include them in the
  14282   ~org-latex-packages-alist~ variable so the LaTeX export backend can
  14283   insert the appropriate load package headers in the converted LaTeX
  14284   file.  Look in the docstring for the ~org-latex-packages-alist~
  14285   variable for configuring these packages for LaTeX snippet previews,
  14286   if any.
  14287 
  14288 - =:caption= ::
  14289 
  14290   Use =CAPTION= keyword to set a simple caption for a table (see
  14291   [[*Captions]]).  For custom captions, use =:caption= attribute, which
  14292   accepts raw LaTeX code.  =:caption= value overrides =CAPTION= value.
  14293 
  14294 - =:float=, =:placement= ::
  14295 
  14296   The table environments by default are not floats in LaTeX.  To make
  14297   them floating objects use =:float= with one of the following
  14298   options: =t= (for a default =table= environment), =sideways= (for a
  14299   =sidewaystable= environment), =multicolumn= (to span the table
  14300   across multiple columns of a page in a =table*= environment) and
  14301   =nil=.  In addition to these three values, =:float= can pass through
  14302   any arbitrary value, for example a user-defined float type with the
  14303   =float= LaTeX package.
  14304 
  14305   LaTeX floats can also have additional layout =:placement=
  14306   attributes.  These are the usual =[h t b p ! H]= permissions
  14307   specified in square brackets.  Note that for =:float sideways=
  14308   tables, the LaTeX export backend ignores =:placement= attributes.
  14309 
  14310 - =:align=, =:font=, =:width= ::
  14311 
  14312   The LaTeX export backend uses these attributes for regular tables
  14313   to set their alignments, fonts, and widths.
  14314 
  14315 - =:options= ::
  14316 
  14317   The =:options= attribute allows adding an optional argument with
  14318   a list of various table options (between brackets in LaTeX export),
  14319   since certain tabular environments, such as longtblr of the
  14320   tabularray LaTeX package, provides this structure.  For example:
  14321   =:options remark{Note}={note},remark{Source}={source}=.
  14322 
  14323 - =:spread= ::
  14324 
  14325   When =:spread= is non-~nil~, the LaTeX export backend spreads or
  14326   shrinks the table by the =:width= for tabu and longtabu
  14327   environments.  =:spread= has no effect if =:width= is not set.
  14328 
  14329 - =:booktabs=, =:center=, =:rmlines= ::
  14330 
  14331   #+vindex: org-latex-tables-booktabs
  14332   #+vindex: org-latex-tables-centered
  14333   All three commands are toggles.  =:booktabs= brings in modern
  14334   typesetting enhancements to regular tables.  The booktabs package
  14335   has to be loaded through ~org-latex-packages-alist~.  =:center= is
  14336   for centering the table.  =:rmlines= removes all but the very first
  14337   horizontal line made of ASCII characters from "table.el" tables
  14338   only.
  14339 
  14340 - =:math-prefix=, =:math-suffix=, =:math-arguments= ::
  14341 
  14342   The LaTeX export backend inserts =:math-prefix= string value in
  14343   a math environment before the table.  The LaTeX export backend
  14344   inserts =:math-suffix= string value in a math environment after the
  14345   table.  The LaTeX export backend inserts =:math-arguments= string
  14346   value between the macro name and the table's contents.
  14347   =:math-arguments= comes in use for matrix macros that require more
  14348   than one argument, such as =qbordermatrix=.
  14349 
  14350 LaTeX table attributes help formatting tables for a wide range of
  14351 situations, such as matrix product or spanning multiple pages:
  14352 
  14353 #+begin_example
  14354 ,#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
  14355 | ... | ... |
  14356 | ... | ... |
  14357 
  14358 ,#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
  14359 | a | b |
  14360 | c | d |
  14361 ,#+ATTR_LATEX: :mode math :environment bmatrix
  14362 | 1 | 2 |
  14363 | 3 | 4 |
  14364 #+end_example
  14365 
  14366 Set the caption with the LaTeX command
  14367 =\bicaption{HeadingA}{HeadingB}=:
  14368 
  14369 #+begin_example
  14370 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
  14371 | ... | ... |
  14372 | ... | ... |
  14373 #+end_example
  14374 
  14375 *** Images in LaTeX export
  14376 :PROPERTIES:
  14377 :DESCRIPTION: How to insert figures into @LaTeX{} output.
  14378 :END:
  14379 #+cindex: images, inline in LaTeX
  14380 #+cindex: inlining images in LaTeX
  14381 #+cindex: @samp{ATTR_LATEX}, keyword
  14382 
  14383 The LaTeX export backend processes image links in Org files that do
  14384 not have descriptions, such as these links =[[file:img.jpg]]= or
  14385 =[[./img.jpg]]=, as direct image insertions in the final PDF output.  In
  14386 the PDF, they are no longer links but actual images embedded on the
  14387 page.  The LaTeX export backend uses =\includegraphics= macro to
  14388 insert the image.  But for TikZ (https://sourceforge.net/projects/pgf/)
  14389 images, the backend uses an ~\input~ macro wrapped within
  14390 a ~tikzpicture~ environment.
  14391 
  14392 For specifying image =:width=, =:height=, =:scale= and other =:options=,
  14393 use this syntax:
  14394 
  14395 #+begin_example
  14396 ,#+ATTR_LATEX: :width 5cm :options angle=90
  14397 [[./img/sed-hr4049.pdf]]
  14398 #+end_example
  14399 
  14400 A =:scale= attribute overrides both =:width= and =:height= attributes.
  14401 
  14402 For custom commands for captions, use the =:caption= attribute.  It
  14403 overrides the default =#+CAPTION= value:
  14404 
  14405 #+begin_example
  14406 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
  14407 [[./img/sed-hr4049.pdf]]
  14408 #+end_example
  14409 
  14410 When captions follow the method as described in [[*Captions]], the LaTeX
  14411 export backend wraps the picture in a floating =figure= environment.
  14412 To float an image without specifying a caption, set the =:float=
  14413 attribute to one of the following:
  14414 
  14415 - =t= ::
  14416 
  14417   For a default =figure= environment.
  14418 
  14419 - =multicolumn= ::
  14420 
  14421   To span the image across multiple columns of a page; the backend
  14422   wraps the image in a =figure*= environment.
  14423 
  14424 - =wrap= ::
  14425 
  14426   For text to flow around the image on the right; the figure occupies
  14427   the left half of the page.
  14428 
  14429 - =sideways= ::
  14430 
  14431   For a new page with the image sideways, rotated ninety degrees, in
  14432   a =sidewaysfigure= environment; overrides =:placement= setting.
  14433 
  14434 - =nil= ::
  14435 
  14436   To avoid a =:float= even if using a caption.
  14437 
  14438 - Any arbitrary value ::
  14439 
  14440   For example, a user-defined float type with the =float= LaTeX
  14441   package.
  14442 
  14443 
  14444 Use the =placement= attribute to modify a floating environment's
  14445 placement.
  14446 
  14447 #+begin_example
  14448 ,#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth}
  14449 [[./img/hst.png]]
  14450 #+end_example
  14451 
  14452 #+vindex: org-latex-images-centered
  14453 #+cindex: center image in LaTeX export
  14454 #+cindex: image, centering in LaTeX export
  14455 The LaTeX export backend centers all images by default.  Setting
  14456 =:center= to =nil= disables centering.  To disable centering globally,
  14457 set ~org-latex-images-centered~ to =nil=.
  14458 
  14459 Set the =:comment-include= attribute to non-~nil~ value for the LaTeX
  14460 export backend to comment out the =\includegraphics= macro.
  14461 
  14462 *** Plain lists in LaTeX export
  14463 :PROPERTIES:
  14464 :DESCRIPTION: Attributes specific to lists.
  14465 :END:
  14466 
  14467 #+cindex: plain lists, in @LaTeX{} export
  14468 #+cindex: @samp{ATTR_LATEX}, keyword
  14469 The LaTeX export backend accepts the =environment= and =options=
  14470 attributes for plain lists.  Both attributes work together for
  14471 customizing lists, as shown in the examples:
  14472 
  14473 #+begin_example
  14474 ,#+LATEX_HEADER: \usepackage[inline]{enumitem}
  14475 Some ways to say "Hello":
  14476 ,#+ATTR_LATEX: :environment itemize*
  14477 ,#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}]
  14478 - Hola
  14479 - Bonjour
  14480 - Guten Tag.
  14481 #+end_example
  14482 
  14483 Since LaTeX supports only four levels of nesting for lists, use an
  14484 external package, such as =enumitem= in LaTeX, for levels deeper than
  14485 four:
  14486 
  14487 #+begin_example
  14488 ,#+LATEX_HEADER: \usepackage{enumitem}
  14489 ,#+LATEX_HEADER: \renewlist{itemize}{itemize}{9}
  14490 ,#+LATEX_HEADER: \setlist[itemize]{label=$\circ$}
  14491 - One
  14492   - Two
  14493     - Three
  14494       - Four
  14495         - Five
  14496 #+end_example
  14497 
  14498 *** Source blocks in LaTeX export
  14499 :PROPERTIES:
  14500 :DESCRIPTION: Attributes specific to source code blocks.
  14501 :END:
  14502 #+cindex: source blocks, in @LaTeX{} export
  14503 #+cindex: @samp{ATTR_LATEX}, keyword
  14504 
  14505 #+vindex: org-latex-src-block-backend
  14506 LaTeX export backend provides multiple ways to render src blocks in
  14507 LaTeX, according to the value of ~org-latex-src-block-backend~.  The
  14508 default value =verbatim= renders the src code verbatim, without any
  14509 extra styling.  Alternative values allow more colorful styling, but
  14510 require additional LaTeX (=listings=, =minted=), system (=minted=), or
  14511 Emacs (=engraved=) packages.  See the ~org-latex-src-block-backend~
  14512 docstring for more details.
  14513 
  14514 The LaTeX export backend can make source code blocks into floating
  14515 objects through the attributes =:float= and =:options=.  For =:float=:
  14516 
  14517 - =t= ::
  14518 
  14519   Makes a source block float; by default floats any source block with
  14520   a caption.
  14521 
  14522 - =multicolumn= ::
  14523 
  14524   Spans the source block across multiple columns of a page.
  14525 
  14526 - =nil= ::
  14527 
  14528   Avoids a =:float= even if using a caption; useful for source code
  14529   blocks that may not fit on a page.
  14530 
  14531 #+begin_example
  14532 ,#+ATTR_LATEX: :float nil
  14533 ,#+BEGIN_SRC emacs-lisp
  14534   Lisp code that may not fit in a single page.
  14535 ,#+END_SRC
  14536 #+end_example
  14537 
  14538 #+vindex: org-latex-listings-options
  14539 #+vindex: org-latex-minted-options
  14540 #+vindex: org-latex-engraved-options
  14541 The LaTeX export backend passes string values in =:options= to LaTeX
  14542 packages for customization of that specific source block.  In the
  14543 example below, the =:options= are set for Engraved or Minted.  Minted
  14544 is a source code highlighting LaTeX package with many configurable
  14545 options[fn:: Minted uses an external Python package for code
  14546 highlighting, which requires the flag =-shell-escape= to be added to
  14547 ~org-latex-pdf-process~.].  Both Minted and Engraved are built on
  14548 [[https://www.ctan.org/pkg/fvextra][fvextra]], and so support many of
  14549 the same options.
  14550 
  14551 #+begin_example
  14552 ,#+ATTR_LATEX: :options mathescape
  14553 ,#+BEGIN_SRC emacs-lisp
  14554   (defun Fib (n) ; $n_i = n_{i-2} + n_{i-1}$
  14555     (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
  14556 ,#+END_SRC
  14557 #+end_example
  14558 
  14559 To apply similar configuration options for all source blocks in a
  14560 file, use the ~org-latex-listings-options~,
  14561 ~org-latex-engraved-options~, and ~org-latex-minted-options~
  14562 variables.
  14563 
  14564 *** Example blocks in LaTeX export
  14565 :PROPERTIES:
  14566 :DESCRIPTION: Attributes specific to example blocks.
  14567 :END:
  14568 #+cindex: example blocks, in @LaTeX{} export
  14569 #+cindex: verbatim blocks, in @LaTeX{} export
  14570 #+cindex: @samp{ATTR_LATEX}, keyword
  14571 
  14572 The LaTeX export backend wraps the contents of example blocks in
  14573 a =verbatim= environment.  To change this behavior to use another
  14574 environment globally, specify an appropriate export filter (see
  14575 [[*Advanced Export Configuration]]).  To change this behavior to use
  14576 another environment for each block, use the =:environment= parameter
  14577 to specify a custom environment.
  14578 
  14579 #+begin_example
  14580 ,#+ATTR_LATEX: :environment myverbatim
  14581 ,#+BEGIN_EXAMPLE
  14582   This sentence is false.
  14583 ,#+END_EXAMPLE
  14584 #+end_example
  14585 
  14586 *** Special blocks in LaTeX export
  14587 :PROPERTIES:
  14588 :DESCRIPTION: Attributes specific to special blocks.
  14589 :END:
  14590 
  14591 #+cindex: special blocks, in @LaTeX{} export
  14592 #+cindex: abstract, in @LaTeX{} export
  14593 #+cindex: proof, in @LaTeX{} export
  14594 #+cindex: @samp{ATTR_LATEX}, keyword
  14595 
  14596 For other special blocks in the Org file, the LaTeX export backend
  14597 makes a special environment of the same name.  The backend also takes
  14598 =:options=, if any, and appends as-is to that environment's opening
  14599 string.  For example:
  14600 
  14601 #+begin_example
  14602 ,#+BEGIN_abstract
  14603   We demonstrate how to solve the Syracuse problem.
  14604 ,#+END_abstract
  14605 
  14606 ,#+ATTR_LATEX: :options [Proof of important theorem]
  14607 ,#+BEGIN_proof
  14608   ...
  14609   Therefore, any even number greater than 2 is the sum of two primes.
  14610 ,#+END_proof
  14611 #+end_example
  14612 
  14613 #+texinfo: @noindent
  14614 exports to
  14615 
  14616 #+begin_example
  14617 \begin{abstract}
  14618   We demonstrate how to solve the Syracuse problem.
  14619 \end{abstract}
  14620 
  14621 \begin{proof}[Proof of important theorem]
  14622   ...
  14623   Therefore, any even number greater than 2 is the sum of two primes.
  14624 \end{proof}
  14625 #+end_example
  14626 
  14627 If you need to insert a specific caption command, use =:caption=
  14628 attribute.  It overrides standard =CAPTION= value, if any.  For
  14629 example:
  14630 
  14631 #+begin_example
  14632 ,#+ATTR_LATEX: :caption \MyCaption{HeadingA}
  14633 ,#+BEGIN_proof
  14634   ...
  14635 ,#+END_proof
  14636 #+end_example
  14637 
  14638 *** Horizontal rules in LaTeX export
  14639 :PROPERTIES:
  14640 :DESCRIPTION: Attributes specific to horizontal rules.
  14641 :END:
  14642 #+cindex: horizontal rules, in @LaTeX{} export
  14643 #+cindex: @samp{ATTR_LATEX}, keyword
  14644 
  14645 The LaTeX export backend converts horizontal rules by the specified
  14646 =:width= and =:thickness= attributes.  For example:
  14647 
  14648 #+begin_example
  14649 ,#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
  14650 -----
  14651 #+end_example
  14652 
  14653 *** Verse blocks in LaTeX export
  14654 :PROPERTIES:
  14655 :DESCRIPTION: Attributes specific to special blocks.
  14656 :END:
  14657 
  14658 #+cindex: verse blocks, in @LaTeX{} export
  14659 #+cindex: @samp{ATTR_LATEX}, keyword
  14660 
  14661 The LaTeX export backend accepts five attributes for verse blocks:
  14662 =:lines=, =:center=, =:versewidth=, =:latexcode= and =:literal=.  The
  14663 three first require the external LaTeX package =verse.sty=, which is
  14664 an extension of the standard LaTeX environment.
  14665 
  14666 - =:lines= :: To add marginal verse numbering.  Its value is an
  14667   integer, the sequence in which the verses should be numbered.
  14668 - =:center= :: With value =t= all the verses on the page are optically
  14669   centered (a typographic convention for poetry), taking as a
  14670   reference the longest verse, which must be indicated by the
  14671   attribute =:versewidth=.
  14672 - =:versewidth= :: Its value is a literal text string with the longest
  14673   verse.
  14674 - =:latexcode= :: It accepts any arbitrary LaTeX code that can be
  14675   included within a LaTeX =verse= environment.
  14676 - =:literal= :: With value t, all blank lines are preserved and
  14677   exported as =\vspace*{\baselineskip}=, including the blank lines
  14678   before or after contents.  Note that without the =:literal=
  14679   attribute, one or more blank lines between stanzas are exported as a
  14680   single blank line, and any blank lines before or after the content
  14681   are removed, which is more consistent with the syntax of the LaTeX
  14682   `verse' environment, and the one provided by the =verse= package.
  14683   If the =verse= package is loaded, the vertical spacing between all
  14684   stanzas can be controlled by the global length =\stanzaskip= (see
  14685   https://www.ctan.org/pkg/verse).
  14686 
  14687 A complete example with Shakespeare's first sonnet:
  14688 
  14689 #+begin_src org
  14690 ,#+ATTR_LATEX: :center t :latexcode \color{red} :lines 5
  14691 ,#+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel,
  14692 ,#+BEGIN_VERSE
  14693 From fairest creatures we desire increase,
  14694 That thereby beauty’s rose might never die,
  14695 But as the riper should by time decease
  14696 His tender heir might bear his memory
  14697 But thou, contracted to thine own bright eyes,
  14698 Feed’st thy light’s flame with self-substantial fuel,
  14699 Making a famine where abundance lies,
  14700 Thyself thy foe, to thy sweet self too cruel.
  14701 Thou that art now the world’s fresh ornament,
  14702 And only herald to the gaudy spring,
  14703 Within thine own bud buriest thy content,
  14704 And, tender churl, mak’st waste in niggardly.
  14705 Pity the world, or else this glutton be,
  14706 To eat the world’s due, by the grave and thee.
  14707 ,#+END_VERSE
  14708 #+end_src
  14709 
  14710 *** Quote blocks in LaTeX export
  14711 :PROPERTIES:
  14712 :DESCRIPTION: Attributes specific to quote blocks.
  14713 :END:
  14714 
  14715 #+cindex: quote blocks, in @LaTeX{} export
  14716 #+cindex: @samp{ATTR_LATEX}, keyword
  14717 #+cindex: org-latex-default-quote-environment
  14718 
  14719 The LaTeX export backend accepts two attributes for quote blocks:
  14720 =:environment=, for an arbitrary quoting environment (the default
  14721 value is that of ~org-latex-default-quote-environment~: ~"quote"~) and
  14722 =:options=.  For example, to choose the environment =quotation=,
  14723 included as an alternative to =quote= in standard LaTeX classes:
  14724 
  14725 #+begin_example
  14726 ,#+ATTR_LATEX: :environment quotation
  14727 ,#+BEGIN_QUOTE
  14728 some text...
  14729 ,#+END_QUOTE
  14730 #+end_example
  14731 
  14732 To choose the =foreigndisplayquote= environment, included in the LaTeX
  14733 package =csquotes=, with the =german= option, use this syntax:
  14734 
  14735 #+begin_example
  14736 ,#+LATEX_HEADER:\usepackage[autostyle=true]{csquotes}
  14737 ,#+ATTR_LATEX: :environment foreigndisplayquote :options {german}
  14738 ,#+BEGIN_QUOTE
  14739 some text in German...
  14740 ,#+END_QUOTE
  14741 #+end_example
  14742 
  14743 #+texinfo: @noindent
  14744 which is exported to LaTeX as
  14745 
  14746 #+begin_example
  14747 \begin{foreigndisplayquote}{german}
  14748 some text in German...
  14749 \end{foreigndisplayquote}
  14750 #+end_example
  14751 
  14752 ** Markdown Export
  14753 :PROPERTIES:
  14754 :DESCRIPTION: Exporting to Markdown.
  14755 :END:
  14756 #+cindex: Markdown export
  14757 
  14758 The Markdown export backend, "md", converts an Org file to Markdown
  14759 format, as defined at https://daringfireball.net/projects/markdown/.
  14760 This is the original Markdown specification, developed by John Gruber
  14761 and Aaron Swartz.
  14762 
  14763 Since "md" backend is built on top of the HTML backend (see [[*HTML
  14764 Export]]), it converts every Org construct not defined in Markdown
  14765 syntax, such as tables, to HTML.
  14766 
  14767 Do note that the original markdown syntax has differences with other
  14768 commonly used Markdown flavors.  See
  14769 https://en.wikipedia.org/wiki/Markdown for more details.
  14770 
  14771 *** Markdown export commands
  14772 :PROPERTIES:
  14773 :UNNUMBERED: notoc
  14774 :END:
  14775 
  14776 - {{{kbd(C-c C-e m m)}}} (~org-md-export-to-markdown~) ::
  14777 
  14778   #+kindex: C-c C-c m m
  14779   #+findex: org-md-export-to-markdown
  14780   Export to a text file with Markdown syntax.  For =myfile.org=, Org
  14781   exports to =myfile.md=, overwritten without warning.
  14782 
  14783 - {{{kbd(C-c C-e m M)}}} (~org-md-export-as-markdown~) ::
  14784 
  14785   #+kindex: C-c C-c m M
  14786   #+findex: org-md-export-as-markdown
  14787   Export to a temporary buffer.  Does not create a file.
  14788 
  14789 - {{{kbd(C-c C-e m o)}}} ::
  14790 
  14791   #+kindex: C-c C-e m o
  14792   Export as a text file with Markdown syntax, then open it.
  14793 
  14794 *** Header and sectioning structure
  14795 :PROPERTIES:
  14796 :UNNUMBERED: notoc
  14797 :END:
  14798 
  14799 #+vindex: org-md-headline-style
  14800 Based on ~org-md-headline-style~, Markdown export can generate
  14801 headlines of both /atx/ and /setext/ types.  /setext/ limits headline
  14802 levels to two whereas /atx/ limits headline levels to six.  /mixed/
  14803 exports headline levels one and two in /setext/-style, and headline
  14804 levels three through six as /atx/-style headlines.  Beyond these
  14805 limits, the export backend converts headlines to lists.  To set a
  14806 limit to a level before the absolute limit (see [[*Export Settings]]).
  14807 
  14808 ** OpenDocument Text Export
  14809 :PROPERTIES:
  14810 :DESCRIPTION: Exporting to OpenDocument Text.
  14811 :END:
  14812 #+cindex: ODT
  14813 #+cindex: OpenDocument
  14814 #+cindex: export, OpenDocument
  14815 #+cindex: LibreOffice
  14816 
  14817 The ODT export backend handles creating of OpenDocument Text (ODT)
  14818 format.  Documents created by this exporter use the
  14819 {{{cite(OpenDocument-v1.2 specification)}}}[fn:: See
  14820 [[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open
  14821 Document Format for Office Applications (OpenDocument) Version 1.2]].]
  14822 and are compatible with LibreOffice 3.4.
  14823 
  14824 *** Pre-requisites for ODT export
  14825 :PROPERTIES:
  14826 :DESCRIPTION: Required packages.
  14827 :END:
  14828 #+cindex: zip
  14829 
  14830 The ODT export backend relies on the zip program to create the final
  14831 compressed ODT output.  Check if =zip= is locally available and
  14832 executable.  Without it, export cannot finish.
  14833 
  14834 *** ODT export commands
  14835 :PROPERTIES:
  14836 :DESCRIPTION: Invoking export.
  14837 :END:
  14838 
  14839 - {{{kbd(C-c C-e o o)}}} (~org-odt-export-to-odt~) ::
  14840 
  14841   #+kindex: C-c C-e o o
  14842   #+findex: org-odt-export-to-odt
  14843   Export as OpenDocument Text file.
  14844 
  14845   #+cindex: @samp{EXPORT_FILE_NAME}, property
  14846   #+vindex: org-odt-preferred-output-format
  14847 
  14848   If ~org-odt-preferred-output-format~ is specified, the ODT export
  14849   backend automatically converts the exported file to that format.
  14850 
  14851   For =myfile.org=, Org exports to =myfile.odt=, overwriting without
  14852   warning.  The ODT export backend exports a region only if a region
  14853   was active.
  14854 
  14855   If the selected region is a single tree, the ODT export backend
  14856   makes the tree head the document title.  Incidentally, {{{kbd(C-c
  14857   @)}}} selects the current subtree.  If the tree head entry has, or
  14858   inherits, an =EXPORT_FILE_NAME= property, the ODT export backend
  14859   uses that for file name.
  14860 
  14861 - {{{kbd(C-c C-e o O)}}} ::
  14862 
  14863   #+kindex: C-c C-e o O
  14864   Export as an OpenDocument Text file and open the resulting file.
  14865 
  14866   #+vindex: org-export-odt-preferred-output-format
  14867   If ~org-export-odt-preferred-output-format~ is specified, open the
  14868   converted file instead.  See [[*Automatically exporting to other
  14869   formats]].
  14870 
  14871 *** ODT specific export settings
  14872 :PROPERTIES:
  14873 :DESCRIPTION: Configuration options.
  14874 :END:
  14875 
  14876 The ODT export backend has several additional keywords for
  14877 customizing ODT output.  Setting these keywords works similar to the
  14878 general options (see [[*Export Settings]]).
  14879 
  14880 - =DESCRIPTION= ::
  14881 
  14882   #+cindex: @samp{DESCRIPTION}, keyword
  14883   This is the document's description, which the ODT export backend
  14884   inserts as document metadata.  For long descriptions, use multiple
  14885   lines, prefixed with =DESCRIPTION=.
  14886 
  14887 - =KEYWORDS= ::
  14888 
  14889   #+cindex: @samp{KEYWORDS}, keyword
  14890   The keywords for the document.  The ODT export backend inserts the
  14891   description along with author name, keywords, and related file
  14892   metadata as metadata in the output file.  Use multiple =KEYWORDS= if
  14893   necessary.
  14894 
  14895 - =ODT_STYLES_FILE= ::
  14896 
  14897   #+cindex: @samp{ODT_STYLES_FILE}, keyword
  14898   #+vindex: org-odt-styles-file
  14899   The ODT export backend uses the ~org-odt-styles-file~ by default.
  14900   See [[*Applying custom styles]] for details.
  14901 
  14902 - =SUBTITLE= ::
  14903 
  14904   #+cindex: @samp{SUBTITLE}, keyword
  14905   The document subtitle.
  14906 
  14907 *** Extending ODT export
  14908 :PROPERTIES:
  14909 :DESCRIPTION: Producing DOC, PDF files.
  14910 :END:
  14911 
  14912 The ODT export backend can produce documents in other formats besides
  14913 ODT using a specialized ODT converter process.  Its common interface
  14914 works with popular converters to produce formats such as =doc=, or
  14915 convert a document from one format, say =csv=, to another format, say
  14916 =xls=.
  14917 
  14918 #+cindex: @file{unoconv}
  14919 #+vindex: org-odt-convert-process
  14920 Customize ~org-odt-convert-process~ variable to point to =unoconv=,
  14921 which is the ODT's preferred converter.  Working installations of
  14922 LibreOffice would already have =unoconv= installed.  Alternatively,
  14923 other converters may be substituted here.  See [[*Configuring
  14924 a document converter]].
  14925 
  14926 **** Automatically exporting to other formats
  14927 :PROPERTIES:
  14928 :UNNUMBERED: notoc
  14929 :END:
  14930 
  14931 #+vindex: org-odt-preferred-output-format
  14932 If ODT format is just an intermediate step to get to other formats,
  14933 such as =doc=, =docx=, =rtf=, or =pdf=, etc., then extend the ODT
  14934 export backend to directly produce that format.  Specify the final
  14935 format in the ~org-odt-preferred-output-format~ variable.  This is one
  14936 way to extend (see [[*ODT export commands]]).
  14937 
  14938 **** Converting between document formats
  14939 :PROPERTIES:
  14940 :UNNUMBERED: notoc
  14941 :END:
  14942 
  14943 The Org export backend is made to be inter-operable with a wide range
  14944 of text document format converters.  Newer generation converters, such
  14945 as LibreOffice and Pandoc, can handle hundreds of formats at once.
  14946 Org provides a consistent interaction with whatever converter is
  14947 installed.  Here are some generic commands:
  14948 
  14949 - {{{kbd(M-x org-odt-convert)}}} ::
  14950 
  14951   #+findex: org-odt-convert
  14952   Convert an existing document from one format to another.  With
  14953   a prefix argument, opens the newly produced file.
  14954 
  14955 *** Applying custom styles
  14956 :PROPERTIES:
  14957 :DESCRIPTION: Styling the output.
  14958 :END:
  14959 #+cindex: styles, custom
  14960 #+cindex: template, custom
  14961 
  14962 The ODT export backend comes with many OpenDocument styles (see
  14963 [[*Working with OpenDocument style files]]).  To expand or further
  14964 customize these built-in style sheets, either edit the style sheets
  14965 directly or generate them using an application such as LibreOffice.
  14966 The example here shows creating a style using LibreOffice.
  14967 
  14968 **** Applying custom styles: the easy way
  14969 :PROPERTIES:
  14970 :UNNUMBERED: notoc
  14971 :END:
  14972 
  14973 1. Create a sample =example.org= file with settings as shown below,
  14974    and export it to ODT format.
  14975 
  14976    : #+OPTIONS: H:10 num:t
  14977 
  14978 2. Open the above =example.odt= using LibreOffice.  Use the /Stylist/
  14979    to locate the target styles, which typically have the "Org" prefix.
  14980    Open one, modify, and save as either OpenDocument Text (ODT) or
  14981    OpenDocument Template (OTT) file.
  14982 
  14983 3.
  14984    #+vindex: org-odt-styles-file
  14985    Customize the variable ~org-odt-styles-file~ and point it to the
  14986    newly created file.  For additional configuration options, see
  14987    [[x-overriding-factory-styles][Overriding factory styles]].
  14988 
  14989    #+cindex: @samp{ODT_STYLES_FILE}, keyword
  14990    To apply an ODT style to a particular file, use the
  14991    =ODT_STYLES_FILE= keyword as shown in the example below:
  14992 
  14993    : #+ODT_STYLES_FILE: "/path/to/example.ott"
  14994 
  14995    #+texinfo: @noindent
  14996    or
  14997 
  14998    : #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
  14999 
  15000 **** Using third-party styles and templates
  15001 :PROPERTIES:
  15002 :UNNUMBERED: notoc
  15003 :END:
  15004 
  15005 The ODT export backend relies on many templates and style names.
  15006 Using third-party styles and templates can lead to mismatches.
  15007 Templates derived from built-in ODT templates and styles seem to have
  15008 fewer problems.
  15009 
  15010 *** Links in ODT export
  15011 :PROPERTIES:
  15012 :DESCRIPTION: Handling and formatting links.
  15013 :END:
  15014 #+cindex: links, in ODT export
  15015 
  15016 ODT exporter creates native cross-references for internal links.  It
  15017 creates Internet-style links for all other links.
  15018 
  15019 A link with no description and pointing to a regular, un-itemized,
  15020 outline heading is replaced with a cross-reference and section number
  15021 of the heading.
  15022 
  15023 A =\ref{label}=-style reference to an image, table etc., is replaced
  15024 with a cross-reference and sequence number of the labeled entity.  See
  15025 [[*Labels and captions in ODT export]].
  15026 
  15027 *** Tables in ODT export
  15028 :PROPERTIES:
  15029 :DESCRIPTION: Org tables conversions.
  15030 :END:
  15031 
  15032 #+cindex: tables, in ODT export
  15033 
  15034 The ODT export backend handles native Org mode tables (see [[*Tables]])
  15035 and simple =table.el= tables.  Complex =table.el= tables having column
  15036 or row spans are not supported.  Such tables are stripped from the
  15037 exported document.
  15038 
  15039 By default, the ODT export backend exports a table with top and
  15040 bottom frames and with ruled lines separating row and column groups
  15041 (see [[*Column Groups]]).  All tables are typeset to occupy the same
  15042 width.  The ODT export backend honors any table alignments and
  15043 relative widths for columns (see [[*Column Width and Alignment]]).
  15044 
  15045 Note that the ODT export backend interprets column widths as weighted
  15046 ratios, the default weight being 1.
  15047 
  15048 #+cindex: @samp{ATTR_ODT}, keyword
  15049 Specifying =:rel-width= property on an =ATTR_ODT= line controls the
  15050 width of the table.  For example:
  15051 
  15052 #+begin_example
  15053 ,#+ATTR_ODT: :rel-width 50
  15054 | Area/Month    |   Jan |   Feb |   Mar |   Sum |
  15055 |---------------+-------+-------+-------+-------|
  15056 | /             |     < |       |       |     < |
  15057 | <l13>         |  <r5> |  <r5> |  <r5> |  <r6> |
  15058 | North America |     1 |    21 |   926 |   948 |
  15059 | Middle East   |     6 |    75 |   844 |   925 |
  15060 | Asia Pacific  |     9 |    27 |   790 |   826 |
  15061 |---------------+-------+-------+-------+-------|
  15062 | Sum           |    16 |   123 |  2560 |  2699 |
  15063 #+end_example
  15064 
  15065 On export, the above table takes 50% of text width area.  The exporter
  15066 sizes the columns in the ratio: 13:5:5:5:6.  The first column is
  15067 left-aligned and rest of the columns, right-aligned.  Vertical rules
  15068 separate the header and the last column.  Horizontal rules separate
  15069 the header and the last row.
  15070 
  15071 For even more customization, create custom table styles and associate
  15072 them with a table using the =ATTR_ODT= keyword.  See [[*Customizing
  15073 tables in ODT export]].
  15074 
  15075 *** Images in ODT export
  15076 :PROPERTIES:
  15077 :DESCRIPTION: Inserting images.
  15078 :END:
  15079 #+cindex: images, embedding in ODT
  15080 #+cindex: embedding images in ODT
  15081 
  15082 **** Embedding images
  15083 :PROPERTIES:
  15084 :UNNUMBERED: notoc
  15085 :END:
  15086 
  15087 The ODT export backend processes image links in Org files that do not
  15088 have descriptions, such as these links =[[file:img.jpg]]= or =[[./img.jpg]]=,
  15089 as direct image insertions in the final output.  Either of these
  15090 examples works:
  15091 
  15092 : [[file:img.png]]
  15093 
  15094 : [[./img.png]]
  15095 
  15096 **** Embedding clickable images
  15097 :PROPERTIES:
  15098 :UNNUMBERED: notoc
  15099 :END:
  15100 
  15101 For clickable images, provide a link whose description is another link
  15102 to an image file.  For example, to embed an image
  15103 =org-mode-unicorn.png= which when clicked jumps to https://orgmode.org
  15104 website, do the following
  15105 
  15106 : [[https://orgmode.org][./org-mode-unicorn.png]]
  15107 
  15108 **** Sizing and scaling of embedded images
  15109 :PROPERTIES:
  15110 :UNNUMBERED: notoc
  15111 :END:
  15112 
  15113 #+cindex: @samp{ATTR_ODT}, keyword
  15114 
  15115 Control the size and scale of the embedded images with the =ATTR_ODT=
  15116 attribute.
  15117 
  15118 #+cindex: identify, ImageMagick
  15119 #+vindex: org-odt-pixels-per-inch
  15120 The ODT export backend starts with establishing the size of the image
  15121 in the final document.  The dimensions of this size are measured in
  15122 centimeters.  The backend then queries the image file for its
  15123 dimensions measured in pixels.  For this measurement, the backend
  15124 relies on ImageMagick's identify program or Emacs ~create-image~ and
  15125 ~image-size~ API.  ImageMagick is the preferred choice for large file
  15126 sizes or frequent batch operations.  The backend then converts the
  15127 pixel dimensions using ~org-odt-pixels-per-inch~ into the familiar 72
  15128 dpi or 96 dpi.  The default value for this is in
  15129 ~display-pixels-per-inch~, which can be tweaked for better results
  15130 based on the capabilities of the output device.  Here are some common
  15131 image scaling operations:
  15132 
  15133 - Explicitly size the image ::
  15134 
  15135   To embed =img.png= as a 10 cm x 10 cm image, do the following:
  15136 
  15137   #+begin_example
  15138   ,#+ATTR_ODT: :width 10 :height 10
  15139   [[./img.png]]
  15140   #+end_example
  15141 
  15142 - Scale the image ::
  15143 
  15144   To embed =img.png= at half its size, do the following:
  15145 
  15146   #+begin_example
  15147   ,#+ATTR_ODT: :scale 0.5
  15148   [[./img.png]]
  15149   #+end_example
  15150 
  15151 - Scale the image to a specific width ::
  15152 
  15153   To embed =img.png= with a width of 10 cm while retaining the
  15154   original height:width ratio, do the following:
  15155 
  15156   #+begin_example
  15157   ,#+ATTR_ODT: :width 10
  15158   [[./img.png]]
  15159   #+end_example
  15160 
  15161 - Scale the image to a specific height ::
  15162 
  15163   To embed =img.png= with a height of 10 cm while retaining the
  15164   original height:width ratio, do the following:
  15165 
  15166   #+begin_example
  15167   ,#+ATTR_ODT: :height 10
  15168   [[./img.png]]
  15169   #+end_example
  15170 
  15171 **** Anchoring of images
  15172 :PROPERTIES:
  15173 :UNNUMBERED: notoc
  15174 :END:
  15175 
  15176 #+cindex: @samp{ATTR_ODT}, keyword
  15177 The ODT export backend can anchor images to =as-char=, =paragraph=,
  15178 or =page=.  Set the preferred anchor using the =:anchor= property of
  15179 the =ATTR_ODT= line.
  15180 
  15181 To create an image that is anchored to a page:
  15182 
  15183 #+begin_example
  15184 ,#+ATTR_ODT: :anchor page
  15185 [[./img.png]]
  15186 #+end_example
  15187 
  15188 *** Math formatting in ODT export
  15189 :PROPERTIES:
  15190 :DESCRIPTION: Formatting @LaTeX{} fragments.
  15191 :END:
  15192 
  15193 The ODT exporter has special support for handling math.
  15194 
  15195 **** LaTeX math snippets
  15196 :PROPERTIES:
  15197 :DESCRIPTION: Embedding in @LaTeX{} format.
  15198 :END:
  15199 
  15200 LaTeX math snippets (see [[*LaTeX fragments]]) can be embedded in the ODT
  15201 document in one of the following ways:
  15202 
  15203 - MathML ::
  15204 
  15205   #+cindex: MathML
  15206   Add this line to the Org file.  This option is activated on
  15207   a per-file basis.
  15208 
  15209   : #+OPTIONS: tex:t
  15210 
  15211   With this option, LaTeX fragments are first converted into MathML
  15212   fragments using an external LaTeX-to-MathML converter program.  The
  15213   resulting MathML fragments are then embedded as an OpenDocument
  15214   Formula in the exported document.
  15215 
  15216   #+vindex: org-latex-to-mathml-convert-command
  15217   #+vindex: org-latex-to-mathml-jar-file
  15218   You can specify the LaTeX-to-MathML converter by customizing the
  15219   variables ~org-latex-to-mathml-convert-command~ and
  15220   ~org-latex-to-mathml-jar-file~.
  15221 
  15222   If you prefer to use MathToWeb[fn:: See
  15223   [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].]
  15224   as your converter, you can configure the above variables as shown
  15225   below.
  15226 
  15227   #+begin_src emacs-lisp
  15228   (setq org-latex-to-mathml-convert-command
  15229         "java -jar %j -unicode -force -df %o %I"
  15230         org-latex-to-mathml-jar-file
  15231         "/path/to/mathtoweb.jar")
  15232   #+end_src
  15233 
  15234   #+texinfo: @noindent
  15235   or, to use LaTeX​ML[fn:: See [[https://dlmf.nist.gov/LaTeXML/]].]
  15236   instead,
  15237 
  15238   #+begin_src emacs-lisp
  15239   (setq org-latex-to-mathml-convert-command
  15240         "latexmlmath %i --presentationmathml=%o")
  15241   #+end_src
  15242 
  15243   To quickly verify the reliability of the LaTeX-to-MathML
  15244   converter, use the following commands:
  15245 
  15246   - {{{kbd(M-x org-export-as-odf)}}} ::
  15247 
  15248     Convert a LaTeX math snippet to an OpenDocument formula (=.odf=)
  15249     file.
  15250 
  15251   - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
  15252 
  15253     Convert a LaTeX math snippet to an OpenDocument formula (=.odf=)
  15254     file and open the formula file with the system-registered
  15255     application.
  15256 
  15257 - PNG images ::
  15258 
  15259   #+cindex: dvipng
  15260   #+cindex: dvisvgm
  15261   #+cindex: ImageMagick
  15262   Add this line to the Org file.  This option is activated on
  15263   a per-file basis.
  15264 
  15265   : #+OPTIONS: tex:dvipng
  15266 
  15267   : #+OPTIONS: tex:dvisvgm
  15268 
  15269   #+texinfo: @noindent
  15270   or
  15271 
  15272   : #+OPTIONS: tex:imagemagick
  15273 
  15274   Under this option, LaTeX fragments are processed into PNG or SVG
  15275   images and the resulting images are embedded in the exported
  15276   document.  This method requires dvipng program, dvisvgm or
  15277   ImageMagick programs.
  15278 
  15279 **** MathML and OpenDocument formula files
  15280 :PROPERTIES:
  15281 :DESCRIPTION: Embedding in native format.
  15282 :END:
  15283 
  15284 When embedding LaTeX math snippets in ODT documents is not reliable,
  15285 there is one more option to try.  Embed an equation by linking to its
  15286 MathML (=.mml=) source or its OpenDocument formula (=.odf=) file as
  15287 shown below:
  15288 
  15289 : [[./equation.mml]]
  15290 
  15291 #+texinfo: @noindent
  15292 or
  15293 
  15294 : [[./equation.odf]]
  15295 
  15296 *** Labels and captions in ODT export
  15297 :PROPERTIES:
  15298 :DESCRIPTION: Rendering objects.
  15299 :END:
  15300 
  15301 ODT format handles labeling and captioning of objects based on their
  15302 types.  Inline images, tables, LaTeX fragments, and Math formulas are
  15303 numbered and captioned separately.  Each object also gets a unique
  15304 sequence number based on its order of first appearance in the Org
  15305 file.  Each category has its own sequence.  A caption is just a label
  15306 applied to these objects.
  15307 
  15308 #+begin_example
  15309 ,#+CAPTION: Bell curve
  15310 ,#+NAME:   fig:SED-HR4049
  15311 [[./img/a.png]]
  15312 #+end_example
  15313 
  15314 When rendered, it may show as follows in the exported document:
  15315 
  15316 : Figure 2: Bell curve
  15317 
  15318 #+vindex: org-odt-category-map-alist
  15319 To modify the category component of the caption, customize the option
  15320 ~org-odt-category-map-alist~.  For example, to tag embedded images
  15321 with the string "Illustration" instead of the default string "Figure",
  15322 use the following setting:
  15323 
  15324 #+begin_src emacs-lisp
  15325 (setq org-odt-category-map-alist
  15326       '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
  15327 #+end_src
  15328 
  15329 With the above modification, the previous example changes to:
  15330 
  15331 : Illustration 2: Bell curve
  15332 
  15333 *** Literal examples in ODT export
  15334 :PROPERTIES:
  15335 :DESCRIPTION: For source code and example blocks.
  15336 :END:
  15337 
  15338 The ODT export backend supports literal examples (see [[*Literal
  15339 Examples]]) with full fontification.  Internally, the ODT export
  15340 backend relies on =htmlfontify.el= to generate the style definitions
  15341 needed for fancy listings.  The auto-generated styles get =OrgSrc=
  15342 prefix and inherit colors from the faces used by Emacs Font Lock
  15343 library for that source language.
  15344 
  15345 #+vindex: org-odt-fontify-srcblocks
  15346 For custom fontification styles, customize the
  15347 ~org-odt-create-custom-styles-for-srcblocks~ option.
  15348 
  15349 #+vindex: org-odt-create-custom-styles-for-srcblocks
  15350 To turn off fontification of literal examples, customize the
  15351 ~org-odt-fontify-srcblocks~ option.
  15352 
  15353 *** Advanced topics in ODT export
  15354 :PROPERTIES:
  15355 :DESCRIPTION: For power users.
  15356 :END:
  15357 
  15358 The ODT export backend has extensive features useful for power users
  15359 and frequent uses of ODT formats.
  15360 
  15361 **** Configuring a document converter
  15362 :PROPERTIES:
  15363 :DESCRIPTION: Registering a document converter.
  15364 :UNNUMBERED: notoc
  15365 :END:
  15366 #+cindex: convert
  15367 #+cindex: doc, docx, rtf
  15368 #+cindex: converter
  15369 
  15370 The ODT export backend works with popular converters with little or
  15371 no extra configuration.  See [[*Extending ODT export]].  The following is
  15372 for unsupported converters or tweaking existing defaults.
  15373 
  15374 - Register the converter ::
  15375 
  15376   #+vindex: org-export-odt-convert-processes
  15377   Add the name of the converter to the ~org-odt-convert-processes~
  15378   variable.  Note that it also requires how the converter is invoked
  15379   on the command line.  See the variable's docstring for details.
  15380 
  15381 - Configure its capabilities ::
  15382 
  15383   #+vindex: org-export-odt-convert-capabilities
  15384   Specify which formats the converter can handle by customizing the
  15385   variable ~org-odt-convert-capabilities~.  Use the entry for the
  15386   default values in this variable for configuring the new converter.
  15387   Also see its docstring for details.
  15388 
  15389 - Choose the converter ::
  15390 
  15391   #+vindex: org-export-odt-convert-process
  15392   Select the newly added converter as the preferred one by customizing
  15393   the option ~org-odt-convert-process~.
  15394 
  15395 **** Working with OpenDocument style files
  15396 :PROPERTIES:
  15397 :DESCRIPTION: Exploring internals.
  15398 :UNNUMBERED: notoc
  15399 :END:
  15400 #+cindex: styles, custom
  15401 #+cindex: template, custom
  15402 
  15403 This section explores the internals of the ODT exporter; the means by which
  15404 it produces styled documents; the use of automatic and custom OpenDocument
  15405 styles.
  15406 
  15407 The ODT exporter relies on two files for generating its output.  These
  15408 files are bundled with the distribution under the directory pointed to
  15409 by the variable ~org-odt-styles-dir~.  The two files are:
  15410 
  15411 - =OrgOdtStyles.xml= <<x-orgodtstyles-xml>> ::
  15412 
  15413   This file contributes to the =styles.xml= file of the final ODT
  15414   document.  This file gets modified for the following purposes:
  15415 
  15416   1. To control outline numbering based on user settings;
  15417 
  15418   2. To add styles generated by =htmlfontify.el= for fontification of
  15419      code blocks.
  15420 
  15421 - =OrgOdtContentTemplate.xml= <<x-orgodtcontenttemplate-xml>> ::
  15422 
  15423   This file contributes to the =content.xml= file of the final ODT
  15424   document.  The contents of the Org outline are inserted between the
  15425   =<office:text>= ... =</office:text>= elements of this file.
  15426 
  15427   Apart from serving as a template file for the final =content.xml=,
  15428   the file serves the following purposes:
  15429 
  15430   1. It contains automatic styles for formatting of tables which are
  15431      referenced by the exporter;
  15432 
  15433   2. It contains =<text:sequence-decl>= ... =</text:sequence-decl>=
  15434      elements that control numbering of tables, images, equations, and
  15435      similar entities.
  15436 
  15437 <<x-overriding-factory-styles>> The following two variables control
  15438 the location from where the ODT exporter picks up the custom styles
  15439 and content template files.  Customize these variables to override the
  15440 factory styles used by the exporter.
  15441 
  15442 - ~org-odt-styles-file~ ::
  15443 
  15444   The ODT export backend uses the file pointed to by this variable,
  15445   such as =styles.xml=, for the final output.  It can take one of the
  15446   following values:
  15447 
  15448   - =FILE.xml= ::
  15449 
  15450     Use this file instead of the default =styles.xml=
  15451 
  15452   - =FILE.odt= or =FILE.ott= ::
  15453 
  15454     Use the =styles.xml= contained in the specified OpenDocument
  15455     Text or Template file
  15456 
  15457   - =FILE.odt= or =FILE.ott= and a subset of included files ::
  15458 
  15459     Use the =styles.xml= contained in the specified OpenDocument Text
  15460     or Template file.  Additionally extract the specified member files
  15461     and embed those within the final ODT document.
  15462 
  15463     Use this option if the =styles.xml= file references additional
  15464     files like header and footer images.
  15465 
  15466   - ~nil~ ::
  15467 
  15468     Use the default =styles.xml=.
  15469 
  15470 - ~org-odt-content-template-file~ ::
  15471 
  15472   Use this variable to specify the blank =content.xml= used in the
  15473   final output.
  15474 
  15475 **** Creating one-off styles
  15476 :PROPERTIES:
  15477 :DESCRIPTION: Customizing styles, highlighting...
  15478 :UNNUMBERED: notoc
  15479 :END:
  15480 
  15481 The ODT export backend can read embedded raw OpenDocument XML from
  15482 the Org file.  Such direct formatting is useful for one-off instances.
  15483 
  15484 - Embedding ODT tags as part of regular text ::
  15485 
  15486   Enclose OpenDocument syntax in =@@odt:...@@= for inline markup.  For
  15487   example, to highlight a region of text do the following:
  15488 
  15489   #+begin_example
  15490   @@odt:<text:span text:style-name="Highlight">This is highlighted
  15491   text</text:span>@@.  But this is regular text.
  15492   #+end_example
  15493 
  15494   *Hint:* To see the above example in action, edit the =styles.xml=
  15495   (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom /Highlight/ style as shown
  15496   below:
  15497 
  15498   #+begin_example
  15499   <style:style style:name="Highlight" style:family="text">
  15500     <style:text-properties fo:background-color="#ff0000"/>
  15501   </style:style>
  15502   #+end_example
  15503 
  15504 - Embedding a one-line OpenDocument XML ::
  15505 
  15506   #+cindex: @samp{ODT}, keyword
  15507   The ODT export backend can read one-liner options with =#+ODT:= in
  15508   the Org file.  For example, to force a page break:
  15509 
  15510   #+begin_example
  15511   ,#+ODT: <text:p text:style-name="PageBreak"/>
  15512   #+end_example
  15513 
  15514   *Hint:* To see the above example in action, edit your
  15515   =styles.xml= (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom =PageBreak=
  15516   style as shown below.
  15517 
  15518   #+begin_example
  15519   <style:style style:name="PageBreak" style:family="paragraph"
  15520                style:parent-style-name="Text_20_body">
  15521     <style:paragraph-properties fo:break-before="page"/>
  15522   </style:style>
  15523   #+end_example
  15524 
  15525 - Embedding a block of OpenDocument XML ::
  15526 
  15527   The ODT export backend can also read ODT export blocks for
  15528   OpenDocument XML.  Such blocks use the =#+BEGIN_EXPORT odt=
  15529   ... =#+END_EXPORT= constructs.
  15530 
  15531   For example, to create a one-off paragraph that uses bold text, do
  15532   the following:
  15533 
  15534   #+begin_example
  15535   ,#+BEGIN_EXPORT odt
  15536     <text:p text:style-name="Text_20_body_20_bold">
  15537     This paragraph is specially formatted and uses bold text.
  15538     </text:p>
  15539   ,#+END_EXPORT
  15540   #+end_example
  15541 
  15542 **** Customizing tables in ODT export
  15543 :PROPERTIES:
  15544 :DESCRIPTION: Defining table templates.
  15545 :UNNUMBERED: notoc
  15546 :END:
  15547 #+cindex: tables, in ODT export
  15548 #+cindex: @samp{ATTR_ODT}, keyword
  15549 
  15550 Override the default table format by specifying a custom table style
  15551 with the =#+ATTR_ODT= line.  For a discussion on default formatting of
  15552 tables, see [[*Tables in ODT export]].
  15553 
  15554 This feature closely mimics the way table templates are defined in the
  15555 OpenDocument-v1.2 specification[fn::
  15556 [[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2
  15557 Specification]]].
  15558 
  15559 #+vindex: org-odt-table-styles
  15560 For quick preview of this feature, install the settings below and export the
  15561 table that follows:
  15562 
  15563 #+begin_src emacs-lisp
  15564 (setq org-export-odt-table-styles
  15565       (append org-export-odt-table-styles
  15566               '(("TableWithHeaderRowAndColumn" "Custom"
  15567                  ((use-first-row-styles . t)
  15568                   (use-first-column-styles . t)))
  15569                 ("TableWithFirstRowandLastRow" "Custom"
  15570                  ((use-first-row-styles . t)
  15571                   (use-last-row-styles . t))))))
  15572 #+end_src
  15573 
  15574 #+begin_example
  15575 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
  15576 | Name  | Phone | Age |
  15577 | Peter |  1234 |  17 |
  15578 | Anna  |  4321 |  25 |
  15579 #+end_example
  15580 
  15581 The example above used =Custom= template and installed two table
  15582 styles =TableWithHeaderRowAndColumn= and
  15583 =TableWithFirstRowandLastRow=.  *Important:* The OpenDocument styles
  15584 needed for producing the above template were pre-defined.  They are
  15585 available in the section marked =Custom Table Template= in
  15586 =OrgOdtContentTemplate.xml= (see [[x-orgodtcontenttemplate-xml][Factory styles]]).  For adding new
  15587 templates, define new styles there.
  15588 
  15589 To use this feature proceed as follows:
  15590 
  15591 1. Create a table template[fn:: See the =<table:table-template>=
  15592    element of the OpenDocument-v1.2 specification.].
  15593 
  15594    A table template is set of =table-cell= and =paragraph= styles for
  15595    each of the following table cell categories:
  15596 
  15597    - Body
  15598    - First column
  15599    - Last column
  15600    - First row
  15601    - Last row
  15602    - Even row
  15603    - Odd row
  15604    - Even column
  15605    - Odd Column
  15606 
  15607    The names for the above styles must be chosen based on the name of
  15608    the table template using a well-defined convention.
  15609 
  15610    The naming convention is better illustrated with an example.  For
  15611    a table template with the name =Custom=, the needed style names are
  15612    listed in the following table.
  15613 
  15614    | Cell type    | Cell style                   | Paragraph style                   |
  15615    |--------------+------------------------------+-----------------------------------|
  15616    | Body         | =CustomTableCell=            | =CustomTableParagraph=            |
  15617    | First column | =CustomFirstColumnTableCell= | =CustomFirstColumnTableParagraph= |
  15618    | Last column  | =CustomLastColumnTableCell=  | =CustomLastColumnTableParagraph=  |
  15619    | First row    | =CustomFirstRowTableCell=    | =CustomFirstRowTableParagraph=    |
  15620    | Last row     | =CustomLastRowTableCell=     | =CustomLastRowTableParagraph=     |
  15621    | Even row     | =CustomEvenRowTableCell=     | =CustomEvenRowTableParagraph=     |
  15622    | Odd row      | =CustomOddRowTableCell=      | =CustomOddRowTableParagraph=      |
  15623    | Even column  | =CustomEvenColumnTableCell=  | =CustomEvenColumnTableParagraph=  |
  15624    | Odd column   | =CustomOddColumnTableCell=   | =CustomOddColumnTableParagraph=   |
  15625 
  15626    To create a table template with the name =Custom=, define the above
  15627    styles in the =<office:automatic-styles>= ...
  15628    =</office:automatic-styles>= element of the content template file
  15629    (see [[x-orgodtcontenttemplate-xml][Factory styles]]).
  15630 
  15631 2. Define a table style[fn:: See the attributes =table:template-name=,
  15632    =table:use-first-row-styles=, =table:use-last-row-styles=,
  15633    =table:use-first-column-styles=, =table:use-last-column-styles=,
  15634    =table:use-banding-rows-styles=, and
  15635    =table:use-banding-column-styles= of the =<table:table>= element in
  15636    the OpenDocument-v1.2 specification.].
  15637 
  15638    #+vindex: org-odt-table-styles
  15639    To define a table style, create an entry for the style in the
  15640    variable ~org-odt-table-styles~ and specify the following:
  15641 
  15642    - the name of the table template created in step (1),
  15643    - the set of cell styles in that template that are to be activated.
  15644 
  15645    For example, the entry below defines two different table styles
  15646    =TableWithHeaderRowAndColumn= and =TableWithFirstRowandLastRow=
  15647    based on the same template =Custom=.  The styles achieve their
  15648    intended effect by selectively activating the individual cell
  15649    styles in that template.
  15650 
  15651    #+begin_src emacs-lisp
  15652    (setq org-export-odt-table-styles
  15653          (append org-export-odt-table-styles
  15654                  '(("TableWithHeaderRowAndColumn" "Custom"
  15655                     ((use-first-row-styles . t)
  15656                      (use-first-column-styles . t)))
  15657                    ("TableWithFirstRowandLastRow" "Custom"
  15658                     ((use-first-row-styles . t)
  15659                      (use-last-row-styles . t))))))
  15660    #+end_src
  15661 
  15662 3. Associate a table with the table style.
  15663 
  15664    To do this, specify the table style created in step (2) as part of
  15665    the =ATTR_ODT= line as shown below.
  15666 
  15667    #+begin_example
  15668    ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
  15669    | Name  | Phone | Age |
  15670    | Peter |  1234 |  17 |
  15671    | Anna  |  4321 |  25 |
  15672    #+end_example
  15673 
  15674 **** Validating OpenDocument XML
  15675 :PROPERTIES:
  15676 :DESCRIPTION: Debugging corrupted OpenDocument files.
  15677 :UNNUMBERED: notoc
  15678 :END:
  15679 
  15680 Sometimes ODT format files may not open due to =.odt= file corruption.
  15681 To verify if such a file is corrupt, validate it against the
  15682 OpenDocument Relax NG Compact (RNC) syntax schema.  But first the
  15683 =.odt= files have to be decompressed using =zip=.  Note that =.odt=
  15684 files are ZIP archives: [[info:emacs::File Archives]].  The contents of
  15685 ODT files are in XML.  For general help with validation---and
  15686 schema-sensitive editing---of XML files: [[info:nxml-mode::Introduction]].
  15687 
  15688 #+vindex: org-export-odt-schema-dir
  15689 Customize ~org-odt-schema-dir~ to point to a directory with
  15690 OpenDocument RNC files and the needed schema-locating rules.  The ODT
  15691 export backend takes care of updating the
  15692 ~rng-schema-locating-files~.
  15693 
  15694 ** Org Export
  15695 :PROPERTIES:
  15696 :DESCRIPTION: Exporting to Org.
  15697 :END:
  15698 
  15699 #+cindex: Org export
  15700 /org/ export backend creates a normalized version of the Org document
  15701 in current buffer.  The exporter evaluates Babel code (see [[*Evaluating
  15702 Code Blocks]]) and removes content specific to other backends.
  15703 
  15704 *** Org export commands
  15705 :PROPERTIES:
  15706 :UNNUMBERED: notoc
  15707 :END:
  15708 
  15709 - {{{kbd(C-c C-e O o)}}} (~org-org-export-to-org~) ::
  15710 
  15711   #+kindex: C-c C-e O o
  15712   #+findex: org-org-export-to-org
  15713   Export as an Org file with a =.org= extension.  For =myfile.org=,
  15714   Org exports to =myfile.org.org=, overwriting without warning.
  15715 
  15716 - {{{kbd(C-c C-e O v)}}} (~~) ::
  15717 
  15718   #+kindex: C-c C-e O v
  15719   Export to an Org file, then open it.
  15720 
  15721 ** Texinfo Export
  15722 :PROPERTIES:
  15723 :DESCRIPTION: Exporting to Texinfo.
  15724 :END:
  15725 
  15726 *** Texinfo export commands
  15727 :PROPERTIES:
  15728 :DESCRIPTION: Invoking commands.
  15729 :END:
  15730 
  15731 - {{{kbd(C-c C-e i t)}}} (~org-texinfo-export-to-texinfo~) ::
  15732 
  15733   #+kindex: C-c C-e i t
  15734   #+findex: org-texinfo-export-to-texinfo
  15735   Export as a Texinfo file with =.texi= extension.  For =myfile.org=,
  15736   Org exports to =myfile.texi=, overwriting without warning.
  15737 
  15738 - {{{kbd(C-c C-e i i)}}} (~org-texinfo-export-to-info~) ::
  15739 
  15740   #+kindex: C-c C-e i i
  15741   #+findex: org-texinfo-export-to-info
  15742   #+vindex: org-texinfo-info-process
  15743   Export to Texinfo format first and then process it to make an Info
  15744   file.  To generate other formats, such as DocBook, customize the
  15745   ~org-texinfo-info-process~ variable.
  15746 
  15747 *** Texinfo specific export settings
  15748 :PROPERTIES:
  15749 :DESCRIPTION: Setting the environment.
  15750 :END:
  15751 
  15752 The Texinfo export backend has several additional keywords for
  15753 customizing Texinfo output.  Setting these keywords works similar to
  15754 the general options (see [[*Export Settings]]).
  15755 
  15756 - =SUBTITLE= ::
  15757 
  15758   #+cindex: @samp{SUBTITLE}, keyword
  15759   The document subtitle.
  15760 
  15761 - =SUBAUTHOR= ::
  15762 
  15763   #+cindex: @samp{SUBAUTHOR}, keyword
  15764   Additional authors for the document.
  15765 
  15766 - =TEXINFO_FILENAME= ::
  15767 
  15768   #+cindex: @samp{TEXINFO_FILENAME}, keyword
  15769   The Texinfo filename.
  15770 
  15771 - =TEXINFO_CLASS= ::
  15772 
  15773   #+cindex: @samp{TEXINFO_CLASS}, keyword
  15774   #+vindex: org-texinfo-default-class
  15775   The default document class (~org-texinfo-default-class~), which must
  15776   be a member of ~org-texinfo-classes~.
  15777 
  15778 - =TEXINFO_HEADER= ::
  15779 
  15780   #+cindex: @samp{TEXINFO_HEADER}, keyword
  15781   Arbitrary lines inserted at the end of the header.
  15782 
  15783 - =TEXINFO_POST_HEADER= ::
  15784 
  15785   #+cindex: @samp{TEXINFO_POST_HEADER}, keyword
  15786   Arbitrary lines inserted after the end of the header.
  15787 
  15788 - =TEXINFO_DIR_CATEGORY= ::
  15789 
  15790   #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
  15791   The directory category of the document.  Defaults to ~Misc~.
  15792 
  15793 - =TEXINFO_DIR_NAME= ::
  15794 
  15795   #+cindex: @samp{TEXINFO_DIR_NAME}, keyword
  15796   The directory name of the document.
  15797   This is the short name under which the ~m~ command will find your
  15798   manual in the main Info directory.  It defaults to the base name of
  15799   the Texinfo file.
  15800 
  15801   The full form of the Texinfo entry is ~* DIRNAME: NODE.~ where ~NODE~
  15802   is usually just ~(FILENAME)~.  Normally this option only provides the
  15803   ~DIRNAME~ part, but if you need more control, it can also be the full
  15804   entry (recognized by the presence of parentheses or a leading ~* ~).
  15805 
  15806 - =TEXINFO_DIR_DESC= ::
  15807 
  15808   #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
  15809   The directory description of the document.
  15810   Defaults to the title of the document.
  15811 
  15812 - =TEXINFO_PRINTED_TITLE= ::
  15813 
  15814   #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
  15815   The printed title of the document.
  15816 
  15817 *** Texinfo file header
  15818 :PROPERTIES:
  15819 :DESCRIPTION: Generating the header.
  15820 :END:
  15821 
  15822 #+cindex: @samp{TEXINFO_FILENAME}, keyword
  15823 After creating the header for a Texinfo file, the Texinfo backend
  15824 automatically generates a name and destination path for the Info file.
  15825 To override this default with a more sensible path and name, specify
  15826 the =TEXINFO_FILENAME= keyword.
  15827 
  15828 #+vindex: org-texinfo-coding-system
  15829 #+cindex: @samp{TEXINFO_HEADER}, keyword
  15830 Along with the output's file name, the Texinfo header also contains
  15831 language details (see [[*Export Settings]]) and encoding system as set in
  15832 the ~org-texinfo-coding-system~ variable.  Insert =TEXINFO_HEADER=
  15833 keywords for each additional command in the header, for example:
  15834 
  15835 : #+TEXINFO_HEADER: @synindex
  15836 
  15837 #+cindex: @samp{TEXINFO_CLASS}, keyword
  15838 #+vindex: org-texinfo-classes
  15839 Instead of repeatedly installing the same set of commands, define
  15840 a class in ~org-texinfo-classes~ once, and then activate it in the
  15841 document by setting the =TEXINFO_CLASS= keyword to that class.
  15842 
  15843 *** Texinfo title and copyright page
  15844 :PROPERTIES:
  15845 :DESCRIPTION: Creating preamble pages.
  15846 :END:
  15847 
  15848 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
  15849 The default template for hard copy output has a title page with
  15850 =TITLE= and =AUTHOR= keywords (see [[*Export Settings]]).  To replace the
  15851 regular title with something different for the printed version, use
  15852 the =TEXINFO_PRINTED_TITLE= and =SUBTITLE= keywords.  Both expect raw
  15853 Texinfo code for setting their values.
  15854 
  15855 #+cindex: @samp{SUBAUTHOR}, keyword
  15856 If one =AUTHOR= line is not sufficient, add multiple =SUBAUTHOR=
  15857 keywords.  They have to be set in raw Texinfo code.
  15858 
  15859 #+begin_example
  15860 ,#+AUTHOR: Jane Smith
  15861 ,#+SUBAUTHOR: John Doe
  15862 ,#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{}
  15863 #+end_example
  15864 
  15865 #+cindex: @samp{COPYING}, property
  15866 Copying material is defined in a dedicated headline with a non-~nil~
  15867 =COPYING= property.  The backend inserts the contents within
  15868 a =@copying= command at the beginning of the document.  The heading
  15869 itself does not appear in the structure of the document.
  15870 
  15871 Copyright information is printed on the back of the title page.
  15872 
  15873 #+begin_example
  15874 ,* Legalese
  15875   :PROPERTIES:
  15876   :COPYING: t
  15877   :END:
  15878 
  15879   This is a short example of a complete Texinfo file, version 1.0.
  15880 
  15881   Copyright \copy 2016 Free Software Foundation, Inc.
  15882 #+end_example
  15883 
  15884 *** Info directory file
  15885 :PROPERTIES:
  15886 :DESCRIPTION: Installing a manual in Info file hierarchy.
  15887 :END:
  15888 
  15889 #+cindex: @samp{dir} file, in Texinfo export
  15890 #+cindex: Info directory file, in Texinfo export
  15891 #+cindex: @code{install-info}, in Texinfo export
  15892 
  15893 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
  15894 #+cindex: @samp{TEXINFO_DIR_NAME}, keyword
  15895 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
  15896 The end result of the Texinfo export process is the creation of an
  15897 Info file.  This Info file's metadata has variables for category,
  15898 title, and description: =TEXINFO_DIR_CATEGORY=, =TEXINFO_DIR_NAME=,
  15899 and =TEXINFO_DIR_DESC= keywords that establish where in the Info
  15900 hierarchy the file fits.
  15901 
  15902 Here is an example that writes to the Info directory file:
  15903 
  15904 #+begin_example
  15905 ,#+TEXINFO_DIR_CATEGORY: Emacs
  15906 ,#+TEXINFO_DIR_NAME: Org Mode
  15907 ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer
  15908 #+end_example
  15909 
  15910 *** Headings and sectioning structure
  15911 :PROPERTIES:
  15912 :DESCRIPTION: Building document structure.
  15913 :END:
  15914 
  15915 #+vindex: org-texinfo-classes
  15916 #+vindex: org-texinfo-default-class
  15917 #+cindex: @samp{TEXINFO_CLASS}, keyword
  15918 The Texinfo export backend uses a pre-defined scheme to convert Org
  15919 headlines to equivalent Texinfo structuring commands.  A scheme like
  15920 this maps top-level headlines to numbered chapters tagged as
  15921 ~@chapter~ and lower-level headlines to unnumbered chapters tagged as
  15922 ~@unnumbered~.  To override such mappings to introduce ~@part~ or
  15923 other Texinfo structuring commands, define a new class in
  15924 ~org-texinfo-classes~.  Activate the new class with the
  15925 =TEXINFO_CLASS= keyword.  When no new class is defined and activated,
  15926 the Texinfo export backend defaults to the
  15927 ~org-texinfo-default-class~.
  15928 
  15929 If an Org headline's level has no associated Texinfo structuring
  15930 command, or is below a certain threshold (see [[*Export Settings]]), then
  15931 the Texinfo export backend makes it into a list item.
  15932 
  15933 #+cindex: @samp{APPENDIX}, property
  15934 The Texinfo export backend makes any headline with a non-~nil~
  15935 =APPENDIX= property into an appendix.  This happens independent of the
  15936 Org headline level or the =TEXINFO_CLASS= keyword.
  15937 
  15938 #+cindex: @samp{ALT_TITLE}, property
  15939 #+cindex: @samp{DESCRIPTION}, property
  15940 The Texinfo export backend creates a menu entry after the Org
  15941 headline for each regular sectioning structure.  To override this with
  15942 a shorter menu entry, use the =ALT_TITLE= property (see [[*Table of
  15943 Contents]]).  Texinfo menu entries also have an option for a longer
  15944 =DESCRIPTION= property.  Here's an example that uses both to override
  15945 the default menu entry:
  15946 
  15947 #+begin_example
  15948 ,* Controlling Screen Display
  15949   :PROPERTIES:
  15950   :ALT_TITLE: Display
  15951   :DESCRIPTION: Controlling Screen Display
  15952   :END:
  15953 #+end_example
  15954 
  15955 #+cindex: Top node, in Texinfo export
  15956 The text before the first headline belongs to the /Top/ node, i.e.,
  15957 the node in which a reader enters an Info manual.  As such, it is
  15958 expected not to appear in printed output generated from the =.texi=
  15959 file.  See [[info:texinfo::The Top Node]], for more information.
  15960 
  15961 *** Indices
  15962 :PROPERTIES:
  15963 :DESCRIPTION: Creating indices.
  15964 :END:
  15965 
  15966 #+cindex: @samp{CINDEX}, keyword
  15967 #+cindex: concept index, in Texinfo export
  15968 #+cindex: @samp{FINDEX}, keyword
  15969 #+cindex: function index, in Texinfo export
  15970 #+cindex: @samp{KINDEX}, keyword
  15971 #+cindex: keystroke index, in Texinfo export
  15972 #+cindex: @samp{PINDEX}, keyword
  15973 #+cindex: program index, in Texinfo export
  15974 #+cindex: @samp{TINDEX}, keyword
  15975 #+cindex: data type index, in Texinfo export
  15976 #+cindex: @samp{VINDEX}, keyword
  15977 #+cindex: variable index, in Texinfo export
  15978 The Texinfo export backend recognizes these indexing keywords if used
  15979 in the Org file: =CINDEX=, =FINDEX=, =KINDEX=, =PINDEX=, =TINDEX= and
  15980 =VINDEX=.  Write their value as verbatim Texinfo code; in particular,
  15981 ={=, =}= and =@= characters need to be escaped with =@= if they do not
  15982 belong to a Texinfo command.
  15983 
  15984 : #+CINDEX: Defining indexing entries
  15985 
  15986 #+cindex: @samp{INDEX}, property
  15987 For the backend to generate an index entry for a headline, set the
  15988 =INDEX= property to =cp= or =vr=.  These abbreviations come from
  15989 Texinfo that stand for concept index and variable index.  The Texinfo
  15990 manual has abbreviations for all other kinds of indexes.  The backend
  15991 exports the headline as an unnumbered chapter or section command, and
  15992 then inserts the index after its contents.
  15993 
  15994 #+begin_example
  15995 ,* Concept Index
  15996   :PROPERTIES:
  15997   :INDEX: cp
  15998   :END:
  15999 #+end_example
  16000 
  16001 *** Quoting Texinfo code
  16002 :PROPERTIES:
  16003 :DESCRIPTION: Incorporating literal Texinfo code.
  16004 :END:
  16005 
  16006 Use any of the following three methods to insert or escape raw Texinfo
  16007 code:
  16008 
  16009 #+cindex: @samp{TEXINFO}, keyword
  16010 #+cindex: @samp{BEGIN_EXPORT texinfo}
  16011 #+begin_example
  16012 Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU.
  16013 
  16014 ,#+TEXINFO: @need800
  16015 This paragraph is preceded by...
  16016 
  16017 ,#+BEGIN_EXPORT texinfo
  16018   @auindex Johnson, Mark
  16019   @auindex Lakoff, George
  16020 ,#+END_EXPORT
  16021 #+end_example
  16022 
  16023 *** Plain lists in Texinfo export
  16024 :PROPERTIES:
  16025 :DESCRIPTION: List attributes.
  16026 :END:
  16027 
  16028 #+cindex: lettered lists, in Texinfo export
  16029 #+cindex: enum, Texinfo attribute
  16030 The Texinfo export backend converts unordered and ordered lists in
  16031 the Org file using the default command =@itemize=.
  16032 
  16033 Ordered lists are numbered when exported to Texinfo format.  Such
  16034 numbering obeys any counter (see [[*Plain Lists]]) in the first item of
  16035 the list.  The =:enum= attribute also let you start the list at a
  16036 specific number, or switch to a lettered list, as illustrated here:
  16037 
  16038 #+begin_example
  16039 #+ATTR_TEXINFO: :enum A
  16040 1. Alpha
  16041 2. Bravo
  16042 3. Charlie
  16043 #+end_example
  16044 
  16045 #+cindex: @samp{ATTR_TEXINFO}, keyword
  16046 #+cindex: two-column tables, in Texinfo export
  16047 #+cindex: table-type, Texinfo attribute
  16048 The Texinfo export backend by default converts description lists in
  16049 the Org file using the default command =@table=, which results in
  16050 a table with two columns.  To change this behavior, set =:table-type=
  16051 attribute to either =ftable= or =vtable= value.  For more information,
  16052 see [[info:texinfo::Two-column Tables]].
  16053 
  16054 #+vindex: org-texinfo-table-default-markup
  16055 #+cindex: indic, Texinfo attribute
  16056 The Texinfo export backend by default also applies a text highlight
  16057 based on the defaults stored in ~org-texinfo-table-default-markup~.
  16058 To override the default highlight command, specify another one with
  16059 the =:indic= attribute.
  16060 
  16061 #+cindex: multiple items in Texinfo lists
  16062 #+cindex: sep, Texinfo attribute
  16063 Org syntax is limited to one entry per list item.  Nevertheless, the
  16064 Texinfo export backend can split that entry according to any text
  16065 provided through the =:sep= attribute.  Each part then becomes a new
  16066 entry in the first column of the table.
  16067 
  16068 The following example illustrates all the attributes above:
  16069 
  16070 #+begin_example
  16071 ,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
  16072 - foo, bar :: This is the common text for variables foo and bar.
  16073 #+end_example
  16074 
  16075 #+texinfo: @noindent
  16076 becomes
  16077 
  16078 #+begin_example
  16079 @vtable @asis
  16080 @item foo
  16081 @itemx bar
  16082 This is the common text for variables foo and bar.
  16083 @end table
  16084 #+end_example
  16085 
  16086 The =:compact= attribute is an alternative to the =:sep= attribute,
  16087 which allows writing each entry on its own line.  If this attribute is
  16088 non-~nil~ and an item in a description list has no body but is
  16089 followed by another item, then the second item is transcoded to
  16090 =@itemx=.  This example is transcoded to the same output as above.
  16091 
  16092 #+begin_example
  16093 ,#+ATTR_TEXINFO: :table-type vtable :indic asis :compact t
  16094 - foo ::
  16095 - bar ::
  16096   This is the common text for variables foo and bar.
  16097 #+end_example
  16098 
  16099 Support for this compact syntax can also be enabled for all lists in
  16100 a file using the =compact-itemx= export option, or globally using the
  16101 variable ~org-texinfo-compact-itemx~.
  16102 
  16103 The Texinfo export backend also supports two approaches to writing
  16104 Texinfo definition commands (see [[info:texinfo::Definition Commands]]).
  16105 One of them uses description lists and is described below, the other
  16106 relies on special blocks (see [[*Special blocks in Texinfo export]]).
  16107 
  16108 Items in a description list in an Org file that begin with =Function:=
  16109 or certain other prefixes are converted using Texinfo definition
  16110 commands.  This works even if other items in the same list do not have
  16111 such a prefix; if necessary a single description list is converted
  16112 using multiple tables (such as =@vtable=) and definition commands
  16113 (such as =@defun=).
  16114 
  16115 #+begin_example
  16116 - Function: org-texinfo-drawer drawer contents info ::
  16117   Transcode a DRAWER element from Org to Texinfo.
  16118 #+end_example
  16119 
  16120 #+texinfo: @noindent
  16121 becomes
  16122 
  16123 #+begin_example
  16124 @defun org-texinfo-drawer drawer contents info ::
  16125   Transcode a DRAWER element from Org to Texinfo.
  16126 @end defun
  16127 #+end_example
  16128 
  16129 The recognized prefixes are =Command:=, =Function:=, =Macro:=,
  16130 =Special Form:=, =Variable:= and =User Option:=.  These are the same
  16131 prefixes that appear in the Info file for the respective definition
  16132 commands.  For example a =Function:= item in the Org file is converted
  16133 to a =@defun= command in the Texinfo file, which in turn is converted
  16134 to a definition prefixed with =-- Function:= in the Info file.
  16135 
  16136 As a special case the prefix =Key:= is also recognized.  No Texinfo
  16137 definition command exists for key bindings and the output in Info
  16138 files also lacks the =Key:= prefix.  Even so this special case is
  16139 supported because it provides a convenient shorthand, as illustrated
  16140 here:
  16141 
  16142 #+begin_example
  16143 - Key: C-c C-c (do-something) ::
  16144   This command does something.
  16145 
  16146 - User Option: do-something-somehow ::
  16147   This option controls how exactly ~do-something~ does its thing.
  16148 #+end_example
  16149 
  16150 #+texinfo: @noindent
  16151 becomes
  16152 
  16153 #+begin_example
  16154 @table @asis
  16155 @item @kbd{C-c C-c} (@code{do-something})
  16156 @kindex C-c C-c
  16157 @findex do-something
  16158 This command does something.
  16159 @end table
  16160 
  16161 @defopt do-something-somehow
  16162 This option controls how exactly @code{do-something} does its thing.
  16163 @end defopt
  16164 #+end_example
  16165 
  16166 #+texinfo: @noindent
  16167 Command in parenthesis, as done above, is optional.
  16168 
  16169 *** Tables in Texinfo export
  16170 :PROPERTIES:
  16171 :DESCRIPTION: Table attributes.
  16172 :END:
  16173 
  16174 #+cindex: @samp{ATTR_TEXINFO}, keyword
  16175 When exporting tables, the Texinfo export backend uses the widest
  16176 cell width in each column.  To override this and instead specify as
  16177 fractions of line length, use the =:columns= attribute.  See example
  16178 below.
  16179 
  16180 #+begin_example
  16181 ,#+ATTR_TEXINFO: :columns .5 .5
  16182 | a cell | another cell |
  16183 #+end_example
  16184 
  16185 *** Images in Texinfo export
  16186 :PROPERTIES:
  16187 :DESCRIPTION: Image attributes.
  16188 :END:
  16189 
  16190 #+cindex: @samp{ATTR_TEXINFO}, keyword
  16191 Insert a file link to the image in the Org file, and the Texinfo
  16192 export backend inserts the image.  These links must have the usual
  16193 supported image extensions and no descriptions.  To scale the image,
  16194 use =:width= and =:height= attributes.  For alternate text, use =:alt=
  16195 and specify the text using Texinfo code, as shown in the example:
  16196 
  16197 #+begin_example
  16198 ,#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text}
  16199 [[ridt.pdf]]
  16200 #+end_example
  16201 
  16202 *** Quotations in Texinfo export
  16203 :PROPERTIES:
  16204 :DESCRIPTION: Quote block attributes.
  16205 :END:
  16206 
  16207 #+cindex: @samp{ATTR_TEXINFO}, keyword
  16208 You can write the text of a quotation within a quote block (see
  16209 [[*Paragraphs]]).  You may also emphasize some text at the beginning of
  16210 the quotation with the =:tag= attribute.
  16211 
  16212 #+begin_example
  16213 ,#+ATTR_TEXINFO: :tag Warning
  16214 ,#+BEGIN_QUOTE
  16215 Striking your thumb with a hammer may cause severe pain and discomfort.
  16216 ,#+END_QUOTE
  16217 #+end_example
  16218 
  16219 To specify the author of the quotation, use the =:author= attribute.
  16220 
  16221 #+begin_example
  16222 ,#+ATTR_TEXINFO: :author King Arthur
  16223 ,#+BEGIN_QUOTE
  16224 The Lady of the Lake, her arm clad in the purest shimmering samite,
  16225 held aloft Excalibur from the bosom of the water, signifying by divine
  16226 providence that I, Arthur, was to carry Excalibur.  That is why I am
  16227 your king.
  16228 ,#+END_QUOTE
  16229 #+end_example
  16230 
  16231 *** Key bindings in Texinfo export
  16232 :PROPERTIES:
  16233 :DESCRIPTION: @@kbd Texinfo command.
  16234 :END:
  16235 
  16236 Org does not provide any markup for key bindings that corresponds to
  16237 Texinfo's ~@kbd~ and ~@key~ commands.  One way to deal with this is to
  16238 fall back to code syntax.  =~C-x SPC~=, for example, is transcoded to
  16239 ~@code{C-x SPC}~.
  16240 
  16241 A better approach is to define and use an Org macro named ~kbd~.  To
  16242 make that easier the function ~org-texinfo-kbd-macro~ is provided,
  16243 which is intended to be used like this:
  16244 
  16245 #+begin_example
  16246 ,#+macro: kbd (eval (org-texinfo-kbd-macro $1))
  16247 
  16248 Type {{{kbd(C-c SPC)}}}.
  16249 #+end_example
  16250 
  16251 #+texinfo: @noindent
  16252 which becomes
  16253 
  16254 #+begin_example
  16255 Type @kbd{C-c @key{SPC}}.
  16256 #+end_example
  16257 
  16258 *** Special blocks in Texinfo export
  16259 :PROPERTIES:
  16260 :DESCRIPTION: Special block attributes.
  16261 :END:
  16262 
  16263 The Texinfo export backend supports two approaches to writing Texinfo
  16264 definition commands.  One of them is described here, the other in
  16265 [[*Plain lists in Texinfo export]].
  16266 
  16267 #+cindex: @samp{ATTR_TEXINFO}, keyword
  16268 
  16269 The Texinfo export backend converts special blocks to commands with
  16270 the same name.  It also adds any =:options= attributes to the end of
  16271 the command, as shown in this example:
  16272 
  16273 #+begin_example
  16274 ,#+ATTR_TEXINFO: :options org-org-export-to-org ...
  16275 ,#+BEGIN_defun
  16276   A somewhat obsessive function name.
  16277 ,#+END_defun
  16278 #+end_example
  16279 
  16280 #+texinfo: @noindent
  16281 becomes
  16282 
  16283 #+begin_example
  16284 @defun org-org-export-to-org ...
  16285   A somewhat obsessive function name.
  16286 @end defun
  16287 #+end_example
  16288 
  16289 *** A Texinfo example
  16290 :PROPERTIES:
  16291 :DESCRIPTION: Processing Org to Texinfo.
  16292 :END:
  16293 
  16294 Here is a more detailed example Org file.  See
  16295 [[info:texinfo::GNU Sample Texts]] for an equivalent example using
  16296 Texinfo code.
  16297 
  16298 #+begin_example
  16299 ,#+TITLE: GNU Sample {{{version}}}
  16300 ,#+SUBTITLE: for version {{{version}}}, {{{updated}}}
  16301 ,#+AUTHOR: A.U. Thor
  16302 ,#+EMAIL: bug-sample@gnu.org
  16303 
  16304 ,#+OPTIONS: ':t toc:t author:t email:t
  16305 ,#+LANGUAGE: en
  16306 
  16307 ,#+MACRO: version 2.0
  16308 ,#+MACRO: updated last updated 4 March 2014
  16309 
  16310 ,#+TEXINFO_FILENAME: sample.info
  16311 ,#+TEXINFO_HEADER: @syncodeindex pg cp
  16312 
  16313 ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system
  16314 ,#+TEXINFO_DIR_NAME: sample
  16315 ,#+TEXINFO_DIR_DESC: Invoking sample
  16316 
  16317 ,#+TEXINFO_PRINTED_TITLE: GNU Sample
  16318 
  16319 This manual is for GNU Sample (version {{{version}}},
  16320 {{{updated}}}).
  16321 
  16322 ,* Copying
  16323   :PROPERTIES:
  16324   :COPYING:  t
  16325   :END:
  16326 
  16327   This manual is for GNU Sample (version {{{version}}},
  16328   {{{updated}}}), which is an example in the Texinfo documentation.
  16329 
  16330   Copyright \copy 2016 Free Software Foundation, Inc.
  16331 
  16332   ,#+BEGIN_QUOTE
  16333   Permission is granted to copy, distribute and/or modify this
  16334   document under the terms of the GNU Free Documentation License,
  16335   Version 1.3 or any later version published by the Free Software
  16336   Foundation; with no Invariant Sections, with no Front-Cover Texts,
  16337   and with no Back-Cover Texts.  A copy of the license is included in
  16338   the section entitled "GNU Free Documentation License".
  16339   ,#+END_QUOTE
  16340 
  16341 ,* Invoking sample
  16342 
  16343   ,#+PINDEX: sample
  16344   ,#+CINDEX: invoking @command{sample}
  16345 
  16346   This is a sample manual.  There is no sample program to invoke, but
  16347   if there were, you could see its basic usage and command line
  16348   options here.
  16349 
  16350 ,* GNU Free Documentation License
  16351   :PROPERTIES:
  16352   :APPENDIX: t
  16353   :END:
  16354 
  16355   ,#+INCLUDE: fdl.org
  16356 
  16357 ,* Index
  16358   :PROPERTIES:
  16359   :INDEX:    cp
  16360   :END:
  16361 #+end_example
  16362 
  16363 ** iCalendar Export
  16364 :PROPERTIES:
  16365 :DESCRIPTION: Exporting to iCalendar.
  16366 :END:
  16367 #+cindex: iCalendar export
  16368 
  16369 A large part of Org mode's interoperability success is its ability to
  16370 easily export to or import from external applications.  The iCalendar
  16371 export backend takes calendar data from Org files and exports to the
  16372 standard iCalendar format.
  16373 
  16374 #+vindex: icalendar-export-sexp-enumeration-days
  16375 By default, iCalendar export only includes headings that contain
  16376 active timestamps or diary sexps[fn:: Diary sexp events, except
  16377 certain built-in types (see ~icalendar-export-sexp-enumerate-all~),
  16378 are exported up to ~icalendar-export-sexp-enumeration-days~ into
  16379 future.].
  16380 
  16381 #+vindex: org-icalendar-include-todo
  16382 The iCalendar export backend can also incorporate TODO entries based
  16383 on the configuration of the ~org-icalendar-include-todo~ variable.
  16384 The backend exports plain timestamps as =VEVENT=, TODO items as
  16385 =VTODO=, and also create events from deadlines that are in non-TODO
  16386 items.
  16387 
  16388 #+vindex: org-icalendar-use-deadline
  16389 #+vindex: org-icalendar-use-scheduled
  16390 #+vindex: org-icalendar-todo-unscheduled-start
  16391 The backend uses the deadlines and scheduling dates in Org TODO items
  16392 for setting the start and due dates for the iCalendar TODO entry.
  16393 Consult the ~org-icalendar-use-deadline~,
  16394 ~org-icalendar-use-scheduled~, and
  16395 ~org-icalendar-todo-unscheduled-start~ variables for more details.
  16396 
  16397 #+vindex: org-icalendar-categories
  16398 #+vindex: org-icalendar-alarm-time
  16399 For tags on the headline, the iCalendar export backend makes them
  16400 into iCalendar categories.  To tweak the inheritance of tags and TODO
  16401 states, configure the variable ~org-icalendar-categories~.  To assign
  16402 clock alarms based on time, configure the ~org-icalendar-alarm-time~
  16403 variable.
  16404 
  16405 #+vindex: org-icalendar-store-UID
  16406 #+cindex: @samp{ID}, property
  16407 The iCalendar format standard requires globally unique identifier---or
  16408 UID---for each entry.  The iCalendar export backend creates UIDs
  16409 during export.  To save a copy of the UID in the Org file set the
  16410 variable ~org-icalendar-store-UID~.  The backend looks for the =ID=
  16411 property of the entry for reusing the same UID for subsequent
  16412 exports.
  16413 
  16414 Since a single Org entry can result in multiple iCalendar
  16415 entries---timestamp, deadline, scheduled item, or TODO item---Org adds
  16416 prefixes to the UID, depending on which part of the Org entry
  16417 triggered the creation of the iCalendar entry.  Prefixing ensures UIDs
  16418 remains unique, yet enable synchronization programs trace the
  16419 connections.
  16420 
  16421 - {{{kbd(C-c C-e c f)}}} (~org-icalendar-export-to-ics~) ::
  16422 
  16423   #+kindex: C-c C-e c f
  16424   #+findex: org-icalendar-export-to-ics
  16425   Create iCalendar entries from the current Org buffer and store them
  16426   in the same directory, using a file extension =.ics=.
  16427 
  16428 - {{{kbd(C-c C-e c a)}}} (~org-icalendar-export-agenda-files~) ::
  16429 
  16430   #+kindex: C-c C-e c a
  16431   #+findex: org-icalendar-export-agenda-files
  16432   Create iCalendar entries from Org files in ~org-agenda-files~ and
  16433   store in a separate iCalendar file for each Org file.
  16434 
  16435 - {{{kbd(C-c C-e c c)}}} (~org-icalendar-combine-agenda-files~) ::
  16436 
  16437   #+kindex: C-c C-e c c
  16438   #+findex: org-icalendar-combine-agenda-files
  16439   #+vindex: org-icalendar-combined-agenda-file
  16440   Create a combined iCalendar file from Org files in
  16441   ~org-agenda-files~ and write it to
  16442   ~org-icalendar-combined-agenda-file~ file name.
  16443 
  16444 #+cindex: @samp{SUMMARY}, property
  16445 #+cindex: @samp{DESCRIPTION}, property
  16446 #+cindex: @samp{LOCATION}, property
  16447 #+cindex: @samp{TIMEZONE}, property
  16448 #+cindex: @samp{CLASS}, property
  16449 The iCalendar export backend includes =SUMMARY=, =DESCRIPTION=,
  16450 =LOCATION=, =TIMEZONE= and =CLASS= properties from the Org entries
  16451 when exporting.  To force the backend to inherit the =LOCATION=,
  16452 =TIMEZONE= and =CLASS= properties, configure the
  16453 ~org-use-property-inheritance~ variable.
  16454 
  16455 =SUMMARY=, =LOCATION=, and =DESCRIPTION= properties can define
  16456 multi-line summary, location, or description using =<PROPERTY>+=
  16457 syntax (see [[*Property Syntax]]):
  16458 
  16459 : * Meeting at location with multi-line address
  16460 : <2024-01-08 Mon 14:20-15:00>
  16461 : :PROPERTIES:
  16462 : :LOCATION:  Someplace
  16463 : :LOCATION+: Some Street 5
  16464 : :LOCATION+: 12345 Small Town
  16465 : :END:
  16466 
  16467 #+vindex: org-icalendar-include-body
  16468 When Org entries do not have =SUMMARY=, =DESCRIPTION=, =LOCATION= and
  16469 =CLASS= properties, the iCalendar export backend derives the summary
  16470 from the headline, and derives the description from the body of the
  16471 Org item.  The ~org-icalendar-include-body~ variable limits the
  16472 maximum number of characters of the content are turned into its
  16473 description.
  16474 
  16475 The =TIMEZONE= property can be used to specify a per-entry time zone,
  16476 and is applied to any entry with timestamp information.  Time zones
  16477 should be specified as per the IANA time zone database format, e.g.,
  16478 =Asia/Almaty=.  Alternately, the property value can be =UTC=, to force
  16479 UTC time for this entry only.
  16480 
  16481 The =CLASS= property can be used to specify a per-entry visibility
  16482 class or access restrictions, and is applied to any entry with class
  16483 information.  The iCalendar standard defines three visibility classes:
  16484 - =PUBLIC= :: The entry is publicly visible (this is the default).
  16485 - =CONFIDENTIAL= :: Only a limited group of clients get access to the
  16486   event.
  16487 - =PRIVATE= :: The entry can be retrieved only by its owner.
  16488 The server should treat unknown class properties the same as
  16489 =PRIVATE=.
  16490 
  16491 #+cindex: @samp{ICAL-TTL}, keyword
  16492 #+vindex: org-icalendar-ttl
  16493 The exported iCalendar file can advise clients how often to check for
  16494 updates.  This duration can be set globally with the
  16495 ~org-icalendar-ttl~ variable, or on a per-document basis with the
  16496 =ICAL-TTL= keyword.  This option should be set using the iCalendar
  16497 notation for time durations; consult the docstring of
  16498 ~org-icalendar-ttl~ for more details.
  16499 
  16500 Exporting to iCalendar format depends in large part on the
  16501 capabilities of the destination application.  Some are more lenient
  16502 than others.  Consult the Org mode FAQ for advice on specific
  16503 applications.
  16504 
  16505 ** Other Built-in Backends
  16506 :PROPERTIES:
  16507 :DESCRIPTION: Exporting to a man page.
  16508 :END:
  16509 
  16510 Other export backends included with Org are:
  16511 
  16512 - =ox-man.el=: Export to a man page.
  16513 
  16514 To activate such backends, either customize ~org-export-backends~ or
  16515 load directly with =(require 'ox-man)=.  On successful load, the
  16516 backend adds new keys in the export dispatcher (see [[*The Export
  16517 Dispatcher]]).
  16518 
  16519 Follow the comment section of such files, for example, =ox-man.el=,
  16520 for usage and configuration details.
  16521 
  16522 ** Advanced Export Configuration
  16523 :PROPERTIES:
  16524 :DESCRIPTION: Fine-tuning the export output.
  16525 :END:
  16526 
  16527 *** Export hooks
  16528 :PROPERTIES:
  16529 :UNNUMBERED: notoc
  16530 :END:
  16531 
  16532 #+vindex: org-export-before-processing-hook
  16533 #+vindex: org-export-before-processing-functions
  16534 #+vindex: org-export-before-parsing-hook
  16535 The export process executes two hooks before the actual exporting
  16536 begins.  The first hook, ~org-export-before-processing-functions~,
  16537 runs before any expansions of macros, Babel code, and include keywords
  16538 in the buffer.  The second hook,
  16539 ~org-export-before-parsing-functions~, runs before the buffer is
  16540 parsed.
  16541 
  16542 Functions added to these hooks are called with a single argument: the
  16543 export backend actually used, as a symbol.  You may use them for
  16544 heavy duty structural modifications of the document.  For example, you
  16545 can remove every headline in the buffer during export like this:
  16546 
  16547 #+begin_src emacs-lisp
  16548 (defun my-headline-removal (backend)
  16549   "Remove all headlines in the current buffer.
  16550 BACKEND is the export backend being used, as a symbol."
  16551   (org-map-entries
  16552    (lambda ()
  16553      (delete-region (point) (line-beginning-position 2))
  16554      ;; We need to tell `org-map-entries' to not skip over heading at
  16555      ;; point.  Otherwise, it would continue from _next_ heading.  See
  16556      ;; the docstring of `org-map-entries' for details.
  16557      (setq org-map-continue-from (point)))))
  16558 
  16559 (add-hook 'org-export-before-parsing-functions #'my-headline-removal)
  16560 #+end_src
  16561 
  16562 *** Filters
  16563 :PROPERTIES:
  16564 :UNNUMBERED: notoc
  16565 :END:
  16566 
  16567 #+cindex: Filters, exporting
  16568 Filters are lists of functions to be applied to certain parts for
  16569 a given backend.  The output from the first function in the filter is
  16570 passed on to the next function in the filter.  The final output is the
  16571 output from the final function in the filter.
  16572 
  16573 The Org export process has many filter sets applicable to different
  16574 types of objects, plain text, parse trees, export options, and final
  16575 output formats.  The filters are named after the element type or
  16576 object type: ~org-export-filter-TYPE-functions~, where {{{var(TYPE)}}}
  16577 is the type targeted by the filter.  Valid types are:
  16578 
  16579 #+attr_texinfo: :columns 0.33 0.33 0.33
  16580 | body                | bold               | babel-call       |
  16581 | center-block        | clock              | code             |
  16582 | diary-sexp          | drawer             | dynamic-block    |
  16583 | entity              | example-block      | export-block     |
  16584 | export-snippet      | final-output       | fixed-width      |
  16585 | footnote-definition | footnote-reference | headline         |
  16586 | horizontal-rule     | inline-babel-call  | inline-src-block |
  16587 | inlinetask          | italic             | item             |
  16588 | keyword             | latex-environment  | latex-fragment   |
  16589 | line-break          | link               | node-property    |
  16590 | options             | paragraph          | parse-tree       |
  16591 | plain-list          | plain-text         | planning         |
  16592 | property-drawer     | quote-block        | radio-target     |
  16593 | section             | special-block      | src-block        |
  16594 | statistics-cookie   | strike-through     | subscript        |
  16595 | superscript         | table              | table-cell       |
  16596 | table-row           | target             | timestamp        |
  16597 | underline           | verbatim           | verse-block      |
  16598 
  16599 Here is an example filter that replaces non-breaking spaces ~ ~ in the
  16600 Org buffer with =~= for the LaTeX backend.
  16601 
  16602 #+begin_src emacs-lisp
  16603 (defun my-latex-filter-nobreaks (text backend info)
  16604   "Ensure \" \" are properly handled in LaTeX export."
  16605   (when (org-export-derived-backend-p backend 'latex)
  16606     (replace-regexp-in-string " " "~" text)))
  16607 
  16608 (add-to-list 'org-export-filter-plain-text-functions
  16609              'my-latex-filter-nobreaks)
  16610 #+end_src
  16611 
  16612 A filter requires three arguments: the code to be transformed, the
  16613 name of the backend, and some optional information about the export
  16614 process.  The third argument can be safely ignored.  Note the use of
  16615 ~org-export-derived-backend-p~ predicate that tests for /latex/
  16616 backend or any other backend, such as /beamer/, derived from
  16617 /latex/.
  16618 
  16619 *** Defining filters for individual files
  16620 :PROPERTIES:
  16621 :UNNUMBERED: notoc
  16622 :END:
  16623 
  16624 The Org export can filter not just for backends, but also for
  16625 specific files through the =BIND= keyword.  Here is an example with
  16626 two filters; one removes brackets from time stamps, and the other
  16627 removes strike-through text.  The filter functions are defined in
  16628 a code block in the same Org file, which is a handy location for
  16629 debugging.
  16630 
  16631 #+begin_example
  16632 ,#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
  16633 ,#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
  16634 ,#+BEGIN_SRC emacs-lisp :exports results :results none
  16635   (defun tmp-f-timestamp (s backend info)
  16636     (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
  16637   (defun tmp-f-strike-through (s backend info) "")
  16638 ,#+END_SRC
  16639 #+end_example
  16640 
  16641 *** Summary of the export process
  16642 :PROPERTIES:
  16643 :UNNUMBERED: notoc
  16644 :END:
  16645 
  16646 #+findex: org-export-as
  16647 Org mode export is a multi-step process that works on a temporary copy
  16648 of the buffer.  The export process consists of 4 major steps:
  16649 
  16650 1. Process the temporary copy, making necessary changes to the buffer
  16651    text;
  16652 
  16653 2. Parse the buffer, converting plain Org markup into an abstract
  16654    syntax tree (AST);
  16655 
  16656 3. Convert the AST to text, as prescribed by the selected export
  16657    backend;
  16658 
  16659 4. Post-process the resulting exported text.
  16660 
  16661 
  16662 #+texinfo: @noindent
  16663 Process temporary copy of the source Org buffer [fn::Unless
  16664 otherwise specified, each step of the export process only operates on
  16665 the accessible portion of the buffer.  When subtree export is selected
  16666 (see [[*The Export Dispatcher]]), the buffer is narrowed to the body of
  16667 the selected subtree, so that the rest of the buffer text, except
  16668 export keywords, does not contribute to the export output.]:
  16669 
  16670 1. Execute ~org-export-before-processing-functions~ (see [[*Export hooks]]);
  16671 
  16672 2. Expand =#+include= keywords in the whole buffer (see
  16673    [[*Include Files]]);
  16674 
  16675 3. Remove commented subtrees in the whole buffer (see [[*Comment
  16676    Lines]]);
  16677 
  16678 4. Replace macros in the whole buffer (see [[*Macro Replacement]]);
  16679 
  16680 5. When ~org-export-use-babel~ is non-nil (default), process code
  16681    blocks:
  16682 
  16683    - Leave code blocks inside archived subtrees (see [[*Internal
  16684      archiving]]) as is;
  16685 
  16686    - Evaluate all the other code blocks according to code block
  16687      headers (see [[*Limit code block evaluation]]);
  16688 
  16689    - Remove code, results of evaluation, both, or neither according
  16690      to =:exports= header argument (see [[*Exporting Code Blocks]]).
  16691 
  16692 
  16693 #+texinfo: @noindent
  16694 Parse the temporary buffer, creating AST:
  16695 
  16696 1. Execute ~org-export-before-parsing-functions~ (see [[*Export hooks]]).
  16697    The hook functions may still modify the buffer;
  16698 
  16699 2. Calculate export option values according to subtree-specific export
  16700    settings, in-buffer keywords, =#+BIND= keywords, and buffer-local
  16701    and global customization.  The whole buffer is considered;
  16702 
  16703 3. When ~org-org-with-cite-processors~ is non-nil (default), determine
  16704    contributing bibliographies and record them into export options
  16705    (see [[*Citations]]).  The whole buffer is considered;
  16706 
  16707 4. Execute ~org-export-filter-options-functions~;
  16708 
  16709 5. Parse the accessible portion of the temporary buffer to generate an
  16710    AST.  The AST is a nested list of lists representing Org syntax
  16711    elements (see [[https://orgmode.org/worg/dev/org-element-api.html][Org Element API]] for more details):
  16712 
  16713    : (org-data ...
  16714    :  (heading
  16715    :   (section
  16716    :    (paragraph (plain-text) (bold (plain-text))))
  16717    :   (heading)
  16718    :   (heading (section ...))))
  16719 
  16720    Past this point, modifications to the temporary buffer no longer
  16721    affect the export; Org export works only with the AST;
  16722 
  16723 6. Remove elements that are not exported from the AST:
  16724 
  16725    - Headings according to =SELECT_TAGS= and =EXCLUDE_TAGS= export
  16726      keywords; =task=, =inline=, =arch= export options (see
  16727      [[*Export Settings]]);
  16728 
  16729    - Comments;
  16730 
  16731    - Clocks, drawers, fixed-width environments, footnotes, LaTeX
  16732      environments and fragments, node properties, planning lines,
  16733      property drawers, statistics cookies, timestamps, etc according
  16734      to =#+OPTIONS= keyword (see [[*Export Settings]]);
  16735 
  16736    - Table rows containing width and alignment markers, unless the
  16737      selected export backend changes ~:with-special-rows~ export option
  16738      to non-nil (see [[*Column Width and Alignment]]);
  16739 
  16740    - Table columns containing recalc marks (see [[*Advanced features]]).
  16741 
  16742 7. Expand environment variables in file link AST nodes according to
  16743    the =expand-links= export option (see [[*Export Settings]]);
  16744 
  16745 8. Execute ~org-export-filter-parse-tree-functions~.  These
  16746    functions can modify the AST by side effects;
  16747 
  16748 9. When ~org-org-with-cite-processors~ is non-nil (default), replace
  16749    citation AST nodes and =#+print_bibliography= keyword AST nodes as
  16750    prescribed by the selected citation export processor (see [[*Citation
  16751    export processors]]).
  16752 
  16753 
  16754 #+texinfo: @noindent
  16755 Convert the AST to text by traversing the AST nodes, depth-first:
  16756 
  16757 1. Convert the leaf nodes (without children) to text as prescribed
  16758    by "transcoders" in the selected export backend
  16759    [fn:: See transcoders and ~:translate-alist~ in the docstrings
  16760    of ~org-export-define-backend~ and ~org-export-define-derived-backend~.];
  16761 
  16762 2. Pass the converted nodes through the corresponding export
  16763    filters (see [[*Filters]]);
  16764 
  16765 3. Concatenate all the converted child nodes to produce parent
  16766    node contents;
  16767 
  16768 4. Convert the nodes with children to text, passing the nodes
  16769    themselves and their exported contents to the corresponding
  16770    transcoders and then to the export filters (see [[*Filters]]).
  16771 
  16772 
  16773 #+texinfo: @noindent
  16774 Post-process the exported text:
  16775 
  16776   1. Post-process the converted AST, as prescribed by the export
  16777      backend. [fn:: See ~inner-template~ in the docstring of ~org-export-define-backend~.]
  16778      This step usually adds generated content (like Table of Contents)
  16779      to the exported text;
  16780 
  16781   2. Execute ~org-export-filter-body-functions~;
  16782 
  16783   3. Unless body-only export is selected (see [[*The Export Dispatcher]]),
  16784      add the necessary metadata to the final document, as prescribed
  16785      by the export backend.  Examples: Document author/title; HTML
  16786      headers/footers; LaTeX preamble;
  16787 
  16788   4. When ~org-org-with-cite-processors~ is non-nil (default), add
  16789      bibliography metadata, as prescribed by the citation export
  16790      processor;
  16791 
  16792   5. Execute ~org-export-filter-final-output-functions~.
  16793 
  16794 *** Extending an existing backend
  16795 :PROPERTIES:
  16796 :UNNUMBERED: notoc
  16797 :END:
  16798 
  16799 Some parts of the conversion process can be extended for certain
  16800 elements so as to introduce a new or revised translation.  That is how
  16801 the HTML export backend was extended to handle Markdown format.  The
  16802 extensions work seamlessly so any aspect of filtering not done by the
  16803 extended backend is handled by the original backend.  Of all the
  16804 export customization in Org, extending is very powerful as it operates
  16805 at the parser level.
  16806 
  16807 For this example, make the /ascii/ backend display the language used
  16808 in a source code block.  Also make it display only when some attribute
  16809 is non-~nil~, like the following:
  16810 
  16811 : #+ATTR_ASCII: :language t
  16812 
  16813 Then extend ASCII backend with a custom "my-ascii" backend.
  16814 
  16815 #+begin_src emacs-lisp
  16816 (defun my-ascii-src-block (src-block contents info)
  16817   "Transcode a SRC-BLOCK element from Org to ASCII.
  16818 CONTENTS is nil.  INFO is a plist used as a communication
  16819 channel."
  16820   (if (not (org-export-read-attribute :attr_ascii src-block :language))
  16821       (org-export-with-backend 'ascii src-block contents info)
  16822     (concat
  16823      (format ",--[ %s ]--\n%s`----"
  16824              (org-element-property :language src-block)
  16825              (replace-regexp-in-string
  16826               "^" "| "
  16827               (org-element-normalize-string
  16828                (org-export-format-code-default src-block info)))))))
  16829 
  16830 (org-export-define-derived-backend 'my-ascii 'ascii
  16831   :translate-alist '((src-block . my-ascii-src-block)))
  16832 #+end_src
  16833 
  16834 The ~my-ascii-src-block~ function looks at the attribute above the
  16835 current element.  If not true, hands over to /ascii/ backend.  If
  16836 true, which it is in this example, it creates a box around the code
  16837 and leaves room for the inserting a string for language.  The last
  16838 form creates the new backend that springs to action only when
  16839 translating ~src-block~ type elements.
  16840 
  16841 To use the newly defined backend, evaluate the following from an Org
  16842 buffer:
  16843 
  16844 #+begin_src emacs-lisp
  16845 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
  16846 #+end_src
  16847 
  16848 Further steps to consider would be an interactive function,
  16849 self-installing an item in the export dispatcher menu, and other
  16850 user-friendly improvements.  See
  16851 <https://orgmode.org/worg/dev/org-export-reference.html> for more
  16852 details.
  16853 
  16854 ** Export Region
  16855 :PROPERTIES:
  16856 :DESCRIPTION: Author tables and lists in Org syntax.
  16857 :END:
  16858 
  16859 Some export backends include commands to convert a region of Org
  16860 formatted text to another format, such as HTML or LaTeX.  The
  16861 conversion replaces the original source.  Here are such commands:
  16862 
  16863 - ~org-export-region-to-ascii~ ::
  16864 
  16865   #+findex: org-ascii-convert-region-to-ascii
  16866   #+findex: org-export-region-to-ascii
  16867   Convert the selected region into ASCII.
  16868 
  16869 - ~org-export-region-to-utf8~ ::
  16870 
  16871   #+findex: org-ascii-convert-region-to-utf8
  16872   #+findex: org-export-region-to-utf8
  16873   Convert the selected region into UTF-8.
  16874 
  16875 - ~org-export-region-to-html~ ::
  16876 
  16877   #+findex: org-html-convert-region-to-html
  16878   #+findex: org-export-region-to-html
  16879   Convert the selected region into HTML.
  16880 
  16881 - ~org-export-region-to-latex~ ::
  16882 
  16883   #+findex: org-latex-convert-region-to-latex
  16884   #+findex: org-export-region-to-latex
  16885   Convert the selected region into LaTeX.
  16886 
  16887 - ~org-export-region-to-texinfo~ ::
  16888 
  16889   #+findex: org-texinfo-convert-region-to-texinfo
  16890   #+findex: org-export-region-to-texinfo
  16891   Convert the selected region into Texinfo.
  16892 
  16893 - ~org-export-region-to-md~ ::
  16894 
  16895   #+findex: org-md-convert-region-to-md
  16896   #+findex: org-export-region-to-md
  16897   Convert the selected region into Markdown.
  16898 
  16899 The in-place conversion is particularly handy for quick conversion of
  16900 tables and lists in non-Org buffers.  For example, in an HTML buffer,
  16901 write a list in Org syntax, select it, and convert it to HTML with
  16902 {{{kbd(M-x org-html-convert-region-to-html)}}}.
  16903 
  16904 * Publishing
  16905 :PROPERTIES:
  16906 :DESCRIPTION: Create a web site of linked Org files.
  16907 :END:
  16908 #+cindex: publishing
  16909 
  16910 Org includes a publishing management system that allows you to
  16911 configure automatic HTML conversion of /projects/ composed of
  16912 interlinked Org files.  You can also configure Org to automatically
  16913 upload your exported HTML pages and related attachments, such as
  16914 images and source code files, to a web server.
  16915 
  16916 You can also use Org to convert files into PDF, or even combine HTML
  16917 and PDF conversion so that files are available in both formats on the
  16918 server.
  16919 
  16920 Publishing has been contributed to Org by David O'Toole.
  16921 
  16922 ** Configuration
  16923 :PROPERTIES:
  16924 :DESCRIPTION: Defining projects.
  16925 :END:
  16926 Publishing needs significant configuration to specify files,
  16927 destination and many other properties of a project.
  16928 
  16929 *** The variable ~org-publish-project-alist~
  16930 :PROPERTIES:
  16931 :DESCRIPTION: The central configuration variable.
  16932 :ALT_TITLE: Project alist
  16933 :END:
  16934 #+cindex: projects, for publishing
  16935 
  16936 #+vindex: org-publish-project-alist
  16937 Publishing is configured almost entirely through setting the value of
  16938 one variable, called ~org-publish-project-alist~.  Each element of the
  16939 list configures one project, and may be in one of the two following
  16940 forms:
  16941 
  16942 #+begin_src emacs-lisp
  16943 ("project-name" :property value :property value ...)
  16944 #+end_src
  16945 
  16946 #+texinfo: @noindent
  16947 i.e., a well-formed property list with alternating keys and values,
  16948 or:
  16949 
  16950 #+begin_src emacs-lisp
  16951 ("project-name" :components ("project-name" "project-name" ...))
  16952 #+end_src
  16953 
  16954 In both cases, projects are configured by specifying property values.
  16955 A project defines the set of files that are to be published, as well
  16956 as the publishing configuration to use when publishing those files.
  16957 When a project takes the second form listed above, the individual
  16958 members of the ~:components~ property are taken to be sub-projects,
  16959 which group together files requiring different publishing options.
  16960 When you publish such a "meta-project", all the components are also
  16961 published, in the sequence given.
  16962 
  16963 *** Sources and destinations for files
  16964 :PROPERTIES:
  16965 :DESCRIPTION: From here to there.
  16966 :ALT_TITLE: Sources and destinations
  16967 :END:
  16968 #+cindex: directories, for publishing
  16969 
  16970 Most properties are optional, but some should always be set.  In
  16971 particular, Org needs to know where to look for source files, and
  16972 where to put published files.
  16973 
  16974 - ~:base-directory~ ::
  16975 
  16976   Directory containing publishing source files.
  16977 
  16978 - ~:publishing-directory~ ::
  16979 
  16980   Directory where output files are published.  You can directly
  16981   publish to a webserver using a file name syntax appropriate for the
  16982   Emacs tramp package.  Or you can publish to a local directory and
  16983   use external tools to upload your website (see [[*Uploading Files]]).
  16984 
  16985 - ~:preparation-function~ ::
  16986 
  16987   Function or list of functions to be called before starting the
  16988   publishing process, for example, to run =make= for updating files to
  16989   be published.  Each preparation function is called with a single
  16990   argument, the project property list.
  16991 
  16992 - ~:completion-function~ ::
  16993 
  16994   Function or list of functions called after finishing the publishing
  16995   process, for example, to change permissions of the resulting files.
  16996   Each completion function is called with a single argument, the
  16997   project property list.
  16998 
  16999 *** Selecting files
  17000 :PROPERTIES:
  17001 :DESCRIPTION: What files are part of the project?
  17002 :END:
  17003 #+cindex: files, selecting for publishing
  17004 
  17005 By default, all files with extension =.org= in the base directory are
  17006 considered part of the project.  This can be modified by setting the
  17007 following properties
  17008 
  17009 - ~:base-extension~ ::
  17010 
  17011   Extension---without the dot---of source files.  This actually is
  17012   a regular expression.  Set this to the symbol ~any~ if you want to
  17013   get all files in ~:base-directory~, even without extension.
  17014 
  17015 - ~:exclude~ ::
  17016 
  17017   Regular expression to match file names that should not be published,
  17018   even though they have been selected on the basis of their extension.
  17019 
  17020 - ~:include~ ::
  17021 
  17022   List of files to be included regardless of ~:base-extension~ and
  17023   ~:exclude~.
  17024 
  17025 - ~:recursive~ ::
  17026 
  17027   Non-~nil~ means, check base-directory recursively for files to
  17028   publish.
  17029 
  17030 *** Publishing action
  17031 :PROPERTIES:
  17032 :DESCRIPTION: Setting the function doing the publishing.
  17033 :END:
  17034 #+cindex: action, for publishing
  17035 
  17036 Publishing means that a file is copied to the destination directory
  17037 and possibly transformed in the process.  The default transformation
  17038 is to export Org files as HTML files, and this is done by the function
  17039 ~org-html-publish-to-html~ which calls the HTML exporter (see [[*HTML
  17040 Export]]).  But you can also publish your content as PDF files using
  17041 ~org-latex-publish-to-pdf~, or as ASCII, Texinfo, etc., using the
  17042 corresponding functions.
  17043 
  17044 If you want to publish the Org file as an =.org= file but with
  17045 /archived/, /commented/, and /tag-excluded/ trees removed, use
  17046 ~org-org-publish-to-org~.  This produces =file.org= and puts it in the
  17047 publishing directory.  If you want a htmlized version of this file,
  17048 set the parameter ~:htmlized-source~ to ~t~.  It produces
  17049 =file.org.html= in the publishing directory[fn:: If the publishing
  17050 directory is the same as the source directory, =file.org= is exported
  17051 as =file.org.org=, so you probably do not want to do this.].
  17052 
  17053 Other files like images only need to be copied to the publishing
  17054 destination; for this you can use ~org-publish-attachment~.  For
  17055 non-Org files, you always need to specify the publishing function:
  17056 
  17057 - ~:publishing-function~ ::
  17058 
  17059   Function executing the publication of a file.  This may also be
  17060   a list of functions, which are all called in turn.
  17061 
  17062 - ~:htmlized-source~ ::
  17063 
  17064   Non-~nil~ means, publish htmlized source.
  17065 
  17066 The function must accept three arguments: a property list containing
  17067 at least a ~:publishing-directory~ property, the name of the file to
  17068 be published, and the path to the publishing directory of the output
  17069 file.  It should take the specified file, make the necessary
  17070 transformation, if any, and place the result into the destination
  17071 folder.
  17072 
  17073 *** Options for the exporters
  17074 :PROPERTIES:
  17075 :DESCRIPTION: Tweaking HTML/@LaTeX{} export.
  17076 :ALT_TITLE: Publishing options
  17077 :END:
  17078 #+cindex: options, for publishing
  17079 #+cindex: publishing options
  17080 
  17081 The property list can be used to set many export options for the HTML
  17082 and LaTeX exporters.  In most cases, these properties correspond to
  17083 user variables in Org.  The table below lists these properties along
  17084 with the variable they belong to.  See the documentation string for
  17085 the respective variable for details.
  17086 
  17087 #+vindex: org-publish-project-alist
  17088 When a property is given a value in ~org-publish-project-alist~, its
  17089 setting overrides the value of the corresponding user variable, if
  17090 any, during publishing.  Options set within a file (see [[*Export
  17091 Settings]]), however, override everything.
  17092 
  17093 **** Generic properties
  17094 :PROPERTIES:
  17095 :UNNUMBERED: notoc
  17096 :END:
  17097 
  17098 #+NAME: org-manual-get-export-props-customizations
  17099 #+begin_src emacs-lisp :exports none :results table
  17100 (require 'ox)
  17101 (let (result)
  17102   (dolist (spec alist)
  17103     (when (and (nth 3 spec) (symbolp (nth 3 spec))) ; has customization
  17104       (push (list (format "~%s~" (car spec)) (format "~%s~" (nth 3 spec))) result)))
  17105   (nreverse result))
  17106 #+end_src
  17107 
  17108 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17109 (require 'ox)
  17110 (let ((alist org-export-options-alist))
  17111 <<org-manual-get-export-props-customizations>>
  17112 )
  17113 #+end_src
  17114 
  17115 
  17116 **** ASCII specific properties
  17117 :PROPERTIES:
  17118 :UNNUMBERED: notoc
  17119 :END:
  17120 
  17121 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17122 (require 'ox-ascii)
  17123 (let ((alist (org-export-backend-options (org-export-get-backend 'ascii))))
  17124 <<org-manual-get-export-props-customizations>>
  17125 )
  17126 #+end_src
  17127 
  17128 **** Beamer specific properties
  17129 :PROPERTIES:
  17130 :UNNUMBERED: notoc
  17131 :END:
  17132 
  17133 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17134 (require 'ox-beamer)
  17135 (let ((alist (org-export-backend-options (org-export-get-backend 'beamer))))
  17136 <<org-manual-get-export-props-customizations>>
  17137 )
  17138 #+end_src
  17139 
  17140 **** HTML specific properties
  17141 :PROPERTIES:
  17142 :UNNUMBERED: notoc
  17143 :END:
  17144 
  17145 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17146 (require 'ox-html)
  17147 (let ((alist (org-export-backend-options (org-export-get-backend 'html))))
  17148 <<org-manual-get-export-props-customizations>>
  17149 )
  17150 #+end_src
  17151 
  17152 **** LaTeX specific properties
  17153 :PROPERTIES:
  17154 :UNNUMBERED: notoc
  17155 :END:
  17156 
  17157 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17158 (require 'ox-latex)
  17159 (let ((alist (org-export-backend-options (org-export-get-backend 'latex))))
  17160 <<org-manual-get-export-props-customizations>>
  17161 )
  17162 #+end_src
  17163 
  17164 **** Markdown specific properties
  17165 :PROPERTIES:
  17166 :UNNUMBERED: notoc
  17167 :END:
  17168 
  17169 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17170 (require 'ox-md)
  17171 (let ((alist (org-export-backend-options (org-export-get-backend 'md))))
  17172 <<org-manual-get-export-props-customizations>>
  17173 )
  17174 #+end_src
  17175 
  17176 **** ODT specific properties
  17177 :PROPERTIES:
  17178 :UNNUMBERED: notoc
  17179 :END:
  17180 
  17181 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17182 (require 'ox-odt)
  17183 (let ((alist (org-export-backend-options (org-export-get-backend 'odt))))
  17184 <<org-manual-get-export-props-customizations>>
  17185 )
  17186 #+end_src
  17187 
  17188 **** Texinfo specific properties
  17189 :PROPERTIES:
  17190 :UNNUMBERED: notoc
  17191 :END:
  17192 
  17193 #+begin_src emacs-lisp :exports results :results table :eval yes :noweb yes
  17194 (require 'ox-texinfo)
  17195 (let ((alist (org-export-backend-options (org-export-get-backend 'texinfo))))
  17196 <<org-manual-get-export-props-customizations>>
  17197 )
  17198 #+end_src
  17199 
  17200 *** Publishing links
  17201 :PROPERTIES:
  17202 :DESCRIPTION: Which links keep working after publishing?
  17203 :END:
  17204 #+cindex: links, publishing
  17205 
  17206 To create a link from one Org file to another, you would use something
  17207 like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see
  17208 [[*External Links]]).  When published, this link becomes a link to
  17209 =foo.html=.  You can thus interlink the pages of your "Org web"
  17210 project and the links will work as expected when you publish them to
  17211 HTML.  If you also publish the Org source file and want to link to it,
  17212 use an =http= link instead of a =file:= link, because =file= links are
  17213 converted to link to the corresponding =.html= file.
  17214 
  17215 Links to encrypted Org files, like =[[file:foo.org.gpg]]= are also
  17216 supported.
  17217 
  17218 You may also link to related files, such as images.  Provided you are
  17219 careful with relative file names, and provided you have also
  17220 configured Org to upload the related files, these links will work too.
  17221 See [[*Example: complex publishing configuration]], for an example of this
  17222 usage.
  17223 
  17224 Links between published documents can contain some search options (see
  17225 [[*Search Options in File Links]]), which will be resolved to the
  17226 appropriate location in the linked file.  For example, once published
  17227 to HTML, the following links all point to a dedicated anchor in
  17228 =foo.html=.
  17229 
  17230 #+begin_example
  17231 [[file:foo.org::*heading]]
  17232 [[file:foo.org::#custom-id]]
  17233 [[file:foo.org::target]]
  17234 #+end_example
  17235 
  17236 *** Generating a sitemap
  17237 :PROPERTIES:
  17238 :DESCRIPTION: Generating a list of all pages.
  17239 :ALT_TITLE: Site map
  17240 :END:
  17241 #+cindex: sitemap, of published pages
  17242 
  17243 #+vindex: org-publish-project-alist
  17244 The following properties may be used to control publishing of
  17245 a map of files for a given project.
  17246 
  17247 - ~:auto-sitemap~ ::
  17248 
  17249   When non-~nil~, publish a sitemap during
  17250   ~org-publish-current-project~ or ~org-publish-all~.
  17251 
  17252 - ~:sitemap-filename~ ::
  17253 
  17254   Filename for output of sitemap.  Defaults to =sitemap.org=, which
  17255   becomes =sitemap.html=.
  17256 
  17257 - ~:sitemap-title~ ::
  17258 
  17259   Title of sitemap page.  Defaults to name of file.
  17260 
  17261 - ~:sitemap-style~ ::
  17262 
  17263     Can be ~list~ (site-map is just an itemized list of the titles of
  17264     the files involved) or ~tree~ (the directory structure of the
  17265     source files is reflected in the site-map).  Defaults to ~tree~.
  17266 
  17267 - ~:sitemap-format-entry~ ::
  17268 
  17269   #+findex: org-publish-find-date
  17270   #+findex: org-publish-find-property
  17271   #+findex: org-publish-find-title
  17272   With this option one can tell how a site-map entry is formatted in
  17273   the site-map.  It is a function called with three arguments: the
  17274   file or directory name relative to base directory of the project,
  17275   the site-map style and the current project.  It is expected to
  17276   return a string.  Default value turns file names into links and use
  17277   document titles as descriptions.  For specific formatting needs, one
  17278   can use ~org-publish-find-date~, ~org-publish-find-title~ and
  17279   ~org-publish-find-property~, to retrieve additional information
  17280   about published documents.
  17281 
  17282 - ~:sitemap-function~ ::
  17283 
  17284   Plug-in function to use for generation of the sitemap.  It is called
  17285   with two arguments: the title of the site-map and a representation
  17286   of the files and directories involved in the project as a nested
  17287   list, which can further be transformed using ~org-list-to-generic~,
  17288   ~org-list-to-subtree~ and alike.  Default value generates a plain
  17289   list of links to all files in the project.
  17290 
  17291 - ~:sitemap-sort-folders~ ::
  17292 
  17293   Where folders should appear in the sitemap.  Set this to ~first~
  17294   (default) or ~last~ to display folders first or last, respectively.
  17295   When set to ~ignore~, folders are ignored altogether.  Any other
  17296   value mixes files and folders.  This variable has no effect when
  17297   site-map style is ~tree~.
  17298 
  17299 - ~:sitemap-sort-files~ ::
  17300 
  17301   How the files are sorted in the site map.  Set this to
  17302   ~alphabetically~ (default), ~chronologically~ or
  17303   ~anti-chronologically~.  ~chronologically~ sorts the files with
  17304   older date first while ~anti-chronologically~ sorts the files with
  17305   newer date first.  ~alphabetically~ sorts the files alphabetically.
  17306   The date of a file is retrieved with ~org-publish-find-date~.
  17307 
  17308 - ~:sitemap-ignore-case~ ::
  17309 
  17310   Should sorting be case-sensitive?  Default ~nil~.
  17311 
  17312 *** Generating an index
  17313 :PROPERTIES:
  17314 :DESCRIPTION: An index that reaches across pages.
  17315 :END:
  17316 #+cindex: index, in a publishing project
  17317 
  17318 Org mode can generate an index across the files of a publishing project.
  17319 
  17320 - ~:makeindex~ ::
  17321 
  17322   When non-~nil~, generate in index in the file =theindex.org= and
  17323   publish it as =theindex.html=.
  17324 
  17325 The file is created when first publishing a project with the
  17326 ~:makeindex~ set.  The file only contains a statement =#+INCLUDE:
  17327 "theindex.inc"=.  You can then build around this include statement by
  17328 adding a title, style information, etc.
  17329 
  17330 #+cindex: @samp{INDEX}, keyword
  17331 Index entries are specified with =INDEX= keyword.  An entry that
  17332 contains an exclamation mark creates a sub item.
  17333 
  17334 #+begin_example
  17335 ,*** Curriculum Vitae
  17336 ,#+INDEX: CV
  17337 ,#+INDEX: Application!CV
  17338 #+end_example
  17339 
  17340 ** Uploading Files
  17341 :PROPERTIES:
  17342 :DESCRIPTION: How to get files up on the server.
  17343 :END:
  17344 #+cindex: rsync
  17345 #+cindex: unison
  17346 
  17347 For those people already utilizing third party sync tools such as
  17348 Rsync or Unison, it might be preferable not to use the built-in remote
  17349 publishing facilities of Org mode which rely heavily on Tramp.  Tramp,
  17350 while very useful and powerful, tends not to be so efficient for
  17351 multiple file transfer and has been known to cause problems under
  17352 heavy usage.
  17353 
  17354 Specialized synchronization utilities offer several advantages.  In
  17355 addition to timestamp comparison, they also do content and
  17356 permissions/attribute checks.  For this reason you might prefer to
  17357 publish your web to a local directory---possibly even /in place/ with
  17358 your Org files---and then use Unison or Rsync to do the
  17359 synchronization with the remote host.
  17360 
  17361 Since Unison, for example, can be configured as to which files to
  17362 transfer to a certain remote destination, it can greatly simplify the
  17363 project publishing definition.  Simply keep all files in the correct
  17364 location, process your Org files with ~org-publish~ and let the
  17365 synchronization tool do the rest.  You do not need, in this scenario,
  17366 to include attachments such as JPG, CSS or PNG files in the project
  17367 definition since the third-party tool syncs them.
  17368 
  17369 Publishing to a local directory is also much faster than to a remote
  17370 one, so that you can afford more easily to republish entire projects.
  17371 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
  17372 main benefit of re-including any changed external files such as source
  17373 example files you might include with =INCLUDE= keyword.  The timestamp
  17374 mechanism in Org is not smart enough to detect if included files have
  17375 been modified.
  17376 
  17377 ** Sample Configuration
  17378 :PROPERTIES:
  17379 :DESCRIPTION: Example projects.
  17380 :END:
  17381 
  17382 Below we provide two example configurations.  The first one is
  17383 a simple project publishing only a set of Org files.  The second
  17384 example is more complex, with a multi-component project.
  17385 
  17386 *** Example: simple publishing configuration
  17387 :PROPERTIES:
  17388 :DESCRIPTION: One-component publishing.
  17389 :ALT_TITLE: Simple example
  17390 :END:
  17391 
  17392 This example publishes a set of Org files to the =public_html=
  17393 directory on the local machine.
  17394 
  17395 #+begin_src emacs-lisp
  17396 (setq org-publish-project-alist
  17397       '(("org"
  17398          :base-directory "~/org/"
  17399          :publishing-function org-html-publish-to-html
  17400          :publishing-directory "~/public_html"
  17401          :section-numbers nil
  17402          :with-toc nil
  17403          :html-head "<link rel=\"stylesheet\"
  17404                     href=\"../other/mystyle.css\"
  17405                     type=\"text/css\"/>")))
  17406 #+end_src
  17407 
  17408 *** Example: complex publishing configuration
  17409 :PROPERTIES:
  17410 :DESCRIPTION: A multi-component publishing example.
  17411 :ALT_TITLE: Complex example
  17412 :END:
  17413 
  17414 This more complicated example publishes an entire website, including
  17415 Org files converted to HTML, image files, Emacs Lisp source code, and
  17416 style sheets.  The publishing directory is remote and private files
  17417 are excluded.
  17418 
  17419 To ensure that links are preserved, care should be taken to replicate
  17420 your directory structure on the web server, and to use relative file
  17421 paths.  For example, if your Org files are kept in =~/org/= and your
  17422 publishable images in =~/images/=, you would link to an image with
  17423 
  17424 : file:../images/myimage.png
  17425 
  17426 On the web server, the relative path to the image should be the same.
  17427 You can accomplish this by setting up an =images/= folder in the right
  17428 place on the web server, and publishing images to it.
  17429 
  17430 #+begin_src emacs-lisp
  17431 (setq org-publish-project-alist
  17432       `(("orgfiles"
  17433          :base-directory "~/org/"
  17434          :base-extension "org"
  17435          :publishing-directory "/ssh:user@host:~/html/notebook/"
  17436          :publishing-function org-html-publish-to-html
  17437          :exclude ,(rx (or "PrivateFile.org" (seq line-start "private/"))) ;; regexp
  17438          :headline-levels 3
  17439          :section-numbers nil
  17440          :with-toc nil
  17441          :html-head "<link rel=\"stylesheet\"
  17442                   href=\"../other/mystyle.css\" type=\"text/css\"/>"
  17443          :html-preamble t)
  17444 
  17445         ("images"
  17446          :base-directory "~/images/"
  17447          :base-extension "jpg\\|gif\\|png"
  17448          :publishing-directory "/ssh:user@host:~/html/images/"
  17449          :publishing-function org-publish-attachment)
  17450 
  17451         ("other"
  17452          :base-directory "~/other/"
  17453          :base-extension "css\\|el"
  17454          :publishing-directory "/ssh:user@host:~/html/other/"
  17455          :publishing-function org-publish-attachment)
  17456         ("website" :components ("orgfiles" "images" "other"))))
  17457 #+end_src
  17458 
  17459 ** Triggering Publication
  17460 :PROPERTIES:
  17461 :DESCRIPTION: Publication commands.
  17462 :END:
  17463 
  17464 Once properly configured, Org can publish with the following commands:
  17465 
  17466 - {{{kbd(C-c C-e P x)}}} (~org-publish~) ::
  17467 
  17468   #+kindex: C-c C-e P x
  17469   #+findex: org-publish
  17470   Prompt for a specific project and publish all files that belong to
  17471   it.
  17472 
  17473 - {{{kbd(C-c C-e P p)}}} (~org-publish-current-project~) ::
  17474 
  17475   #+kindex: C-c C-e P p
  17476   #+findex: org-publish-current-project
  17477   Publish the project containing the current file.
  17478 
  17479 - {{{kbd(C-c C-e P f)}}} (~org-publish-current-file~) ::
  17480 
  17481   #+kindex: C-c C-e P f
  17482   #+findex: org-publish-current-file
  17483   Publish only the current file.
  17484 
  17485 - {{{kbd(C-c C-e P a)}}} (~org-publish-all~) ::
  17486 
  17487   #+kindex: C-c C-e P a
  17488   #+findex: org-publish-all
  17489   Publish every project.
  17490 
  17491 #+vindex: org-publish-use-timestamps-flag
  17492 Org uses timestamps to track when a file has changed.  The above
  17493 functions normally only publish changed files.  You can override this
  17494 and force publishing of all files by giving a prefix argument to any
  17495 of the commands above, or by customizing the variable
  17496 ~org-publish-use-timestamps-flag~.  This may be necessary in
  17497 particular if files include other files via =SETUPFILE= or =INCLUDE=
  17498 keywords.
  17499 
  17500 * Citation handling
  17501 :PROPERTIES:
  17502 :DESCRIPTION: create, follow and export citations.
  17503 :END:
  17504 #+cindex: citation
  17505 #+cindex: citation processor
  17506 
  17507 While links (see [[*Hyperlinks]]) are often sufficient to refer to
  17508 external or internal information from Org, they have their limitations
  17509 when referring to multiple targets or typesetting printed
  17510 publications.
  17511 
  17512 Org mode provides a more sophisticated markup to "cite" external
  17513 resources.  For example, consider the following Org mode snippet
  17514 
  17515 : #+bibliography: citationdata.bib
  17516 :
  17517 : Org mode is used by various communities [cite:teaching: @orgteaching;
  17518 : and TeX: @orgtex].  [cite/author/caps:@orgtex] uses Org mode to simplify
  17519 : writing scientific publications, while [cite/author/caps:@orgteaching]
  17520 : experiment with Org babel to improve teaching.
  17521 :
  17522 : #+print_bibliography:
  17523 
  17524 Org mode will gather citation metadata from the =#+bibliography=
  17525 database and use it to typeset the exported document in arbitrary
  17526 formats.  For example, the snippet below shows ASCII export output.
  17527 
  17528 : Org mode is used by various communities (teaching: Birkenkrahe, Marcus,
  17529 : 2023, and TeX: Somma, Emmanuele F, 2023).  Somma, Emmanuele F uses Org
  17530 : mode to simplify writing scientific publications, while Birkenkrahe,
  17531 : Marcus experiment with Org babel to improve teaching.
  17532 :
  17533 : Birkenkrahe, Marcus (2023). /Teaching Data Science with Literate
  17534 : Programming Tools/, MDPI.
  17535 :
  17536 : Somma, Emmanuele F (2023). /Simplifying LaTeX with ORG-mode in Emacs/,
  17537 : TUGboat volume.
  17538 
  17539 In addition to export, users can use completion to search and insert
  17540 citations from the bibliography (via ~org-cite-insert~).  Citations
  17541 also act like ordinary links, jumping to the citation metadata when
  17542 "following" them using ~org-open-at-point~.
  17543 
  17544 You can customize every aspect (/capability/) of citation handling
  17545 using built-in or external /citation processors/.
  17546 
  17547 Org mode ships with several built-in citation processors tailored to
  17548 work with LaTeX export and BibTeX bibliographies (=bibtex=,
  17549 =biblatex=, and =natbib= processors), or with more generic formats
  17550 described using [[https://citationstyles.org/][Citation Style
  17551 Language]] (=csl= processor).
  17552 The default citation processor is =basic= - it works with arbitrary
  17553 export formats and recognizes both BibTeX and CSL bibliographies.
  17554 More citation processors are distributed as Emacs packages.
  17555 
  17556 #+vindex: org-cite-activate-processor
  17557 #+vindex: org-cite-follow-processor
  17558 #+vindex: org-cite-insert-processor
  17559 #+vindex: org-cite-export-processor
  17560 Multiple citation processors can be mixed to meet your preferences.
  17561 Configure ~org-cite-activate-processor~, ~org-cite-follow-processor~,
  17562 ~org-cite-insert-processor~, and ~org-cite-export-processors~ to
  17563 select which processor to use for every citation capability:
  17564 
  17565 - activate :: Fontification, tooltip preview, etc.
  17566 - follow :: At-point actions on citations via ~org-open-at-point~.
  17567 - insert :: Add and edit citations via ~org-cite-insert~.
  17568 - export :: Via different libraries for different target formats.
  17569 
  17570 ** Citations
  17571 
  17572 #+cindex: bibliography
  17573 
  17574 #+vindex: org-cite-global-bibliography
  17575 Before adding citations, first set one-or-more bibliographies, either
  17576 globally with ~org-cite-global-bibliography~, or locally using one or
  17577 more "bibliography" keywords.
  17578 
  17579 #+cindex: @samp{BIBLIOGRAPHY}, keyword
  17580 #+begin_example
  17581 #+bibliography: SomeFile.bib
  17582 #+bibliography: /some/other/file.json
  17583 #+bibliography: "/some/file/with spaces/in its name.bib"
  17584 #+end_example
  17585 
  17586 Org mode uses all the local and global bibliographies combined to
  17587 search for citation keys.
  17588 
  17589 #+kindex: C-c C-x @@
  17590 #+findex: org-cite-insert
  17591 One can then insert and edit citations using ~org-cite-insert~, called
  17592 with {{{kbd(C-c C-x @)}}}.
  17593 
  17594 A /citation/ requires one or more citation /key(s)/, elements
  17595 identifying a reference in the bibliography.
  17596 
  17597 - Each citation is surrounded by brackets and uses the =cite= type.
  17598 
  17599 - Each key starts with the character =@=.
  17600 
  17601   : [cite:@key]
  17602 
  17603 - Each key can be qualified by a /prefix/ (e.g.\nbsp{}"see ") and/or
  17604   a /suffix/ (e.g.\nbsp{}"p.\nbsp{}123"), giving information useful or necessary
  17605   for the comprehension of the citation but not included in the
  17606   reference.
  17607 
  17608   : [cite:see @key p. 123]
  17609 
  17610 - A single citation can cite more than one reference ; the keys are
  17611   separated by semicolons ; the formatting of such citation groups is
  17612   specified by the style.
  17613 
  17614   : [cite:@key1;@key2;@key3]
  17615 
  17616 - One can also specify a stylistic variation for the citations by
  17617   inserting a =/= and a style name between the =cite= keyword and the
  17618   colon; this usually makes sense only for the author-year styles.
  17619 
  17620   : [cite/style:common prefix ;prefix @key suffix; ... ; common suffix]
  17621 
  17622   When =style= is not specified, one of the two default styles are
  17623   used
  17624 
  17625   + either the default style specified in the =CITE_EXPORT= keyword
  17626     (see [[*Citation export processors]])
  17627 
  17628     : #+cite_export: basic numeric noauthor/bare
  17629     : [cite:@key] is the same as [cite/noauthor/bare:@key]
  17630 
  17631   + or, if =CITE_EXPORT= is not set, using the default =nil= style
  17632 
  17633     : [cite:@key] is the same as [cite/nil:@key]
  17634 
  17635 
  17636 The only mandatory elements are:
  17637 
  17638 - The =cite= keyword and the colon.
  17639 - The =@= character immediately preceding each key.
  17640 - The brackets surrounding the citation(s) (group).
  17641 
  17642 ** Citation export processors
  17643 
  17644 Org currently includes the following export processors:
  17645 
  17646 - Two processors can export to a variety of formats, including =latex=
  17647   (and therefore =pdf=), =html=, =odt= and plain (UTF8) text:
  17648 
  17649   - basic :: a basic export processor, well adapted to situations
  17650     where backward compatibility is not a requirement and formatting
  17651     needs are minimal;
  17652 
  17653   - csl :: this export processor uses format files written in
  17654     [[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation
  17655     Style Language]] via
  17656     [[https://github.com/andras-simonyi/citeproc-el][citeproc-el]];
  17657 
  17658 - In contrast, three other processors target LaTeX and LaTeX-derived
  17659   formats exclusively:
  17660 
  17661   - bibtex :: this export processor uses BibTeX, the historical
  17662     bibliographic processor used with LaTeX, thus allowing the use of
  17663     data and style files compatible with this processor (including a
  17664     large number of publishers' styles).  It only supports LaTeX's
  17665     =\cite= and =\nocite= commands.
  17666 
  17667   - natbib :: as with the bibtex processor, but using the LaTeX
  17668     package =natbib=, allowing more stylistic variants that LaTeX's
  17669     =\cite= command.
  17670 
  17671   - biblatex :: this backend allows the use of data and formats
  17672     prepared for BibLaTeX, an alternate bibliographic processor used
  17673     with LaTeX, which overcomes some serious BibTeX limitations, but
  17674     has not (yet?)\nbsp{}been widely adopted by publishers.
  17675 
  17676 #+cindex: @samp{CITE_EXPORT}, keyword
  17677 The =CITE_EXPORT= keyword specifies the export processor, citation
  17678 style, and bibliography style; for example (all arguments are
  17679 optional)
  17680 
  17681 : #+cite_export: [export processor name] [bibliography style] [default citation style]
  17682 : #+cite_export: basic author-year author
  17683 
  17684 #+texinfo: @noindent
  17685 specifies the =basic= export processor with citations inserted as
  17686 author's name and references indexed by author's names and year;
  17687 
  17688 : #+cite_export: csl /some/path/to/vancouver-brackets.csl
  17689 
  17690 #+texinfo: @noindent
  17691 specifies the =csl= processor and CSL style, which in this case
  17692 defines numeric citations and numeric references according to the
  17693 =Vancouver= specification (as style used in many medical journals),
  17694 following a typesetting variation putting citations between brackets;
  17695 
  17696 : #+cite_export: natbib kluwer
  17697 
  17698 #+texinfo: @noindent
  17699 specifies the =natbib= export processor with a label citation style
  17700 conformant to the Harvard style and the specification of the
  17701 Wolkers-Kluwer publisher; since it relies on the ~bibtex~ processor of
  17702 your LaTeX installation, it won't export to anything but PDF.
  17703 
  17704 : #+cite_export: biblatex numeric,backend=bibtex
  17705 
  17706 #+vindex: org-cite-biblatex-options
  17707 #+texinfo: @noindent
  17708 specifies the =biblatex= export processor with the default =numeric=
  17709 style and the =bibtex= backend.  Always define the style first and then
  17710 the rest of load-time options for the =biblatex=
  17711 package.  Alternatively, you can use the ~key=val,key=val~ format for
  17712 the options as documented in the =biblatex= package documentation:
  17713 
  17714 : #+cite_export: biblatex backend=bibtex,style=numeric
  17715 
  17716 The ~org-cite-biblatex-options~ variable in your Emacs configuration
  17717 uses this format.  It will only export to PDF, since it relies on the
  17718 ~biblatex~ processor of your LaTeX installation.
  17719 
  17720 ** Bibliography printing
  17721 
  17722 #+cindex: @samp{PRINT_BIBLIOGRAPHY}, keyword
  17723 The =PRINT_BIBLIOGRAPHY= keyword specifies where the bibliography
  17724 should be printed (note the colon):
  17725 
  17726 : #+print_bibliography:
  17727 
  17728 The bibliography printed by the LaTeX-based export processors
  17729 =bibtex=, =natbib= and =biblatex= has a chapter or section heading by
  17730 default, while the =basic= and =csl= processors print the list of
  17731 bibliography entries without a heading.
  17732 
  17733 A document may contain more than one =PRINT_BIBLIOGRAPHY= keywords.
  17734 Each of the keywords will trigger printing the bibliography.
  17735 
  17736 The keywords can be used with or without additional options.  Options
  17737 can be used, for example, to print only entries that belong to a
  17738 certain category or to control formatting.  The set of supported
  17739 =PRINT_BIBLIOGRAPHY= options and their interpretation varies between
  17740 the different citation export processors.  Some export processors do
  17741 not support passing options.
  17742 
  17743 *** Bibliography options in the =biblatex= and =csl= export processors
  17744 
  17745 The =biblatex= and =csl= export processors support bibliography
  17746 options through a property list attached to the =PRINT_BIBLIOGRAPHY=
  17747 keyword.  For example,
  17748 
  17749 : #+print_bibliography: :keyword algebra :type book
  17750 
  17751 Values including spaces must be surrounded with double quotes.  If you
  17752 need to use a key multiple times, you can separate its values with
  17753 commas, but without any space in-between:
  17754 
  17755 : #+print_bibliography: :keyword "algebraic logic" :nottype article,book
  17756 
  17757 The =biblatex= export processor accepts all options supported by
  17758 BibLaTeX's ~\printbibliography~ command.
  17759 
  17760 The =csl= processor accepts the following options:
  17761 
  17762 - =:keyword <keyword(,keyword2...)>= :: Print only entries whose
  17763   keyword field contains all given keywords.
  17764 
  17765 - =:notkeyword <keyword(,keyword2...)>= :: Print only entries whose
  17766   keyword field does not contain any of the given keywords.
  17767 
  17768 - =:type <entrytype>= :: Print only entries whose type is
  17769   =<entrytype>=.  Entry type is the BibTeX/BibLaTeX entry type if this
  17770   information is available (the entry was read from a BibTeX/BibLaTeX
  17771   bibliography) and the CSL entry type otherwise.
  17772 
  17773 - =:nottype <entrytype(,entrytype2...)>= :: Print only entries whose
  17774   type is not among the given entry types.  Entry type is determined
  17775   as in the case of =:type=.
  17776 
  17777 - =:csltype <entrytype>= :: Print only entries whose CSL entry type
  17778   (possibly based on a conversion from BibTeX/BibLaTeX to CSL) is
  17779   =<entrytype>=.
  17780 
  17781 - =:notcsltype <entrytype(,entrytype2...)>= :: Print only entries whose
  17782   CSL entry type (possibly based on a conversion from BibTeX/BibLaTeX
  17783   to CSL) is not among the listed entry types.
  17784 
  17785 - =:filter <predicate>= :: Print only entries for which the given
  17786   Emacs Lisp predicate returns a non-~nil~ value.
  17787 
  17788 * Working with Source Code
  17789 :PROPERTIES:
  17790 :DESCRIPTION: Export, evaluate, and tangle code blocks.
  17791 :END:
  17792 #+cindex: source code, working with
  17793 
  17794 Source code here refers to any plain text collection of computer
  17795 instructions, possibly with comments, written using a human-readable
  17796 programming language.  Org can manage source code in an Org document
  17797 when the source code is identified with begin and end markers.
  17798 Working with source code begins with identifying source code blocks.
  17799 A source code block can be placed almost anywhere in an Org document;
  17800 it is not restricted to the preamble or the end of the document.
  17801 However, Org cannot manage a source code block if it is placed inside
  17802 an Org comment or within a fixed width section.
  17803 
  17804 Here is an example source code block in the Emacs Lisp language:
  17805 
  17806 #+begin_example
  17807 ,#+BEGIN_SRC emacs-lisp
  17808   (defun org-xor (a b)
  17809      "Exclusive or."
  17810      (if a (not b) b))
  17811 ,#+END_SRC
  17812 #+end_example
  17813 
  17814 Source code blocks are one of many Org block types, which also include
  17815 "center", "comment", "dynamic", "example", "export", "quote",
  17816 "special", and "verse".  This section pertains to blocks between
  17817 =#+BEGIN_SRC= and =#+END_SRC=.
  17818 
  17819 Details of Org's facilities for working with source code are described
  17820 in the following sections.
  17821 
  17822 ** Features Overview
  17823 :PROPERTIES:
  17824 :DESCRIPTION: Enjoy the versatility of source blocks.
  17825 :END:
  17826 
  17827 Org can manage the source code in the block delimited by =#+BEGIN_SRC=
  17828 ... =#+END_SRC= in several ways that can simplify housekeeping tasks
  17829 essential to modern source code maintenance.  Org can edit, format,
  17830 extract, export, and publish source code blocks.  Org can also compile
  17831 and execute a source code block, then capture the results.  The Org
  17832 mode literature sometimes refers to source code blocks as /live code/
  17833 blocks because they can alter the content of the Org document or the
  17834 material that it exports.  Users can control the "liveliness" of each
  17835 source code block by tweaking the header arguments (see [[*Using Header
  17836 Arguments]]) for compiling, execution, extraction, and exporting.
  17837 
  17838 For editing and formatting a source code block, Org uses an
  17839 appropriate Emacs major mode that includes features specifically
  17840 designed for source code in that language.
  17841 
  17842 Org can extract one or more source code blocks and write them to one
  17843 or more source files---a process known as /tangling/ in literate
  17844 programming terminology.
  17845 
  17846 For exporting and publishing, Org's backends can format a source code
  17847 block appropriately, often with native syntax highlighting.
  17848 
  17849 For executing and compiling a source code block, the user can
  17850 configure Org to select the appropriate compiler.  Org provides
  17851 facilities to collect the result of the execution or compiler output,
  17852 insert it into the Org document, and/or export it.  In addition to
  17853 text results, Org can insert links to other data types, including
  17854 audio, video, and graphics.  Org can also link a compiler error
  17855 message to the appropriate line in the source code block.
  17856 
  17857 An important feature of Org's management of source code blocks is the
  17858 ability to pass variables, functions, and results to one another using
  17859 a common syntax for source code blocks in any language.  Although most
  17860 literate programming facilities are restricted to one language or
  17861 another, Org's language-agnostic approach lets the literate programmer
  17862 match each programming task with the appropriate computer language and
  17863 to mix them all together in a single Org document.  This
  17864 interoperability among languages explains why Org's source code
  17865 management facility was named /Org Babel/ by its originators, Eric
  17866 Schulte and Dan Davison.
  17867 
  17868 Org mode fulfills the promise of easy verification and maintenance of
  17869 publishing reproducible research by keeping text, data, code,
  17870 configuration settings of the execution environment, the results of
  17871 the execution, and associated narratives, claims, references, and
  17872 internal and external links in a single Org document.
  17873 
  17874 ** Structure of Code Blocks
  17875 :PROPERTIES:
  17876 :DESCRIPTION: Code block syntax described.
  17877 :END:
  17878 #+cindex: code block, structure
  17879 #+cindex: source code, block structure
  17880 #+cindex: @samp{NAME} keyword, in source blocks
  17881 #+cindex: @samp{BEGIN_SRC}
  17882 
  17883 Org offers two ways to structure source code in Org documents: in
  17884 a source code block, and directly inline.  Both specifications are
  17885 shown below.
  17886 
  17887 A source code block conforms to this structure:
  17888 
  17889 #+begin_example
  17890 ,#+NAME: <name>
  17891 ,#+BEGIN_SRC <language> <switches> <header arguments>
  17892   <body>
  17893 ,#+END_SRC
  17894 #+end_example
  17895 
  17896 Do not be put-off by having to remember the source block syntax.  Org
  17897 mode offers a command for wrapping existing text in a block (see
  17898 [[*Structure Templates]]).  Org also works with other completion systems
  17899 in Emacs, some of which predate Org and have custom domain-specific
  17900 languages for defining templates.  Regular use of templates reduces
  17901 errors, increases accuracy, and maintains consistency.
  17902 
  17903 #+cindex: source code, inline
  17904 An inline code block conforms to this structure:
  17905 
  17906 : src_<language>{<body>}
  17907 
  17908 #+texinfo: @noindent
  17909 or
  17910 
  17911 : src_<language>[<header arguments>]{<body>}
  17912 
  17913 - =#+NAME: <name>= ::
  17914 
  17915   Optional.  Names the source block so it can be called, like
  17916   a function, from other source blocks or inline code to evaluate or
  17917   to capture the results.  Code from other blocks, other files, and
  17918   from table formulas (see [[*The Spreadsheet]]) can use the name to
  17919   reference a source block.  This naming serves the same purpose as
  17920   naming Org tables.  Org mode requires unique names.  For duplicate
  17921   names, Org mode's behavior is undefined.  Inline code blocks cannot
  17922   have a name.
  17923 
  17924 - =#+BEGIN_SRC= ... =#+END_SRC= ::
  17925 
  17926   Mandatory.  They mark the start and end of a block that Org
  17927   requires.  The =#+BEGIN_SRC= line takes additional arguments, as
  17928   described next.
  17929 
  17930 - =<language>= ::
  17931 
  17932   #+cindex: language, in code blocks
  17933   Optional.  It is the identifier of the source code language in the
  17934   block.  See [[*Languages]], for identifiers of supported languages.
  17935 
  17936   When =<language>= identifier is omitted, the block also cannot
  17937   have =<switches>= and =<header arguments>=.
  17938 
  17939   Language identifier is also used to fontify code blocks in Org
  17940   buffers, when ~org-src-fontify-natively~ is set to non-~nil~.  See
  17941   [[*Editing Source Code]].
  17942 
  17943 - =<switches>= ::
  17944 
  17945   #+cindex: switches, in code blocks
  17946   Optional.  Switches provide finer control of the code execution,
  17947   export, and format (see the discussion of switches in [[*Literal
  17948   Examples]]).
  17949 
  17950 - =<header arguments>= ::
  17951 
  17952   #+cindex: header arguments, in code blocks
  17953   Optional.  Heading arguments control many aspects of evaluation,
  17954   export and tangling of code blocks (see [[*Using Header Arguments]]).
  17955   Using Org's properties feature, header arguments can be selectively
  17956   applied to the entire buffer or specific subtrees of the Org
  17957   document.
  17958 
  17959 - =<body>= ::
  17960 
  17961   Source code in the dialect of the specified language identifier.
  17962 
  17963 ** Using Header Arguments
  17964 :PROPERTIES:
  17965 :DESCRIPTION: Different ways to set header arguments.
  17966 :END:
  17967 
  17968 Org comes with many header arguments common to all languages.  New
  17969 header arguments are added for specific languages as they become
  17970 available for use in source code blocks.  A header argument is
  17971 specified with an initial colon followed by the argument's name in
  17972 lowercase.
  17973 
  17974 Since header arguments can be set in several ways, Org prioritizes
  17975 them in case of overlaps or conflicts by giving local settings
  17976 a higher priority.  Header values in function calls, for example,
  17977 override header values from global defaults.
  17978 
  17979 *** System-wide header arguments
  17980 :PROPERTIES:
  17981 :UNNUMBERED: notoc
  17982 :END:
  17983 #+vindex: org-babel-default-header-args
  17984 
  17985 #+vindex: org-babel-default-header-args
  17986 System-wide values of header arguments can be specified by customizing
  17987 the ~org-babel-default-header-args~ variable, which defaults to the
  17988 following values:
  17989 
  17990 #+begin_example
  17991 :session    => "none"
  17992 :results    => "replace"
  17993 :exports    => "code"
  17994 :cache      => "no"
  17995 :noweb      => "no"
  17996 :hlines     => "no"
  17997 :tangle     => "no"
  17998 #+end_example
  17999 
  18000 #+vindex: org-babel-default-inline-header-args
  18001 Inline source blocks (see [[*Structure of Code Blocks]]) use slightly
  18002 different default header arguments defined in
  18003 ~org-babel-default-inline-header-args~:
  18004 
  18005 #+begin_example
  18006 :session    => "none"
  18007 :results    => "replace"
  18008 :exports    => "results"
  18009 :hlines     => "yes"
  18010 #+end_example
  18011 
  18012 The most notable difference between default header arguments for
  18013 inline and normal source blocks is =:exports= argument.  For inline
  18014 source blocks, results of evaluation are exported by default; not the
  18015 code.
  18016 
  18017 Unlike the default values, header arguments set using Org mode
  18018 properties (see [[*Header arguments in Org mode properties]]) do apply to
  18019 both the normal source blocks and inline source blocks.
  18020 
  18021 The example below sets =:noweb= header arguments to =yes=, which makes
  18022 Org expand =:noweb= references by default.
  18023 
  18024 #+begin_src emacs-lisp
  18025 (setq org-babel-default-header-args
  18026       (cons '(:noweb . "yes")
  18027             (assq-delete-all :noweb org-babel-default-header-args)))
  18028 #+end_src
  18029 
  18030 #+cindex: language specific default header arguments
  18031 #+cindex: default header arguments per language
  18032 Each language can have separate default header arguments by
  18033 customizing the variable ~org-babel-default-header-args:<LANG>~, where
  18034 {{{var(<LANG>)}}} is the name of the language.  For details, see the
  18035 language-specific online documentation at
  18036 https://orgmode.org/worg/org-contrib/babel/.
  18037 
  18038 *** Header arguments in Org mode properties
  18039 :PROPERTIES:
  18040 :UNNUMBERED: notoc
  18041 :END:
  18042 
  18043 For header arguments applicable to the buffer, use =PROPERTY= keyword
  18044 anywhere in the Org file (see [[*Property Syntax]]).
  18045 
  18046 The following example makes all the R code blocks execute in the same
  18047 session.  Setting =:results= to =silent= ignores the results of
  18048 executions for all blocks, not just R code blocks; no results inserted
  18049 for any block.
  18050 
  18051 #+begin_example
  18052 ,#+PROPERTY: header-args:R  :session *R*
  18053 ,#+PROPERTY: header-args    :results silent
  18054 #+end_example
  18055 
  18056 #+vindex: org-use-property-inheritance
  18057 Header arguments set through Org's property drawers (see [[*Property
  18058 Syntax]]) apply at the subtree level on down.  Since these property
  18059 drawers can appear anywhere in the file hierarchy, Org uses outermost
  18060 call or source block to resolve the values.  Org ignores
  18061 ~org-use-property-inheritance~ setting.
  18062 
  18063 In this example, =:cache= defaults to =yes= for all code blocks in the
  18064 subtree.
  18065 
  18066 #+begin_example
  18067 ,* sample header
  18068   :PROPERTIES:
  18069   :header-args:    :cache yes
  18070   :END:
  18071 #+end_example
  18072 
  18073 #+kindex: C-c C-x p
  18074 #+findex: org-set-property
  18075 Properties defined through ~org-set-property~ function, bound to
  18076 {{{kbd(C-c C-x p)}}}, apply to all active languages.  They override
  18077 properties set in ~org-babel-default-header-args~.
  18078 
  18079 #+cindex: language specific header arguments properties
  18080 #+cindex: header arguments per language
  18081 Language-specific header arguments are also read from properties
  18082 =header-args:<LANG>= where {{{var(<LANG>)}}} is the language
  18083 identifier.  For example,
  18084 
  18085 #+begin_example
  18086 ,* Heading
  18087   :PROPERTIES:
  18088   :header-args:clojure:    :session *clojure-1*
  18089   :header-args:R:          :session *R*
  18090   :END:
  18091 ,** Subheading
  18092   :PROPERTIES:
  18093   :header-args:clojure:    :session *clojure-2*
  18094   :END:
  18095 #+end_example
  18096 
  18097 #+texinfo: @noindent
  18098 would force separate sessions for Clojure blocks in =Heading= and
  18099 =Subheading=, but use the same session for all R blocks.  Blocks in
  18100 =Subheading= inherit settings from =Heading=.
  18101 
  18102 *** Code block specific header arguments
  18103 :PROPERTIES:
  18104 :UNNUMBERED: notoc
  18105 :END:
  18106 
  18107 Header arguments are most commonly set at the source code block level,
  18108 on the =#+BEGIN_SRC= line.  Arguments set at this level take
  18109 precedence over those set in the ~org-babel-default-header-args~
  18110 variable, and also those set as header properties.
  18111 
  18112 In the following example, setting =:results= to =silent= makes it
  18113 ignore results of the code execution.  Setting =:exports= to =code=
  18114 exports only the body of the code block to HTML or LaTeX.
  18115 
  18116 #+begin_example
  18117 ,#+NAME: factorial
  18118 ,#+BEGIN_SRC haskell :results silent :exports code :var n=0
  18119   fac 0 = 1
  18120   fac n = n * fac (n-1)
  18121 ,#+END_SRC
  18122 #+end_example
  18123 
  18124 The same header arguments in an inline code block:
  18125 
  18126 : src_haskell[:exports both]{fac 5}
  18127 
  18128 #+cindex: @samp{HEADER}, keyword
  18129 Code block header arguments can span multiple lines using =#+HEADER:=
  18130 on each line.  Note that Org currently accepts the plural spelling of
  18131 =#+HEADER:= only as a convenience for backward-compatibility.  It may
  18132 be removed at some point.
  18133 
  18134 Multi-line header arguments on an unnamed code block:
  18135 
  18136 #+begin_example
  18137 ,#+HEADER: :var data1=1
  18138 ,#+BEGIN_SRC emacs-lisp :var data2=2
  18139    (message "data1:%S, data2:%S" data1 data2)
  18140 ,#+END_SRC
  18141 
  18142 ,#+RESULTS:
  18143 : data1:1, data2:2
  18144 #+end_example
  18145 
  18146 Multi-line header arguments on a named code block:
  18147 
  18148 #+begin_example
  18149 ,#+NAME: named-block
  18150 ,#+HEADER: :var data=2
  18151 ,#+BEGIN_SRC emacs-lisp
  18152   (message "data:%S" data)
  18153 ,#+END_SRC
  18154 
  18155 ,#+RESULTS: named-block
  18156   : data:2
  18157 #+end_example
  18158 
  18159 *** Header arguments in function calls
  18160 :PROPERTIES:
  18161 :UNNUMBERED: notoc
  18162 :END:
  18163 
  18164 Header arguments in function calls are the most specific and override
  18165 all other settings in case of an overlap.  They get the highest
  18166 priority.  Two =#+CALL:= examples are shown below.  For the complete
  18167 syntax of =CALL= keyword, see [[*Evaluating Code Blocks]].
  18168 
  18169 In this example, =:exports results= header argument is applied to the
  18170 evaluation of the =#+CALL:= line.
  18171 
  18172 : #+CALL: factorial(n=5) :exports results
  18173 
  18174 In this example, =:session special= header argument is applied to the
  18175 evaluation of =factorial= code block.
  18176 
  18177 : #+CALL: factorial[:session special](n=5)
  18178 
  18179 ** Environment of a Code Block
  18180 :PROPERTIES:
  18181 :DESCRIPTION: Arguments, sessions, working directory...
  18182 :END:
  18183 
  18184 *** Passing arguments
  18185 :PROPERTIES:
  18186 :UNNUMBERED: notoc
  18187 :END:
  18188 
  18189 #+cindex: passing arguments to code blocks
  18190 #+cindex: arguments, in code blocks
  18191 #+cindex: @samp{var}, header argument
  18192 Use =var= for passing arguments to source code blocks.  The specifics
  18193 of variables in code blocks vary by the source language and are
  18194 covered in the language-specific documentation.  The syntax for =var=,
  18195 however, is the same for all languages.  This includes declaring
  18196 a variable, and assigning a default value.
  18197 
  18198 The following syntax is used to pass arguments to code blocks using
  18199 the =var= header argument.
  18200 
  18201 : :var NAME=ASSIGN
  18202 
  18203 #+texinfo: @noindent
  18204 {{{var(NAME)}}} is the name of the variable bound in the code block
  18205 body.  {{{var(ASSIGN)}}} is a literal value, such as a string,
  18206 a number, a reference to a table, a list, a literal example, another
  18207 code block---with or without arguments---or the results of evaluating
  18208 a code block.  {{{var(ASSIGN)}}} may specify a filename for references
  18209 to elements in a different file, using a =:= to separate the filename
  18210 from the reference.
  18211 
  18212 : :var NAME=FILE:REFERENCE
  18213 
  18214 When =FILE= does not exist, the reference is searched in the current
  18215 file, using the verbatim reference.  This way,
  18216 =:var table=tbl:example= will be searched inside the current buffer.
  18217 
  18218 Here are examples of passing values by reference:
  18219 
  18220 - table ::
  18221 
  18222   A table named with a =NAME= keyword.
  18223 
  18224   #+begin_example
  18225   ,#+NAME: example-table
  18226   | 1 |
  18227   | 2 |
  18228   | 3 |
  18229   | 4 |
  18230 
  18231   ,#+NAME: table-length
  18232   ,#+BEGIN_SRC emacs-lisp :var table=example-table
  18233     (length table)
  18234   ,#+END_SRC
  18235 
  18236   ,#+RESULTS: table-length
  18237   : 4
  18238   #+end_example
  18239 
  18240   When passing a table, you can treat specially the row, or the
  18241   column, containing labels for the columns, or the rows, in the
  18242   table.
  18243 
  18244   #+cindex: @samp{colnames}, header argument
  18245   The =colnames= header argument accepts =yes=, =no=, or =nil= values.
  18246   The default value is =nil=: if an input table has column
  18247   names---because the second row is a horizontal rule---then Org
  18248   removes the column names, processes the table, puts back the column
  18249   names, and then writes the table to the results block.  Using =yes=,
  18250   Org does the same to the first non-hline row, even if the initial
  18251   table does not contain any horizontal rule.  When set to =no=, Org
  18252   does not pre-process column names at all.
  18253 
  18254   # We keep python blocks unindented on purpose - to keep the example
  18255   # working even for users who changed the default value of ~org-src-preserve-indentation~
  18256   #+begin_example
  18257   ,#+NAME: less-cols
  18258   | a |
  18259   |---|
  18260   | b |
  18261   | c |
  18262 
  18263   ,#+BEGIN_SRC python :var tab=less-cols :colnames nil
  18264   return [[val + '*' for val in row] for row in tab]
  18265   ,#+END_SRC
  18266 
  18267   ,#+RESULTS:
  18268   | a  |
  18269   |----|
  18270   | b* |
  18271   | c* |
  18272   #+end_example
  18273 
  18274   #+cindex: @samp{rownames}, header argument
  18275   Similarly, the =rownames= header argument can take two values: =yes=
  18276   or =no=.  When set to =yes=, Org removes the first column, processes
  18277   the table, puts back the first column, and then writes the table to
  18278   the results block.  The default is =no=, which means Org does not
  18279   pre-process the first column.  Note that Emacs Lisp code blocks
  18280   ignore =rownames= header argument because of the ease of
  18281   table-handling in Emacs.
  18282 
  18283   #+begin_example
  18284   ,#+NAME: with-rownames
  18285   | one | 1 | 2 | 3 | 4 |  5 |
  18286   | two | 6 | 7 | 8 | 9 | 10 |
  18287 
  18288   ,#+BEGIN_SRC python :var tab=with-rownames :rownames yes
  18289   return [[val + 10 for val in row] for row in tab]
  18290   ,#+END_SRC
  18291 
  18292   ,#+RESULTS:
  18293   | one | 11 | 12 | 13 | 14 | 15 |
  18294   | two | 16 | 17 | 18 | 19 | 20 |
  18295   #+end_example
  18296 
  18297 To refer to a table in another file, join the filename and table name with
  18298 a colon, for example: =:var table=other-file.org:example-table=.
  18299 
  18300 - list ::
  18301 
  18302   A simple named list.
  18303 
  18304   #+begin_example
  18305   ,#+NAME: example-list
  18306   - simple
  18307     - not
  18308     - nested
  18309   - list
  18310 
  18311   ,#+BEGIN_SRC emacs-lisp :var x=example-list
  18312     (print x)
  18313   ,#+END_SRC
  18314 
  18315   ,#+RESULTS:
  18316   | simple | list |
  18317   #+end_example
  18318 
  18319   Note that only the top level list items are passed along.  Nested
  18320   list items are ignored.
  18321 
  18322 - code block without arguments ::
  18323 
  18324   A code block name, as assigned by =NAME= keyword from the example
  18325   above, optionally followed by parentheses.
  18326 
  18327   #+begin_example
  18328   ,#+BEGIN_SRC emacs-lisp :var length=table-length()
  18329     (* 2 length)
  18330   ,#+END_SRC
  18331 
  18332   ,#+RESULTS:
  18333   : 8
  18334   #+end_example
  18335 
  18336 - code block with arguments ::
  18337 
  18338   A code block name, as assigned by =NAME= keyword, followed by
  18339   parentheses and optional arguments passed within the parentheses.
  18340   The block is evaluated with point at its location.
  18341 
  18342   #+begin_example
  18343   ,#+NAME: double
  18344   ,#+BEGIN_SRC emacs-lisp :var input=8
  18345     (* 2 input)
  18346   ,#+END_SRC
  18347 
  18348   ,#+RESULTS: double
  18349   : 16
  18350 
  18351   ,#+NAME: squared
  18352   ,#+BEGIN_SRC emacs-lisp :var input=double(input=1)
  18353     (* input input)
  18354   ,#+END_SRC
  18355 
  18356   ,#+RESULTS: squared
  18357   : 4
  18358   #+end_example
  18359 
  18360 - literal example, or code block contents ::
  18361 
  18362   A code block or literal example block named with a =NAME= keyword,
  18363   followed by brackets (optional for example blocks).
  18364 
  18365   #+begin_example
  18366   ,#+NAME: literal-example
  18367   ,#+BEGIN_EXAMPLE
  18368     A literal example
  18369     on two lines
  18370   ,#+END_EXAMPLE
  18371 
  18372   ,#+NAME: read-literal-example
  18373   ,#+BEGIN_SRC emacs-lisp :var x=literal-example[]
  18374     (concatenate #'string x " for you.")
  18375   ,#+END_SRC
  18376 
  18377   ,#+RESULTS: read-literal-example
  18378   : A literal example
  18379   : on two lines for you.
  18380   #+end_example
  18381 
  18382 Indexing variable values enables referencing portions of a variable.
  18383 Indexes are 0 based with negative values counting backwards from the
  18384 end.  If an index is separated by commas then each subsequent section
  18385 indexes as the next dimension.  Note that this indexing occurs
  18386 /before/ other table-related header arguments are applied, such as
  18387 =hlines=, =colnames= and =rownames=.  The following example assigns
  18388 the last cell of the first row the table =example-table= to the
  18389 variable =data=:
  18390 
  18391 #+begin_example
  18392 ,#+NAME: example-table
  18393 | 1 | a |
  18394 | 2 | b |
  18395 | 3 | c |
  18396 | 4 | d |
  18397 
  18398 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
  18399   data
  18400 ,#+END_SRC
  18401 
  18402 ,#+RESULTS:
  18403 : a
  18404 #+end_example
  18405 
  18406 Two integers separated by a colon reference a range of variable
  18407 values.  In that case the entire inclusive range is referenced.  For
  18408 example the following assigns the middle three rows of =example-table=
  18409 to =data=.
  18410 
  18411 #+begin_example
  18412 ,#+NAME: example-table
  18413 | 1 | a |
  18414 | 2 | b |
  18415 | 3 | c |
  18416 | 4 | d |
  18417 | 5 | 3 |
  18418 
  18419 ,#+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
  18420   data
  18421 ,#+END_SRC
  18422 
  18423 ,#+RESULTS:
  18424 | 2 | b |
  18425 | 3 | c |
  18426 | 4 | d |
  18427 #+end_example
  18428 
  18429 To pick the entire range, use an empty index, or the single character
  18430 =*=.  =0:-1= does the same thing.  Example below shows how to
  18431 reference the first column only.
  18432 
  18433 #+begin_example
  18434 ,#+NAME: example-table
  18435 | 1 | a |
  18436 | 2 | b |
  18437 | 3 | c |
  18438 | 4 | d |
  18439 
  18440 ,#+BEGIN_SRC emacs-lisp :var data=example-table[,0]
  18441   data
  18442 ,#+END_SRC
  18443 
  18444 ,#+RESULTS:
  18445 | 1 | 2 | 3 | 4 |
  18446 #+end_example
  18447 
  18448 Index referencing can be used for tables and code blocks.  Index
  18449 referencing can handle any number of dimensions.  Commas delimit
  18450 multiple dimensions, as shown below.
  18451 
  18452 #+begin_example
  18453 ,#+NAME: 3D
  18454 ,#+BEGIN_SRC emacs-lisp
  18455   '(((1  2  3)  (4  5  6)  (7  8  9))
  18456     ((10 11 12) (13 14 15) (16 17 18))
  18457     ((19 20 21) (22 23 24) (25 26 27)))
  18458 ,#+END_SRC
  18459 
  18460 ,#+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
  18461   data
  18462 ,#+END_SRC
  18463 
  18464 ,#+RESULTS:
  18465 | 11 | 14 | 17 |
  18466 #+end_example
  18467 
  18468 Note that row names and column names are not removed prior to variable
  18469 indexing.  You need to take them into account, even when =colnames= or
  18470 =rownames= header arguments remove them.
  18471 
  18472 Emacs lisp code can also set the values for variables.  To
  18473 differentiate a value from Lisp code, Org interprets any value
  18474 starting with =(=, =[=, ='= or =`= as Emacs Lisp code.  The result of
  18475 evaluating that code is then assigned to the value of that variable.
  18476 The following example shows how to reliably query and pass the file
  18477 name of the Org mode buffer to a code block using headers.  We need
  18478 reliability here because the file's name could change once the code in
  18479 the block starts executing.
  18480 
  18481 #+begin_example
  18482 ,#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
  18483   wc -w $filename
  18484 ,#+END_SRC
  18485 #+end_example
  18486 
  18487 Note that values read from tables and lists are not mistakenly
  18488 evaluated as Emacs Lisp code, as illustrated in the following example.
  18489 
  18490 #+begin_example
  18491 ,#+NAME: table
  18492 | (a b c) |
  18493 
  18494 ,#+HEADER: :var data=table[0,0]
  18495 ,#+BEGIN_SRC perl
  18496   $data
  18497 ,#+END_SRC
  18498 
  18499 ,#+RESULTS:
  18500 : (a b c)
  18501 #+end_example
  18502 
  18503 *** Using sessions
  18504 :PROPERTIES:
  18505 :UNNUMBERED: notoc
  18506 :END:
  18507 
  18508 #+cindex: using sessions in code blocks
  18509 #+cindex: @samp{session}, header argument
  18510 Two code blocks can share the same environment.  The =session= header
  18511 argument is for running multiple source code blocks under one session.
  18512 Org runs code blocks with the same session name in the same
  18513 interpreter process.
  18514 
  18515 - =none= ::
  18516 
  18517   Default.  Each code block gets a new interpreter process to execute.
  18518   The process terminates once the block is evaluated.
  18519 
  18520 - {{{var(STRING)}}} ::
  18521 
  18522   Any string besides =none= turns that string into the name of that
  18523   session.  For example, =:session STRING= names it =STRING=.  If
  18524   =session= has no value, then the session name is derived from the
  18525   source language identifier.  Subsequent blocks with the same source
  18526   code language use the same session.  Depending on the language,
  18527   state variables, code from other blocks, and the overall interpreted
  18528   environment may be shared.  Some interpreted languages support
  18529   concurrent sessions when subsequent source code language blocks
  18530   change session names.
  18531 
  18532 Only languages that provide interactive evaluation can have session
  18533 support.  Not all languages provide this support, such as C and ditaa.
  18534 Even languages, such as Python and Haskell, that do support
  18535 interactive evaluation impose limitations on allowable language
  18536 constructs that can run interactively.  Org inherits those limitations
  18537 for those code blocks running in a session.
  18538 
  18539 *** Choosing a working directory
  18540 :PROPERTIES:
  18541 :UNNUMBERED: notoc
  18542 :END:
  18543 
  18544 #+cindex: working directory, in a code block
  18545 #+cindex: @samp{dir}, header argument
  18546 #+cindex: @samp{mkdirp}, header argument
  18547 The =dir= header argument specifies the default directory during code
  18548 block execution.  If it is absent, then the directory associated with
  18549 the current buffer is used.  In other words, supplying =:dir
  18550 DIRECTORY= temporarily has the same effect as changing the current
  18551 directory with {{{kbd(M-x cd RET DIRECTORY)}}}, and then not setting
  18552 =dir=.  Under the surface, =dir= simply sets the value of the Emacs
  18553 variable ~default-directory~.  Setting =mkdirp= header argument to
  18554 a non-~nil~ value creates the directory, if necessary.
  18555 
  18556 Setting =dir= to the symbol ~attach~ or the string ~"'attach"~ will
  18557 set =dir= to the directory returned by ~(org-attach-dir)~, set =:mkdir
  18558 yes=, and insert any file paths, as when using =:results file=, which
  18559 are under the node's attachment directory using =attachment:= links
  18560 instead of the usual =file:= links.  Any returned path outside of the
  18561 attachment directory will use =file:= links as per usual.
  18562 
  18563 For example, to save the plot file in the =Work/= folder of the home
  18564 directory---notice tilde is expanded:
  18565 
  18566 #+begin_example
  18567 ,#+BEGIN_SRC R :file myplot.png :dir ~/Work
  18568   matplot(matrix(rnorm(100), 10), type="l")
  18569 ,#+END_SRC
  18570 #+end_example
  18571 
  18572 To evaluate the code block on a remote machine, supply a remote
  18573 directory name using Tramp syntax.  For example:
  18574 
  18575 #+begin_example
  18576 ,#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu:
  18577   plot(1:10, main=system("hostname", intern=TRUE))
  18578 ,#+END_SRC
  18579 #+end_example
  18580 
  18581 Org first captures the text results as usual for insertion in the Org
  18582 file.  Then Org also inserts a link to the remote file, thanks to
  18583 Emacs Tramp.  Org constructs the remote path to the file name from
  18584 =dir= and ~default-directory~, as illustrated here:
  18585 
  18586 : [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
  18587 
  18588 When =dir= is used with =session=, Org sets the starting directory for
  18589 a new session.  But Org does not alter the directory of an already
  18590 existing session.
  18591 
  18592 Do not use =dir= with =:exports results= or with =:exports both= to
  18593 avoid Org inserting incorrect links to remote files.  That is because
  18594 Org does not expand ~default directory~ to avoid some underlying
  18595 portability issues.
  18596 
  18597 *** Inserting headers and footers
  18598 :PROPERTIES:
  18599 :UNNUMBERED: notoc
  18600 :END:
  18601 
  18602 #+cindex: headers, in code blocks
  18603 #+cindex: footers, in code blocks
  18604 #+cindex: @samp{prologue}, header argument
  18605 The =prologue= header argument is for appending to the top of the code
  18606 block for execution, like a reset instruction.  For example, you may
  18607 use =:prologue "reset"= in a Gnuplot code block or, for every such
  18608 block:
  18609 
  18610 #+begin_src emacs-lisp
  18611 (add-to-list 'org-babel-default-header-args:gnuplot
  18612              '((:prologue . "reset")))
  18613 
  18614 #+end_src
  18615 
  18616 #+cindex: @samp{epilogue}, header argument
  18617 Likewise, the value of the =epilogue= header argument is for appending
  18618 to the end of the code block for execution.
  18619 
  18620 ** Evaluating Code Blocks
  18621 :PROPERTIES:
  18622 :DESCRIPTION: Place results of evaluation in the Org buffer.
  18623 :END:
  18624 #+cindex: code block, evaluating
  18625 #+cindex: source code, evaluating
  18626 #+cindex: @samp{RESULTS}, keyword
  18627 
  18628 A note about security: With code evaluation comes the risk of harm.
  18629 Org safeguards by prompting for user's permission before executing any
  18630 code in the source block.  To customize this safeguard, or disable it,
  18631 see [[*Code Evaluation and Security Issues]].
  18632 
  18633 *** How to evaluate source code
  18634 :PROPERTIES:
  18635 :UNNUMBERED: notoc
  18636 :END:
  18637 
  18638 Org captures the results of the code block evaluation and inserts them
  18639 in the Org file, right after the code block.  The insertion point is
  18640 after a newline and the =RESULTS= keyword.  Org creates the =RESULTS=
  18641 keyword if one is not already there.  More details in [[*Results of
  18642 Evaluation]].
  18643 
  18644 By default, Org enables only Emacs Lisp code blocks for execution.
  18645 See [[*Languages]] to enable other languages.
  18646 
  18647 #+kindex: C-c C-c
  18648 #+kindex: C-c C-v e
  18649 #+findex: org-babel-execute-src-block
  18650 Org provides many ways to execute code blocks.  {{{kbd(C-c C-c)}}} or
  18651 {{{kbd(C-c C-v e)}}} with the point on a code block[fn:: The option
  18652 ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used to remove code
  18653 evaluation from the {{{kbd(C-c C-c)}}} key binding.] calls the
  18654 ~org-babel-execute-src-block~ function, which executes the code in the
  18655 block, collects the results, and inserts them in the buffer.
  18656 
  18657 #+cindex: @samp{CALL}, keyword
  18658 #+vindex: org-babel-inline-result-wrap
  18659 By calling a named code block[fn:49] from an Org mode buffer or
  18660 a table.  Org can call the named code blocks from the current Org mode
  18661 buffer or from the "Library of Babel" (see [[*Library of Babel]]).
  18662 
  18663 The syntax for =CALL= keyword is:
  18664 
  18665 #+begin_example
  18666 ,#+CALL: <name>(<arguments>)
  18667 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
  18668 #+end_example
  18669 
  18670 The syntax for inline named code blocks is:
  18671 
  18672 #+begin_example
  18673 ... call_<name>(<arguments>) ...
  18674 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
  18675 #+end_example
  18676 
  18677 When inline syntax is used, the result is wrapped based on the
  18678 variable ~org-babel-inline-result-wrap~, which by default is set to
  18679 ~"=%s="~ to produce verbatim text suitable for markup.
  18680 
  18681 - =<name>= ::
  18682 
  18683   This is the name of the code block (see [[*Structure of Code Blocks]])
  18684   to be evaluated in the current document.  If the block is located in
  18685   another file, start =<name>= with the file name followed by
  18686   a colon.  For example, in order to execute a block named =clear-data=
  18687   in =file.org=, you can write the following:
  18688 
  18689   : #+CALL: file.org:clear-data()
  18690 
  18691 - =<arguments>= ::
  18692 
  18693   Org passes arguments to the code block using standard function call
  18694   syntax.  For example, a =#+CALL:= line that passes =4= to a code
  18695   block named =double=, which declares the header argument =:var n=2=,
  18696   would be written as:
  18697 
  18698   : #+CALL: double(n=4)
  18699 
  18700   #+texinfo: @noindent
  18701   Note how this function call syntax is different from the header
  18702   argument syntax.
  18703 
  18704 - =<inside header arguments>= ::
  18705 
  18706   Org passes inside header arguments to the named code block using the
  18707   header argument syntax.  Inside header arguments apply to code block
  18708   evaluation.  For example, =[:results output]= collects results
  18709   printed to stdout during code execution of that block.  Note how
  18710   this header argument syntax is different from the function call
  18711   syntax.
  18712 
  18713 - =<end header arguments>= ::
  18714 
  18715   End header arguments affect the results returned by the code block.
  18716   For example, =:results html= wraps the results in a =#+BEGIN_EXPORT
  18717   html= block before inserting the results in the Org buffer.
  18718 
  18719 *** Limit code block evaluation
  18720 :PROPERTIES:
  18721 :UNNUMBERED: notoc
  18722 :END:
  18723 
  18724 #+cindex: @samp{eval}, header argument
  18725 #+cindex: control code block evaluation
  18726 The =eval= header argument can limit evaluation of specific code
  18727 blocks and =CALL= keyword.  It is useful for protection against
  18728 evaluating untrusted code blocks by prompting for a confirmation.
  18729 
  18730 - =yes= ::
  18731 
  18732   Org evaluates the source code, possibly asking permission according
  18733   to ~org-confirm-babel-evaluate~.
  18734 
  18735 - =never= or =no= ::
  18736 
  18737   Org never evaluates the source code.
  18738 
  18739 - =query= ::
  18740 
  18741   Org prompts the user for permission to evaluate the source code.
  18742 
  18743 - =never-export= or =no-export= ::
  18744 
  18745   Org does not evaluate the source code when exporting, yet the user
  18746   can evaluate it interactively.
  18747 
  18748 - =query-export= ::
  18749 
  18750   Org prompts the user for permission to evaluate the source code
  18751   during export.
  18752 
  18753 If =eval= header argument is not set, then Org determines whether to
  18754 evaluate the source code from the ~org-confirm-babel-evaluate~
  18755 variable (see [[*Code Evaluation and Security Issues]]).
  18756 
  18757 *** Cache results of evaluation
  18758 :PROPERTIES:
  18759 :UNNUMBERED: notoc
  18760 :END:
  18761 
  18762 #+cindex: @samp{cache}, header argument
  18763 #+cindex: cache results of code evaluation
  18764 The =cache= header argument is for caching results of evaluating code
  18765 blocks.  Caching results can avoid re-evaluating a code block that
  18766 have not changed since the previous run.  To benefit from the cache
  18767 and avoid redundant evaluations, the source block must have a result
  18768 already present in the buffer, and neither the header
  18769 arguments---including the value of =var= references---nor the text of
  18770 the block itself has changed since the result was last computed.  This
  18771 feature greatly helps avoid long-running calculations.  For some edge
  18772 cases, however, the cached results may not be reliable.
  18773 
  18774 The caching feature is best for when code blocks are pure functions,
  18775 that is functions that return the same value for the same input
  18776 arguments (see [[*Environment of a Code Block]]), and that do not have
  18777 side effects, and do not rely on external variables other than the
  18778 input arguments.  Functions that depend on a timer, file system
  18779 objects, and random number generators are clearly unsuitable for
  18780 caching.
  18781 
  18782 A note of warning: when =cache= is used in a session, caching may
  18783 cause unexpected results.
  18784 
  18785 When the caching mechanism tests for any source code changes, it does
  18786 not expand noweb style references (see [[*Noweb Reference Syntax]]).
  18787 
  18788 The =cache= header argument can have one of two values: =yes= or =no=.
  18789 
  18790 - =no= ::
  18791 
  18792   Default.  No caching of results; code block evaluated every time.
  18793 
  18794 - =yes= ::
  18795 
  18796   Whether to run the code or return the cached results is determined
  18797   by comparing the SHA1 hash value of the combined code block and
  18798   arguments passed to it.  This hash value is packed on the
  18799   =#+RESULTS:= line from previous evaluation.  When hash values match,
  18800   Org does not evaluate the code block.  When hash values mismatch,
  18801   Org evaluates the code block, inserts the results, recalculates the
  18802   hash value, and updates =#+RESULTS:= line.
  18803 
  18804 In this example, both functions are cached.  But =caller= runs only if
  18805 the result from =random= has changed since the last run.
  18806 
  18807 # +1 here is to work around Emacs bug#59293.
  18808 # Otherwise, (1) is recognized as footnote reference by info.el.
  18809 #+begin_example
  18810 ,#+NAME: random
  18811 ,#+BEGIN_SRC R :cache yes
  18812   runif(+1)
  18813 ,#+END_SRC
  18814 
  18815 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
  18816 0.4659510825295
  18817 
  18818 ,#+NAME: caller
  18819 ,#+BEGIN_SRC emacs-lisp :var x=random :cache yes
  18820   x
  18821 ,#+END_SRC
  18822 
  18823 ,#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  18824 0.254227238707244
  18825 #+end_example
  18826 
  18827 ** Results of Evaluation
  18828 :PROPERTIES:
  18829 :DESCRIPTION: Choosing a results type, post-processing...
  18830 :END:
  18831 #+cindex: code block, results of evaluation
  18832 #+cindex: source code, results of evaluation
  18833 
  18834 #+cindex: @samp{results}, header argument
  18835 How Org handles results of a code block execution depends on many
  18836 header arguments working together.  The primary determinant, however,
  18837 is the =results= header argument.  It accepts four classes of options.
  18838 Each code block can take only one option per class:
  18839 
  18840 - Collection ::
  18841 
  18842   For how the results should be collected from the code block;
  18843 
  18844 - Type ::
  18845 
  18846   For which type of result the code block will return; affects how Org
  18847   processes and inserts results in the Org buffer;
  18848 
  18849 - Format ::
  18850 
  18851   For the result; affects how Org processes results;
  18852 
  18853 - Handling ::
  18854 
  18855   For inserting results once they are properly formatted.
  18856 
  18857 *** Collection
  18858 :PROPERTIES:
  18859 :UNNUMBERED: notoc
  18860 :END:
  18861 
  18862 Collection options specify the results.  Choose one of the options;
  18863 they are mutually exclusive.
  18864 
  18865 - =value= ::
  18866 
  18867   Default for most Babel libraries[fn:49].  Functional mode.  Org
  18868   gets the value by wrapping the code in a function definition in the
  18869   language of the source block.  That is why when using =:results
  18870   value=, code should execute like a function and return a value.  For
  18871   languages like Python, an explicit ~return~ statement is mandatory
  18872   when using =:results value=.  Result is the value returned by the
  18873   last statement in the code block.
  18874 
  18875   When evaluating the code block in a session (see [[*Environment of
  18876   a Code Block]]), Org passes the code to an interpreter running as an
  18877   interactive Emacs inferior process.  Org gets the value from the
  18878   source code interpreter's last statement output.  Org has to use
  18879   language-specific methods to obtain the value.  For example, from
  18880   the variable ~_~ in Ruby, and the value of ~.Last.value~ in R.
  18881 
  18882 - =output= ::
  18883 
  18884   Scripting mode.  Org passes the code to an external process running
  18885   the interpreter.  Org returns the contents of the standard output
  18886   stream as text results.
  18887 
  18888   When using a session, Org passes the code to the interpreter running
  18889   as an interactive Emacs inferior process.  Org concatenates any text
  18890   output from the interpreter and returns the collection as a result.
  18891 
  18892 *** Type
  18893 :PROPERTIES:
  18894 :UNNUMBERED: notoc
  18895 :END:
  18896 
  18897 Type tells what result types to expect from the execution of the code
  18898 block.  Choose one of the options; they are mutually exclusive.
  18899 
  18900 The default behavior is to automatically determine the result type.
  18901 The result type detection depends on the code block language, as
  18902 described in the documentation for individual languages.  See
  18903 [[*Languages]].
  18904 
  18905 #+attr_texinfo: :sep ,
  18906 - =table=, =vector= ::
  18907 
  18908   Interpret the results as an Org table.  If the result is a single
  18909   value, create a table with one row and one column.  Usage example:
  18910   =:results value table=.
  18911 
  18912   #+cindex: @samp{hlines}, header argument
  18913   In-between each table row or below the table headings, sometimes
  18914   results have horizontal lines, which are also known as "hlines".
  18915   The =hlines= argument with the default =no= value strips such lines
  18916   from the input table.  For most code, this is desirable, or else
  18917   those =hline= symbols raise unbound variable errors.  A =yes=
  18918   accepts such lines, as demonstrated in the following example.
  18919 
  18920   # We keep python blocks unindented on purpose - to keep the example
  18921   # working even for users who changed the default value of ~org-src-preserve-indentation~
  18922   #+begin_example
  18923   ,#+NAME: many-cols
  18924   | a | b | c |
  18925   |---+---+---|
  18926   | d | e | f |
  18927   |---+---+---|
  18928   | g | h | i |
  18929 
  18930   ,#+NAME: no-hline
  18931   ,#+BEGIN_SRC python :var tab=many-cols :hlines no
  18932   return tab
  18933   ,#+END_SRC
  18934 
  18935   ,#+RESULTS: no-hline
  18936   | a | b | c |
  18937   | d | e | f |
  18938   | g | h | i |
  18939 
  18940   ,#+NAME: hlines
  18941   ,#+BEGIN_SRC python :var tab=many-cols :hlines yes
  18942   return tab
  18943   ,#+END_SRC
  18944 
  18945   ,#+RESULTS: hlines
  18946   | a | b | c |
  18947   |---+---+---|
  18948   | d | e | f |
  18949   |---+---+---|
  18950   | g | h | i |
  18951   #+end_example
  18952 
  18953 - =list= ::
  18954 
  18955   Interpret the results as an Org list.  If the result is a single
  18956   value, create a list of one element.
  18957 
  18958 - =scalar=, =verbatim= ::
  18959 
  18960   Interpret literally and insert as quoted text.  Do not create
  18961   a table.  Usage example: =:results value verbatim=.
  18962 
  18963 - =file= ::
  18964 
  18965   Interpret as a filename.  Save the results of execution of the code
  18966   block to that file, then insert a link to it.  You can control both
  18967   the filename and the description associated to the link.
  18968 
  18969   #+cindex: @samp{file}, header argument
  18970   #+cindex: @samp{output-dir}, header argument
  18971   Org first tries to generate the filename from the value of the
  18972   =file= header argument and the directory specified using the
  18973   =output-dir= header arguments.  If =output-dir= is not specified,
  18974   Org assumes it is the current directory.
  18975 
  18976   #+begin_example
  18977   ,#+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
  18978     size(2cm);
  18979     draw(unitcircle);
  18980   ,#+END_SRC
  18981   #+end_example
  18982 
  18983   #+cindex: @samp{file-ext}, header argument
  18984   If =file= header argument is missing, Org generates the base name of
  18985   the output file from the name of the code block, and its extension
  18986   from the =file-ext= header argument.  In that case, both the name
  18987   and the extension are mandatory.
  18988 
  18989   Result can also be interpreted as path to file.  See =:results
  18990   link=.
  18991 
  18992   #+begin_example
  18993   ,#+name: circle
  18994   ,#+BEGIN_SRC asymptote :results value file :file-ext pdf
  18995     size(2cm);
  18996     draw(unitcircle);
  18997   ,#+END_SRC
  18998   #+end_example
  18999 
  19000   #+cindex: @samp{file-desc}, header argument
  19001   The =file-desc= header argument defines the description (see [[*Link
  19002   Format]]) for the link.  If =file-desc= is present but has no value,
  19003   the =file= value is used as the link description.  When this
  19004   argument is not present, the description is omitted.  If you want to
  19005   provide the =file-desc= argument but omit the description, you can
  19006   provide it with an empty vector (i.e., :file-desc []).
  19007 
  19008   #+cindex: @samp{sep}, header argument
  19009   By default, Org assumes that a table written to a file has
  19010   TAB-delimited output.  You can choose a different separator with
  19011   the =sep= header argument.
  19012 
  19013   #+cindex: @samp{file-mode}, header argument
  19014   The =file-mode= header argument defines the file permissions.  To
  19015   make it executable, use =:file-mode (identity #o755)=.
  19016 
  19017   #+begin_example
  19018   ,#+BEGIN_SRC shell :results file :file script.sh :file-mode (identity #o755)
  19019     echo "#!/bin/bash"
  19020     echo "echo Hello World"
  19021   ,#+END_SRC
  19022   #+end_example
  19023 
  19024 *** Format
  19025 :PROPERTIES:
  19026 :UNNUMBERED: notoc
  19027 :END:
  19028 
  19029 Format pertains to the type of the result returned by the code block.
  19030 Choose one of the options; they are mutually exclusive.  The default
  19031 follows from the type specified above.
  19032 
  19033 #+attr_texinfo: :sep ,
  19034 - =raw= ::
  19035 
  19036   Interpreted as raw Org mode.  Inserted directly into the buffer.
  19037   Aligned if it is a table.  Usage example: =:results value raw=.
  19038 
  19039 - =code= ::
  19040 
  19041   Result enclosed in a code block.  Useful for parsing.  Usage
  19042   example: =:results value code=.
  19043 
  19044 - =drawer= ::
  19045 
  19046   Results are added directly to the Org file as with =raw=, but are
  19047   wrapped in a =RESULTS= drawer or results macro (for inline code
  19048   blocks), for later scripting and automated processing.
  19049   Usage example: =:results value drawer=.
  19050 
  19051 - =html= ::
  19052 
  19053   Results enclosed in a =BEGIN_EXPORT html= block.  Usage example:
  19054   =:results value html=.
  19055 
  19056 - =latex= ::
  19057 
  19058   Results enclosed in a =BEGIN_EXPORT latex= block.  Usage example:
  19059   =:results value latex=.
  19060 
  19061 - =link=, =graphics= ::
  19062 
  19063   When used along with =file= type, the result is a link to the file
  19064   specified in =:file= header argument.  However, unlike plain =file=
  19065   type, code block output is not written to the disk.  The block is
  19066   expected to generate the file by its side-effects only, as in the
  19067   following example:
  19068 
  19069   #+begin_example
  19070   ,#+begin_src shell :results file link :file "org-mode-unicorn.svg"
  19071     wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg"
  19072   ,#+end_src
  19073 
  19074   ,#+RESULTS:
  19075   [[file:org-mode-unicorn.svg]]
  19076   #+end_example
  19077 
  19078   If =:file= header argument is omitted, interpret source block result
  19079   as the file path.
  19080 
  19081 - =org= ::
  19082 
  19083   Results enclosed in a =BEGIN_SRC org= block.  For comma-escape,
  19084   either {{{kbd(TAB)}}} in the block, or export the file.  Usage
  19085   example: =:results value org=.
  19086 
  19087 - =pp= ::
  19088 
  19089   Result converted to pretty-print source code.  Enclosed in a code
  19090   block.  Languages supported: Emacs Lisp, Python, and Ruby.  Usage
  19091   example: =:results value pp=.
  19092 
  19093 
  19094 #+cindex: @samp{wrap}, header argument
  19095 The =wrap= header argument unconditionally marks the results block by
  19096 appending strings to =#+BEGIN_= and =#+END_=.  If no string is
  19097 specified, Org wraps the results in a =#+BEGIN_results=
  19098 ... =#+END_results= block.  It takes precedent over the =results=
  19099 value listed above.  E.g.,
  19100 
  19101 #+begin_example
  19102 ,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown
  19103 "<blink>Welcome back to the 90's</blink>"
  19104 ,#+END_SRC
  19105 
  19106 ,#+RESULTS:
  19107 ,#+BEGIN_EXPORT markdown
  19108 <blink>Welcome back to the 90's</blink>
  19109 ,#+END_EXPORT
  19110 #+end_example
  19111 
  19112 *** Handling
  19113 :PROPERTIES:
  19114 :UNNUMBERED: notoc
  19115 :END:
  19116 
  19117 Handling options after collecting the results.  Choose one of the
  19118 options; they are mutually exclusive.
  19119 
  19120 - =replace= ::
  19121 
  19122   Default.  Insert results in the Org buffer.  Remove previous
  19123   results.  Usage example: =:results output replace=.
  19124 
  19125 - =silent= ::
  19126 
  19127   Do not insert results in the Org mode buffer, but echo them in the
  19128   minibuffer.  Usage example: =:results output silent=.
  19129 
  19130 - =none= ::
  19131 
  19132   Compute results, but do not do anything with them.  No inserting in
  19133   the Org mode buffer nor echo them in the minibuffer.  The results
  19134   can still be used when referenced from another code block.
  19135   Usage example: =:results none=.
  19136 
  19137 - =discard= ::
  19138 
  19139   Ignore the results completely.  This option is similar to =none=,
  19140   but no processing is performed on the return value.  Calling the
  19141   code block programmatically (see [[*How to evaluate source code]]) or by
  19142   reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will
  19143   always yield ~nil~.
  19144 
  19145 - =append= ::
  19146 
  19147   Append results to the Org buffer.  Latest results are at the bottom.
  19148   Does not remove previous results.  Usage example: =:results output
  19149   append=.
  19150 
  19151 - =prepend= ::
  19152 
  19153   Prepend results to the Org buffer.  Latest results are at the top.
  19154   Does not remove previous results.  Usage example: =:results output
  19155   prepend=.
  19156 
  19157 *** Post-processing
  19158 :PROPERTIES:
  19159 :UNNUMBERED: notoc
  19160 :END:
  19161 
  19162 #+cindex: @samp{post}, header argument
  19163 #+cindex: @samp{*this*}, in @samp{post} header argument
  19164 The =post= header argument is for post-processing results from block
  19165 evaluation.  When =post= has any value, Org binds the results to
  19166 ~*this*~ variable for easy passing to =var= header argument
  19167 specifications (see [[*Environment of a Code Block]]).  That makes results
  19168 available to other code blocks, or even for direct Emacs Lisp code
  19169 execution.
  19170 
  19171 The following two examples illustrate =post= header argument in
  19172 action.  The first one shows how to attach an =ATTR_LATEX= keyword
  19173 using =post=.
  19174 
  19175 #+begin_example
  19176 ,#+NAME: attr_wrap
  19177 ,#+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
  19178   echo "#+ATTR_LATEX: :width $width"
  19179   echo "$data"
  19180 ,#+END_SRC
  19181 
  19182 ,#+HEADER: :file /tmp/it.png
  19183 ,#+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
  19184   digraph{
  19185           a -> b;
  19186           b -> c;
  19187           c -> a;
  19188   }
  19189 ,#+end_src
  19190 
  19191 ,#+RESULTS:
  19192 :RESULTS:
  19193 ,#+ATTR_LATEX :width 5cm
  19194 [[file:/tmp/it.png]]
  19195 :END:
  19196 #+end_example
  19197 
  19198 The second example shows use of =colnames= header argument in =post=
  19199 to pass data between code blocks.
  19200 
  19201 #+begin_example
  19202 ,#+NAME: round-tbl
  19203 ,#+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
  19204   (mapcar (lambda (row)
  19205             (mapcar (lambda (cell)
  19206                       (if (numberp cell)
  19207                           (format fmt cell)
  19208                         cell))
  19209                     row))
  19210           tbl)
  19211 ,#+end_src
  19212 
  19213 ,#+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
  19214   set.seed(42)
  19215   data.frame(foo=rnorm(1))
  19216 ,#+END_SRC
  19217 
  19218 ,#+RESULTS:
  19219 |   foo |
  19220 |-------|
  19221 | 1.371 |
  19222 #+end_example
  19223 
  19224 ** Exporting Code Blocks
  19225 :PROPERTIES:
  19226 :DESCRIPTION: Export contents and/or results.
  19227 :END:
  19228 #+cindex: code block, exporting
  19229 #+cindex: source code, exporting
  19230 
  19231 It is possible to export the /code/ of code blocks, the /results/ of
  19232 code block evaluation, /both/ the code and the results of code block
  19233 evaluation, or /none/.  Org defaults to exporting /code/ for most
  19234 languages and /results/ for inline code blocks.  For some languages,
  19235 such as ditaa, Org defaults to /results/ both in ordinary source
  19236 blocks and in inline source blocks.  To export just the body of code
  19237 blocks, see [[*Literal Examples]].  To selectively export subtrees of an
  19238 Org document, see [[*Exporting]].
  19239 
  19240 #+cindex: @samp{exports}, header argument
  19241 The =exports= header argument is to specify if that part of the Org
  19242 file is exported to, say, HTML or LaTeX formats.
  19243 
  19244 - =code= ::
  19245 
  19246   The default.  The body of code is included into the exported file.
  19247   Example: =:exports code=.
  19248 
  19249 - =results= ::
  19250 
  19251   The results of evaluation of the code is included in the exported
  19252   file.  Example: =:exports results=.
  19253 
  19254 - =both= ::
  19255 
  19256   Both the code and results of evaluation are included in the exported
  19257   file.  Example: =:exports both=.
  19258 
  19259 - =none= ::
  19260 
  19261   Neither the code nor the results of evaluation is included in the
  19262   exported file.  Whether the code is evaluated at all depends on
  19263   other options.  Example: =:exports none=.
  19264 
  19265 If a source block is named using =NAME= keyword, the same name will be
  19266 assigned to the results of evaluation.  This way, fuzzy links pointing
  19267 to the named source blocks exported using =:exports results= will
  19268 remain valid and point to the results of evaluation.
  19269 
  19270 Results of evaluation of a named block can also be explicitly named
  19271 using a separate =NAME= keyword.  The name value set via =NAME=
  19272 keyword will be preferred over the parent source block.
  19273 
  19274 : #+NAME: code name
  19275 : #+BEGIN_SRC emacs-lisp :exports both value
  19276 : (+ 1 2)
  19277 : #+END_SRC
  19278 :
  19279 : #+NAME: results name
  19280 : #+RESULTS: code name
  19281 : 3
  19282 :
  19283 : This [[code name][link]] will point to the code block.
  19284 : Another [[results name][link]] will point to the results.
  19285 
  19286 Explicit setting of the result name may be necessary when a named code
  19287 block is exported using =:exports both=.  Links to such block may
  19288 arbitrarily point either to the code block or to its results when
  19289 results do not have a distinct name.
  19290 
  19291 Note that all the links pointing to a source block exported using
  19292 =:exports none= will be broken.  This will make export process fail,
  19293 unless broken links are allowed during export (see [[*Export Settings]]).
  19294 
  19295 #+vindex: org-export-use-babel
  19296 To stop Org from evaluating code blocks to speed exports, use the
  19297 header argument =:eval never-export= (see [[*Evaluating Code Blocks]]).
  19298 To stop Org from evaluating code blocks for greater security, set the
  19299 ~org-export-use-babel~ variable to ~nil~, but understand that header
  19300 arguments will have no effect.
  19301 
  19302 Turning off evaluation comes in handy when batch processing.  For
  19303 example, markup languages for wikis, which have a high risk of
  19304 untrusted code.  Stopping code block evaluation also stops evaluation
  19305 of all header arguments of the code block.  This may not be desirable
  19306 in some circumstances.  So during export, to allow evaluation of just
  19307 the header arguments but not any code evaluation in the source block,
  19308 set =:eval never-export= (see [[*Evaluating Code Blocks]]).
  19309 
  19310 Org never evaluates code blocks in commented subtrees when exporting
  19311 (see [[*Comment Lines]]).  On the other hand, Org does evaluate code
  19312 blocks in subtrees excluded from export (see [[*Export Settings]]).
  19313 
  19314 ** Extracting Source Code
  19315 :PROPERTIES:
  19316 :DESCRIPTION: Create pure source code files.
  19317 :END:
  19318 #+cindex: tangling
  19319 #+cindex: source code, extracting
  19320 #+cindex: code block, extracting source code
  19321 
  19322 Extracting source code from code blocks is a basic task in literate
  19323 programming.  Org has features to make this easy.  In literate
  19324 programming parlance, documents on creation are /woven/ with code and
  19325 documentation, and on export, the code is tangled for execution by
  19326 a computer.  Org facilitates weaving and tangling for producing,
  19327 maintaining, sharing, and exporting literate programming documents.
  19328 Org provides extensive customization options for extracting source
  19329 code.
  19330 
  19331 When Org tangles code blocks, it expands, merges, and transforms them.
  19332 Then Org recomposes them into one or more separate files, as
  19333 configured through the options.  During this tangling process, Org
  19334 expands variables in the source code, and resolves any noweb style
  19335 references (see [[*Noweb Reference Syntax]]).
  19336 
  19337 *** Header arguments
  19338 :PROPERTIES:
  19339 :UNNUMBERED: notoc
  19340 :END:
  19341 
  19342 #+cindex: @samp{tangle}, header argument
  19343 The =tangle= header argument specifies if the code block is exported
  19344 to source file(s).
  19345 
  19346 - =yes= ::
  19347 
  19348   Export the code block to source file.  The file name for the source
  19349   file is derived from the name of the Org file, and the file
  19350   extension is derived from the source code language identifier.
  19351   Example: =:tangle yes=.
  19352 
  19353 - =no= ::
  19354 
  19355   The default.  Do not extract the code in a source code file.
  19356   Example: =:tangle no=.
  19357 
  19358 - {{{var(FILENAME)}}} ::
  19359 
  19360   Export the code block to source file whose file name is derived from
  19361   any string passed to the =tangle= header argument.  Org derives the
  19362   file name as being relative to the directory of the Org file's
  19363   location.  Example: =:tangle FILENAME=.
  19364 
  19365 #+cindex: @samp{mkdirp}, header argument
  19366 The =mkdirp= header argument creates parent directories for tangled
  19367 files if the directory does not exist.  A =yes= value enables
  19368 directory creation whereas =no= inhibits it.
  19369 
  19370 #+cindex: @samp{comments}, header argument
  19371 The =comments= header argument controls inserting comments into
  19372 tangled files.  These are above and beyond whatever comments may
  19373 already exist in the code block.
  19374 
  19375 - =no= ::
  19376 
  19377   The default.  Do not insert any extra comments during tangling.
  19378 
  19379 - =link= ::
  19380 
  19381   Wrap the code block in comments.  Include links pointing back to the
  19382   place in the Org file from where the code was tangled.
  19383 
  19384 - =yes= ::
  19385 
  19386   Kept for backward compatibility; same as =link=.
  19387 
  19388 - =org= ::
  19389 
  19390   Nearest headline text from Org file is inserted as comment.  The
  19391   exact text that is inserted is picked from the leading context of
  19392   the source block.
  19393 
  19394 - =both= ::
  19395 
  19396   Includes both =link= and =org= options.
  19397 
  19398 - =noweb= ::
  19399 
  19400   Includes =link= option, expands noweb references (see [[*Noweb
  19401   Reference Syntax]]), and wraps them in link comments inside the body
  19402   of the code block.
  19403 
  19404 #+cindex: @samp{padline}, header argument
  19405 The =padline= header argument controls insertion of newlines to pad
  19406 source code in the tangled file.
  19407 
  19408 - =yes= ::
  19409 
  19410   Default.  Insert a newline before and after each code block in the
  19411   tangled file.
  19412 
  19413 - =no= ::
  19414 
  19415   Do not insert newlines to pad the tangled code blocks.
  19416 
  19417 #+cindex: @samp{shebang}, header argument
  19418 The =shebang= header argument can turn results into executable script
  19419 files.  By setting it to a string value---for example, =:shebang
  19420 "#!/bin/bash"=---Org inserts that string as the first line of the
  19421 tangled file that the code block is extracted to.  Org then turns on
  19422 the tangled file's executable permission.
  19423 
  19424 #+cindex: @samp{tangle-mode}, header argument
  19425 The =tangle-mode= header argument specifies what permissions to set
  19426 for tangled files by ~set-file-modes~.  Permissions are given by an
  19427 octal value, which can be provided calling the ~identity~ function on
  19428 an elisp octal value.  For instance, to create a read-only file one may
  19429 use =:tangle-mode (identity #o444)=.  To reduce the verbosity required,
  19430 a octal shorthand is defined, =oXXX= (=o= for octal).  Using this, our
  19431 read-only example is =:tangle-mode o444=.  Omitting the =o= prefix will
  19432 cause the argument to be interpreted as an integer, which can lead to
  19433 unexpected results (=444= is the same as =o674=).
  19434 Two other shorthands are recognized, ls-style strings like
  19435 =rw-r--r--=, and chmod-style permissions like =g+w=.
  19436 Note that chmod-style permissions are based on
  19437 ~org-babel-tangle-default-file-mode~, which is =#o544= by default.
  19438 
  19439 When =:tangle-mode= and =:shebang= are both specified, the give
  19440 =:tangle-mode= will override the permissions from =:shebang=.  When
  19441 multiple source code blocks tangle to a single file with conflicting
  19442 =:tangle-mode= header arguments, Org's behavior is undefined.
  19443 
  19444 #+cindex: @samp{no-expand}, header argument
  19445 By default Org expands code blocks during tangling.  The =no-expand=
  19446 header argument turns off such expansions.  Note that one side-effect
  19447 of expansion by ~org-babel-expand-src-block~ also assigns values (see
  19448 [[*Environment of a Code Block]]) to variables.  Expansions also replace
  19449 noweb references with their targets (see [[*Noweb Reference Syntax]]).
  19450 Some of these expansions may cause premature assignment, hence this
  19451 option.  This option makes a difference only for tangling.  It has no
  19452 effect when exporting since code blocks for execution have to be
  19453 expanded anyway.
  19454 
  19455 *** Functions
  19456 :PROPERTIES:
  19457 :UNNUMBERED: notoc
  19458 :END:
  19459 
  19460 - ~org-babel-tangle~ ::
  19461 
  19462   #+findex: org-babel-tangle
  19463   #+kindex: C-c C-v t
  19464   Tangle the current file.  Bound to {{{kbd(C-c C-v t)}}}.
  19465 
  19466   With prefix argument only tangle the current code block.
  19467 
  19468 - ~org-babel-tangle-file~ ::
  19469 
  19470   #+findex: org-babel-tangle-file
  19471   #+kindex: C-c C-v f
  19472   Choose a file to tangle.  Bound to {{{kbd(C-c C-v f)}}}.
  19473 
  19474 *** Tangle hooks
  19475 :PROPERTIES:
  19476 :UNNUMBERED: notoc
  19477 :END:
  19478 
  19479 - ~org-babel-pre-tangle-hook~ ::
  19480 
  19481   #+vindex: org-babel-pre-tangle-hook
  19482   This hook is run before the tangle process begins.  The active
  19483   buffer is buffer to be tangled.
  19484 
  19485 - ~org-babel-tangle-body-hook~ ::
  19486 
  19487   #+vindex: org-babel-tangle-body-hook
  19488   This hook is run from a temporary buffer containing expanded code of
  19489   every tangled code block.  The hook can modify the expanded code as
  19490   needed.  The contents of the current buffer will be used as actual
  19491   code block expansion.
  19492 
  19493 - ~org-babel-post-tangle-hook~ ::
  19494 
  19495   #+vindex: org-babel-post-tangle-hook
  19496   This hook is run from within code files tangled by
  19497   ~org-babel-tangle~, making it suitable for post-processing,
  19498   compilation, and evaluation of code in the tangled files.
  19499 
  19500 - ~org-babel-tangle-finished-hook~ ::
  19501   #+vindex: org-babel-tangle-finished-hook
  19502   This hook is run after post-tangle hooks, in the original buffer.
  19503 
  19504 *** Jumping between code and Org
  19505 :PROPERTIES:
  19506 :UNNUMBERED: notoc
  19507 :END:
  19508 
  19509 #+findex: org-babel-tangle-jump-to-org
  19510 Debuggers normally link errors and messages back to the source code.
  19511 But for tangled files, we want to link back to the Org file, not to
  19512 the tangled source file.  To make this extra jump, Org uses
  19513 ~org-babel-tangle-jump-to-org~ function with two additional source
  19514 code block header arguments:
  19515 
  19516 1. Set =padline= to true---this is the default setting.
  19517 2. Set =comments= to =link=, which makes Org insert links to the Org
  19518    file.
  19519 
  19520 ** Languages
  19521 :PROPERTIES:
  19522 :DESCRIPTION: List of supported code block languages.
  19523 :END:
  19524 #+cindex: babel, languages
  19525 #+cindex: source code, languages
  19526 #+cindex: code block, languages
  19527 
  19528 Code blocks in dozens of languages are supported.  See Worg website
  19529 for [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language specific documentation]].
  19530 
  19531 #+vindex: org-babel-load-languages
  19532 By default, only Emacs Lisp is enabled for evaluation.  To enable or
  19533 disable other languages, customize the ~org-babel-load-languages~
  19534 variable either through the Emacs customization interface, or by
  19535 adding code to the init file as shown next.
  19536 
  19537 In this example, evaluation is disabled for Emacs Lisp, and enabled
  19538 for R.
  19539 
  19540 #+begin_src emacs-lisp
  19541 (org-babel-do-load-languages
  19542  'org-babel-load-languages
  19543  '((emacs-lisp . nil)
  19544    (R . t)))
  19545 #+end_src
  19546 
  19547 Note that this is not the only way to enable a language.  Org also
  19548 enables languages when loaded with ~require~ statement.  For example,
  19549 the following enables execution of Clojure code blocks:
  19550 
  19551 #+begin_src emacs-lisp
  19552 (require 'ob-clojure)
  19553 #+end_src
  19554 
  19555 ** Editing Source Code
  19556 :PROPERTIES:
  19557 :DESCRIPTION: Language major-mode editing.
  19558 :END:
  19559 #+cindex: code block, editing
  19560 #+cindex: source code, editing
  19561 
  19562 #+kindex: C-c '
  19563 Use {{{kbd(C-c ')}}} to edit the current code block.  It opens a new
  19564 major mode edit buffer containing the body of the source code block,
  19565 ready for any edits.  Use {{{kbd(C-c ')}}} again to close the buffer
  19566 and return to the Org buffer.
  19567 
  19568 #+kindex: C-x C-s
  19569 #+vindex: org-edit-src-auto-save-idle-delay
  19570 #+cindex: auto-save, in code block editing
  19571 {{{kbd(C-x C-s)}}} saves the buffer and updates the contents of the
  19572 Org buffer.  Set ~org-edit-src-auto-save-idle-delay~ to save the base
  19573 buffer after a certain idle delay time.  Set
  19574 ~org-edit-src-turn-on-auto-save~ to auto-save this buffer into
  19575 a separate file using Auto-save mode.
  19576 
  19577 While editing the source code in the major mode, the Org Src minor
  19578 mode remains active.  It provides these customization variables as
  19579 described below.  For even more variables, look in the customization
  19580 group ~org-edit-structure~.
  19581 
  19582 - ~org-src-lang-modes~ ::
  19583 
  19584   #+vindex: org-src-lang-modes
  19585   If an Emacs major-mode named ~<LANG>-mode~ exists, where
  19586   {{{var(<LANG>)}}} is the language identifier from code block's
  19587   header line, then the edit buffer uses that major mode.  Use this
  19588   variable to arbitrarily map language identifiers to major modes.
  19589 
  19590   When language identifier is omitted in the src block, Org mode's
  19591   behavior is undefined.
  19592 
  19593 - ~org-src-window-setup~ ::
  19594 
  19595   #+vindex: org-src-window-setup
  19596   For specifying Emacs window arrangement when the new edit buffer is
  19597   created.
  19598 
  19599 - ~org-src-preserve-indentation~ ::
  19600 
  19601   #+cindex: indentation, in code blocks
  19602   #+vindex: org-src-preserve-indentation
  19603   Default is ~nil~.  Source code is indented.  This indentation
  19604   applies during export or tangling, and depending on the context, may
  19605   alter leading spaces and tabs.  When non-~nil~, source code is
  19606   aligned with the leftmost column.  No lines are modified during
  19607   export or tangling, which is very useful for white-space sensitive
  19608   languages, such as Python.
  19609 
  19610 - ~org-src-ask-before-returning-to-edit-buffer~ ::
  19611 
  19612   #+vindex: org-src-ask-before-returning-to-edit-buffer
  19613   When ~nil~, Org returns to the edit buffer without further prompts.
  19614   The default prompts for a confirmation.
  19615 
  19616 #+vindex: org-src-fontify-natively
  19617 #+vindex: org-src-block-faces
  19618 Fontification of code blocks can give visual separation of text and
  19619 code on the display page.  Set ~org-src-fontify-natively~ to non-~nil~
  19620 to turn on native code fontification in the /Org/ buffer.  The
  19621 fontification follows the major mode used to edit the code block (see
  19622 ~org-src-lang-modes~ above).
  19623 
  19624 To further customize the appearance of ~org-block~ for specific
  19625 languages, customize ~org-src-block-faces~.  The following example
  19626 shades the background of regular blocks, and colors source blocks only
  19627 for Python and Emacs Lisp languages.
  19628 
  19629 #+begin_src emacs-lisp
  19630 (require 'color)
  19631 (set-face-attribute 'org-block nil :background
  19632                     (color-darken-name
  19633                      (face-attribute 'default :background) 3))
  19634 
  19635 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
  19636                             ("python" (:background "#E5FFB8"))))
  19637 #+end_src
  19638 
  19639 ** Noweb Reference Syntax
  19640 :PROPERTIES:
  19641 :DESCRIPTION: Literate programming in Org mode.
  19642 :END:
  19643 #+cindex: code block, noweb reference
  19644 #+cindex: syntax, noweb
  19645 #+cindex: source code, noweb reference
  19646 
  19647 #+cindex: @samp{noweb-ref}, header argument
  19648 Source code blocks can include references to other source code blocks,
  19649 using a noweb[fn:: For noweb literate programming details, see
  19650 https://www.cs.tufts.edu/~nr/noweb/.] style syntax:
  19651 
  19652 : <<CODE-BLOCK-ID>>
  19653 
  19654 #+texinfo: @noindent
  19655 where {{{var(CODE-BLOCK-ID)}}} refers to either the =NAME= of a single
  19656 source code block, or a collection of one or more source code blocks
  19657 sharing the same =noweb-ref= header argument (see [[*Using Header
  19658 Arguments]]).  Org can replace such references with the source code of
  19659 the block or blocks being referenced, or, in the case of a single
  19660 source code block named with =NAME=, with the results of an evaluation
  19661 of that block.
  19662 
  19663 #+cindex: @samp{noweb}, header argument
  19664 The =noweb= header argument controls expansion of noweb syntax
  19665 references.  Expansions occur when source code blocks are evaluated,
  19666 tangled, or exported.
  19667 
  19668 - =no= ::
  19669 
  19670   Default.  No expansion of noweb syntax references in the body of the
  19671   code when evaluating, tangling, or exporting.
  19672 
  19673 - =yes= ::
  19674 
  19675   Expansion of noweb syntax references in the body of the code block
  19676   when evaluating, tangling, or exporting.
  19677 
  19678 - =tangle= ::
  19679 
  19680   Expansion of noweb syntax references in the body of the code block
  19681   when tangling.  No expansion when evaluating or exporting.
  19682 
  19683 - =strip-tangle= ::
  19684 
  19685   Expansion of noweb syntax references in the body of the code block
  19686   when evaluating or exporting.  Removes noweb syntax references
  19687   when exporting.
  19688 
  19689 - =no-export= ::
  19690 
  19691   Expansion of noweb syntax references in the body of the code block
  19692   when evaluating or tangling.  No expansion when exporting.
  19693 
  19694 - =strip-export= ::
  19695 
  19696   Expansion of noweb syntax references in the body of the code block
  19697   when expanding prior to evaluating or tangling.  Removes noweb
  19698   syntax references when exporting.
  19699 
  19700 - =eval= ::
  19701 
  19702   Expansion of noweb syntax references in the body of the code block
  19703   only before evaluating.
  19704 
  19705 In the most simple case, the contents of a single source block is
  19706 inserted within other blocks.  Thus, in following example,
  19707 
  19708 #+begin_example
  19709 ,#+NAME: initialization
  19710 ,#+BEGIN_SRC emacs-lisp
  19711   (setq sentence "Never a foot too far, even.")
  19712 ,#+END_SRC
  19713 
  19714 ,#+BEGIN_SRC emacs-lisp :noweb yes
  19715   <<initialization>>
  19716   (reverse sentence)
  19717 ,#+END_SRC
  19718 #+end_example
  19719 
  19720 #+texinfo: @noindent
  19721 the second code block is expanded as
  19722 
  19723 #+begin_example
  19724 ,#+BEGIN_SRC emacs-lisp :noweb yes
  19725   (setq sentence "Never a foot too far, even.")
  19726   (reverse sentence)
  19727 ,#+END_SRC
  19728 #+end_example
  19729 
  19730 Note that noweb expansion does not automatically carry over =:var=
  19731 header arguments[fn:50].
  19732 
  19733 You may also include the contents of multiple blocks sharing a common
  19734 =noweb-ref= header argument, which can be set at the file, subtree,
  19735 or code block level.  In the example Org file shown next, the body of
  19736 the source code in each block is extracted for concatenation to a pure
  19737 code file when tangled.
  19738 
  19739 #+begin_example
  19740 ,#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
  19741   <<fullest-disk>>
  19742 ,#+END_SRC
  19743 ,* the mount point of the fullest disk
  19744   :PROPERTIES:
  19745   :header-args: :noweb-ref fullest-disk
  19746   :END:
  19747 
  19748 ,** query all mounted disks
  19749 ,#+BEGIN_SRC sh
  19750   df \
  19751 ,#+END_SRC
  19752 
  19753 ,** strip the header row
  19754 ,#+BEGIN_SRC sh
  19755   |sed '1d' \
  19756 ,#+END_SRC
  19757 
  19758 ,** output mount point of fullest disk
  19759 ,#+BEGIN_SRC sh
  19760   |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
  19761 ,#+END_SRC
  19762 #+end_example
  19763 
  19764 #+cindex: @samp{noweb-sep}, header argument
  19765 By default a newline separates each noweb reference concatenation.  To
  19766 use a different separator, edit the =noweb-sep= header argument.
  19767 
  19768 Alternatively, Org can include the results of evaluation of a single
  19769 code block rather than its body [[fn::The reference is evaluated with
  19770 point at the referenced block, using its header arguments (including
  19771 inherited)].  Evaluation occurs when parentheses, possibly including
  19772 arguments, are appended to the code block name, as shown below.
  19773 
  19774 : <<NAME(optional arguments)>>
  19775 
  19776 Note that in this case, a code block name set by =NAME= keyword is
  19777 required; the reference set by =noweb-ref= will not work when
  19778 evaluation is desired.
  19779 
  19780 Here is an example that demonstrates how the exported content changes
  19781 when noweb style references are used with parentheses versus without.
  19782 Given:
  19783 
  19784 # We keep python blocks unindented on purpose - to keep the example
  19785 # working even for users who changed the default value of ~org-src-preserve-indentation~
  19786 #+begin_example
  19787 ,#+NAME: some-code
  19788 ,#+BEGIN_SRC python :var num=0 :results output :exports none
  19789 print(num*10)
  19790 ,#+END_SRC
  19791 #+end_example
  19792 
  19793 #+texinfo: @noindent
  19794 this code block:
  19795 
  19796 #+begin_example
  19797 ,#+BEGIN_SRC text :noweb yes
  19798   <<some-code>>
  19799 ,#+END_SRC
  19800 #+end_example
  19801 
  19802 #+texinfo: @noindent
  19803 expands to:
  19804 
  19805 : print(num*10)
  19806 
  19807 Below, a similar noweb style reference is used, but with parentheses,
  19808 while setting a variable =num= to 10:
  19809 
  19810 #+begin_example
  19811 ,#+BEGIN_SRC text :noweb yes
  19812   <<some-code(num=10)>>
  19813 ,#+END_SRC
  19814 #+end_example
  19815 
  19816 #+texinfo: @noindent
  19817 Note that the expansion now contains the results of the code block
  19818 =some-code=, not the code block itself:
  19819 
  19820 : 100
  19821 
  19822 Noweb insertions honor prefix characters that appear before the noweb
  19823 syntax reference.  This behavior is illustrated in the following
  19824 example.  Because the =<<example>>= noweb reference appears behind the
  19825 SQL comment syntax, each line of the expanded noweb reference is
  19826 commented.  With:
  19827 
  19828 #+begin_example
  19829 ,#+NAME: example
  19830 ,#+BEGIN_SRC text
  19831   this is the
  19832   multi-line body of example
  19833 ,#+END_SRC
  19834 #+end_example
  19835 
  19836 #+texinfo: @noindent
  19837 this code block:
  19838 
  19839 #+begin_example
  19840 ,#+BEGIN_SRC sql :noweb yes
  19841  ---<<example>>
  19842 ,#+END_SRC
  19843 #+end_example
  19844 
  19845 #+texinfo: @noindent
  19846 expands to:
  19847 
  19848 #+begin_example
  19849 ,#+BEGIN_SRC sql :noweb yes
  19850  ---this is the
  19851  ---multi-line body of example
  19852 ,#+END_SRC
  19853 #+end_example
  19854 
  19855 Since this change does not affect noweb replacement text without
  19856 newlines in them, inline noweb references are acceptable.
  19857 
  19858 This feature can also be used for management of indentation in
  19859 exported code snippets.  With:
  19860 
  19861 # We keep python blocks unindented on purpose - to keep the example
  19862 # working even for users who changed the default value of ~org-src-preserve-indentation~
  19863 #+begin_example
  19864 ,#+NAME: if-true
  19865 ,#+BEGIN_SRC python :exports none
  19866 print('do things when true')
  19867 ,#+end_src
  19868 
  19869 ,#+name: if-false
  19870 ,#+begin_src python :exports none
  19871 print('do things when false')
  19872 ,#+end_src
  19873 #+end_example
  19874 
  19875 #+texinfo: @noindent
  19876 this code block:
  19877 
  19878 #+begin_example
  19879 ,#+begin_src python :noweb yes :results output
  19880 if true:
  19881     <<if-true>>
  19882 else:
  19883     <<if-false>>
  19884 ,#+end_src
  19885 #+end_example
  19886 
  19887 #+texinfo: @noindent
  19888 expands to:
  19889 
  19890 #+begin_example
  19891 if true:
  19892     print('do things when true')
  19893 else:
  19894     print('do things when false')
  19895 #+end_example
  19896 
  19897 This prefix behavior can be turned off in a block by setting the
  19898 =noweb-prefix= header argument to =no=, as in:
  19899 
  19900 #+begin_example
  19901 ,#+BEGIN_SRC elisp :noweb-prefix no
  19902   (setq example-data "<<example>>")
  19903 ,#+END_SRC
  19904 #+end_example
  19905 
  19906 #+texinfo: @noindent
  19907 which expands to:
  19908 
  19909 #+begin_example
  19910 (setq example-data "this is the
  19911 multi-line body of example")
  19912 #+end_example
  19913 
  19914 When in doubt about the outcome of a source code block expansion, you
  19915 can preview the results with the following command:
  19916 
  19917 - {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} (~org-babel-expand-src-block~) ::
  19918 
  19919   #+findex: org-babel-expand-src-block
  19920   #+kindex: C-c C-v v
  19921   #+kindex: C-c C-v C-v
  19922   Expand the current source code block according to its header
  19923   arguments and pop open the results in a preview buffer.
  19924 
  19925 ** Library of Babel
  19926 :PROPERTIES:
  19927 :DESCRIPTION: Use and contribute to a library of useful code blocks.
  19928 :END:
  19929 #+cindex: babel, library of
  19930 #+cindex: source code, library
  19931 #+cindex: code block, library
  19932 
  19933 The "Library of Babel" is a collection of code blocks.  Like
  19934 a function library, these code blocks can be called from other Org
  19935 files.  A collection of useful code blocks is available on [[https://orgmode.org/worg/library-of-babel.html][Worg]].  For
  19936 remote code block evaluation syntax, see [[*Evaluating Code Blocks]].
  19937 
  19938 #+kindex: C-c C-v i
  19939 #+findex: org-babel-lob-ingest
  19940 For any user to add code to the library, first save the code in
  19941 regular code blocks of an Org file, and then load the Org file with
  19942 ~org-babel-lob-ingest~, which is bound to {{{kbd(C-c C-v i)}}}.
  19943 
  19944 ** Key bindings and Useful Functions
  19945 :PROPERTIES:
  19946 :DESCRIPTION: Work quickly with code blocks.
  19947 :END:
  19948 #+cindex: code block, key bindings
  19949 
  19950 Many common Org mode key sequences are re-bound depending on
  19951 the context.
  19952 
  19953 Active key bindings in code blocks:
  19954 
  19955 #+kindex: C-c C-c
  19956 #+findex: org-babel-execute-src-block
  19957 #+kindex: C-c C-o
  19958 #+findex: org-babel-open-src-block-result
  19959 #+kindex: M-UP
  19960 #+findex: org-babel-load-in-session
  19961 #+kindex: M-DOWN
  19962 #+findex: org-babel-pop-to-session
  19963 #+attr_texinfo: :columns 0.2 0.55
  19964 | Key binding        | Function                          |
  19965 |--------------------+-----------------------------------|
  19966 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~     |
  19967 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ |
  19968 | {{{kbd(M-UP)}}}    | ~org-babel-load-in-session~       |
  19969 | {{{kbd(M-DOWN)}}}  | ~org-babel-pop-to-session~        |
  19970 
  19971 Active key bindings in Org mode buffer:
  19972 
  19973 #+kindex: C-c C-v p
  19974 #+kindex: C-c C-v C-p
  19975 #+kindex: C-c C-v n
  19976 #+kindex: C-c C-v C-n
  19977 #+kindex: C-c C-v e
  19978 #+kindex: C-c C-v C-e
  19979 #+kindex: C-c C-v o
  19980 #+kindex: C-c C-v C-o
  19981 #+kindex: C-c C-v v
  19982 #+kindex: C-c C-v C-v
  19983 #+kindex: C-c C-v u
  19984 #+kindex: C-c C-v C-u
  19985 #+kindex: C-c C-v g
  19986 #+kindex: C-c C-v C-g
  19987 #+kindex: C-c C-v r
  19988 #+kindex: C-c C-v C-r
  19989 #+kindex: C-c C-v b
  19990 #+kindex: C-c C-v C-b
  19991 #+kindex: C-c C-v s
  19992 #+kindex: C-c C-v C-s
  19993 #+kindex: C-c C-v d
  19994 #+kindex: C-c C-v C-d
  19995 #+kindex: C-c C-v t
  19996 #+kindex: C-c C-v C-t
  19997 #+kindex: C-c C-v f
  19998 #+kindex: C-c C-v C-f
  19999 #+kindex: C-c C-v c
  20000 #+kindex: C-c C-v C-c
  20001 #+kindex: C-c C-v j
  20002 #+kindex: C-c C-v C-j
  20003 #+kindex: C-c C-v l
  20004 #+kindex: C-c C-v C-l
  20005 #+kindex: C-c C-v i
  20006 #+kindex: C-c C-v C-i
  20007 #+kindex: C-c C-v I
  20008 #+kindex: C-c C-v C-I
  20009 #+kindex: C-c C-v z
  20010 #+kindex: C-c C-v C-z
  20011 #+kindex: C-c C-v a
  20012 #+kindex: C-c C-v C-a
  20013 #+kindex: C-c C-v h
  20014 #+kindex: C-c C-v C-h
  20015 #+kindex: C-c C-v x
  20016 #+kindex: C-c C-v C-x
  20017 #+findex: org-babel-previous-src-block
  20018 #+findex: org-babel-next-src-block
  20019 #+findex: org-babel-execute-maybe
  20020 #+findex: org-babel-open-src-block-result
  20021 #+findex: org-babel-expand-src-block
  20022 #+findex: org-babel-goto-src-block-head
  20023 #+findex: org-babel-goto-named-src-block
  20024 #+findex: org-babel-goto-named-result
  20025 #+findex: org-babel-execute-buffer
  20026 #+findex: org-babel-execute-subtree
  20027 #+findex: org-babel-demarcate-block
  20028 #+findex: org-babel-tangle
  20029 #+findex: org-babel-tangle-file
  20030 #+findex: org-babel-check-src-block
  20031 #+findex: org-babel-insert-header-arg
  20032 #+findex: org-babel-load-in-session
  20033 #+findex: org-babel-lob-ingest
  20034 #+findex: org-babel-view-src-block-info
  20035 #+findex: org-babel-switch-to-session-with-code
  20036 #+findex: org-babel-sha1-hash
  20037 #+findex: org-babel-describe-bindings
  20038 #+findex: org-babel-do-key-sequence-in-edit-buffer
  20039 #+attr_texinfo: :columns 0.45 0.55
  20040 | Key binding                                    | Function                                   |
  20041 |------------------------------------------------+--------------------------------------------|
  20042 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~             |
  20043 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~                 |
  20044 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~                  |
  20045 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~          |
  20046 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~               |
  20047 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~            |
  20048 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~           |
  20049 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~              |
  20050 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~                 |
  20051 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~                |
  20052 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~                |
  20053 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~                         |
  20054 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~                    |
  20055 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~                |
  20056 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~              |
  20057 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~                |
  20058 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~                     |
  20059 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~            |
  20060 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~    |
  20061 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~                      |
  20062 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~              |
  20063 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
  20064 
  20065 ** Batch Execution
  20066 :PROPERTIES:
  20067 :DESCRIPTION: Call functions from the command line.
  20068 :END:
  20069 #+cindex: code block, batch execution
  20070 #+cindex: source code, batch execution
  20071 
  20072 Org mode features, including working with source code facilities can
  20073 be invoked from the command line.  This enables building shell scripts
  20074 for batch processing, running automated system tasks, and expanding
  20075 Org mode's usefulness.
  20076 
  20077 The sample script shows batch processing of multiple files using
  20078 ~org-babel-tangle~.
  20079 
  20080 #+begin_example
  20081 #!/bin/sh
  20082 # Tangle files with Org mode
  20083 #
  20084 emacs -Q --batch --eval "
  20085     (progn
  20086       (require 'ob-tangle)
  20087       (dolist (file command-line-args-left)
  20088         (with-current-buffer (find-file-noselect file)
  20089           (org-babel-tangle))))
  20090   " "$@"
  20091 #+end_example
  20092 
  20093 * Miscellaneous
  20094 :PROPERTIES:
  20095 :DESCRIPTION: All the rest which did not fit elsewhere.
  20096 :END:
  20097 
  20098 ** Completion
  20099 :PROPERTIES:
  20100 :DESCRIPTION: @kbd{M-@key{TAB}} guesses completions.
  20101 :END:
  20102 #+cindex: completion, of @TeX{} symbols
  20103 #+cindex: completion, of TODO keywords
  20104 #+cindex: completion, of dictionary words
  20105 #+cindex: completion, of option keywords
  20106 #+cindex: completion, of tags
  20107 #+cindex: completion, of property keys
  20108 #+cindex: completion, of link abbreviations
  20109 #+cindex: @TeX{} symbol completion
  20110 #+cindex: TODO keywords completion
  20111 #+cindex: dictionary word completion
  20112 #+cindex: option keyword completion
  20113 #+cindex: tag completion
  20114 #+cindex: link abbreviations, completion of
  20115 
  20116 Org has in-buffer completions.  Unlike minibuffer completions, which
  20117 are useful for quick command interactions, Org's in-buffer completions
  20118 are more suitable for content creation in Org documents.  Type one or
  20119 more letters and invoke the hot key to complete the text in-place.
  20120 Depending on the context and the keys, Org offers different types of
  20121 completions.  No minibuffer is involved.  Such mode-specific hot keys
  20122 have become an integral part of Emacs and Org provides several
  20123 shortcuts.
  20124 
  20125 - {{{kbd(M-TAB)}}} ::
  20126   #+kindex: M-TAB
  20127 
  20128   Complete word at point.
  20129 
  20130   - At the beginning of an empty headline, complete TODO keywords.
  20131 
  20132   - After =\=, complete TeX symbols supported by the exporter.
  20133 
  20134   - After =:= in a headline, complete tags.  Org deduces the list of
  20135     tags from the =TAGS= in-buffer option (see [[*Setting Tags]]), the
  20136     variable ~org-tag-alist~, or from all tags used in the current
  20137     buffer.
  20138 
  20139   - After =:= and not in a headline, complete property keys.  The list
  20140     of keys is constructed dynamically from all keys used in the
  20141     current buffer.
  20142 
  20143   - After =[[=, complete link abbreviations (see [[*Link Abbreviations]]).
  20144 
  20145   - After =[[*=, complete headlines in the current buffer so that they
  20146     can be used in search links like: =[[*find this headline]]=
  20147 
  20148   - After =#+=, complete the special keywords like =TYP_TODO= or
  20149     file-specific =OPTIONS=.  After option keyword is complete,
  20150     pressing {{{kbd(M-TAB)}}} again inserts example settings for this
  20151     keyword.
  20152 
  20153   - After =STARTUP= keyword, complete startup items.
  20154 
  20155   - When point is anywhere else, complete dictionary words using
  20156     Ispell.
  20157 
  20158 ** Structure Templates
  20159 :PROPERTIES:
  20160 :DESCRIPTION: Quick insertion of structural elements.
  20161 :END:
  20162 #+cindex: template insertion
  20163 #+cindex: insertion, of templates
  20164 
  20165 With just a few keystrokes, it is possible to insert empty structural
  20166 blocks, such as =#+BEGIN_SRC= ... =#+END_SRC=, or to wrap existing
  20167 text in such a block.
  20168 
  20169 - {{{kbd(C-c C-\,)}}} (~org-insert-structure-template~) ::
  20170 
  20171   #+findex: org-insert-structure-template
  20172   #+kindex: C-c C-,
  20173   Prompt for a type of block structure, and insert the block at point.
  20174   If the region is active, it is wrapped in the block.  First prompts
  20175   the user for keys, which are used to look up a structure type from
  20176   the variable below.  If the key is {{{kbd(TAB)}}}, {{{kbd(RET)}}},
  20177   or {{{kbd(SPC)}}}, the user is prompted to enter a block type.
  20178 
  20179 #+vindex: org-structure-template-alist
  20180 Available structure types are defined in
  20181 ~org-structure-template-alist~, see the docstring for adding or
  20182 changing values.
  20183 
  20184 #+cindex: Tempo
  20185 #+cindex: template expansion
  20186 #+cindex: insertion, of templates
  20187 #+vindex: org-tempo-keywords-alist
  20188 Org Tempo expands snippets to structures defined in
  20189 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~.  For
  20190 example, {{{kbd(< s TAB)}}} creates a code block.  Enable it by
  20191 customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs
  20192 init file[fn:: For more information, please refer to the commentary
  20193 section in =org-tempo.el=.].
  20194 
  20195 #+attr_texinfo: :columns 0.1 0.9
  20196 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
  20197 | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER=       |
  20198 | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT=     |
  20199 | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE=     |
  20200 | {{{kbd(E)}}} | =#+BEGIN_EXPORT= ... =#+END_EXPORT=       |
  20201 | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT=  |
  20202 | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= |
  20203 | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE=         |
  20204 | {{{kbd(s)}}} | =#+BEGIN_SRC= ... =#+END_SRC=             |
  20205 | {{{kbd(v)}}} | =#+BEGIN_VERSE= ... =#+END_VERSE=         |
  20206 
  20207 ** Speed Keys
  20208 :PROPERTIES:
  20209 :DESCRIPTION: Electric commands at the beginning of a headline.
  20210 :END:
  20211 #+cindex: speed keys
  20212 
  20213 Single keystrokes can execute custom commands in an Org file when
  20214 point is on a headline.  Without the extra burden of a meta or
  20215 modifier key, Speed Keys can speed navigation or execute custom
  20216 commands.  Besides faster navigation, Speed Keys may come in handy on
  20217 small mobile devices that do not have full keyboards.  Speed Keys may
  20218 also work on TTY devices known for their problems when entering Emacs
  20219 key chords.
  20220 
  20221 #+vindex: org-use-speed-commands
  20222 By default, Org has Speed Keys disabled.  To activate Speed Keys, set
  20223 the variable ~org-use-speed-commands~ to a non-~nil~ value.  To
  20224 trigger a Speed Key, point must be at the beginning of an Org
  20225 headline, before any of the stars.
  20226 
  20227 #+vindex: org-speed-commands
  20228 #+findex: org-speed-command-help
  20229 Org comes with a pre-defined list of Speed Keys.  To add or modify
  20230 Speed Keys, customize the option ~org-speed-commands~.  For more
  20231 details, see the variable's docstring.  With Speed Keys activated,
  20232 {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when point is at the
  20233 beginning of an Org headline, shows currently active Speed Keys,
  20234 including the user-defined ones.
  20235 
  20236 ** A Cleaner Outline View
  20237 :PROPERTIES:
  20238 :DESCRIPTION: Getting rid of leading stars in the outline.
  20239 :ALT_TITLE: Clean View
  20240 :END:
  20241 #+cindex: hiding leading stars
  20242 #+cindex: dynamic indentation
  20243 #+cindex: odd-levels-only outlines
  20244 #+cindex: clean outline view
  20245 
  20246 Org's outline with stars and no indents can look cluttered for short
  20247 documents.  For /book-like/ long documents, the effect is not as
  20248 noticeable.  Org provides an alternate stars and indentation scheme,
  20249 as shown on the right in the following table.  It displays only one
  20250 star and indents text to line up with the heading:
  20251 
  20252 #+begin_example
  20253 ,* Top level headline             |    * Top level headline
  20254 ,** Second level                  |      * Second level
  20255 ,*** Third level                  |        * Third level
  20256 some text                        |          some text
  20257 ,*** Third level                  |        * Third level
  20258 more text                        |          more text
  20259 ,* Another top level headline     |    * Another top level headline
  20260 #+end_example
  20261 
  20262 Org can achieve this in two ways, (1) by just displaying the buffer in
  20263 this way without changing it, or (2) by actually indenting every line
  20264 in the desired amount with hard spaces and hiding leading stars.
  20265 
  20266 *** Org Indent Mode
  20267 
  20268 #+cindex: Indent mode
  20269 #+findex: org-indent-mode
  20270 To display the buffer in the indented view, activate Org Indent minor
  20271 mode, using {{{kbd(M-x org-indent-mode)}}}.  Text lines that are not
  20272 headlines are prefixed with virtual spaces to vertically align with
  20273 the headline text[fn:51].
  20274 
  20275 #+vindex: org-indent-indentation-per-level
  20276 To make more horizontal space, the headlines are shifted by two
  20277 characters.  Configure ~org-indent-indentation-per-level~ variable for
  20278 a different number.
  20279 
  20280 #+vindex: org-indent-mode-turns-on-hiding-stars
  20281 #+vindex: org-indent-mode-turns-off-org-adapt-indentation
  20282 By default, Org Indent mode turns off ~org-adapt-indentation~ and does
  20283 hide leading stars by locally setting ~org-hide-leading-stars~ to ~t~:
  20284 only one star on each headline is visible, the rest are masked with
  20285 the same font color as the background.  If you want to customize this
  20286 default behavior, see ~org-indent-mode-turns-on-hiding-stars~ and
  20287 ~org-indent-mode-turns-off-org-adapt-indentation~.
  20288 
  20289 #+vindex: org-startup-indented
  20290 To globally turn on Org Indent mode for all files, customize the
  20291 variable ~org-startup-indented~.  To control it for individual files,
  20292 use =STARTUP= keyword as follows:
  20293 
  20294 : #+STARTUP: indent
  20295 : #+STARTUP: noindent
  20296 
  20297 *** Hard indentation
  20298 
  20299 It is possible to use hard spaces to achieve the indentation instead,
  20300 if the bare ASCII file should have the indented look also outside
  20301 Emacs[fn:52].  With Org's support, you have to indent all lines to
  20302 line up with the outline headers.  You would use these settings[fn::
  20303 ~org-adapt-indentation~ can also be set to ='headline-data=, in which
  20304 case only data lines below the headline will be indented.]:
  20305 
  20306 #+begin_src emacs-lisp
  20307 (setq org-adapt-indentation t
  20308       org-hide-leading-stars t
  20309       org-odd-levels-only t)
  20310 #+end_src
  20311 
  20312 - /Indentation of text below headlines/ (~org-adapt-indentation~) ::
  20313 
  20314   #+vindex: org-adapt-indentation
  20315   The first setting modifies paragraph filling, line wrapping, and
  20316   structure editing commands to preserving or adapting the indentation
  20317   as appropriate.
  20318 
  20319 - /Hiding leading stars/ (~org-hide-leading-stars~) ::
  20320 
  20321   #+vindex: org-hide-leading-stars
  20322   #+vindex: org-hide, face
  20323   The second setting makes leading stars invisible by applying the
  20324   face ~org-hide~ to them.  For per-file preference, use these file
  20325   =STARTUP= options:
  20326 
  20327   #+begin_example
  20328   ,#+STARTUP: hidestars
  20329   ,#+STARTUP: showstars
  20330   #+end_example
  20331 
  20332 - /Odd levels/ (~org-odd-levels-only~) ::
  20333 
  20334   #+vindex: org-odd-levels-only
  20335   The third setting makes Org use only odd levels, 1, 3, 5, ..., in
  20336   the outline to create more indentation.  On a per-file level,
  20337   control this with:
  20338 
  20339   #+begin_example
  20340   ,#+STARTUP: odd
  20341   ,#+STARTUP: oddeven
  20342   #+end_example
  20343 
  20344   To convert a file between single and double stars layouts, use
  20345   {{{kbd(M-x org-convert-to-odd-levels)}}} and {{{kbd(M-x
  20346   org-convert-to-oddeven-levels)}}}.
  20347 
  20348 ** Execute commands in the active region
  20349 :PROPERTIES:
  20350 :DESCRIPTION: Execute commands on multiple items in Org or agenda view.
  20351 :END:
  20352 
  20353 #+vindex: org-loop-over-headlines-in-active-region
  20354 When in an Org buffer and the region is active, some commands will
  20355 apply to all the subtrees in the active region.  For example, hitting
  20356 {{{kbd(C-c C-s)}}} when multiple headlines are within the active region will
  20357 successively prompt you for a new schedule date and time.  To disable
  20358 this, set the option ~org-loop-over-headlines-in-active-region~ to
  20359 non-~t~, activate the region and run the command normally.
  20360 
  20361 #+vindex: org-agenda-loop-over-headlines-in-active-region
  20362 ~org-agenda-loop-over-headlines-in-active-region~ is the equivalent
  20363 option of the agenda buffer, where you can also use [[*Bulk remote editing selected entries][bulk editing of
  20364 selected entries]].
  20365 
  20366 Not all commands can loop in the active region and what subtrees or
  20367 headlines are considered can be refined: see the docstrings of these
  20368 options for more details.
  20369 
  20370 ** Dynamic Headline Numbering
  20371 :PROPERTIES:
  20372 :DESCRIPTION: Display and update outline numbering.
  20373 :END:
  20374 
  20375 #+cindex: Org Num mode
  20376 #+cindex: number headlines
  20377 The Org Num minor mode, toggled with {{{kbd(M-x org-num-mode)}}},
  20378 displays outline numbering on top of headlines.  It also updates it
  20379 automatically upon changes to the structure of the document.
  20380 
  20381 #+vindex: org-num-max-level
  20382 #+vindex: org-num-skip-tags
  20383 #+vindex: org-num-skip-commented
  20384 #+vindex: org-num-skip-unnumbered
  20385 By default, all headlines are numbered.  You can limit numbering to
  20386 specific headlines according to their level, tags, =COMMENT= keyword,
  20387 or =UNNUMBERED= property.  Set ~org-num-max-level~,
  20388 ~org-num-skip-tags~, ~org-num-skip-commented~,
  20389 ~org-num-skip-unnumbered~, or ~org-num-skip-footnotes~ accordingly.
  20390 
  20391 #+vindex: org-num-skip-footnotes
  20392 If ~org-num-skip-footnotes~ is non-~nil~, footnotes sections (see
  20393 [[*Creating Footnotes]]) are not numbered either.
  20394 
  20395 #+vindex: org-num-face
  20396 #+vindex: org-num-format-function
  20397 You can control how the numbering is displayed by setting
  20398 ~org-num-face~ and ~org-num-format-function~.
  20399 
  20400 #+vindex: org-startup-numerated
  20401 You can also turn this mode globally for all Org files by setting the
  20402 option ~org-startup-numerated~ to =t=, or locally on a file by using
  20403 =#+startup: num=.
  20404 
  20405 ** The Very Busy {{{kbd(C-c C-c)}}} Key
  20406 :PROPERTIES:
  20407 :DESCRIPTION: When in doubt, press @kbd{C-c C-c}.
  20408 :END:
  20409 #+kindex: C-c C-c
  20410 #+cindex: @kbd{C-c C-c}, overview
  20411 
  20412 The {{{kbd(C-c C-c)}}} key in Org serves many purposes depending on
  20413 the context.  It is probably the most over-worked, multi-purpose key
  20414 combination in Org.  Its uses are well documented throughout this
  20415 manual, but here is a consolidated list for easy reference.
  20416 
  20417 - If column view (see [[*Column View]]) is on, exit column view.
  20418 
  20419 - If any highlights shown in the buffer from the creation of a sparse
  20420   tree, or from clock display, remove such highlights.
  20421 
  20422 - If point is in one of the special =KEYWORD= lines, scan the buffer
  20423   for these lines and update the information.  Also reset the Org file
  20424   cache used to temporary store the contents of URLs used as values
  20425   for keywords like =SETUPFILE=.
  20426 
  20427 - If point is inside a table, realign the table.
  20428 
  20429 - If point is on a =TBLFM= keyword, re-apply the formulas to the
  20430   entire table.
  20431 
  20432 - If the current buffer is a capture buffer, close the note and file
  20433   it.  With a prefix argument, also jump to the target location after
  20434   saving the note.
  20435 
  20436 - If point is on a =<<<target>>>=, update radio targets and
  20437   corresponding links in this buffer.
  20438 
  20439 - If point is on a property line or at the start or end of a property
  20440   drawer, offer property commands.
  20441 
  20442 - If point is at a footnote reference, go to the corresponding
  20443   definition, and /vice versa/.
  20444 
  20445 - If point is on a statistics cookie, update it.
  20446 
  20447 - If point is in a plain list item with a checkbox, toggle the status
  20448   of the checkbox.
  20449 
  20450 - If point is on a numbered item in a plain list, renumber the ordered
  20451   list.
  20452 
  20453 - If point is on the =#+BEGIN= line of a dynamic block, the block is
  20454   updated.
  20455 
  20456 - If point is at a timestamp, fix the day name in the timestamp.
  20457 
  20458 ** Summary of In-Buffer Settings
  20459 :PROPERTIES:
  20460 :DESCRIPTION: Overview of keywords.
  20461 :ALT_TITLE: In-buffer Settings
  20462 :END:
  20463 #+cindex: in-buffer settings
  20464 #+cindex: special keywords
  20465 
  20466 In-buffer settings start with =#+=, followed by a keyword, a colon,
  20467 one or more spaces, and then a word for each setting.  Org accepts
  20468 multiple settings on the same line.  Org also accepts multiple lines
  20469 for a keyword.  This manual describes these settings throughout.  A
  20470 summary follows here.
  20471 
  20472 #+cindex: refresh set-up
  20473 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
  20474 Closing and reopening the Org file in Emacs also activates the
  20475 changes.
  20476 
  20477 #+attr_texinfo: :sep ,
  20478 - =#+ARCHIVE: %s_done::= ::
  20479 
  20480   #+cindex: @samp{ARCHIVE}, keyword
  20481   #+vindex: org-archive-location
  20482   Sets the archive location of the agenda file.  The corresponding
  20483   variable is ~org-archive-location~.
  20484 
  20485 - =#+CATEGORY= ::
  20486 
  20487   #+cindex: @samp{CATEGORY}, keyword
  20488   Sets the category of the agenda file, which applies to the entire
  20489   document.
  20490 
  20491 - =#+COLUMNS: %25ITEM ...= ::
  20492 
  20493   #+cindex: @samp{COLUMNS}, property
  20494   Set the default format for columns view.  This format applies when
  20495   columns view is invoked in locations where no =COLUMNS= property
  20496   applies.
  20497 
  20498 - =#+CONSTANTS: name1=value1 ...= ::
  20499 
  20500   #+cindex: @samp{CONSTANTS}, keyword
  20501   #+vindex: org-table-formula-constants
  20502   #+vindex: org-table-formula
  20503   Set file-local values for constants that table formulas can use.
  20504   This line sets the local variable
  20505   ~org-table-formula-constants-local~.  The global version of this
  20506   variable is ~org-table-formula-constants~.
  20507 
  20508 - =#+FILETAGS: :tag1:tag2:tag3:= ::
  20509 
  20510   #+cindex: @samp{FILETAGS}, keyword
  20511   Set tags that all entries in the file inherit from, including the
  20512   top-level entries.
  20513 
  20514 - =#+LINK: linkword replace= ::
  20515 
  20516   #+cindex: @samp{LINK}, keyword
  20517   #+vindex: org-link-abbrev-alist
  20518   Each line specifies one abbreviation for one link.  Use multiple
  20519   =LINK= keywords for more, see [[*Link Abbreviations]].  The
  20520   corresponding variable is ~org-link-abbrev-alist~.
  20521 
  20522 - =#+PRIORITIES: highest lowest default= ::
  20523 
  20524   #+cindex: @samp{PRIORITIES}, keyword
  20525   #+vindex: org-priority-highest
  20526   #+vindex: org-priority-lowest
  20527   #+vindex: org-priority-default
  20528   This line sets the limits and the default for the priorities.  All
  20529   three must be either letters A--Z or numbers 0--9.  The highest
  20530   priority must have a lower ASCII number than the lowest priority.
  20531 
  20532 - =#+PROPERTY: Property_Name Value= ::
  20533 
  20534   #+cindex: @samp{PROPERTY}, keyword
  20535   This line sets a default inheritance value for entries in the
  20536   current buffer, most useful for specifying the allowed values of
  20537   a property.
  20538 
  20539 - =#+SETUPFILE: file= ::
  20540 
  20541   #+cindex: @samp{SETUPFILE}, keyword
  20542   The setup file or a URL pointing to such file is for additional
  20543   in-buffer settings.  Org loads this file and parses it for any
  20544   settings in it when Org opens the main file.  If URL is
  20545   specified, the contents are downloaded and stored in a temporary
  20546   file cache.  {{{kbd(C-c C-c)}}} on the settings line re-parses and
  20547   re-loads the file, and also resets the temporary file cache.
  20548 
  20549   Org also parses and loads /in-buffer settings/ from the setup file
  20550   during normal exporting process.  Org parses the /in-buffer
  20551   settings/ as if it was included in the containing Org buffer.  The
  20552   rest of the contents of setup file is ignored.
  20553 
  20554   To visit the setup file---not a URL---use {{{kbd(C-c ')}}} while point
  20555   is on the line with the setup file name.
  20556 
  20557 - =#+STARTUP:= ::
  20558 
  20559   #+cindex: @samp{STARTUP}, keyword
  20560   Startup options Org uses when first visiting a file.
  20561 
  20562   #+vindex: org-startup-folded
  20563   The first set of options deals with the initial visibility of the
  20564   outline tree.  The corresponding variable for global default
  20565   settings is ~org-startup-folded~ with a default value of
  20566   ~showeverything~.
  20567 
  20568   | =overview=       | Top-level headlines only.  |
  20569   | =content=        | All headlines.             |
  20570   | =showall=        | No folding on any entry.   |
  20571   | =show2levels=    | Headline levels 1-2.       |
  20572   | =show3levels=    | Headline levels 1-3.       |
  20573   | =show4levels=    | Headline levels 1-4.       |
  20574   | =show5levels=    | Headline levels 1-5.       |
  20575   | =showeverything= | Show even drawer contents. |
  20576 
  20577   #+vindex: org-startup-indented
  20578   Dynamic virtual indentation is controlled by the variable
  20579   ~org-startup-indented~[fn:: Note that Org Indent mode also sets the
  20580   ~wrap-prefix~ property, such that Visual Line mode (or purely
  20581   setting ~word-wrap~) wraps long lines, including headlines,
  20582   correctly indented.].
  20583 
  20584   | =indent=   | Start with Org Indent mode turned on.  |
  20585   | =noindent= | Start with Org Indent mode turned off. |
  20586 
  20587   #+vindex: org-startup-numerated
  20588   Dynamic virtual numeration of headlines is controlled by the variable
  20589   ~org-startup-numerated~.
  20590 
  20591   | =num=   | Start with Org num mode turned on.  |
  20592   | =nonum= | Start with Org num mode turned off. |
  20593 
  20594   #+vindex: org-startup-align-all-tables
  20595   Aligns tables consistently upon visiting a file.  The
  20596   corresponding variable is ~org-startup-align-all-tables~ with
  20597   ~nil~ as default value.
  20598 
  20599   | =align=   | Align all tables.               |
  20600   | =noalign= | Do not align tables on startup. |
  20601 
  20602   #+vindex: org-startup-shrink-all-tables
  20603   Shrink table columns with a width cookie.  The corresponding
  20604   variable is ~org-startup-shrink-all-tables~ with ~nil~ as
  20605   default value.
  20606 
  20607   #+vindex: org-startup-with-inline-images
  20608   When visiting a file, inline images can be automatically
  20609   displayed.  The corresponding variable is
  20610   ~org-startup-with-inline-images~, with a default value ~nil~ to
  20611   avoid delays when visiting a file.
  20612 
  20613   | =inlineimages=   | Show inline images.                   |
  20614   | =noinlineimages= | Do not show inline images on startup. |
  20615 
  20616   #+vindex: org-link-descriptive
  20617   Bracket links in Org buffers are displayed hiding the link path and
  20618   brackets.  For example, =[[https://orgmode.org][Org Website]]= is,
  20619   by default, displayed as "Org Website", hiding the link itself and
  20620   just displaying its description.  Alternatively, the links can be
  20621   displayed in full.  The corresponding variable is
  20622   ~org-link-descriptive~.
  20623 
  20624   | =descriptivelinks= | Hide path and brackets in links. |
  20625   | =literallinks=     | Do not hide anything.            |
  20626 
  20627   #+vindex: org-log-done
  20628   #+vindex: org-log-note-clock-out
  20629   #+vindex: org-log-repeat
  20630   Logging the closing and reopening of TODO items and clock
  20631   intervals can be configured using these options (see variables
  20632   ~org-log-done~, ~org-log-note-clock-out~, and ~org-log-repeat~).
  20633 
  20634   | =logdone=            | Record a timestamp when an item is marked as done. |
  20635   | =lognotedone=        | Record timestamp and a note when DONE.             |
  20636   | =nologdone=          | Do not record when items are marked as done.       |
  20637   | =logrepeat=          | Record a time when reinstating a repeating item.   |
  20638   | =lognoterepeat=      | Record a note when reinstating a repeating item.   |
  20639   | =nologrepeat=        | Do not record when reinstating repeating item.     |
  20640   | =lognoteclock-out=   | Record a note when clocking out.                   |
  20641   | =nolognoteclock-out= | Do not record a note when clocking out.            |
  20642   | =logreschedule=      | Record a timestamp when scheduling time changes.   |
  20643   | =lognotereschedule=  | Record a note when scheduling time changes.        |
  20644   | =nologreschedule=    | Do not record when a scheduling date changes.      |
  20645   | =logredeadline=      | Record a timestamp when deadline changes.          |
  20646   | =lognoteredeadline=  | Record a note when deadline changes.               |
  20647   | =nologredeadline=    | Do not record when a deadline date changes.        |
  20648   | =logrefile=          | Record a timestamp when refiling.                  |
  20649   | =lognoterefile=      | Record a note when refiling.                       |
  20650   | =nologrefile=        | Do not record when refiling.                       |
  20651 
  20652   #+vindex: org-hide-leading-stars
  20653   #+vindex: org-odd-levels-only
  20654   Here are the options for hiding leading stars in outline
  20655   headings, and for indenting outlines.  The corresponding
  20656   variables are ~org-hide-leading-stars~ and
  20657   ~org-odd-levels-only~, both with a default setting ~nil~
  20658   (meaning =showstars= and =oddeven=).
  20659 
  20660   | =hidestars= | Make all but one of the stars starting a headline invisible. |
  20661   | =showstars= | Show all stars starting a headline.                          |
  20662   | =indent=    | Virtual indentation according to outline level.              |
  20663   | =noindent=  | No virtual indentation according to outline level.           |
  20664   | =odd=       | Allow only odd outline levels (1, 3, ...).                   |
  20665   | =oddeven=   | Allow all outline levels.                                    |
  20666 
  20667   #+vindex: org-display-custom-times
  20668   #+vindex: org-timestamp-custom-formats
  20669   #+vindex: org-time-stamp-custom-formats
  20670   To turn on custom format overlays over timestamps (variables
  20671   ~org-display-custom-times~ and
  20672   ~org-timestamp-custom-formats~), use:
  20673 
  20674   | =customtime= | Overlay custom time format. |
  20675 
  20676   #+vindex: constants-unit-system
  20677   The following options influence the table spreadsheet (variable
  20678   ~constants-unit-system~).
  20679 
  20680   | =constcgs= | =constants.el= should use the c-g-s unit system. |
  20681   | =constSI=  | =constants.el= should use the SI unit system.    |
  20682 
  20683   #+vindex: org-footnote-define-inline
  20684   #+vindex: org-footnote-auto-label
  20685   #+vindex: org-footnote-auto-adjust
  20686   To influence footnote settings, use the following keywords.  The
  20687   corresponding variables are ~org-footnote-define-inline~,
  20688   ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
  20689 
  20690   | =fninline=   | Define footnotes inline.                               |
  20691   | =fnnoinline= | Define footnotes in separate section.                  |
  20692   | =fnlocal=    | Define footnotes near first reference, but not inline. |
  20693   | =fnprompt=   | Prompt for footnote labels.                            |
  20694   | =fnauto=     | Create =[fn:1]=-like labels automatically (default).   |
  20695   | =fnconfirm=  | Offer automatic label for editing or confirmation.     |
  20696   | =fnadjust=   | Automatically renumber and sort footnotes.             |
  20697   | =nofnadjust= | Do not renumber and sort automatically.                |
  20698   | =fnanon=     | Create anonymous footnotes with ~org-footnote-new~.    |
  20699 
  20700   #+vindex: org-hide-block-startup
  20701   #+vindex: org-hide-drawer-startup
  20702   To hide blocks or drawers on startup, use these keywords.  The
  20703   corresponding variables are ~org-hide-block-startup~ and
  20704   ~org-hide-drawer-startup~.
  20705 
  20706   | =hideblocks=    | Hide all begin/end blocks on startup. |
  20707   | =nohideblocks=  | Do not hide blocks on startup.        |
  20708   | =hidedrawers=   | Hide all begin/end blocks on startup. |
  20709   | =nohidedrawers= | Do not hide blocks on startup.        |
  20710 
  20711 
  20712   #+vindex: org-pretty-entities
  20713   The display of entities as UTF-8 characters is governed by the
  20714   variable ~org-pretty-entities~ and the keywords
  20715 
  20716   | =entitiespretty= | Show entities as UTF-8 characters where possible. |
  20717   | =entitiesplain=  | Leave entities plain.                             |
  20718 
  20719 - =#+TAGS: TAG1(c1) TAG2(c2)= ::
  20720 
  20721   #+cindex: @samp{TAGS}, keyword
  20722   #+vindex: org-tag-alist
  20723   These lines (several such lines are allowed) specify the valid tags
  20724   in this file, and (potentially) the corresponding /fast tag
  20725   selection/ keys.  The corresponding variable is ~org-tag-alist~.
  20726 
  20727 - =#+TODO:=, =#+SEQ_TODO:=, =#+TYP_TODO:= ::
  20728 
  20729   #+cindex: @samp{SEQ_TODO}, keyword
  20730   #+cindex: @samp{TODO}, keyword
  20731   #+cindex: @samp{TYP_TODO}, keyword
  20732   #+vindex: org-todo-keywords
  20733   These lines set the TODO keywords and their interpretation in the
  20734   current file.  The corresponding variable is ~org-todo-keywords~.
  20735 
  20736 ** Regular Expressions
  20737 :PROPERTIES:
  20738 :DESCRIPTION: Elisp regular expressions.
  20739 :END:
  20740 #+cindex: regular expressions syntax
  20741 #+cindex: regular expressions, in searches
  20742 
  20743 Org, as an Emacs mode, makes use of Elisp regular expressions for
  20744 searching, matching and filtering.  Elisp regular expressions have a
  20745 somewhat different syntax then some common standards.  Most notably,
  20746 alternation is indicated using =\|= and matching groups are denoted by
  20747 =\(...\)=.  For example the string =home\|work= matches either =home=
  20748 or =work=.
  20749 
  20750 For more information, see [[info:emacs::Regexps][Regular Expressions in Emacs]].
  20751 
  20752 ** Org Syntax
  20753 :PROPERTIES:
  20754 :DESCRIPTION: Formal description of Org's syntax.
  20755 :END:
  20756 
  20757 A reference document providing a formal description of Org's syntax is
  20758 available as [[https://orgmode.org/worg/org-syntax.html][a draft on Worg]], initially written by Nicolas Goaziou.
  20759 It defines Org's core internal concepts such as "headlines",
  20760 "sections", "affiliated keywords", "(greater) elements" and "objects".
  20761 Each part of an Org document belongs to one of the previous
  20762 categories.
  20763 
  20764 To explore the abstract structure of an Org buffer, run this in
  20765 a buffer:
  20766 
  20767 : M-: (org-element-parse-buffer) <RET>
  20768 
  20769 #+texinfo: @noindent
  20770 It outputs a list containing the buffer's content represented as an
  20771 abstract structure.  The export engine relies on the information
  20772 stored in this list.  Most interactive commands---e.g., for structure
  20773 editing---also rely on the syntactic meaning of the surrounding
  20774 context.
  20775 
  20776 #+cindex: syntax checker
  20777 #+cindex: linter
  20778 #+findex: org-lint
  20779 You can probe the syntax of your documents with the command
  20780 
  20781 : M-x org-lint <RET>
  20782 
  20783 #+texinfo: @noindent
  20784 It runs a number of checks to find common mistakes.  It then displays
  20785 their location in a dedicated buffer, along with a description and
  20786 a "trust level", since false-positive are possible.  From there, you
  20787 can operate on the reports with the following keys:
  20788 
  20789 #+attr_texinfo: :columns 0.22 0.78
  20790 | {{{kbd(C-j)}}}, {{{kbd(TAB)}}} | Display the offending line                  |
  20791 | {{{kbd(RET)}}}                 | Move point to the offending line            |
  20792 | {{{kbd(g)}}}                   | Check the document again                    |
  20793 | {{{kbd(h)}}}                   | Hide all reports from the same checker      |
  20794 | {{{kbd(i)}}}                   | Also remove them from all subsequent checks |
  20795 | {{{kbd(S)}}}                   | Sort reports by the column at point         |
  20796 
  20797 ** Context Dependent Documentation
  20798 :PROPERTIES:
  20799 :DESCRIPTION: Read documentation about current syntax.
  20800 :ALT_TITLE: Documentation Access
  20801 :END:
  20802 #+cindex: documentation
  20803 #+cindex: Info
  20804 
  20805 #+findex: org-info-find-node
  20806 #+kindex: C-c C-x I
  20807 {{{kbd(C-c C-x I)}}} in an Org file tries to open a suitable section
  20808 of the Org manual depending on the syntax at point.  For example,
  20809 using it on a headline displays "Document Structure" section.
  20810 
  20811 {{{kbd(q)}}} closes the Info window.
  20812 
  20813 ** Escape Character
  20814 :PROPERTIES:
  20815 :DESCRIPTION: Prevent Org from interpreting your writing.
  20816 :END:
  20817 
  20818 #+cindex: escape character
  20819 #+cindex: zero width space
  20820 You may sometimes want to write text that looks like Org syntax, but
  20821 should really read as plain text.  Org may use a specific escape
  20822 character in some situations, i.e., a backslash in macros (see [[*Macro
  20823 Replacement]]) and links (see [[*Link Format]]), or a comma in source and
  20824 example blocks (see [[*Literal Examples]]).  In the general case, however,
  20825 we suggest to use the zero width space.  You can insert one with any
  20826 of the following:
  20827 
  20828 : C-x 8 <RET> zero width space <RET>
  20829 : C-x 8 <RET> 200B <RET>
  20830 
  20831 For example, in order to write =[[1,2]]= as-is in your document, you
  20832 may write instead
  20833 
  20834 : [X[1,2]]
  20835 
  20836 where =X= denotes the zero width space character.
  20837 
  20838 ** Code Evaluation and Security Issues
  20839 :PROPERTIES:
  20840 :DESCRIPTION: Org files evaluate in-line code.
  20841 :ALT_TITLE: Code Evaluation Security
  20842 :END:
  20843 
  20844 Unlike plain text, running code comes with risk.  Each source code
  20845 block, in terms of risk, is equivalent to an executable file.  Org
  20846 therefore puts a few confirmation prompts by default.  This is to
  20847 alert the casual user from accidentally running untrusted code.
  20848 
  20849 For users who do not run code blocks or write code regularly, Org's
  20850 default settings should suffice.  However, some users may want to
  20851 tweak the prompts for fewer interruptions.  To weigh the risks of
  20852 automatic execution of code blocks, here are some details about code
  20853 evaluation.
  20854 
  20855 Org evaluates code in the following circumstances:
  20856 
  20857 - /Source code blocks/ ::
  20858 
  20859   Org evaluates source code blocks in an Org file during export.  Org
  20860   also evaluates a source code block with the {{{kbd(C-c C-c)}}} key
  20861   chord.  Users exporting or running code blocks must load files only
  20862   from trusted sources.  Be wary of customizing variables that remove
  20863   or alter default security measures.
  20864 
  20865   #+attr_texinfo: :options org-confirm-babel-evaluate
  20866   #+begin_defopt
  20867   When ~t~, Org prompts the user for confirmation before executing
  20868   each code block.  When ~nil~, Org executes code blocks without
  20869   prompting the user for confirmation.  When this option is set to
  20870   a custom function, Org invokes the function with these two
  20871   arguments: the source code language and the body of the code block.
  20872   The custom function must return either a ~t~ or ~nil~, which
  20873   determines if the user is prompted.  Each source code language can
  20874   be handled separately through this function argument.
  20875   #+end_defopt
  20876 
  20877   For example, here is how to execute ditaa code blocks without
  20878   prompting:
  20879 
  20880   #+begin_src emacs-lisp
  20881   (defun my-org-confirm-babel-evaluate (lang body)
  20882     (not (string= lang "ditaa")))  ;don't ask for ditaa
  20883   (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  20884   #+end_src
  20885 
  20886 - /Following =shell= and =elisp= links/ ::
  20887 
  20888   Org has two link types that can directly evaluate code (see
  20889   [[*External Links]]).  Because such code is not visible, these links
  20890   have a potential risk.  Org therefore prompts the user when it
  20891   encounters such links.  The customization variables are:
  20892 
  20893   #+attr_texinfo: :options org-link-shell-confirm-function
  20894   #+begin_defopt
  20895   Function that prompts the user before executing a shell link.
  20896   #+end_defopt
  20897 
  20898   #+attr_texinfo: :options org-link-elisp-confirm-function
  20899   #+begin_defopt
  20900   Function that prompts the user before executing an Emacs Lisp link.
  20901   #+end_defopt
  20902 
  20903 - /Formulas in tables/ ::
  20904 
  20905   Formulas in tables (see [[*The Spreadsheet]]) are code that is evaluated
  20906   either by the Calc interpreter, or by the Emacs Lisp interpreter.
  20907 
  20908 ** Interaction with Other Packages
  20909 :PROPERTIES:
  20910 :DESCRIPTION: With other Emacs packages.
  20911 :ALT_TITLE: Interaction
  20912 :END:
  20913 #+cindex: packages, interaction with other
  20914 
  20915 Org's compatibility and the level of interaction with other Emacs
  20916 packages are documented here.
  20917 
  20918 *** Packages that Org cooperates with
  20919 :PROPERTIES:
  20920 :DESCRIPTION: Packages Org cooperates with.
  20921 :ALT_TITLE: Cooperation
  20922 :END:
  20923 
  20924 - =calc.el= by Dave Gillespie ::
  20925   #+cindex: @file{calc.el}
  20926 
  20927   Org uses the Calc package for implementing spreadsheet functionality
  20928   in its tables (see [[*The Spreadsheet]]).  Org also uses Calc for
  20929   embedded calculations.  See [[info:calc::Embedded Mode][GNU Emacs Calc Manual]].
  20930 
  20931 - =constants.el= by Carsten Dominik ::
  20932   #+cindex: @file{constants.el}
  20933   #+vindex: org-table-formula-constants
  20934 
  20935   Org can use names for constants in formulas in tables.  Org can also
  20936   use calculation suffixes for units, such as =M= for =Mega=.  For a
  20937   standard collection of such constants, install the =constants=
  20938   package.  Install version 2.0 of this package, available at
  20939   [[https://github.com/cdominik/constants-for-Emacs]].  Org checks if the
  20940   function ~constants-get~ has been autoloaded.  Installation
  20941   instructions are in the file =constants.el=.
  20942 
  20943 - =cdlatex.el= by Carsten Dominik ::
  20944   #+cindex: @file{cdlatex.el}
  20945 
  20946   Org mode can make use of the CDLaTeX package to efficiently enter
  20947   LaTeX fragments into Org files.  See [[*Using CDLaTeX to enter math]].
  20948 
  20949 - =imenu.el= by Ake Stenhoff and Lars Lindberg ::
  20950   #+cindex: @file{imenu.el}
  20951 
  20952   Imenu creates dynamic menus based on an index of items in a file.
  20953   Org mode supports Imenu menus.  Enable it with a mode hook as
  20954   follows:
  20955 
  20956   #+begin_src emacs-lisp
  20957   (add-hook 'org-mode-hook
  20958             (lambda () (imenu-add-to-menubar "Imenu")))
  20959   #+end_src
  20960 
  20961   #+vindex: org-imenu-depth
  20962   By default the index is two levels deep---you can modify the
  20963   depth using the option ~org-imenu-depth~.
  20964 
  20965   Org activates Imenu support only in the buffers opened after loading
  20966   Imenu library.  To enable Imenu support in an already opened Org
  20967   buffer, reload Org.
  20968 
  20969 - =speedbar.el= by Eric\nbsp{}M.\nbsp{}Ludlam ::
  20970   #+cindex: @file{speedbar.el}
  20971 
  20972   Speedbar package creates a special Emacs frame for displaying files
  20973   and index items in files.  Org mode supports Speedbar; users can
  20974   drill into Org files directly from the Speedbar.  The {{{kbd(<)}}}
  20975   in the Speedbar frame tweaks the agenda commands to that file or to
  20976   a subtree.
  20977 
  20978 - =table.el= by Takaaki Ota ::
  20979   #+cindex: table editor, @file{table.el}
  20980   #+cindex: @file{table.el}
  20981 
  20982   Complex ASCII tables with automatic line wrapping, column- and
  20983   row-spanning, and alignment can be created using the Emacs table
  20984   package by Takaaki Ota.  Org mode recognizes such tables and exports
  20985   them properly.  {{{kbd(C-c ')}}} to edit these tables in a special
  20986   buffer, much like Org's code blocks.  Because of interference with
  20987   other Org mode functionality, Takaaki Ota tables cannot be edited
  20988   directly in the Org buffer.
  20989 
  20990   - {{{kbd(C-c ')}}} (~org-edit-special~) ::
  20991 
  20992     #+kindex: C-c '
  20993     #+findex: org-edit-special
  20994     Edit a =table.el= table.  Works when point is in a =table.el=
  20995     table.
  20996 
  20997   - {{{kbd(C-c ~​)}}} (~org-table-create-with-table.el~) ::
  20998 
  20999     #+kindex: C-c ~
  21000     #+findex: org-table-create-with-table.el
  21001     Insert a =table.el= table.  If there is already a table at point,
  21002     this command converts it between the =table.el= format and the Org
  21003     mode format.  See the documentation string of the command
  21004     ~org-convert-table~ for the restrictions under which this is
  21005     possible.
  21006 
  21007 *** Packages that conflict with Org mode
  21008 :PROPERTIES:
  21009 :DESCRIPTION: Packages that lead to conflicts.
  21010 :ALT_TITLE: Conflicts
  21011 :END:
  21012 
  21013 #+cindex: shift-selection
  21014 #+vindex: org-support-shift-select
  21015 In Emacs, shift-selection combines motions of point with shift key to
  21016 enlarge regions.  Emacs sets this mode by default.  This conflicts
  21017 with Org's use of {{{kbd(S-<cursor>)}}} commands to change timestamps,
  21018 TODO keywords, priorities, and item bullet types, etc.  Since
  21019 {{{kbd(S-<cursor>)}}} commands outside of specific contexts do not do
  21020 anything, Org offers the variable ~org-support-shift-select~ for
  21021 customization.  Org mode accommodates shift selection by (i) making it
  21022 available outside of the special contexts where special commands
  21023 apply, and (ii) extending an existing active region even if point
  21024 moves across a special context.
  21025 
  21026 - =cua.el= by Kim\nbsp{}F.\nbsp{}Storm ::
  21027 
  21028   #+cindex: @file{cua.el}
  21029   #+vindex: org-replace-disputed-keys
  21030   Org key bindings conflict with {{{kbd(S-<cursor>)}}} keys used by
  21031   CUA mode.  For Org to relinquish these bindings to CUA mode,
  21032   configure the variable ~org-replace-disputed-keys~.  When set, Org
  21033   moves the following key bindings in Org files, and in the agenda
  21034   buffer---but not during date selection.
  21035 
  21036   #+attr_texinfo: :columns 0.4 0.4
  21037   | {{{kbd(S-UP)}}}      \rArr{}  {{{kbd(M-p)}}}   | {{{kbd(S-DOWN)}}}     \rArr{}  {{{kbd(M-n)}}}   |
  21038   | {{{kbd(S-LEFT)}}}    \rArr{}  {{{kbd(M--)}}}   | {{{kbd(S-RIGHT)}}}    \rArr{}  {{{kbd(M-+)}}}   |
  21039   | {{{kbd(C-S-LEFT)}}}  \rArr{}  {{{kbd(M-S--)}}} | {{{kbd(C-S-RIGHT)}}}  \rArr{}  {{{kbd(M-S-+)}}} |
  21040 
  21041   #+vindex: org-disputed-keys
  21042   Yes, these are unfortunately more difficult to remember.  If you
  21043   want to have other replacement keys, look at the variable
  21044   ~org-disputed-keys~.
  21045 
  21046 - =ecomplete.el= by Lars Magne Ingebrigtsen ::
  21047 
  21048   #+cindex: @file{ecomplete.el}
  21049   Ecomplete provides "electric" address completion in address header
  21050   lines in message buffers.  Sadly Orgtbl mode cuts Ecomplete's power
  21051   supply: no completion happens when Orgtbl mode is enabled in message
  21052   buffers while entering text in address header lines.  If one wants
  21053   to use ecomplete one should /not/ follow the advice to automagically
  21054   turn on Orgtbl mode in message buffers (see [[*The Orgtbl Minor Mode]]),
  21055   but instead---after filling in the message headers---turn on Orgtbl
  21056   mode manually when needed in the messages body.
  21057 
  21058 - =filladapt.el= by Kyle Jones ::
  21059 
  21060   #+cindex: @file{filladapt.el}
  21061   Org mode tries to do the right thing when filling paragraphs, list
  21062   items and other elements.  Many users reported problems using both
  21063   =filladapt.el= and Org mode, so a safe thing to do is to disable
  21064   filladapt like this:
  21065 
  21066   #+begin_src emacs-lisp
  21067   (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
  21068   #+end_src
  21069 
  21070 - =viper.el= by Michael Kifer ::
  21071   #+cindex: @file{viper.el}
  21072   #+kindex: C-c /
  21073 
  21074   Viper uses {{{kbd(C-c /)}}} and therefore makes this key not access
  21075   the corresponding Org mode command ~org-sparse-tree~.  You need to
  21076   find another key for this command, or override the key in
  21077   ~viper-vi-global-user-map~ with
  21078 
  21079   #+begin_src emacs-lisp
  21080   (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  21081   #+end_src
  21082 
  21083 - =windmove.el= by Hovav Shacham ::
  21084   #+cindex: @file{windmove.el}
  21085 
  21086   This package also uses the {{{kbd(S-<cursor>)}}} keys, so everything
  21087   written in the paragraph above about CUA mode also applies here.  If
  21088   you want to make the windmove function active in locations where Org
  21089   mode does not have special functionality on {{{kbd(S-<cursor>)}}},
  21090   add this to your configuration:
  21091 
  21092   #+begin_src emacs-lisp
  21093   ;; Make windmove work in Org mode:
  21094   (add-hook 'org-shiftup-final-hook 'windmove-up)
  21095   (add-hook 'org-shiftleft-final-hook 'windmove-left)
  21096   (add-hook 'org-shiftdown-final-hook 'windmove-down)
  21097   (add-hook 'org-shiftright-final-hook 'windmove-right)
  21098   #+end_src
  21099 
  21100 - =yasnippet.el= ::
  21101 
  21102   #+cindex: @file{yasnippet.el}
  21103   The way Org mode binds the {{{kbd(TAB)}}} key (binding to ~[tab]~
  21104   instead of ~"\t"~) overrules YASnippet's access to this key.  The
  21105   following code fixed this problem:
  21106 
  21107   #+begin_src emacs-lisp
  21108   (add-hook 'org-mode-hook
  21109             (lambda ()
  21110               (setq-local yas/trigger-key [tab])
  21111               (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  21112   #+end_src
  21113 
  21114   The latest version of YASnippet does not play well with Org mode.
  21115   If the above code does not fix the conflict, start by defining
  21116   the following function:
  21117 
  21118   #+begin_src emacs-lisp
  21119   (defun yas/org-very-safe-expand ()
  21120     (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  21121   #+end_src
  21122 
  21123   Then, tell Org mode to use that function:
  21124 
  21125   #+begin_src emacs-lisp
  21126   (add-hook 'org-mode-hook
  21127             (lambda ()
  21128               (make-variable-buffer-local 'yas/trigger-key)
  21129               (setq yas/trigger-key [tab])
  21130               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
  21131               (define-key yas/keymap [tab] 'yas/next-field)))
  21132   #+end_src
  21133 
  21134 ** Using Org on a TTY
  21135 :PROPERTIES:
  21136 :DESCRIPTION: Using Org on a tty.
  21137 :ALT_TITLE: TTY Keys
  21138 :END:
  21139 #+cindex: tty key bindings
  21140 
  21141 Org provides alternative key bindings for TTY and modern mobile
  21142 devices that cannot perform movement commands on point and key
  21143 bindings with modifier keys.  Some of these workarounds may be more
  21144 cumbersome than necessary.  Users should look into customizing these
  21145 further based on their usage needs.  For example, the normal
  21146 {{{kbd(S-<cursor>)}}} for editing timestamp might be better with
  21147 {{{kbd(C-c .)}}} chord.
  21148 
  21149 #+attr_texinfo: :columns 0.2 0.28 0.15 0.21
  21150 | Default              | Alternative 1            | Speed key    | Alternative 2        |
  21151 |----------------------+--------------------------+--------------+----------------------|
  21152 | {{{kbd(S-TAB)}}}     | {{{kbd(C-u TAB)}}}       | {{{kbd(C)}}} |                      |
  21153 | {{{kbd(M-LEFT)}}}    | {{{kbd(C-c C-x l)}}}     | {{{kbd(l)}}} | {{{kbd(Esc LEFT)}}}  |
  21154 | {{{kbd(M-S-LEFT)}}}  | {{{kbd(C-c C-x L)}}}     | {{{kbd(L)}}} |                      |
  21155 | {{{kbd(M-RIGHT)}}}   | {{{kbd(C-c C-x r)}}}     | {{{kbd(r)}}} | {{{kbd(Esc RIGHT)}}} |
  21156 | {{{kbd(M-S-RIGHT)}}} | {{{kbd(C-c C-x R)}}}     | {{{kbd(R)}}} |                      |
  21157 | {{{kbd(M-UP)}}}      | {{{kbd(C-c C-x u)}}}     |              | {{{kbd(Esc UP)}}}    |
  21158 | {{{kbd(M-S-UP)}}}    | {{{kbd(C-c C-x U)}}}     | {{{kbd(U)}}} |                      |
  21159 | {{{kbd(M-DOWN)}}}    | {{{kbd(C-c C-x d)}}}     |              | {{{kbd(Esc DOWN)}}}  |
  21160 | {{{kbd(M-S-DOWN)}}}  | {{{kbd(C-c C-x D)}}}     | {{{kbd(D)}}} |                      |
  21161 | {{{kbd(S-RET)}}}     | {{{kbd(C-c C-x c)}}}     |              |                      |
  21162 | {{{kbd(M-RET)}}}     | {{{kbd(C-c C-x m)}}}     |              | {{{kbd(Esc RET)}}}   |
  21163 | {{{kbd(M-S-RET)}}}   | {{{kbd(C-c C-x M)}}}     |              |                      |
  21164 | {{{kbd(S-LEFT)}}}    | {{{kbd(C-c LEFT)}}}      |              |                      |
  21165 | {{{kbd(S-RIGHT)}}}   | {{{kbd(C-c RIGHT)}}}     |              |                      |
  21166 | {{{kbd(S-UP)}}}      | {{{kbd(C-c UP)}}}        |              |                      |
  21167 | {{{kbd(S-DOWN)}}}    | {{{kbd(C-c DOWN)}}}      |              |                      |
  21168 | {{{kbd(C-S-LEFT)}}}  | {{{kbd(C-c C-x LEFT)}}}  |              |                      |
  21169 | {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} |              |                      |
  21170 | {{{kbd(C-c C-\,)}}}  | {{{kbd(C-c C-x s)}}}     |              |                      |
  21171 
  21172 ** Protocols for External Access
  21173 :PROPERTIES:
  21174 :DESCRIPTION: External access to Emacs and Org.
  21175 :ALT_TITLE: Protocols
  21176 :END:
  21177 #+cindex: protocols, for external access
  21178 
  21179 Org protocol is a tool to trigger custom actions in Emacs from
  21180 external applications.  Any application that supports calling external
  21181 programs with an URL as argument may be used with this functionality.
  21182 For example, you can configure bookmarks in your web browser to send a
  21183 link to the current page to Org and create a note from it using
  21184 capture (see [[*Capture]]).  You can also create a bookmark that tells
  21185 Emacs to open the local source file of a remote website you are
  21186 browsing.
  21187 
  21188 #+cindex: Org protocol, set-up
  21189 #+cindex: Installing Org protocol
  21190 In order to use Org protocol from an application, you need to register
  21191 =org-protocol://= as a valid scheme-handler.  External calls are
  21192 passed to Emacs through the =emacsclient= command, so you also need to
  21193 ensure an Emacs server is running.  More precisely, when the
  21194 application calls
  21195 
  21196 : emacsclient "org-protocol://PROTOCOL?key1=val1&key2=val2"
  21197 
  21198 #+texinfo: @noindent
  21199 Emacs calls the handler associated to {{{var(PROTOCOL)}}} with
  21200 argument =(:key1 val1 :key2 val2)=.
  21201 
  21202 #+cindex: protocol, new protocol
  21203 #+cindex: defining new protocols
  21204 Org protocol comes with three predefined protocols, detailed in the
  21205 following sections.  Configure ~org-protocol-protocol-alist~ to define
  21206 your own.
  21207 
  21208 *** The ~store-link~ protocol
  21209 :PROPERTIES:
  21210 :DESCRIPTION: Store a link, push URL to kill-ring.
  21211 :END:
  21212 #+cindex: store-link protocol
  21213 #+cindex: protocol, store-link
  21214 
  21215 Using the ~store-link~ handler, you can copy links, to that they can
  21216 be inserted using {{{kbd(M-x org-insert-link)}}} or yanking.  More
  21217 precisely, the command
  21218 
  21219 : emacsclient "org-protocol://store-link?url=URL&title=TITLE"
  21220 
  21221 #+texinfo: @noindent
  21222 stores the following link:
  21223 
  21224 : [[URL][TITLE]]
  21225 
  21226 In addition, {{{var(URL)}}} is pushed on the kill-ring for yanking.
  21227 You need to encode {{{var(URL)}}} and {{{var(TITLE)}}} if they contain
  21228 slashes, and probably quote those for the shell.
  21229 
  21230 To use this feature from a browser, add a bookmark with an arbitrary
  21231 name, e.g., =Org: store-link= and enter this as /Location/:
  21232 
  21233 #+begin_example
  21234 javascript:location.href='org-protocol://store-link?' +
  21235       new URLSearchParams({url:location.href, title:document.title});
  21236 #+end_example
  21237 
  21238 Title is an optional parameter.  Another expression was recommended earlier:
  21239 
  21240 #+begin_example
  21241 javascript:location.href='org-protocol://store-link?url='+
  21242       encodeURIComponent(location.href);
  21243 #+end_example
  21244 
  21245 The latter form is compatible with older Org versions from 9.0 to 9.4.
  21246 
  21247 *** The ~capture~ protocol
  21248 :PROPERTIES:
  21249 :DESCRIPTION: Fill a buffer with external information.
  21250 :END:
  21251 #+cindex: capture protocol
  21252 #+cindex: protocol, capture
  21253 
  21254 Activating the "capture" handler pops up a =Capture= buffer in Emacs,
  21255 using acapture template.
  21256 
  21257 : emacsclient "org-protocol://capture?template=X&url=URL&title=TITLE&body=BODY"
  21258 
  21259 To use this feature, add a bookmark with an arbitrary name, e.g.,
  21260 =Org: capture=, and enter this as =Location=:
  21261 
  21262 #+begin_example
  21263 javascript:location.href='org-protocol://capture?' +
  21264       new URLSearchParams({
  21265             template: 'x', url: window.location.href,
  21266             title: document.title, body: window.getSelection()});
  21267 #+end_example
  21268 
  21269 You might have seen another expression:
  21270 
  21271 #+begin_example
  21272 javascript:location.href='org-protocol://capture?template=x'+
  21273       '&url='+encodeURIComponent(window.location.href)+
  21274       '&title='+encodeURIComponent(document.title)+
  21275       '&body='+encodeURIComponent(window.getSelection());
  21276 #+end_example
  21277 
  21278 It is a bit more cluttered than the former one, but it is compatible
  21279 with previous Org versions 9.0-9.4.  In these versions encoding of
  21280 space as "+" character was not supported by URI decoder.
  21281 
  21282 #+vindex: org-protocol-default-template-key
  21283 The capture template to be used can be specified in the bookmark (like
  21284 =X= above).  If unspecified, the template key is set in the variable
  21285 ~org-protocol-default-template-key~.  The following template
  21286 placeholders are available:
  21287 
  21288 #+begin_example
  21289 %:link          The URL
  21290 %:description   The webpage title
  21291 %:annotation    Equivalent to [[%:link][%:description]]
  21292 %i              The selected text
  21293 #+end_example
  21294 
  21295 *** The ~open-source~ protocol
  21296 :PROPERTIES:
  21297 :DESCRIPTION: Edit published contents.
  21298 :END:
  21299 #+cindex: open-source protocol
  21300 #+cindex: protocol, open-source
  21301 
  21302 The ~open-source~ handler is designed to help with editing local
  21303 sources when reading a document.  To that effect, you can use
  21304 a bookmark with the following location:
  21305 
  21306 #+begin_example
  21307 javascript:location.href='org-protocol://open-source?&url='+
  21308       encodeURIComponent(location.href)
  21309 #+end_example
  21310 
  21311 #+vindex: org-protocol-project-alist
  21312 The variable ~org-protocol-project-alist~ maps URLs to local file
  21313 names, by stripping URL parameters from the end and replacing the
  21314 ~:base-url~ with ~:working-directory~ and ~:online-suffix~ with
  21315 ~:working-suffix~.  For example, assuming you own a local copy of
  21316 =https://orgmode.org/worg/= contents at =/home/user/worg=, you can set
  21317 ~org-protocol-project-alist~ to the following
  21318 
  21319 #+begin_src emacs-lisp
  21320 (setq org-protocol-project-alist
  21321       '(("Worg"
  21322          :base-url "https://orgmode.org/worg/"
  21323          :working-directory "/home/user/worg/"
  21324          :online-suffix ".html"
  21325          :working-suffix ".org")))
  21326 #+end_src
  21327 
  21328 #+texinfo: @noindent
  21329 If you are now browsing
  21330 =https://orgmode.org/worg/org-contrib/org-protocol.html= and find
  21331 a typo or have an idea about how to enhance the documentation, simply
  21332 click the bookmark and start editing.
  21333 
  21334 #+cindex: rewritten URL in open-source protocol
  21335 #+cindex: protocol, open-source rewritten URL
  21336 However, such mapping may not always yield the desired results.
  21337 Suppose you maintain an online store located at =https://example.com/=.
  21338 The local sources reside in =/home/user/example/=.  It is common
  21339 practice to serve all products in such a store through one file and
  21340 rewrite URLs that do not match an existing file on the server.  That
  21341 way, a request to =https://example.com/print/posters.html= might be
  21342 rewritten on the server to something like
  21343 =https://example.com/shop/products.php/posters.html.php=.  The
  21344 ~open-source~ handler probably cannot find a file named
  21345 =/home/user/example/print/posters.html.php= and fails.
  21346 
  21347 Such an entry in ~org-protocol-project-alist~ may hold an additional
  21348 property ~:rewrites~.  This property is a list of cons cells, each of
  21349 which maps a regular expression to a path relative to the
  21350 ~:working-directory~.
  21351 
  21352 Now map the URL to the path =/home/user/example/products.php= by
  21353 adding ~:rewrites~ rules like this:
  21354 
  21355 #+begin_src emacs-lisp
  21356 (setq org-protocol-project-alist
  21357       '(("example.com"
  21358          :base-url "https://example.com/"
  21359          :working-directory "/home/user/example/"
  21360          :online-suffix ".php"
  21361          :working-suffix ".php"
  21362          :rewrites (("example.com/print/" . "products.php")
  21363                     ("example.com/$" . "index.php")))))
  21364 #+end_src
  21365 
  21366 #+texinfo: @noindent
  21367 Since =example.com/$= is used as a regular expression, it maps
  21368 =https://example.com/=, =https://example.com=,
  21369 =https://www.example.com/= and similar to
  21370 =/home/user/example/index.php=.
  21371 
  21372 The ~:rewrites~ rules are searched as a last resort if and only if no
  21373 existing file name is matched.
  21374 
  21375 #+cindex: protocol, open-source, set-up mapping
  21376 #+cindex: mappings in open-source protocol
  21377 #+findex: org-protocol-create
  21378 #+findex: org-protocol-create-for-org
  21379 Two functions can help you filling ~org-protocol-project-alist~ with
  21380 valid contents: ~org-protocol-create~ and
  21381 ~org-protocol-create-for-org~.  The latter is of use if you're editing
  21382 an Org file that is part of a publishing project.
  21383 ** Org Crypt
  21384 :PROPERTIES:
  21385 :DESCRIPTION: Encrypting Org files.
  21386 :END:
  21387 
  21388 Org Crypt encrypts the text of an entry, but not the headline, or
  21389 properties.  Behind the scene, it uses the [[info:epa][Emacs EasyPG Library]] to
  21390 encrypt and decrypt files, and EasyPG needs a correct [[info:gnupg][GnuPG]] setup.
  21391 
  21392 #+vindex: org-crypt-tag-matcher
  21393 Any text below a headline that has a =crypt= tag is automatically
  21394 encrypted when the file is saved.  To use a different tag, customize
  21395 the ~org-crypt-tag-matcher~ setting.
  21396 
  21397 Here is a suggestion for Org Crypt settings in Emacs init file:
  21398 
  21399 #+begin_src emacs-lisp
  21400 (require 'org-crypt)
  21401 (org-crypt-use-before-save-magic)
  21402 (setq org-tags-exclude-from-inheritance '("crypt"))
  21403 
  21404 (setq org-crypt-key nil)
  21405 ;; GPG key to use for encryption.
  21406 ;; nil means  use symmetric encryption unconditionally.
  21407 ;; "" means use symmetric encryption unless heading sets CRYPTKEY property.
  21408 
  21409 (setq auto-save-default nil)
  21410 ;; Auto-saving does not cooperate with org-crypt.el: so you need to
  21411 ;; turn it off if you plan to use org-crypt.el quite often.  Otherwise,
  21412 ;; you'll get an (annoying) message each time you start Org.
  21413 
  21414 ;; To turn it off only locally, you can insert this:
  21415 ;;
  21416 ;; # -*- buffer-auto-save-file-name: nil; -*-
  21417 #+end_src
  21418 
  21419 It's possible to use different keys for different headings by
  21420 specifying the respective key as property =CRYPTKEY=, e.g.:
  21421 
  21422 #+begin_example
  21423 ,* Totally secret :crypt:
  21424   :PROPERTIES:
  21425   :CRYPTKEY: 0x0123456789012345678901234567890123456789
  21426   :END:
  21427 #+end_example
  21428 
  21429 Note that the =CRYPTKEY= property is only effective when
  21430 ~org-crypt-key~ is non-~nil~.  If ~org-crypt-key~ is ~nil~, Org uses
  21431 symmetric encryption unconditionally.
  21432 
  21433 Excluding the =crypt= tag from inheritance prevents already encrypted
  21434 text from being encrypted again.
  21435 
  21436 ** Org Mobile
  21437 :PROPERTIES:
  21438 :DESCRIPTION: Viewing and capture on a mobile device.
  21439 :END:
  21440 #+cindex: smartphone
  21441 
  21442 Org Mobile is a protocol for synchronizing Org files between Emacs and
  21443 other applications, e.g., on mobile devices.  It enables offline-views
  21444 and capture support for an Org mode system that is rooted on a "real"
  21445 computer.  The external application can also record changes to
  21446 existing entries.
  21447 
  21448 This appendix describes Org's support for agenda view formats
  21449 compatible with Org Mobile.  It also describes synchronizing changes,
  21450 such as to notes, between the mobile application and the computer.
  21451 
  21452 To change tags and TODO states in the mobile application, first
  21453 customize the variables ~org-todo-keywords~, ~org-tag-alist~ and
  21454 ~org-tag-persistent-alist~.  These should cover all the important tags
  21455 and TODO keywords, even if Org files use only some of them.  Though
  21456 the mobile application is expected to support in-buffer settings, it
  21457 is required to understand TODO states /sets/ (see [[*Setting up keywords
  21458 for individual files]]) and /mutually exclusive/ tags (see [[*Setting
  21459 Tags]]) only for those set in these variables.
  21460 
  21461 *** Setting up the staging area
  21462 :PROPERTIES:
  21463 :DESCRIPTION: For the mobile device.
  21464 :END:
  21465 
  21466 #+vindex: org-mobile-directory
  21467 The mobile application needs access to a file directory on
  21468 a server[fn:53] to interact with Emacs.  Pass its location through
  21469 the ~org-mobile-directory~ variable.  If you can mount that directory
  21470 locally just set the variable to point to that directory:
  21471 
  21472 #+begin_src emacs-lisp
  21473 (setq org-mobile-directory "~/orgmobile/")
  21474 #+end_src
  21475 
  21476 Alternatively, by using TRAMP (see [[info:tramp][TRAMP User Manual]]),
  21477 ~org-mobile-directory~ may point to a remote directory accessible
  21478 through, for example, SSH, SCP, or DAVS:
  21479 
  21480 #+begin_src emacs-lisp
  21481 (setq org-mobile-directory "/davs:user@remote.host:/org/webdav/")
  21482 #+end_src
  21483 
  21484 #+vindex: org-mobile-encryption
  21485 With a public server, consider encrypting the files.  Org also
  21486 requires OpenSSL installed on the local computer.  To turn on
  21487 encryption, set the same password in the mobile application and in
  21488 Emacs.  Set the password in the variable
  21489 ~org-mobile-use-encryption~[fn:: If Emacs is configured for safe
  21490 storing of passwords, then configure the variable
  21491 ~org-mobile-encryption-password~; please read the docstring of that
  21492 variable.].  Note that even after the mobile application encrypts the
  21493 file contents, the file name remains visible on the file systems of
  21494 the local computer, the server, and the mobile device.
  21495 
  21496 *** Pushing to the mobile application
  21497 :PROPERTIES:
  21498 :DESCRIPTION: Uploading Org files and agendas.
  21499 :END:
  21500 
  21501 #+findex: org-mobile-push
  21502 #+vindex: org-mobile-files
  21503 The command ~org-mobile-push~ copies files listed in
  21504 ~org-mobile-files~ into the staging area.  Files include agenda files
  21505 (as listed in ~org-agenda-files~).  Customize ~org-mobile-files~ to
  21506 add other files.  File names are staged with paths relative to
  21507 ~org-directory~, so all files should be inside this directory[fn::
  21508 Symbolic links in ~org-directory~ need to have the same name as their
  21509 targets.].
  21510 
  21511 Push creates a special Org file =agendas.org= with custom agenda views
  21512 defined by the user[fn:54].
  21513 
  21514 Finally, Org writes the file =index.org=, containing links to other
  21515 files.  The mobile application reads this file first from the server
  21516 to determine what other files to download for agendas.  For faster
  21517 downloads, it is expected to only read files whose checksums[fn::
  21518 Checksums are stored automatically in the file =checksums.dat=.]  have
  21519 changed.
  21520 
  21521 *** Pulling from the mobile application
  21522 :PROPERTIES:
  21523 :DESCRIPTION: Integrating captured and flagged items.
  21524 :END:
  21525 
  21526 #+findex: org-mobile-pull
  21527 The command ~org-mobile-pull~ synchronizes changes with the server.
  21528 More specifically, it first pulls the Org files for viewing.  It then
  21529 appends captured entries and pointers to flagged or changed entries to
  21530 the file =mobileorg.org= on the server.  Org ultimately integrates its
  21531 data in an inbox file format, through the following steps:
  21532 
  21533 1.
  21534    #+vindex: org-mobile-inbox-for-pull
  21535    Org moves all entries found in =mobileorg.org=[fn:: The file will
  21536    be empty after this operation.] and appends them to the file
  21537    pointed to by the variable ~org-mobile-inbox-for-pull~.  It should
  21538    reside neither in the staging area nor on the server.  Each
  21539    captured entry and each editing event is a top-level entry in the
  21540    inbox file.
  21541 
  21542 2.
  21543    #+cindex: @samp{FLAGGED}, tag
  21544    After moving the entries, Org processes changes to the shared
  21545    files.  Some of them are applied directly and without user
  21546    interaction.  Examples include changes to tags, TODO state,
  21547    headline and body text.  Entries requiring further action are
  21548    tagged as =FLAGGED=.  Org marks entries with problems with an error
  21549    message in the inbox.  They have to be resolved manually.
  21550 
  21551 3. Org generates an agenda view for flagged entries for user
  21552    intervention to clean up.  For notes stored in flagged entries, Org
  21553    displays them in the echo area when point is on the corresponding
  21554    agenda item.
  21555 
  21556    - {{{kbd(?)}}} ::
  21557 
  21558      Pressing {{{kbd(?)}}} displays the entire flagged note in another
  21559      window.  Org also pushes it to the kill ring.  To store flagged
  21560      note as a normal note, use {{{kbd(? z C-y C-c C-c)}}}.  Pressing
  21561      {{{kbd(?)}}} twice does these things: first it removes the
  21562      =FLAGGED= tag; second, it removes the flagged note from the
  21563      property drawer; third, it signals that manual editing of the
  21564      flagged entry is now finished.
  21565 
  21566 #+kindex: ? @r{(Agenda dispatcher)}
  21567 From the agenda dispatcher, {{{kbd(?)}}} returns to the view to finish
  21568 processing flagged entries.  Note that these entries may not be the
  21569 most recent since the mobile application searches files that were last
  21570 pulled.  To get an updated agenda view with changes since the last
  21571 pull, pull again.
  21572 
  21573 ** Drag and Drop & ~yank-media~
  21574 :PROPERTIES:
  21575 :DESCRIPTION: Dropping and pasting files and images
  21576 :END:
  21577 
  21578 #+cindex: dropping files
  21579 #+cindex: dragging files
  21580 #+cindex: drag and drop
  21581 #+cindex: dnd
  21582 #+vindex: org-yank-dnd-method
  21583 Org mode supports drag and drop (DnD) of files.  By default, Org asks
  21584 the user what must be done with the dropped file: attach it, insert
  21585 =file:= link, or open the file.  Customize ~org-yank-dnd-method~ to
  21586 set the default DnD action.
  21587 
  21588 When DnD method is "attach", Org mode first consults DnD metadata to
  21589 decide the attach method.  For example, when file/files are dragged
  21590 from a file manager, Org may attach by copying or by moving.
  21591 
  21592 #+vindex: org-yank-dnd-default-attach-method
  21593 If Org cannot figure out which attachment method to use from the
  21594 metadata, it defaults to ~org-yank-dnd-default-attach-method~ [fn::By
  21595 default, ~org-yank-dnd-default-attach-method~ is set to nil -- use the same
  21596 value as ~org-attach-method~ (~cp~ by default).]
  21597 
  21598 #+cindex: pasting files, images from clipboard
  21599 Starting from Emacs 29, Org mode supports ~yank-media~ command to yank
  21600 images from the clipboard and files from a file manager.
  21601 
  21602 #+vindex: org-yank-image-save-method
  21603 When yanking images from clipboard, Org saves the image on disk and
  21604 inserts the image link to Org buffer.  Images are either saved as
  21605 attachments to heading (default) or to a globally defined directory.
  21606 The save location is controlled by ~org-yank-image-save-method~.
  21607 
  21608 #+vindex: org-yank-image-file-name-function
  21609 The yanked images are saved under automatically generated name.  You
  21610 can customize ~org-yank-image-file-name-function~ to make Org query
  21611 the image names or change the naming scheme.
  21612 
  21613 When yanking files copied from a file manager, Org respects the value
  21614 of ~org-yank-dnd-method~.  Image files pasted this way also respect
  21615 the value of ~org-yank-image-save-method~ when the action to perform
  21616 is =attach=.
  21617 
  21618 * Hacking
  21619 :PROPERTIES:
  21620 :DESCRIPTION: How to hack your way around.
  21621 :APPENDIX: t
  21622 :END:
  21623 #+cindex: hacking
  21624 
  21625 This appendix describes some ways a user can extend the functionality
  21626 of Org.
  21627 
  21628 ** Hooks
  21629 :PROPERTIES:
  21630 :DESCRIPTION: How to reach into Org's internals.
  21631 :END:
  21632 #+cindex: hooks
  21633 
  21634 Org has a large number of hook variables for adding functionality.  A
  21635 complete list of hooks with documentation is maintained by the Worg
  21636 project at https://orgmode.org/worg/doc.html#hooks.
  21637 
  21638 ** Add-on Packages
  21639 :PROPERTIES:
  21640 :DESCRIPTION: Available extensions.
  21641 :END:
  21642 #+cindex: add-on packages
  21643 
  21644 Various authors wrote a large number of add-on packages for Org.  Some
  21645 of these packages used to be part of the =org-mode= repository but are
  21646 now hosted in a separate =org-contrib= repository
  21647 [[https://git.sr.ht/~bzg/org-contrib][here]].  A Worg page with more
  21648 information is at: https://orgmode.org/worg/org-contrib/.
  21649 
  21650 ** Adding Hyperlink Types
  21651 :PROPERTIES:
  21652 :DESCRIPTION: New custom link types.
  21653 :END:
  21654 #+cindex: hyperlinks, adding new types
  21655 
  21656 Org has many built-in hyperlink types (see [[*Hyperlinks]]), and an
  21657 interface for adding new link types.  The following example shows the
  21658 process of adding Org links to Unix man pages, which look like this
  21659 
  21660 : [[man:printf][The printf manual]]
  21661 
  21662 #+texinfo: @noindent
  21663 The following =ol-man.el= file implements it
  21664 
  21665 #+begin_src emacs-lisp
  21666 ;;; ol-man.el - Support for links to man pages in Org mode
  21667 (require 'ol)
  21668 
  21669 (org-link-set-parameters "man"
  21670                          :follow #'org-man-open
  21671                          :export #'org-man-export
  21672                          :store #'org-man-store-link)
  21673 
  21674 (defcustom org-man-command 'man
  21675   "The Emacs command to be used to display a man page."
  21676   :group 'org-link
  21677   :type '(choice (const man) (const woman)))
  21678 
  21679 (defun org-man-open (path _)
  21680   "Visit the manpage on PATH.
  21681 PATH should be a topic that can be thrown at the man command."
  21682   (funcall org-man-command path))
  21683 
  21684 (defun org-man-store-link (&optional _interactive?)
  21685   "Store a link to a man page."
  21686   (when (memq major-mode '(Man-mode woman-mode))
  21687     ;; This is a man page, we do make this link.
  21688     (let* ((page (org-man-get-page-name))
  21689            (link (concat "man:" page))
  21690            (description (format "Man page for %s" page)))
  21691       (org-link-store-props
  21692        :type "man"
  21693        :link link
  21694        :description description))))
  21695 
  21696 (defun org-man-get-page-name ()
  21697   "Extract the page name from the buffer name."
  21698   ;; This works for both `Man-mode' and `woman-mode'.
  21699   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  21700       (match-string 1 (buffer-name))
  21701     (error "Cannot create link to this man page")))
  21702 
  21703 (defun org-man-export (link description format _)
  21704   "Export a man page link from Org files."
  21705   (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  21706         (desc (or description link)))
  21707     (pcase format
  21708       (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  21709       (`latex (format "\\href{%s}{%s}" path desc))
  21710       (`texinfo (format "@uref{%s,%s}" path desc))
  21711       (`ascii (format "%s (%s)" desc path))
  21712       (t path))))
  21713 
  21714 (provide ol-man)
  21715 ;;; ol-man.el ends here
  21716 #+end_src
  21717 
  21718 #+texinfo: @noindent
  21719 To activate links to man pages in Org, enter this in the Emacs init
  21720 file:
  21721 
  21722 #+begin_src emacs-lisp
  21723 (require 'ol-man)
  21724 #+end_src
  21725 
  21726 #+texinfo: @noindent
  21727 A review of =ol-man.el=:
  21728 
  21729 1. First, =(require 'ol)= ensures that =ol.el= is loaded.
  21730 
  21731 2.
  21732 
  21733    #+findex: org-link-set-parameters
  21734    #+vindex: org-link-parameters
  21735    Then ~org-link-set-parameters~ defines a new link type with =man=
  21736    prefix and associates functions for following, exporting and
  21737    storing such links.  See the variable ~org-link-parameters~ for
  21738    a complete list of possible associations.
  21739 
  21740 3. The rest of the file implements necessary variables and functions.
  21741 
  21742    For example, ~org-man-store-link~ is responsible for storing a link
  21743    when ~org-store-link~ (see [[*Handling Links]]) is called from a buffer
  21744    displaying a man page.  It is passed an argument ~interactive?~
  21745    which this function does not use, but other store functions use to
  21746    behave differently when a link is stored interactively by the user.
  21747    It first checks if the major mode is appropriate.  If check fails,
  21748    the function returns ~nil~, which means it isn't responsible for
  21749    creating a link to the current buffer.  Otherwise the function
  21750    makes a link string by combining the =man:= prefix with the man
  21751    topic.  It also provides a default description.  The function
  21752    ~org-insert-link~ can insert it back into an Org buffer later on.
  21753 
  21754 ** Adding Export Backends
  21755 :PROPERTIES:
  21756 :DESCRIPTION: How to write new export backends.
  21757 :END:
  21758 #+cindex: Export, writing backends
  21759 
  21760 Org's export engine makes it easy for writing new backends.  The
  21761 framework on which the engine was built makes it easy to derive new
  21762 backends from existing ones.
  21763 
  21764 #+findex: org-export-define-backend
  21765 #+findex: org-export-define-derived-backend
  21766 The two main entry points to the export engine are:
  21767 ~org-export-define-backend~ and ~org-export-define-derived-backend~.
  21768 To grok these functions, see =ox-latex.el= for an example of defining
  21769 a new backend from scratch, and =ox-beamer.el= for an example of
  21770 deriving from an existing engine.
  21771 
  21772 For creating a new backend from scratch, first set its name as
  21773 a symbol in an alist consisting of elements and export functions.  To
  21774 make the backend visible to the export dispatcher, set ~:menu-entry~
  21775 keyword.  For export options specific to this backend, set the
  21776 ~:options-alist~.
  21777 
  21778 For creating a new backend from an existing one, set
  21779 ~:translate-alist~ to an alist of export functions.  This alist
  21780 replaces the parent backend functions.
  21781 
  21782 For complete documentation, see [[https://orgmode.org/worg/dev/org-export-reference.html][the Org Export Reference on Worg]].
  21783 
  21784 ** Tables in Arbitrary Syntax
  21785 :PROPERTIES:
  21786 :DESCRIPTION: Orgtbl for LaTeX and other programs.
  21787 :END:
  21788 #+cindex: tables, in other modes
  21789 #+cindex: lists, in other modes
  21790 #+cindex: Orgtbl mode
  21791 
  21792 Due to Org's success in handling tables with Orgtbl, a frequently
  21793 requested feature is the use of Org's table functions in other modes,
  21794 e.g., LaTeX.  This would be hard to do in a general way without
  21795 complicated customization nightmares.  Moreover, that would take Org
  21796 away from its simplicity roots that Orgtbl has proven.  There is,
  21797 however, an alternate approach to accomplishing the same.
  21798 
  21799 This approach involves implementing a custom /translate/ function that
  21800 operates on a native Org /source table/ to produce a table in another
  21801 format.  This strategy would keep the excellently working Orgtbl
  21802 simple and isolate complications, if any, confined to the translate
  21803 function.  To add more alien table formats, we just add more translate
  21804 functions.  Also the burden of developing custom translate functions
  21805 for new table formats is in the hands of those who know those formats
  21806 best.
  21807 
  21808 *** Radio tables
  21809 :PROPERTIES:
  21810 :DESCRIPTION: Sending and receiving radio tables.
  21811 :END:
  21812 #+cindex: radio tables
  21813 
  21814 Radio tables are target locations for translated tables that are not near
  21815 their source.  Org finds the target location and inserts the translated
  21816 table.
  21817 
  21818 The key to finding the target location is the magic words =BEGIN/END
  21819 RECEIVE ORGTBL=.  They have to appear as comments in the current mode.
  21820 If the mode is C, then:
  21821 
  21822 #+begin_example
  21823 /* BEGIN RECEIVE ORGTBL table_name */
  21824 /* END RECEIVE ORGTBL table_name */
  21825 #+end_example
  21826 
  21827 At the location of source, Org needs a special line to direct Orgtbl
  21828 to translate and to find the target for inserting the translated
  21829 table.  For example:
  21830 
  21831 #+cindex: @samp{ORGTBL}, keyword
  21832 : #+ORGTBL: SEND table_name translation_function arguments ...
  21833 
  21834 #+texinfo: @noindent
  21835 =table_name= is the table's reference name, which is also used in the
  21836 receiver lines, and the =translation_function= is the Lisp function
  21837 that translates.  This line, in addition, may also contain alternating
  21838 key and value arguments at the end.  The translation function gets
  21839 these values as a property list.  A few standard parameters are
  21840 already recognized and acted upon before the translation function is
  21841 called:
  21842 
  21843 - =:skip N= ::
  21844 
  21845   Skip the first N lines of the table.  Hlines do count; include them
  21846   if they are to be skipped.
  21847 
  21848 - =:skipcols (n1 n2 ...)= ::
  21849 
  21850   List of columns to be skipped.  First Org automatically discards
  21851   columns with calculation marks and then sends the table to the
  21852   translator function, which then skips columns as specified in
  21853   =skipcols=.
  21854 
  21855 To keep the source table intact in the buffer without being disturbed
  21856 when the source file is compiled or otherwise being worked on, use one
  21857 of these strategies:
  21858 
  21859 - Place the table in a block comment.  For example, in C mode you
  21860   could wrap the table between =/*= and =*/= lines.
  21861 
  21862 - Put the table after an "end" statement.  For example ~\bye~ in TeX
  21863   and ~\end{document}~ in LaTeX.
  21864 
  21865 - Comment and un-comment each line of the table during edits.  The
  21866   {{{kbd(M-x orgtbl-toggle-comment)}}} command makes toggling easy.
  21867 
  21868 *** A LaTeX example of radio tables
  21869 :PROPERTIES:
  21870 :DESCRIPTION: Step by step, almost a tutorial.
  21871 :ALT_TITLE: A LaTeX example
  21872 :END:
  21873 #+cindex: @LaTeX{}, and Orgtbl mode
  21874 
  21875 To wrap a source table in LaTeX, use the =comment= environment
  21876 provided by =comment.sty=[fn:: https://www.ctan.org/pkg/comment].  To
  21877 activate it, put ~\usepackage{comment}~ in the document header.
  21878 Orgtbl mode inserts a radio table skeleton[fn:55] with the command
  21879 {{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table
  21880 name.  For example, if =salesfigures= is the name, the template
  21881 inserts:
  21882 
  21883 #+begin_example
  21884 % BEGIN RECEIVE ORGTBL salesfigures
  21885 % END RECEIVE ORGTBL salesfigures
  21886 \begin{comment}
  21887 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
  21888 | | |
  21889 \end{comment}
  21890 #+end_example
  21891 
  21892 #+vindex: LaTeX-verbatim-environments
  21893 #+texinfo: @noindent
  21894 The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
  21895 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
  21896 the table at the target (receive) location named =salesfigures=.  Now
  21897 the table is ready for data entry.  It can even use spreadsheet
  21898 features[fn:56]:
  21899 
  21900 #+begin_example
  21901 % BEGIN RECEIVE ORGTBL salesfigures
  21902 % END RECEIVE ORGTBL salesfigures
  21903 \begin{comment}
  21904 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
  21905 | Month | Days | Nr sold | per day |
  21906 |-------+------+---------+---------|
  21907 | Jan   |   23 |      55 |     2.4 |
  21908 | Feb   |   21 |      16 |     0.8 |
  21909 | March |   22 |     278 |    12.6 |
  21910 ,#+TBLFM: $4=$3/$2;%.1f
  21911 % $ (optional extra dollar to keep Font Lock happy, see footnote)
  21912 \end{comment}
  21913 #+end_example
  21914 
  21915 After editing, {{{kbd(C-c C-c)}}} inserts the translated table at the
  21916 target location, between the two marker lines.
  21917 
  21918 For hand-made custom tables, note that the translator needs to skip
  21919 the first two lines of the source table.  Also the command has to
  21920 /splice/ out the target table without the header and footer.
  21921 
  21922 #+begin_example
  21923 \begin{tabular}{lrrr}
  21924 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
  21925 % BEGIN RECEIVE ORGTBL salesfigures
  21926 % END RECEIVE ORGTBL salesfigures
  21927 \end{tabular}
  21928 %
  21929 \begin{comment}
  21930 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  21931 | Month | Days | Nr sold | per day |
  21932 |-------+------+---------+---------|
  21933 | Jan   |   23 |      55 |     2.4 |
  21934 | Feb   |   21 |      16 |     0.8 |
  21935 | March |   22 |     278 |    12.6 |
  21936 ,#+TBLFM: $4=$3/$2;%.1f
  21937 \end{comment}
  21938 #+end_example
  21939 
  21940 The LaTeX translator function ~orgtbl-to-latex~ is already part of
  21941 Orgtbl mode and uses a =tabular= environment to typeset the table and
  21942 marks horizontal lines with ~\hline~.  For additional parameters to
  21943 control output, see [[*Translator functions]]:
  21944 
  21945 - =:splice BOOLEAN= ::
  21946 
  21947   When {{{var(BOOLEAN}}} is non-~nil~, return only table body lines;
  21948   i.e., not wrapped in =tabular= environment.  Default is ~nil~.
  21949 
  21950 - =:fmt FMT= ::
  21951 
  21952   Format string to warp each field.  It should contain =%s= for the
  21953   original field value.  For example, to wrap each field value in
  21954   dollar symbol, you could use =:fmt "$%s$"=.  Format can also wrap
  21955   a property list with column numbers and formats, for example =:fmt
  21956   (2 "$%s$" 4 "%s\\%%")=.  In place of a string, a function of one
  21957   argument can be used; the function must return a formatted string.
  21958 
  21959 - =:efmt EFMT= ::
  21960 
  21961   Format numbers as exponentials.  The spec should have =%s= twice for
  21962   inserting mantissa and exponent, for example ="%s\\times10^{%s}"=.  This
  21963   may also be a property list with column numbers and formats, for
  21964   example =:efmt (2 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")=.  After
  21965   {{{var(EFMT)}}} has been applied to a value, {{{var(FMT)}}}---see
  21966   above---is also applied.  Functions with two arguments can be
  21967   supplied instead of strings.  By default, no special formatting is
  21968   applied.
  21969 
  21970 *** Translator functions
  21971 :PROPERTIES:
  21972 :DESCRIPTION: Copy and modify.
  21973 :END:
  21974 #+cindex: HTML, and Orgtbl mode
  21975 #+cindex: translator function
  21976 
  21977 #+findex: orgtbl-to-csv
  21978 #+findex: orgtbl-to-tsv
  21979 #+findex: orgtbl-to-latex
  21980 #+findex: orgtbl-to-html
  21981 #+findex: orgtbl-to-texinfo
  21982 #+findex: orgtbl-to-unicode
  21983 #+findex: orgtbl-to-orgtbl
  21984 #+findex: orgtbl-to-generic
  21985 Orgtbl mode has built-in translator functions: ~orgtbl-to-csv~
  21986 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values),
  21987 ~orgtbl-to-latex~, ~orgtbl-to-html~, ~orgtbl-to-texinfo~,
  21988 ~orgtbl-to-unicode~ and ~orgtbl-to-orgtbl~.  They use the generic
  21989 translator, ~orgtbl-to-generic~, which delegates translations to
  21990 various export backends.
  21991 
  21992 Properties passed to the function through the =ORGTBL SEND= line take
  21993 precedence over properties defined inside the function.  For example,
  21994 this overrides the default LaTeX line endings, ~\\~, with ~\\[2mm]~:
  21995 
  21996 : #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  21997 
  21998 For a new language translator, define a converter function.  It can be
  21999 a generic function, such as shown in this example.  It marks
  22000 a beginning and ending of a table with =!BTBL!= and =!ETBL!=;
  22001 a beginning and ending of lines with =!BL!= and =!EL!=; and uses a TAB
  22002 for a field separator:
  22003 
  22004 #+begin_src emacs-lisp
  22005 (defun orgtbl-to-language (table params)
  22006   "Convert the orgtbl-mode TABLE to language."
  22007   (orgtbl-to-generic
  22008    table
  22009    (org-combine-plists
  22010     '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
  22011     params)))
  22012 #+end_src
  22013 
  22014 #+texinfo: @noindent
  22015 The documentation for the ~orgtbl-to-generic~ function shows
  22016 a complete list of parameters, each of which can be passed through to
  22017 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
  22018 that generic function.
  22019 
  22020 For complicated translations the generic translator function could be
  22021 replaced by a custom translator function.  Such a custom function must
  22022 take two arguments and return a single string containing the formatted
  22023 table.  The first argument is the table whose lines are a list of
  22024 fields or the symbol ~hline~.  The second argument is the property
  22025 list consisting of parameters specified in the =#+ORGTBL: SEND= line.
  22026 Please share your translator functions by posting them to the Org
  22027 users mailing list, at mailto:emacs-orgmode@gnu.org.
  22028 
  22029 ** Dynamic Blocks
  22030 :PROPERTIES:
  22031 :DESCRIPTION: Automatically filled blocks.
  22032 :END:
  22033 #+cindex: dynamic blocks
  22034 
  22035 Org supports /dynamic blocks/ in Org documents.  They are inserted
  22036 with begin and end markers like any other code block, but the contents
  22037 are updated automatically by a user function.
  22038 
  22039 #+kindex: C-c C-x x
  22040 #+findex: org-dynamic-block-insert-dblock
  22041 You can insert a dynamic block with ~org-dynamic-block-insert-dblock~,
  22042 which is bound to {{{kbd(C-c C-x x)}}} by default.  For example,
  22043 {{{kbd(C-c C-x x c l o c k t a b l e RET)}}} inserts a table that
  22044 updates the work time (see [[*Clocking Work Time]]).
  22045 
  22046 Dynamic blocks can have names and function parameters.  The syntax is
  22047 similar to source code block specifications:
  22048 
  22049 #+begin_example
  22050 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  22051   ...
  22052 ,#+END:
  22053 #+end_example
  22054 
  22055 These commands update dynamic blocks:
  22056 
  22057 - {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
  22058 
  22059   #+kindex: C-c C-x C-u
  22060   #+findex: org-dblock-update
  22061   Update dynamic block at point.
  22062 
  22063 - {{{kbd(C-u C-c C-x C-u)}}} ::
  22064 
  22065   #+kindex: C-u C-c C-x C-u
  22066   Update all dynamic blocks in the current file.
  22067 
  22068 Before updating a dynamic block, Org removes content between the
  22069 =BEGIN= and =END= markers.  Org then reads the parameters on the
  22070 =BEGIN= line for passing to the writer function as a plist.  The
  22071 previous content of the dynamic block becomes erased from the buffer
  22072 and appended to the plist under ~:content~.
  22073 
  22074 The syntax for naming a writer function with a dynamic block labeled
  22075 =myblock= is: ~org-dblock-write:myblock~.
  22076 
  22077 The following is an example of a dynamic block and a block writer function
  22078 that updates the time when the function was last run:
  22079 
  22080 #+begin_example
  22081 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  22082   ...
  22083 ,#+END:
  22084 #+end_example
  22085 
  22086 #+texinfo: @noindent
  22087 The dynamic block's writer function:
  22088 
  22089 #+begin_src emacs-lisp
  22090 (defun org-dblock-write:block-update-time (params)
  22091   (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  22092     (insert "Last block update at: "
  22093             (format-time-string fmt))))
  22094 #+end_src
  22095 
  22096 To keep dynamic blocks up-to-date in an Org file, use the function,
  22097 ~org-update-all-dblocks~ in hook, such as ~before-save-hook~.  The
  22098 ~org-update-all-dblocks~ function does not run if the file is not in
  22099 Org mode.
  22100 
  22101 #+findex: org-narrow-to-block
  22102 Dynamic blocks, like any other block, can be narrowed with
  22103 ~org-narrow-to-block~.
  22104 
  22105 ** Special Agenda Views
  22106 :PROPERTIES:
  22107 :DESCRIPTION: Customized views.
  22108 :END:
  22109 #+cindex: agenda views, user-defined
  22110 
  22111 #+vindex: org-agenda-skip-function
  22112 #+vindex: org-agenda-skip-function-global
  22113 Org provides a special hook to further limit items in agenda views:
  22114 ~agenda~, ~agenda*~[fn:: The ~agenda*~ view is the same as ~agenda~
  22115 except that it only considers /appointments/, i.e., scheduled and
  22116 deadline items that have a time specification =[h]h:mm= in their
  22117 timestamps.], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, ~tags-tree~.
  22118 Specify a custom function that tests inclusion of every matched item
  22119 in the view.  This function can also skip as much as is needed.
  22120 
  22121 For a global condition applicable to agenda views, use the
  22122 ~org-agenda-skip-function-global~ variable.  Org uses a global
  22123 condition with ~org-agenda-skip-function~ for custom searching.
  22124 
  22125 This example defines a function for a custom view showing TODO items
  22126 with =waiting= status.  Manually this is a multi-step search process,
  22127 but with a custom view, this can be automated as follows:
  22128 
  22129 The custom function searches the subtree for the =waiting= tag and
  22130 returns ~nil~ on match.  Otherwise it gives the location from where
  22131 the search continues.
  22132 
  22133 #+begin_src emacs-lisp
  22134 (defun my-skip-unless-waiting ()
  22135   "Skip trees that are not waiting"
  22136   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  22137     (if (re-search-forward ":waiting:" subtree-end t)
  22138         nil          ; tag found, do not skip
  22139       subtree-end))) ; tag not found, continue after end of subtree
  22140 #+end_src
  22141 
  22142 To use this custom function in a custom agenda command:
  22143 
  22144 #+begin_src emacs-lisp
  22145 (org-add-agenda-custom-command
  22146  '("b" todo "PROJECT"
  22147    ((org-agenda-skip-function 'my-skip-unless-waiting)
  22148     (org-agenda-overriding-header "Projects waiting for something: "))))
  22149 #+end_src
  22150 
  22151 #+vindex: org-agenda-overriding-header
  22152 Note that this also binds ~org-agenda-overriding-header~ to a more
  22153 meaningful string suitable for the agenda view.
  22154 
  22155 #+vindex: org-odd-levels-only
  22156 #+vindex: org-agenda-skip-function
  22157 #+findex: org-agenda-skip-entry-if
  22158 #+findex: org-agenda-skip-subtree-if
  22159 Search for entries with a limit set on levels for the custom search.
  22160 This is a general approach to creating custom searches in Org.  To
  22161 include all levels, use =LEVEL>0=[fn:: Note that, for
  22162 ~org-odd-levels-only~, a level number corresponds to order in the
  22163 hierarchy, not to the number of stars.].  Then to selectively pick the
  22164 matched entries, use ~org-agenda-skip-function~, which also accepts
  22165 Lisp forms, such as ~org-agenda-skip-entry-if~ and
  22166 ~org-agenda-skip-subtree-if~.  For example:
  22167 
  22168 - =(org-agenda-skip-entry-if 'scheduled)= ::
  22169 
  22170   Skip current entry if it has been scheduled.
  22171 
  22172 - =(org-agenda-skip-entry-if 'notscheduled)= ::
  22173 
  22174   Skip current entry if it has not been scheduled.
  22175 
  22176 - =(org-agenda-skip-entry-if 'deadline)= ::
  22177 
  22178   Skip current entry if it has a deadline.
  22179 
  22180 - =(org-agenda-skip-entry-if 'scheduled 'deadline)= ::
  22181 
  22182   Skip current entry if it has a deadline, or if it is scheduled.
  22183 
  22184 - =(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))= ::
  22185 
  22186   Skip current entry if the TODO keyword is TODO or WAITING.
  22187 
  22188 - =(org-agenda-skip-entry-if 'todo 'done)= ::
  22189 
  22190   Skip current entry if the TODO keyword marks a DONE state.
  22191 
  22192 - =(org-agenda-skip-entry-if 'timestamp)= ::
  22193 
  22194   Skip current entry if it has any timestamp, may also be deadline or
  22195   scheduled.
  22196 
  22197 - =(org-agenda-skip-entry-if 'regexp "regular expression")= ::
  22198 
  22199   Skip current entry if the regular expression matches in the entry.
  22200 
  22201 - =(org-agenda-skip-entry-if 'notregexp "regular expression")= ::
  22202 
  22203   Skip current entry unless the regular expression matches.
  22204 
  22205 - =(org-agenda-skip-subtree-if 'regexp "regular expression")= ::
  22206 
  22207   Same as above, but check and skip the entire subtree.
  22208 
  22209 The following is an example of a search for =waiting= without the
  22210 special function:
  22211 
  22212 #+begin_src emacs-lisp
  22213 (org-add-agenda-custom-command
  22214  '("b" todo "PROJECT"
  22215    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  22216                                 'regexp ":waiting:"))
  22217     (org-agenda-overriding-header "Projects waiting for something: "))))
  22218 #+end_src
  22219 
  22220 ** Speeding Up Your Agendas
  22221 :PROPERTIES:
  22222 :DESCRIPTION: Tips on how to speed up your agendas.
  22223 :END:
  22224 #+cindex: agenda views, optimization
  22225 
  22226 Some agenda commands slow down when the Org files grow in size or
  22227 number.  Here are tips to speed up:
  22228 
  22229 - Reduce the number of Org agenda files to avoid slowdowns due to hard drive
  22230   accesses.
  22231 
  22232 - Reduce the number of DONE and archived headlines so agenda
  22233   operations that skip over these can finish faster.
  22234 
  22235 - Do not dim blocked tasks:
  22236   #+vindex: org-agenda-dim-blocked-tasks
  22237 
  22238   #+begin_src emacs-lisp
  22239   (setq org-agenda-dim-blocked-tasks nil)
  22240   #+end_src
  22241 
  22242 - Stop preparing agenda buffers on startup:
  22243   #+vindex: org-startup-folded
  22244   #+vindex: org-agenda-inhibit-startup
  22245 
  22246   #+begin_src emacs-lisp
  22247   (setq org-agenda-inhibit-startup t)
  22248   #+end_src
  22249 
  22250 - Disable tag inheritance for agendas:
  22251   #+vindex: org-agenda-show-inherited-tags
  22252   #+vindex: org-agenda-use-tag-inheritance
  22253 
  22254   #+begin_src emacs-lisp
  22255   (setq org-agenda-use-tag-inheritance nil)
  22256   #+end_src
  22257 
  22258   #+vindex: org-agenda-ignore-properties
  22259 - Disable parsing of some properties:
  22260 
  22261   #+begin_src emacs-lisp
  22262   (setq org-agenda-ignore-properties '(stats))
  22263   #+end_src
  22264 
  22265   This will disable parsing and updating statistic cookies.
  22266 
  22267 These options can be applied to selected agenda views.  For more
  22268 details about generation of agenda views, see the docstrings for the
  22269 relevant variables, and this [[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda
  22270 optimization.
  22271 
  22272 ** Extracting Agenda Information
  22273 :PROPERTIES:
  22274 :DESCRIPTION: Post-processing agenda information.
  22275 :END:
  22276 #+cindex: agenda, pipe
  22277 #+cindex: scripts, for agenda processing
  22278 
  22279 Org provides commands to access agendas through Emacs batch mode.
  22280 Through this command-line interface, agendas are automated for further
  22281 processing or printing.
  22282 
  22283 #+vindex: org-agenda-custom-commands
  22284 #+findex: org-batch-agenda
  22285 ~org-batch-agenda~ creates an agenda view in ASCII and outputs to
  22286 standard output.  This command takes one string parameter.  When
  22287 string consists of a single character, Org uses it as a key to
  22288 ~org-agenda-custom-commands~.  These are the same ones available
  22289 through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
  22290 
  22291 This example command line directly prints the TODO list to the printer:
  22292 
  22293 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  22294 
  22295 When the string parameter length is two or more characters, Org
  22296 matches it with tags/TODO strings.  For example, this example command
  22297 line prints items tagged with =shop=, but excludes items tagged with
  22298 =NewYork=:
  22299 
  22300 #+begin_example
  22301 emacs -batch -l ~/.emacs                                      \
  22302       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  22303 #+end_example
  22304 
  22305 #+texinfo: @noindent
  22306 An example showing on-the-fly parameter modifications:
  22307 
  22308 #+begin_example
  22309 emacs -batch -l ~/.emacs                                      \
  22310    -eval '(org-batch-agenda "a"                               \
  22311            org-agenda-span (quote month)                      \
  22312            org-agenda-include-diary nil                       \
  22313            org-agenda-files (quote ("~/org/project.org")))'   \
  22314    | lpr
  22315 #+end_example
  22316 
  22317 #+texinfo: @noindent
  22318 which produces an agenda for the next 30 days from just the
  22319 =~/org/projects.org= file.
  22320 
  22321 #+findex: org-batch-agenda-csv
  22322 For structured processing of agenda output, use ~org-batch-agenda-csv~
  22323 with the following fields:
  22324 
  22325 - category :: The category of the item
  22326 - head :: The headline, without TODO keyword, TAGS and PRIORITY
  22327 - type :: The type of the agenda entry, can be
  22328 
  22329   | ~todo~              | selected in TODO match              |
  22330   | ~tagsmatch~         | selected in tags match              |
  22331   | ~diary~             | imported from diary                 |
  22332   | ~deadline~          | a deadline                          |
  22333   | ~scheduled~         | scheduled                           |
  22334   | ~timestamp~         | appointment, selected by timestamp  |
  22335   | ~closed~            | entry was closed on date            |
  22336   | ~upcoming-deadline~ | warning about nearing deadline      |
  22337   | ~past-scheduled~    | forwarded scheduled item            |
  22338   | ~block~             | entry has date block including date |
  22339 
  22340 - todo :: The TODO keyword, if any
  22341 - tags :: All tags including inherited ones, separated by colons
  22342 - date :: The relevant date, like =2007-2-14=
  22343 - time :: The time, like =15:00-16:50=
  22344 - extra :: String with extra planning info
  22345 - priority-l :: The priority letter if any was given
  22346 - priority-n :: The computed numerical priority
  22347 
  22348 If the selection of the agenda item was based on a timestamp,
  22349 including those items with =DEADLINE= and =SCHEDULED= keywords, then
  22350 Org includes date and time in the output.
  22351 
  22352 If the selection of the agenda item was based on a timestamp  (or
  22353 deadline/scheduled), then Org includes date and time in the output.
  22354 
  22355 Here is an example of a post-processing script in Perl.  It takes the
  22356 CSV output from Emacs and prints with a checkbox:
  22357 
  22358 #+begin_src perl
  22359 #!/usr/bin/perl
  22360 
  22361 # define the Emacs command to run
  22362 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  22363 
  22364 # run it and capture the output
  22365 $agenda = qx{$cmd 2>/dev/null};
  22366 
  22367 # loop over all lines
  22368 foreach $line (split(/\n/,$agenda)) {
  22369     # get the individual values
  22370     ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  22371      $priority_l,$priority_n) = split(/,/,$line);
  22372     # process and print
  22373     print "[ ] $head\n";
  22374 }
  22375 #+end_src
  22376 
  22377 ** Using the Property API
  22378 :PROPERTIES:
  22379 :DESCRIPTION: Writing programs that use entry properties.
  22380 :END:
  22381 #+cindex: API, for properties
  22382 #+cindex: properties, API
  22383 
  22384 Here is a description of the functions that can be used to work with
  22385 properties.
  22386 
  22387 #+attr_texinfo: :options org-entry-properties &optional pom which
  22388 #+begin_defun
  22389 Get all properties of the entry at point-or-marker {{{var(POM)}}}.
  22390 This includes the TODO keyword, the tags, time strings for deadline,
  22391 scheduled, and clocking, and any additional properties defined in the
  22392 entry.  The return value is an alist.  Keys may occur multiple times
  22393 if the property key was used several times.  {{{var(POM)}}} may also
  22394 be ~nil~, in which case the current entry is used.  If
  22395 {{{var(WHICH)}}} is ~nil~ or ~all~, get all properties.  If
  22396 {{{var(WHICH)}}} is ~special~ or ~standard~, only get that subclass.
  22397 #+end_defun
  22398 
  22399 #+vindex: org-use-property-inheritance
  22400 #+findex: org-insert-property-drawer
  22401 #+attr_texinfo: :options org-entry-get pom property &optional inherit
  22402 #+begin_defun
  22403 Get value of {{{var(PROPERTY)}}} for entry at point-or-marker
  22404 {{{var(POM)}}}.  By default, this only looks at properties defined
  22405 locally in the entry.  If {{{var(INHERIT)}}} is non-~nil~ and the
  22406 entry does not have the property, then also check higher levels of the
  22407 hierarchy.  If {{{var(INHERIT)}}} is the symbol ~selective~, use
  22408 inheritance if and only if the setting of
  22409 ~org-use-property-inheritance~ selects {{{var(PROPERTY)}}} for
  22410 inheritance.
  22411 #+end_defun
  22412 
  22413 #+attr_texinfo: :options org-entry-delete pom property
  22414 #+begin_defun
  22415 Delete the property {{{var(PROPERTY)}}} from entry at point-or-marker
  22416 {{{var(POM)}}}.
  22417 #+end_defun
  22418 
  22419 #+attr_texinfo: :options org-entry-put pom property value
  22420 #+begin_defun
  22421 Set {{{var(PROPERTY)}}} to {{{var(VALUES)}}} for entry at
  22422 point-or-marker POM.
  22423 #+end_defun
  22424 
  22425 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
  22426 #+begin_defun
  22427 Get all property keys in the current buffer.
  22428 #+end_defun
  22429 
  22430 #+attr_texinfo: :options org-insert-property-drawer
  22431 #+begin_defun
  22432 Insert a property drawer for the current entry.
  22433 #+end_defun
  22434 
  22435 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
  22436 #+begin_defun
  22437 Set {{{var(PROPERTY)}}} at point-or-marker {{{var(POM)}}} to
  22438 {{{var(VALUES)}}}.  {{{var(VALUES)}}} should be a list of strings.
  22439 They are concatenated, with spaces as separators.
  22440 #+end_defun
  22441 
  22442 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
  22443 #+begin_defun
  22444 Treat the value of the property {{{var(PROPERTY)}}} as
  22445 a whitespace-separated list of values and return the values as a list
  22446 of strings.
  22447 #+end_defun
  22448 
  22449 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
  22450 #+begin_defun
  22451 Treat the value of the property {{{var(PROPERTY)}}} as
  22452 a whitespace-separated list of values and make sure that
  22453 {{{var(VALUE)}}} is in this list.
  22454 #+end_defun
  22455 
  22456 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
  22457 #+begin_defun
  22458 Treat the value of the property {{{var(PROPERTY)}}} as
  22459 a whitespace-separated list of values and make sure that
  22460 {{{var(VALUE)}}} is /not/ in this list.
  22461 #+end_defun
  22462 
  22463 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
  22464 #+begin_defun
  22465 Treat the value of the property {{{var(PROPERTY)}}} as
  22466 a whitespace-separated list of values and check if {{{var(VALUE)}}} is
  22467 in this list.
  22468 #+end_defun
  22469 
  22470 #+attr_texinfo: :options org-property-allowed-value-functions
  22471 #+begin_defopt
  22472 Hook for functions supplying allowed values for a specific property.
  22473 The functions must take a single argument, the name of the property,
  22474 and return a flat list of allowed values.  If =:ETC= is one of the
  22475 values, use the values as completion help, but allow also other values
  22476 to be entered.  The functions must return ~nil~ if they are not
  22477 responsible for this property.
  22478 #+end_defopt
  22479 
  22480 ** Using the Mapping API
  22481 :PROPERTIES:
  22482 :DESCRIPTION: Mapping over all or selected entries.
  22483 :END:
  22484 #+cindex: API, for mapping
  22485 #+cindex: mapping entries, API
  22486 
  22487 Org has sophisticated mapping capabilities to find all entries
  22488 satisfying certain criteria.  Internally, this functionality is used
  22489 to produce agenda views, but there is also an API that can be used to
  22490 execute arbitrary functions for each or selected entries.  The main
  22491 entry point for this API is:
  22492 
  22493 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
  22494 #+begin_defun
  22495 Call {{{var(FUNC)}}} at each headline selected by {{{var(MATCH)}}} in
  22496 {{{var(SCOPE)}}}.
  22497 
  22498 {{{var(FUNC)}}} is a function or a Lisp form.  With point positioned
  22499 at the beginning of the headline, call the function without arguments.
  22500 Org returns a list of return values of calls to the function.
  22501 
  22502 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in
  22503 ~save-excursion~ form.  After evaluation, Org moves point to the end
  22504 of the line that was just processed.  Search continues from that point
  22505 forward.  This may not always work as expected under some conditions,
  22506 such as if the current subtree was removed by a previous archiving
  22507 operation.  In such rare circumstances, Org skips the next entry
  22508 entirely when it should not.  To stop Org from such skips, make
  22509 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
  22510 buffer position.
  22511 
  22512 {{{var(MATCH)}}} is a tags/property/TODO match.  Org iterates only
  22513 matched headlines.  Org iterates over all headlines when
  22514 {{{var(MATCH)}}} is ~nil~ or ~t~.
  22515 
  22516 {{{var(SCOPE)}}} determines the scope of this command.  It can be any
  22517 of:
  22518 
  22519 - ~nil~ ::
  22520 
  22521   The current buffer, respecting the restriction, if any.
  22522 
  22523 - ~tree~ ::
  22524 
  22525   The subtree started with the entry at point.
  22526 
  22527 - ~region~ ::
  22528 
  22529   The entries within the active region, if any.
  22530 
  22531 - ~file~ ::
  22532 
  22533   The current buffer, without restriction.
  22534 
  22535 - ~file-with-archives~ ::
  22536 
  22537   The current buffer, and any archives associated with it.
  22538 
  22539 - ~agenda~ ::
  22540 
  22541   All agenda files.
  22542 
  22543 - ~agenda-with-archives~ ::
  22544 
  22545   All agenda files with any archive files associated with them.
  22546 
  22547 - list of filenames ::
  22548 
  22549   If this is a list, all files in the list are scanned.
  22550 
  22551 #+texinfo: @noindent
  22552 The remaining arguments are treated as settings for the scanner's
  22553 skipping facilities.  Valid arguments are:
  22554 
  22555 - ~archive~ ::
  22556 
  22557   Skip trees with the =ARCHIVE= tag.
  22558 
  22559 - ~comment~ ::
  22560 
  22561   Skip trees with the COMMENT keyword.
  22562 
  22563 - function or Lisp form ::
  22564 
  22565   #+vindex: org-agenda-skip-function
  22566   Used as value for ~org-agenda-skip-function~, so whenever the
  22567   function returns ~t~, {{{var(FUNC)}}} is called for that entry and
  22568   search continues from the point where the function leaves it.
  22569 #+end_defun
  22570 
  22571 The mapping routine can call any arbitrary function, even functions
  22572 that change meta data or query the property API (see [[*Using the
  22573 Property API]]).  Here are some handy functions:
  22574 
  22575 #+attr_texinfo: :options org-todo &optional arg
  22576 #+begin_defun
  22577 Change the TODO state of the entry.  See the docstring of the
  22578 functions for the many possible values for the argument
  22579 {{{var(ARG)}}}.
  22580 #+end_defun
  22581 
  22582 #+attr_texinfo: :options org-priority &optional action
  22583 #+begin_defun
  22584 Change the priority of the entry.  See the docstring of this function
  22585 for the possible values for {{{var(ACTION)}}}.
  22586 #+end_defun
  22587 
  22588 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
  22589 #+begin_defun
  22590 Toggle the tag {{{var(TAG)}}} in the current entry.  Setting
  22591 {{{var(ONOFF)}}} to either ~on~ or ~off~ does not toggle tag, but
  22592 ensure that it is either on or off.
  22593 #+end_defun
  22594 
  22595 #+attr_texinfo: :options org-promote
  22596 #+begin_defun
  22597 Promote the current entry.
  22598 #+end_defun
  22599 
  22600 #+attr_texinfo: :options org-demote
  22601 #+begin_defun
  22602 Demote the current entry.
  22603 #+end_defun
  22604 
  22605 This example turns all entries tagged with =TOMORROW= into TODO
  22606 entries with keyword =UPCOMING=.  Org ignores entries in comment trees
  22607 and archive trees.
  22608 
  22609 #+begin_src emacs-lisp
  22610 (org-map-entries '(org-todo "UPCOMING")
  22611                  "+TOMORROW" 'file 'archive 'comment)
  22612 #+end_src
  22613 
  22614 The following example counts the number of entries with TODO keyword
  22615 =WAITING=, in all agenda files.
  22616 
  22617 #+begin_src emacs-lisp
  22618 (length (org-map-entries t "/+WAITING" 'agenda))
  22619 #+end_src
  22620 
  22621 * History and Acknowledgments
  22622 :PROPERTIES:
  22623 :DESCRIPTION: How Org came into being.
  22624 :APPENDIX: t
  22625 :END:
  22626 
  22627 ** From Carsten
  22628 :PROPERTIES:
  22629 :UNNUMBERED: notoc
  22630 :END:
  22631 
  22632 Org was born in 2003, out of frustration over the user interface of
  22633 the Emacs Outline mode.  I was trying to organize my notes and
  22634 projects, and using Emacs seemed to be the natural way to go.
  22635 However, having to remember eleven different commands with two or
  22636 three keys per command, only to hide and show parts of the outline
  22637 tree, that seemed entirely unacceptable to me.  Also, when using
  22638 outlines to take notes, I constantly wanted to restructure the tree,
  22639 organizing it parallel to my thoughts and plans.  /Visibility cycling/
  22640 and /structure editing/ were originally implemented in the package
  22641 =outline-magic.el=, but quickly moved to the more general =org.el=.
  22642 As this environment became comfortable for project planning, the next
  22643 step was adding /TODO entries/, basic /timestamps/, and /table
  22644 support/.  These areas highlighted the two main goals that Org still
  22645 has today: to be a new, outline-based, plain text mode with innovative
  22646 and intuitive editing features, and to incorporate project planning
  22647 functionality directly into a notes file.
  22648 
  22649 Since the first release, literally thousands of emails to me or to the
  22650 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
  22651 new ideas, and sometimes patches and add-on code.  Many thanks to
  22652 everyone who has helped to improve this package.  I am trying to keep
  22653 here a list of the people who had significant influence in shaping one
  22654 or more aspects of Org.  The list may not be complete, if I have
  22655 forgotten someone, please accept my apologies and let me know.
  22656 
  22657 Before I get to this list, a few special mentions are in order:
  22658 
  22659 - Bastien Guerry ::
  22660 
  22661   Bastien has written a large number of extensions to Org (most of
  22662   them integrated into the core by now), including the LaTeX exporter
  22663   and the plain list parser.  His support during the early days was
  22664   central to the success of this project.  Bastien also invented Worg,
  22665   helped establishing the Web presence of Org, and sponsored hosting
  22666   costs for the orgmode.org website.  Bastien stepped in as maintainer
  22667   of Org between 2011 and 2013, at a time when I desperately needed
  22668   a break.
  22669 
  22670 - Eric Schulte and Dan Davison ::
  22671 
  22672   Eric and Dan are jointly responsible for the Org Babel system, which
  22673   turns Org into a multi-language environment for evaluating code and
  22674   doing literate programming and reproducible research.  This has
  22675   become one of Org's killer features that define what Org is today.
  22676 
  22677 - John Wiegley ::
  22678 
  22679   John has contributed a number of great ideas and patches directly to
  22680   Org, including the attachment system (=org-attach.el=), integration
  22681   with Apple Mail (=org-mac-message.el=), hierarchical dependencies of
  22682   TODO items, habit tracking (=org-habits.el=), and encryption
  22683   (=org-crypt.el=).  Also, the capture system is really an extended
  22684   copy of his great =remember.el=.
  22685 
  22686 - Sebastian Rose ::
  22687 
  22688   Without Sebastian, the HTML/XHTML publishing of Org would be the
  22689   pitiful work of an ignorant amateur.  Sebastian has pushed this part
  22690   of Org onto a much higher level.  He also wrote =org-info.js=,
  22691   a JavaScript program for displaying webpages derived from Org using
  22692   an Info-like or a folding interface with single-key navigation.
  22693 
  22694 See below for the full list of contributions!  Again, please let me
  22695 know what I am missing here!
  22696 
  22697 ** From Bastien
  22698 :PROPERTIES:
  22699 :UNNUMBERED: notoc
  22700 :END:
  22701 
  22702 I (Bastien) have been maintaining Org between 2011 and 2013.  This
  22703 appendix would not be complete without adding a few more
  22704 acknowledgments and thanks.
  22705 
  22706 I am first grateful to Carsten for his trust while handing me over the
  22707 maintainership of Org.  His unremitting support is what really helped
  22708 me getting more confident over time, with both the community and the
  22709 code.
  22710 
  22711 When I took over maintainership, I knew I would have to make Org more
  22712 collaborative than ever, as I would have to rely on people that are
  22713 more knowledgeable than I am on many parts of the code.  Here is
  22714 a list of the persons I could rely on, they should really be
  22715 considered co-maintainers, either of the code or the community:
  22716 
  22717 - Eric Schulte ::
  22718 
  22719   Eric is maintaining the Babel parts of Org.  His reactivity here
  22720   kept me away from worrying about possible bugs here and let me focus
  22721   on other parts.
  22722 
  22723 - Nicolas Goaziou ::
  22724 
  22725   Nicolas is maintaining the consistency of the deepest parts of Org.
  22726   His work on =org-element.el= and =ox.el= has been outstanding, and
  22727   it opened the doors for many new ideas and features.  He rewrote
  22728   many of the old exporters to use the new export engine, and helped
  22729   with documenting this major change.  More importantly (if that's
  22730   possible), he has been more than reliable during all the work done
  22731   for Org 8.0, and always very reactive on the mailing list.
  22732 
  22733 - Achim Gratz ::
  22734 
  22735   Achim rewrote the building process of Org, turning some /ad hoc/
  22736   tools into a flexible and conceptually clean process.  He patiently
  22737   coped with the many hiccups that such a change can create for users.
  22738 
  22739 - Nick Dokos ::
  22740 
  22741   The Org mode mailing list would not be such a nice place without
  22742   Nick, who patiently helped users so many times.  It is impossible to
  22743   overestimate such a great help, and the list would not be so active
  22744   without him.
  22745 
  22746 I received support from so many users that it is clearly impossible to
  22747 be fair when shortlisting a few of them, but Org's history would not
  22748 be complete if the ones above were not mentioned in this manual.
  22749 
  22750 ** List of Contributions
  22751 :PROPERTIES:
  22752 :UNNUMBERED: notoc
  22753 :END:
  22754 
  22755 - Russell Adams came up with the idea for drawers.
  22756 
  22757 - Thomas Baumann wrote =ol-bbdb.el= and =ol-mhe.el=.
  22758 
  22759 - Christophe Bataillon created the great unicorn logo that we use on
  22760   the Org mode website.
  22761 
  22762 - Alex Bochannek provided a patch for rounding timestamps.
  22763 
  22764 - Jan Böcker wrote =ol-docview.el=.
  22765 
  22766 - Brad Bozarth showed how to pull RSS feed data into Org files.
  22767 
  22768 - Tom Breton wrote =org-choose.el=.
  22769 
  22770 - Charles Cave's suggestion sparked the implementation of templates
  22771   for Remember, which are now templates for capture.
  22772 
  22773 - Timothy E Chapman worked on a complete overhaul of the orgmode.org
  22774   website in 2020 and helped fixing various bugs.
  22775 
  22776 - Pavel Chalmoviansky influenced the agenda treatment of items with
  22777   specified time.
  22778 
  22779 - Gregory Chernov patched support for Lisp forms into table
  22780   calculations and improved XEmacs compatibility, in particular by
  22781   porting =nouline.el= to XEmacs.
  22782 
  22783 - Sacha Chua suggested copying some linking code from Planner.
  22784 
  22785 - Baoqiu Cui contributed the DocBook exporter.
  22786 
  22787 - Eddward DeVilla proposed and tested checkbox statistics.  He also
  22788   came up with the idea of properties, and that there should be an API
  22789   for them.
  22790 
  22791 - Nick Dokos tracked down several nasty bugs.
  22792 
  22793 - Kees Dullemond used to edit projects lists directly in HTML and so
  22794   inspired some of the early development, including HTML export.  He
  22795   also asked for a way to narrow wide table columns.
  22796 
  22797 - Thomas\nbsp{}S.\nbsp{}Dye contributed documentation on Worg and helped
  22798   integrating the Org Babel documentation into the manual.
  22799 
  22800 - Christian Egli converted the documentation into Texinfo format,
  22801   inspired the agenda, patched CSS formatting into the HTML exporter,
  22802   and wrote =org-taskjuggler.el=.
  22803 
  22804 - David Emery provided a patch for custom CSS support in exported HTML
  22805   agendas.
  22806 
  22807 - Nic Ferrier contributed mailcap and XOXO support.
  22808 
  22809 - Miguel\nbsp{}A.\nbsp{}Figueroa-Villanueva implemented hierarchical checkboxes.
  22810 
  22811 - John Foerch figured out how to make incremental search show context
  22812   around a match in a hidden outline tree.
  22813 
  22814 - Raimar Finken wrote =org-git-line.el=.
  22815 
  22816 - Mikael Fornius works as a mailing list moderator.
  22817 
  22818 - Austin Frank works as a mailing list moderator.
  22819 
  22820 - Eric Fraga drove the development of Beamer export with ideas and
  22821   testing.
  22822 
  22823 - Barry Gidden did proofreading the manual in preparation for the book
  22824   publication through Network Theory Ltd.
  22825 
  22826 - Niels Giesen had the idea to automatically archive DONE trees.
  22827 
  22828 - Nicolas Goaziou rewrote much of the plain list code.
  22829 
  22830 - Kai Grossjohann pointed out key-binding conflicts with other
  22831   packages.
  22832 
  22833 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
  22834   a book.
  22835 
  22836 - Bernt Hansen has driven much of the support for auto-repeating
  22837   tasks, task state change logging, and the clocktable.  His clear
  22838   explanations have been critical when we started to adopt the Git
  22839   version control system.
  22840 
  22841 - Manuel Hermenegildo has contributed various ideas, small fixes and
  22842   patches.
  22843 
  22844 - Phil Jackson wrote =ol-irc.el=.
  22845 
  22846 - Scott Jaderholm proposed footnotes, control over whitespace between
  22847   folded entries, and column view for properties.
  22848 
  22849 - Matt Jones wrote MobileOrg Android.
  22850 
  22851 - Tokuya Kameshima wrote =org-wl.el= and =org-mew.el=.
  22852 
  22853 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it.  He also
  22854   provided frequent feedback and some patches.
  22855 
  22856 - Matt Lundin has proposed last-row references for table formulas and
  22857   named invisible anchors.  He has also worked a lot on the FAQ.
  22858 
  22859 - David Maus wrote =org-atom.el=, maintains the issues file for Org,
  22860   and is a prolific contributor on the mailing list with competent
  22861   replies, small fixes and patches.
  22862 
  22863 - Jason\nbsp{}F.\nbsp{}McBrayer suggested agenda export to CSV format.
  22864 
  22865 - Kyle Meyer helped setting up the [[https://public-inbox.org/][public-inbox]] archive of the [[https://orgmode.org/list/][Org
  22866   mailing list]] and has been fixing many bugs.
  22867 
  22868 - Max Mikhanosha came up with the idea of refiling.
  22869 
  22870 - Dmitri Minaev sent a patch to set priority limits on a per-file
  22871   basis.
  22872 
  22873 - Stefan Monnier provided a patch to keep the Emacs Lisp compiler
  22874   happy.
  22875 
  22876 - Richard Moreland wrote MobileOrg for the iPhone.
  22877 
  22878 - Rick Moynihan proposed allowing multiple TODO sequences in a file
  22879   and being able to quickly restrict the agenda to a subtree.
  22880 
  22881 - Todd Neal provided patches for links to Info files and Elisp forms.
  22882 
  22883 - Greg Newman refreshed the unicorn logo into its current form.
  22884 
  22885 - Tim O'Callaghan suggested in-file links, search options for general
  22886   file links, and tags.
  22887 
  22888 - Osamu Okano wrote =orgcard2ref.pl=, a Perl program to create a text
  22889   version of the reference card.
  22890 
  22891 - Takeshi Okano translated the manual and David O'Toole's tutorial
  22892   into Japanese.
  22893 
  22894 - Oliver Oppitz suggested multi-state TODO items.
  22895 
  22896 - Scott Otterson sparked the introduction of descriptive text for
  22897   links, among other things.
  22898 
  22899 - Pete Phillips helped during the development of the TAGS feature,
  22900   and provided frequent feedback.
  22901 
  22902 - Martin Pohlack provided the code snippet to bundle character
  22903   insertion into bundles of 20 for undo.
  22904 
  22905 - Ihor Radchenko helped with fixing bugs and improving the user
  22906   experience regarding Org's speed.
  22907 
  22908 - T.\nbsp{}V.\nbsp{}Raman reported bugs and suggested improvements.
  22909 
  22910 - Matthias Rempe (Oelde) provided ideas, Windows support, and quality
  22911   control.
  22912 
  22913 - Paul Rivier provided the basic implementation of named footnotes.
  22914   He also acted as mailing list moderator for some time.
  22915 
  22916 - Kevin Rogers contributed code to access VM files on remote hosts.
  22917 
  22918 - Frank Ruell solved the mystery of the =keymapp nil= bug, a conflict
  22919   with =allout.el=.
  22920 
  22921 - Jason Riedy generalized the send-receive mechanism for Orgtbl
  22922   tables with extensive patches.
  22923 
  22924 - Philip Rooke created the Org reference card, provided lots of
  22925   feedback, developed and applied standards to the Org documentation.
  22926 
  22927 - Christian Schlauer proposed angular brackets around links, among
  22928   other things.
  22929 
  22930 - Paul Sexton wrote =org-ctags.el=.
  22931 
  22932 - Tom Shannon's =organizer-mode.el= inspired linking to VM/BBDB/Gnus.
  22933 
  22934 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
  22935   literal examples, and remote highlighting for referenced code lines.
  22936 
  22937 - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is
  22938   now packaged into the [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository.
  22939 
  22940 - Daniel Sinder came up with the idea of internal archiving by locking
  22941   subtrees.
  22942 
  22943 - Dale Smith proposed link abbreviations.
  22944 
  22945 - James TD Smith has contributed a large number of patches for
  22946   useful tweaks and features.
  22947 
  22948 - Adam Spiers asked for global linking commands, inspired the link
  22949   extension system, added support for Mairix, and proposed the mapping
  22950   API.
  22951 
  22952 - Ulf Stegemann created the table to translate special symbols to
  22953   HTML, LaTeX, UTF-8, Latin-1 and ASCII.
  22954 
  22955 - Andy Stewart contributed code to =ol-w3m.el=, to copy
  22956   HTML content with links transformation to Org syntax.
  22957 
  22958 - David O'Toole wrote =org-publish.el= and drafted the
  22959   manual chapter about publishing.
  22960 
  22961 - Jambunathan\nbsp{}K.\nbsp{}contributed the ODT exporter.
  22962 
  22963 - Sebastien Vauban reported many issues with LaTeX and Beamer export
  22964   and enabled source code highlighting in Gnus.
  22965 
  22966 - Stefan Vollmar organized a video-recorded talk at the
  22967   Max-Planck-Institute for Neurology.  He also inspired the creation
  22968   of a concept index for HTML export.
  22969 
  22970 - Jürgen Vollmer contributed code generating the table of contents in
  22971   HTML output.
  22972 
  22973 - Samuel Wales has provided important feedback and bug reports.
  22974 
  22975 - Chris Wallace provided a patch implementing the =QUOTE= block.
  22976 
  22977 - David Wainberg suggested archiving, and improvements to the
  22978   linking system.
  22979 
  22980 - Carsten Wimmer suggested some changes and helped fix a bug in
  22981   linking to Gnus.
  22982 
  22983 - Roland Winkler requested additional key bindings to make Org work on
  22984   a TTY.
  22985 
  22986 - Piotr Zielinski wrote =org-mouse.el=, proposed agenda
  22987   blocks and contributed various ideas and code snippets.
  22988 
  22989 - Marco Wahl wrote =ol-eww.el=.
  22990 
  22991 * GNU Free Documentation License
  22992 :PROPERTIES:
  22993 :APPENDIX: t
  22994 :DESCRIPTION: The license for this documentation.
  22995 :END:
  22996 
  22997 #+include: fdl.org
  22998 
  22999 * Main Index
  23000 :PROPERTIES:
  23001 :INDEX:    cp
  23002 :DESCRIPTION: An index of Org's concepts and features.
  23003 :END:
  23004 
  23005 * Key Index
  23006 :PROPERTIES:
  23007 :DESCRIPTION: Key bindings and where they are described.
  23008 :INDEX:    ky
  23009 :END:
  23010 
  23011 * Command and Function Index
  23012 :PROPERTIES:
  23013 :DESCRIPTION: Command names and some internal functions.
  23014 :INDEX:    fn
  23015 :END:
  23016 
  23017 * Variable Index
  23018 :PROPERTIES:
  23019 :DESCRIPTION: Variables mentioned in the manual.
  23020 :INDEX:    vr
  23021 :END:
  23022 
  23023 This is not a complete index of variables and faces, only the ones
  23024 that are mentioned in the manual.  For a more complete list, use
  23025 {{{kbd(M-x org-customize)}}} and then click yourself through the tree.
  23026 
  23027 * Copying
  23028 :PROPERTIES:
  23029 :copying:  t
  23030 :END:
  23031 
  23032 This manual is for Org version {{{version}}}.
  23033 
  23034 Copyright \copy 2004--2024 Free Software Foundation, Inc.
  23035 
  23036 #+begin_quote
  23037 Permission is granted to copy, distribute and/or modify this document
  23038 under the terms of the GNU Free Documentation License, Version 1.3 or
  23039 any later version published by the Free Software Foundation; with no
  23040 Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
  23041 and with the Back-Cover Texts as in (a) below.  A copy of the license
  23042 is included in the section entitled "GNU Free Documentation License."
  23043 
  23044 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  23045 modify this GNU manual."
  23046 #+end_quote
  23047 
  23048 * Export Setup                                                          :noexport:
  23049 
  23050 #+setupfile: doc-setup.org
  23051 
  23052 #+export_file_name: org.texi
  23053 
  23054 #+texinfo_dir_category: Emacs editing modes
  23055 #+texinfo_dir_name: Org Mode: (org)
  23056 #+texinfo_dir_desc: Outline-based notes management and organizer
  23057 
  23058 * Footnotes
  23059 
  23060 [fn:1] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
  23061 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
  23062 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines.  Note
  23063 also that clocking only works with headings indented less than 30
  23064 stars.
  23065 
  23066 [fn:2] The indirect buffer contains the entire buffer, but is narrowed
  23067 to the current tree.  Editing the indirect buffer also changes the
  23068 original buffer, but without affecting visibility in that buffer.  For
  23069 more information about indirect buffers, see [[info:emacs#Indirect Buffers][GNU Emacs Manual]].
  23070 
  23071 [fn:3] When using =*= as a bullet, lines must be indented so that they
  23072 are not interpreted as headlines.  Also, when you are hiding leading
  23073 stars to get a clean outline view, plain list items starting with
  23074 a star may be hard to distinguish from true headlines.  In short: even
  23075 though =*= is supported, it may be better to not use it for plain list
  23076 items.
  23077 
  23078 [fn:4] You can also get =a.=, =A.=, =a)= and =A)= by configuring
  23079 ~org-list-allow-alphabetical~.  To minimize confusion with normal
  23080 text, those are limited to one character only.  Beyond that limit,
  23081 bullets automatically become numbers.
  23082 
  23083 [fn:5] If there's a checkbox in the item, the cookie must be put
  23084 /before/ the checkbox.  If you have activated alphabetical lists, you
  23085 can also use counters like =[@b]=.
  23086 
  23087 [fn:6] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
  23088 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
  23089 
  23090 [fn:7] Org understands references typed by the user as =B4=, but it
  23091 does not use this syntax when offering a formula for editing.  You can
  23092 customize this behavior using the variable
  23093 ~org-table-use-standard-references~.
  23094 
  23095 [fn:8] The file =constants.el= can supply the values of constants in
  23096 two different unit systems, =SI= and =cgs=.  Which one is used depends
  23097 on the value of the variable ~constants-unit-system~.  You can use the
  23098 =STARTUP= options =constSI= and =constcgs= to set this value for the
  23099 current buffer.
  23100 
  23101 [fn:9] The printf reformatting is limited in precision because the
  23102 value passed to it is converted into an "integer" or "double".  The
  23103 "integer" is limited in size by truncating the signed value to 32
  23104 bits.  The "double" is limited in precision to 64 bits overall which
  23105 leaves approximately 16 significant decimal digits.
  23106 
  23107 [fn:10] Plain URIs are recognized only for a well-defined set of
  23108 schemes.  See [[*External Links]].  Unlike URI syntax, they cannot contain
  23109 parenthesis or white spaces, either.  URIs within angle brackets have
  23110 no such limitation.
  23111 
  23112 [fn:11] To insert a link targeting a headline, in-buffer completion
  23113 can be used.  Just type a star followed by a few optional letters into
  23114 the buffer and press {{{kbd(M-TAB)}}}.  All headlines in the current
  23115 buffer are offered as completions.
  23116 
  23117 [fn:12] The actual behavior of the search depends on the value of the
  23118 variable ~org-link-search-must-match-exact-headline~.  If its value is
  23119 ~nil~, then a fuzzy text search is done.  If it is ~t~, then only the
  23120 exact headline is matched, ignoring spaces and statistic cookies.  If
  23121 the value is ~query-to-create~, then an exact headline is searched; if
  23122 it is not found, then the user is queried to create it.
  23123 
  23124 [fn:13] Note that you do not have to use this command to insert
  23125 a link.  Links in Org are plain text, and you can type or paste them
  23126 straight into the buffer.  By using this command, the links are
  23127 automatically enclosed in double brackets, and you will be asked for
  23128 the optional descriptive text.
  23129 
  23130 [fn:14] After insertion of a stored link, the link will be removed
  23131 from the list of stored links.  To keep it in the list for later use,
  23132 use a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
  23133 configure the option ~org-link-keep-stored-after-insertion~.
  23134 
  23135 [fn:15] It is possible that Org mode records two timestamps when you
  23136 are using both ~org-log-done~ and state change logging.  However, it
  23137 never prompts for two notes: if you have configured both, the state
  23138 change recording note takes precedence and cancel the closing note.
  23139 
  23140 [fn:16] With the exception of description lists.  But you can allow it
  23141 by modifying ~org-list-automatic-rules~ accordingly.
  23142 
  23143 [fn:17] For both =TIMESTAMP= and =TIMESTAMP_IA=: the word "first"
  23144 refers to the first occurrence in the entry, not the earliest in time;
  23145 the prefix =CLOCK:= at the beginning of a clock entry is considered a
  23146 keyword in this context; and timestamps inside property drawers are
  23147 ignored.
  23148 
  23149 [fn:18] An age can be defined as a duration, using units defined in
  23150 ~org-duration-units~, e.g., =3d 1h=.  If any value in the column is as
  23151 such, the summary is also expressed as a duration.
  23152 
  23153 [fn:19] The Org date format is inspired by the standard ISO 8601
  23154 date/time format.  To use an alternative format, see [[*Custom time
  23155 format]].  The day name is optional when you type the date yourself.
  23156 However, any date inserted or modified by Org adds that day name, for
  23157 reading convenience.
  23158 
  23159 [fn:20] When working with the standard diary expression functions, you
  23160 need to be very careful with the order of the arguments.  That order
  23161 depends evilly on the variable ~calendar-date-style~.  For example, to
  23162 specify a date December 1, 2005, the call might look like
  23163 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date
  23164 2005 12 1)=, depending on the settings.  This has been the source of
  23165 much confusion.  Org mode users can resort to special versions of
  23166 these functions, namely ~org-date~, ~org-anniversary~, ~org-cyclic~, and
  23167 ~org-block~.  These work just like the corresponding ~diary-~
  23168 functions, but with stable ISO order of arguments (year, month, day)
  23169 wherever applicable, independent of the value of
  23170 ~calendar-date-style~.
  23171 
  23172 [fn:21] See the variable ~org-read-date-prefer-future~.  You may set
  23173 that variable to the symbol ~time~ to even make a time before now
  23174 shift the date to tomorrow.
  23175 
  23176 [fn:22] You can also use the calendar command {{{kbd(.)}}} to jump to
  23177 today's date, but if you are inserting an hour specification for your
  23178 timestamp, {{{kbd(.)}}} will then insert a dot after the hour.  By contrast,
  23179 {{{kbd(C-.)}}} will always jump to today's date.
  23180 
  23181 [fn:23] It will still be listed on that date after it has been marked
  23182 as done.  If you do not like this, set the variable
  23183 ~org-agenda-skip-scheduled-if-done~.
  23184 
  23185 [fn:24] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
  23186 right below the headline.  Do not put any text between this line and
  23187 the headline.
  23188 
  23189 [fn:25] Org does not repeat inactive timestamps, however.  See
  23190 [[*Timestamps]].
  23191 
  23192 [fn:26] You can change this using the option ~org-log-repeat~, or the
  23193 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=.
  23194 With =lognoterepeat=, you will also be prompted for a note.
  23195 
  23196 [fn:27] Clocking only works if all headings are indented with less
  23197 than 30 stars.  This is a hard-coded limitation of ~lmax~ in
  23198 ~org-clock-sum~.
  23199 
  23200 [fn:28] When using ~:step~, ~untilnow~ starts from the beginning of
  23201 2003, not the beginning of time.
  23202 
  23203 [fn:29] On computers using macOS, idleness is based on actual user
  23204 idleness, not just Emacs's idle time.  For X11, you can install a
  23205 utility program =x11idle.c=, available in the =org-contrib/=
  23206 repository, or install the xprintidle package and set it to the
  23207 variable ~org-clock-x11idle-program-name~ if you are running Debian,
  23208 to get the same general treatment of idleness.  On other systems, idle
  23209 time refers to Emacs idle time only.
  23210 
  23211 [fn:30] Org used to offer four different targets for date/week tree
  23212 capture.  Now, Org automatically translates these to use
  23213 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
  23214 properties.  Please rewrite your date/week-tree targets using
  23215 ~file+olp+datetree~ since the older targets are now deprecated.
  23216 
  23217 [fn:31] A date tree is an outline structure with years on the highest
  23218 level, months or ISO weeks as sublevels and then dates on the lowest
  23219 level.
  23220 
  23221 #+begin_example
  23222 ,* 2022
  23223 ,** 2022-10 October
  23224 ,*** 2022-10-07 Friday
  23225 ,*** 2022-10-08 Saturday
  23226 #+end_example
  23227 
  23228 TODO state, priority, tags, statistics cookies, and COMMENT keywords
  23229 are allowed in the tree structure.
  23230 
  23231 [fn:32] This is always the other, not the user.  See the variable
  23232 ~org-link-from-user-regexp~.
  23233 
  23234 [fn:33] For backward compatibility, the universal prefix argument
  23235 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
  23236 This feature is deprecated, use the dedicated TODO list, or a block
  23237 agenda instead (see [[*Block agenda]]).
  23238 
  23239 [fn:34] Custom agenda commands can preset a filter by binding one of
  23240 the variables ~org-agenda-tag-filter-preset~,
  23241 ~org-agenda-category-filter-preset~, ~org-agenda-effort-filter-preset~
  23242 or ~org-agenda-regexp-filter-preset~ as an option.  This filter is
  23243 then applied to the view and persists as a basic filter through
  23244 refreshes and more secondary filtering.  The filter is a global
  23245 property of the entire agenda view---in a block agenda, you should
  23246 only set this in the global options section, not in the section of an
  23247 individual block.
  23248 
  23249 [fn:35] /Planned/ means here that these entries have some planning
  23250 information attached to them, like a timestamp, a scheduled or
  23251 a deadline string.  See ~org-agenda-entry-types~ on how to set what
  23252 planning information is taken into account.
  23253 
  23254 [fn:36] To create PDF output, the Ghostscript ps2pdf utility must be
  23255 installed on the system.  Selecting a PDF file also creates the
  23256 postscript file.
  23257 
  23258 [fn:37] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
  23259 system.  Many of the features described here as "LaTeX" are really
  23260 from TeX, but for simplicity I am blurring this distinction.
  23261 
  23262 [fn:38] When MathJax is used, only the environments recognized by
  23263 MathJax are processed.  When dvipng, dvisvgm, or ImageMagick suite is
  23264 used to create images, any LaTeX environment is handled.
  23265 
  23266 [fn:39] These are respectively available at
  23267 [[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
  23268 and from the ImageMagick suite.  Choose the converter by setting the
  23269 variable ~org-preview-latex-default-process~ accordingly.
  23270 
  23271 [fn:40] This works automatically for the HTML backend (it requires
  23272 version 1.34 of the =htmlize.el= package, which you need to install).
  23273 Fontified code chunks in LaTeX can be achieved using either the
  23274 [[https://www.ctan.org/pkg/listings][listings]] LaTeX package, [[https://www.ctan.org/pkg/minted][minted]] LaTeX package, or by using
  23275 [[https://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] .  Refer to ~org-latex-src-block-backend~ for details.
  23276 
  23277 [fn:41] Source code in code blocks may also be evaluated either
  23278 interactively or on export.  See [[*Working with Source Code]] for more
  23279 information on evaluating code blocks.
  23280 
  23281 [fn:42] For export to LaTeX format---or LaTeX-related formats such as
  23282 Beamer---, the =org-latex-package-alist= variable needs further
  23283 configuration.  See [[LaTeX specific export settings]].
  23284 
  23285 [fn:43] At the moment, some export backends do not obey this
  23286 specification.  For example, LaTeX export excludes every unnumbered
  23287 headline from the table of contents.
  23288 
  23289 [fn:44] Note that ~org-link-search-must-match-exact-headline~ is
  23290 locally bound to non-~nil~.  Therefore, ~org-link-search~ only matches
  23291 headlines and named elements.
  23292 
  23293 [fn:45] Since commas separate the arguments, commas within arguments
  23294 have to be escaped with the backslash character.  So only those
  23295 backslash characters before a comma need escaping with another
  23296 backslash character.
  23297 
  23298 [fn:46] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
  23299 to make it visible.  The tag serves as a visual aid and has no
  23300 semantic relevance.
  23301 
  23302 [fn:47] Please note that exported formulas are part of an HTML
  23303 document, and that signs such as =<=, =>=, or =&= have special
  23304 meanings.  See [[https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]].
  23305 
  23306 [fn:48] This does not allow setting different bibliography compilers
  23307 for different files.  However, "smart" LaTeX compilation systems, such
  23308 as latexmk, can select the correct bibliography compiler.
  23309 
  23310 [fn:49] Actually, the constructs =call_<name>()= and =src_<lang>{}=
  23311 are not evaluated when they appear in a keyword (see [[*Summary of
  23312 In-Buffer Settings]]).
  23313 
  23314 [fn:50] In the following example, attempting to evaluate
  23315 the second code block will give an error, because the variables
  23316 defined in the first code block will not be defined in the second
  23317 block.
  23318 
  23319 #+begin_example
  23320 ,#+NAME: get-prompt
  23321 ,#+BEGIN_SRC emacs-lisp :var prompt="root> " :var command="ls"
  23322   (concat prompt command)
  23323 ,#+END_SRC
  23324 
  23325 ,#+RESULTS: get-prompt
  23326 : root> ls
  23327 
  23328 ,#+BEGIN_SRC emacs-lisp :noweb yes
  23329   <<get-prompt>>
  23330 ,#+END_SRC
  23331 #+end_example
  23332 
  23333 The previous block is expanded without setting ~prompt~ and ~command~
  23334 values.
  23335 
  23336 #+begin_example
  23337 ,#+BEGIN_SRC emacs-lisp
  23338   (concat prompt command)
  23339 ,#+END_SRC
  23340 #+end_example
  23341 
  23342 [fn:51] Org Indent mode also sets ~wrap-prefix~ correctly for
  23343 indenting and wrapping long lines of headlines or text.  This minor
  23344 mode also handles Visual Line mode and directly applied settings
  23345 through ~word-wrap~.
  23346 
  23347 [fn:52] This works, but requires extra effort.  Org Indent mode is
  23348 more convenient for most applications.
  23349 
  23350 [fn:53] For a server to host files, consider using a WebDAV server,
  23351 such as [[https://nextcloud.com][Nextcloud]].  Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
  23352 
  23353 [fn:54] While creating the agendas, Org mode forces =ID= properties
  23354 on all referenced entries, so that these entries can be uniquely
  23355 identified if Org Mobile flags them for further action.  To avoid
  23356 setting properties configure the variable
  23357 ~org-mobile-force-id-on-agenda-items~ to ~nil~.  Org mode then relies
  23358 on outline paths, assuming they are unique.
  23359 
  23360 [fn:55] By default this works only for LaTeX, HTML, and Texinfo.
  23361 Configure the variable ~orgtbl-radio-table-templates~ to install
  23362 templates for other modes.
  23363 
  23364 [fn:56] If the =TBLFM= keyword contains an odd number of dollar
  23365 characters, this may cause problems with Font Lock in LaTeX mode.  As
  23366 shown in the example you can fix this by adding an extra line inside
  23367 the =comment= environment that is used to balance the dollar
  23368 expressions.  If you are using AUCTeX with the font-latex library,
  23369 a much better solution is to add the =comment= environment to the
  23370 variable ~LaTeX-verbatim-environments~.