1 #+title: The Org Manual
3 #+texinfo: @insertcopying
7 :DESCRIPTION: Getting started.
13 :DESCRIPTION: Brief summary of what Org does.
17 Org is a mode for keeping notes, maintaining TODO lists, and project
18 planning with a fast and effective plain-text system. It also is an
19 authoring system with unique support for literate programming and
20 reproducible research.
22 Org is implemented on top of Outline mode, which makes it possible to
23 keep the content of large files well structured. Visibility cycling
24 and structure editing help to work with the tree. Tables are easily
25 created with a built-in table editor. Plain text URL-like links
26 connect to websites, emails, Usenet messages, BBDB entries, and any
27 files related to the projects.
29 Org develops organizational tasks around notes files that contain
30 lists or information about projects as plain text. Project planning
31 and task management makes use of metadata which is part of an outline
32 node. Based on this data, specific entries can be extracted in
33 queries and create dynamic /agenda views/ that also integrate the
34 Emacs calendar and diary. Org can be used to implement many different
35 project planning schemes, such as David Allen's GTD system.
37 Org files can serve as a single source authoring system with export to
38 many different formats such as HTML, LaTeX, Open Document, and
39 Markdown. New export backends can be derived from existing ones, or
42 Org files can include source code blocks, which makes Org uniquely
43 suited for authoring technical documents with code examples. Org
44 source code blocks are fully functional; they can be evaluated in
45 place and their results can be captured in the file. This makes it
46 possible to create a single file reproducible research compendium.
48 Org keeps simple things simple. When first fired up, it should feel
49 like a straightforward, easy to use outliner. Complexity is not
50 imposed, but a large amount of functionality is available when needed.
51 Org is a toolbox. Many users actually run only a -- very personal --
52 fraction of Org's capabilities, and know that there is more whenever
55 All of this is achieved with strictly plain text files, the most
56 portable and future-proof file format. Org runs in Emacs. Emacs is
57 one of the most widely ported programs, so that Org mode is available
58 on every major platform.
61 There is a website for Org which provides links to the newest version
62 of Org, as well as additional information, frequently asked questions
63 (FAQ), links to tutorials, etc. This page is located at
64 [[http://orgmode.org]].
66 #+cindex: print edition
67 An earlier version (7.3) of this manual is available as a [[http://www.network-theory.co.uk/org/manual/][paperback
68 book from Network Theory Ltd.]].
72 :DESCRIPTION: Installing Org.
74 #+cindex: installation
76 Org is part of recent distributions of GNU Emacs, so you normally do
77 not need to install it. If, for one reason or another, you want to
78 install Org on top of this pre-packaged version, there are three ways
81 - By using Emacs package system.
82 - By downloading Org as an archive.
83 - By using Org's git repository.
85 We *strongly recommend* to stick to a single installation method.
87 *** Using Emacs packaging system
92 Recent Emacs distributions include a packaging system which lets you
93 install Elisp libraries. You can install Org with {{{kbd(M-x
94 package-install RET org)}}}.
97 *Important*: you need to do this in a session where no =.org= file has
98 been visited, i.e., where no Org built-in function have been loaded.
99 Otherwise autoload Org functions will mess up the installation.
101 Then, to make sure your Org configuration is taken into account,
102 initialize the package system with ~(package-initialize)~ in your
103 Emacs init file before setting any Org option. If you want to use
104 Org's package repository, check out the [[http://orgmode.org/elpa.html][Org ELPA page]].
106 *** Downloading Org as an archive
111 You can download Org latest release from [[http://orgmode.org/][Org's website]]. In this case,
112 make sure you set the load-path correctly in your Emacs init file:
114 #+begin_src emacs-lisp
115 (add-to-list 'load-path "~/path/to/orgdir/lisp")
118 The downloaded archive contains contributed libraries that are not
119 included in Emacs. If you want to use them, add the =contrib/=
120 directory to your load-path:
122 #+begin_src emacs-lisp
123 (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
126 Optionally, you can compile the files and/or install them in your
127 system. Run =make help= to list compilation and installation options.
129 *** Using Org's git repository
134 You can clone Org's repository and install Org like this:
138 $ git clone git://orgmode.org/org-mode.git
142 Note that in this case, ~make autoloads~ is mandatory: it defines
143 Org's version in =org-version.el= and Org's autoloads in
146 Remember to add the correct load-path as described in the method
149 You can also compile with =make=, generate the documentation with
150 =make doc=, create a local configuration with =make config= and
151 install Org with =make install=. Please run =make help= to get the
152 list of compilation/installation options.
154 For more detailed explanations on Org's build system, please check the
155 Org Build System page on [[http://orgmode.org/worg/dev/org-build-system.html][Worg]].
159 :DESCRIPTION: How to activate Org for certain buffers.
164 #+cindex: global key bindings
165 #+cindex: key bindings, global
167 Org mode buffers need Font Lock to be turned on: this is the default
170 There are compatibility issues between Org mode and some other Elisp
171 packages (see [[*Packages that conflict with Org mode]]). Please take the
172 time to check the list.
175 #+findex: org-capture
176 #+findex: org-store-link
177 #+findex: org-iswitchb
178 The four Org commands ~org-store-link~, ~org-capture~, ~org-agenda~,
179 and ~org-iswitchb~ be accessible through global keys -- i.e., anywhere
180 in Emacs, not just in Org buffers. Here are suggested bindings for
181 these keys, please modify the keys to your own liking.
183 #+begin_src emacs-lisp
184 (global-set-key "\C-cl" 'org-store-link)
185 (global-set-key "\C-ca" 'org-agenda)
186 (global-set-key "\C-cc" 'org-capture)
187 (global-set-key "\C-cb" 'org-iswitchb)
190 #+cindex: Org mode, turning on
191 Files with the =.org= extension use Org mode by default. To turn on
192 Org mode in a file that does not have the extension =.org=, make the
193 first line of a file look like this:
195 : MY PROJECTS -*- mode: org; -*-
197 #+vindex: org-insert-mode-line-in-empty-file
199 which selects Org mode for this buffer no matter what the file's name
200 is. See also the variable ~org-insert-mode-line-in-empty-file~.
202 Many commands in Org work on the region if the region is /active/. To
203 make use of this, you need to have ~transient-mark-mode~ turned on,
204 which is the default. If you do not like ~transient-mark-mode~, you
205 can create an active region by using the mouse to select a region, or
206 pressing {{{kbd(C-SPC)}}} twice before moving the cursor.
210 :DESCRIPTION: Bug reports, ideas, patches, etc.
213 #+cindex: bug reports
214 #+cindex: reporting a bug
218 If you find problems with Org, or if you have questions, remarks, or
219 ideas about it, please mail to the Org mailing list
220 [[mailto:emacs-orgmode@gnu.org]]. You can subscribe to the list [[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][on this
221 web page]]. If you are not a member of the mailing list, your mail will
222 be passed to the list after a moderator has approved it[fn:2].
224 #+findex: org-version
225 #+findex: org-submit-bug-report
226 For bug reports, please first try to reproduce the bug with the latest
227 version of Org available -- if you are running an outdated version, it
228 is quite possible that the bug has been fixed already. If the bug
229 persists, prepare a report and provide as much information as
230 possible, including the version information of Emacs ({{{kbd(M-x
231 emacs-version)}}}) and Org ({{{kbd(M-x org-version)}}}), as well as
232 the Org related setup in the Emacs init file. The easiest way to do
233 this is to use the command
235 : M-x org-submit-bug-report <RET>
238 which puts all this information into an Emacs mail buffer so that you
239 only need to add your description. If you are not sending the Email
240 from within Emacs, please copy and paste the content into your Email
243 Sometimes you might face a problem due to an error in your Emacs or
244 Org mode setup. Before reporting a bug, it is very helpful to start
245 Emacs with minimal customizations and reproduce the problem. Doing so
246 often helps you determine if the problem is with your customization or
247 with Org mode itself. You can start a typical minimal session with
248 a command like the example below.
250 : $ emacs -Q -l /path/to/minimal-org.el
252 However if you are using Org mode as distributed with Emacs, a minimal
253 setup is not necessary. In that case it is sufficient to start Emacs
254 as =emacs -Q=. The =minimal-org.el= setup file can have contents as
257 #+begin_src emacs-lisp
258 ;;; Minimal setup to load latest `org-mode'.
260 ;; Activate debugging.
261 (setq debug-on-error t
265 ;; Add latest Org mode to load path.
266 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
267 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
270 If an error occurs, a "backtrace" can be very useful -- see below on
271 how to create one. Often a small example file helps, along with clear
274 1. What exactly did you do?
275 2. What did you expect to happen?
276 3. What happened instead?
279 Thank you for helping to improve this program.
281 *** How to create a useful backtrace
286 #+cindex: backtrace of an error
287 If working with Org produces an error with a message you do not
288 understand, you may have hit a bug. The best way to report this is by
289 providing, in addition to what was mentioned above, a backtrace. This
290 is information from the built-in debugger about where and how the
291 error occurred. Here is how to produce a useful backtrace:
293 1. Reload uncompiled versions of all Org mode Lisp files. The
294 backtrace contains much more information if it is produced with
295 uncompiled code. To do this, use
297 : C-u M-x org-reload <RET>
300 or, from the menu: Org \rarr Refresh/Reload \rarr Reload Org uncompiled.
302 2. Then, activate the debugger:
304 : M-x toggle-debug-or-errror <RET>
307 or, from the menu: Options \rarr Enter Debugger on Error.
309 3. Do whatever you have to do to hit the error. Do not forget to
310 document the steps you take.
312 4. When you hit the error, a =*Backtrace*= buffer appears on the
313 screen. Save this buffer to a file -- for example using {{{kbd(C-x
314 C-w)}}} -- and attach it to your bug report.
316 ** Typesetting conventions used in this manual
318 :DESCRIPTION: Typesetting conventions used in this manual.
319 :ALT_TITLE: Conventions
322 *** TODO keywords, tags, properties, etc.
327 Org uses various syntactical elements: TODO keywords, tags, property
328 names, keywords, blocks, etc. In this manual we use the following
331 #+attr_texinfo: :sep ,
332 - =TODO=, =WAITING= :: TODO keywords are written with all capitals,
333 even if they are user-defined.
335 - =boss=, =ARCHIVE= :: User-defined tags are written in lowercase;
336 built-in tags with special meaning are written with all capitals.
338 - =Release=, =PRIORITY= :: User-defined properties are capitalized;
339 built-in properties with special meaning are written with all
342 - =TITLE=, =BEGIN= ... =END= :: Keywords and blocks are written in
343 uppercase to enhance their readability, but you can use lowercase
346 *** Key bindings and commands
353 The manual suggests a few global key bindings, in particular
354 {{{kbd(C-c a)}}} for ~org-agenda~ and {{{kbd(C-c c)}}} for
355 ~org-capture~. These are only suggestions, but the rest of the manual
356 assumes that these key bindings are in place in order to list commands
359 Also, the manual lists both the keys and the corresponding commands
360 for accessing a functionality. Org mode often uses the same key for
361 different functions, depending on context. The command that is bound
362 to such keys has a generic name, like ~org-metaright~. In the manual
363 we will, wherever possible, give the function that is internally
364 called by the generic command. For example, in the chapter on
365 document structure, {{{kbd(M-right)}}} will be listed to call
366 ~org-do-demote~, while in the chapter on tables, it will be listed to
367 call ~org-table-move-column-right~.
371 :DESCRIPTION: A tree works like your brain.
373 #+cindex: document structure
374 #+cindex: structure of document
376 Org is based on Outline mode and provides flexible commands to
377 edit the structure of the document.
381 :DESCRIPTION: Org is based on Outline mode.
384 #+cindex: Outline mode
386 Org is implemented on top of Outline mode. Outlines allow a document
387 to be organized in a hierarchical structure, which, least for me, is
388 the best representation of notes and thoughts. An overview of this
389 structure is achieved by folding, i.e., hiding large parts of the
390 document to show only the general document structure and the parts
391 currently being worked on. Org greatly simplifies the use of outlines
392 by compressing the entire show and hide functionalities into a single
393 command, ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key.
397 :DESCRIPTION: How to typeset Org tree headlines.
400 #+cindex: outline tree
401 #+vindex: org-special-ctrl-a/e
402 #+vindex: org-special-ctrl-k
403 #+vindex: org-ctrl-k-protect-subtree
405 Headlines define the structure of an outline tree. The headlines in
406 Org start with one or more stars, on the left margin[fn:3]. For
410 ,* Top level headline
416 ,* Another top level headline
419 #+vindex: org-footnote-section
421 Note that the name defined in ~org-footnote-section~ is reserved. Do
422 not use it as a title for your own headings.
424 Some people find the many stars too noisy and would prefer an outline
425 that has whitespace followed by a single star as headline starters.
426 See [[*A cleaner outline view]].
428 #+vindex: org-cycle-separator-lines
429 An empty line after the end of a subtree is considered part of it and
430 is hidden when the subtree is folded. However, if you leave at least
431 two empty lines, one empty line remains visible after folding the
432 subtree, in order to structure the collapsed view. See the variable
433 ~org-cycle-separator-lines~ to modify this behavior.
435 ** Visibility cycling
437 :DESCRIPTION: Show and hide, much simplified.
439 #+cindex: cycling, visibility
440 #+cindex: visibility cycling
441 #+cindex: trees, visibility
442 #+cindex: show hidden text
445 *** Global and local cycling
447 :DESCRIPTION: Cycling through various visibility states.
449 #+cindex: subtree visibility states
450 #+cindex: subtree cycling
451 #+cindex: folded, subtree visibility state
452 #+cindex: children, subtree visibility state
453 #+cindex: subtree, subtree visibility state
455 Outlines make it possible to hide parts of the text in the buffer.
456 Org uses just two commands, bound to {{{kbd(TAB)}}} and
457 {{{kbd(S-TAB)}}} to change the visibility in the buffer.
459 #+attr_texinfo: :sep ,
460 - {{{kbd(TAB)}}} (~org-cycle~) ::
464 /Subtree cycling/: Rotate current subtree among the states
467 ,-> FOLDED -> CHILDREN -> SUBTREE --.
468 '-----------------------------------'
471 #+vindex: org-cycle-emulate-tab
472 The cursor must be on a headline for this to work[fn:4].
474 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
476 #+cindex: global visibility states
477 #+cindex: global cycling
478 #+cindex: overview, global visibility state
479 #+cindex: contents, global visibility state
480 #+cindex: show all, global visibility state
483 #+findex: org-global-cycle
484 /Global cycling/: Rotate the entire buffer among the states
487 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
488 '--------------------------------------'
491 When {{{kbd(S-TAB)}}} is called with a numeric prefix argument N,
492 the CONTENTS view up to headlines of level N are shown. Note
493 that inside tables (see [[*Tables]]), {{{kbd(S-TAB)}}} jumps to the
494 previous field instead.
496 #+vindex: org-cycle-global-at-bob
497 You can run global cycling using {{{kbd(TAB)}}} only if point is
498 at the very beginning of the buffer, but not on a headline, and
499 ~org-cycle-global-at-bob~ is set to a non-~nil~ value.
501 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
503 #+cindex: startup visibility
504 #+kindex: C-u C-u TAB
505 #+findex: org-set-startup-visibility
506 Switch back to the startup visibility of the buffer (see [[*Initial
509 - {{{kbd(C-u C-u C-u TAB)}}} (~outline-show-all~) ::
511 #+cindex: show all, command
512 #+kindex: C-u C-u C-u TAB
513 #+findex: outline-show-all
514 Show all, including drawers.
516 - {{{kbd(C-c C-r)}}} (~org-reveal~) ::
518 #+cindex: revealing context
521 Reveal context around point, showing the current entry, the
522 following heading and the hierarchy above. Useful for working
523 near a location that has been exposed by a sparse tree command
524 (see [[*Sparse trees]]) or an agenda command (see [[*Commands in the
525 agenda buffer]]). With a prefix argument show, on each level, all
526 sibling headings. With a double prefix argument, also show the
527 entire subtree of the parent.
529 - {{{kbd(C-c C-k)}}} (~outline-show-branches~) ::
531 #+cindex: show branches, command
533 #+findex: outline-show-branches
534 Expose all the headings of the subtree, CONTENTS view for just
537 - {{{kbd(C-c TAB)}}} (~outline-show-children~) ::
539 #+cindex: show children, command
541 #+findex: outline-show-children
542 Expose all direct children of the subtree. With a numeric prefix
543 argument N, expose all children down to level N.
545 - {{{kbd(C-c C-x b)}}} (~org-tree-to-indirect-buffer~) ::
548 #+findex: org-tree-to-indirect-buffer
549 Show the current subtree in an indirect buffer[fn:5]. With
550 a numeric prefix argument, N, go up to level N and then take that
551 tree. If N is negative then go up that many levels. With
552 a {{{kbd(C-u)}}} prefix, do not remove the previously used
555 - {{{kbd(C-c C-x v)}}} (~org-copy-visible~) ::
558 #+findex: org-copy-visible
559 Copy the /visible/ text in the region into the kill ring.
561 *** Initial visibility
563 :DESCRIPTION: Setting the initial visibility state.
566 #+vindex: org-startup-folded
567 When Emacs first visits an Org file, the global state is set to
568 OVERVIEW, i.e., only the top level headlines are visible[fn:6]. This
569 can be configured through the variable ~org-startup-folded~, or on
570 a per-file basis by adding one of the following lines anywhere in the
573 #+cindex: STARTUP, keyword
578 ,#+STARTUP: showeverything
581 #+cindex: VISIBILITY, property
583 Furthermore, any entries with a =VISIBILITY= property (see [[*Properties
584 and columns]]) get their visibility adapted accordingly. Allowed values
585 for this property are =folded=, =children=, =content=, and ~all~.
587 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
589 #+kindex: C-u C-u TAB
590 #+findex: org-set-startup-visibility
591 Switch back to the startup visibility of the buffer, i.e.,
592 whatever is requested by startup options and =VISIBILITY=
593 properties in individual entries.
595 *** Catching invisible edits
597 :DESCRIPTION: Preventing mistakes when editing invisible parts.
599 #+cindex: edits, catching invisible
601 #+vindex: org-catch-invisible-edits
602 Sometimes you may inadvertently edit an invisible part of the buffer
603 and be confused on what has been edited and how to undo the mistake.
604 Setting ~org-catch-invisible-edits~ to non-~nil~ helps preventing
605 this. See the docstring of this option on how Org should catch
606 invisible edits and process them.
610 :DESCRIPTION: Jumping to other headlines.
612 #+cindex: motion, between headlines
613 #+cindex: jumping, to headlines
614 #+cindex: headline navigation
616 The following commands jump to other headlines in the buffer.
618 - {{{kbd(C-c C-n)}}} (~outline-next-visible-heading~) ::
621 #+findex: outline-next-visible-heading
624 - {{{kbd(C-c C-p)}}} (~outline-previous-visible-heading~) ::
627 #+findex: outline-previous-visible-heading
630 - {{{kbd(C-c C-f)}}} (~org-forward-same-level~) ::
633 #+findex: org-forward-same-level
634 Next heading same level.
636 - {{{kbd(C-c C-b)}}} (~org-backward-same-level~) ::
639 #+findex: org-backward-same-level
640 Previous heading same level.
642 - {{{kbd(C-c C-u)}}} (~outline-up-heading~) ::
645 #+findex: outline-up-heading
646 Backward to higher level heading.
648 - {{{kbd(C-c C-j)}}} (~org-goto~) ::
652 #+vindex: org-goto-auto-isearch
653 Jump to a different place without changing the current outline
654 visibility. Shows the document structure in a temporary buffer,
655 where you can use the following keys to find your destination:
657 #+attr_texinfo: :columns 0.3 0.7
658 | {{{kbd(TAB)}}} | Cycle visibility. |
659 | {{{kbd(down)}}} / {{{kbd(up)}}} | Next/previous visible headline. |
660 | {{{kbd(RET)}}} | Select this location. |
661 | {{{kbd(/)}}} | Do a Sparse-tree search |
664 The following keys work if you turn off ~org-goto-auto-isearch~
666 #+attr_texinfo: :columns 0.3 0.7
667 | {{{kbd(n)}}} / {{{kbd(p)}}} | Next/previous visible headline. |
668 | {{{kbd(f)}}} / {{{kbd(b)}}} | Next/previous headline same level. |
669 | {{{kbd(u)}}} | One level up. |
670 | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument. |
671 | {{{kbd(q)}}} | Quit. |
673 #+vindex: org-goto-interface
675 See also the variable ~org-goto-interface~.
679 :DESCRIPTION: Changing sequence and level of headlines.
681 #+cindex: structure editing
682 #+cindex: headline, promotion and demotion
683 #+cindex: promotion, of subtrees
684 #+cindex: demotion, of subtrees
685 #+cindex: subtree, cut and paste
686 #+cindex: pasting, of subtrees
687 #+cindex: cutting, of subtrees
688 #+cindex: copying, of subtrees
689 #+cindex: sorting, of subtrees
690 #+cindex: subtrees, cut and paste
692 - {{{kbd(M-RET)}}} (~org-meta-return~) ::
695 #+findex: org-meta-return
696 #+vindex: org-M-RET-may-split-line
697 Insert a new heading, item or row.
699 If the command is used at the /beginning/ of a line, and if there
700 is a heading or a plain list item (see [[*Plain lists]]) at point,
701 the new heading/item is created /before/ the current line. When
702 used at the beginning of a regular line of text, turn that line
705 When this command is used in the middle of a line, the line is
706 split and the rest of the line becomes the new item or headline.
707 If you do not want the line to be split, customize
708 ~org-M-RET-may-split-line~.
710 Calling the command with a {{{kbd(C-u)}}} prefix unconditionally
711 inserts a new heading at the end of the current subtree, thus
712 preserving its contents. With a double {{{kbd(C-u C-u)}}}
713 prefix, the new heading is created at the end of the parent
716 - {{{kbd(C-RET)}}} (~org-insert-heading-respect-content~) ::
719 #+findex: org-insert-heading-respect-content
720 Insert a new heading at the end of the current subtree.
722 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
725 #+findex: org-insert-todo-heading
726 #+vindex: org-treat-insert-todo-heading-as-state-change
727 Insert new TODO entry with same level as current heading. See
729 ~org-treat-insert-todo-heading-as-state-change~.
731 - {{{kbd(C-S-RET)}}} (~org-insert-todo-heading-respect-content~) ::
734 #+findex: org-insert-todo-heading-respect-content
735 Insert new TODO entry with same level as current heading. Like
736 {{{kbd(C-RET)}}}, the new headline is inserted after the current
739 - {{{kbd(TAB)}}} (~org-cycle~) ::
743 In a new entry with no text yet, the first {{{kbd(TAB)}}} demotes
744 the entry to become a child of the previous one. The next
745 {{{kbd(TAB)}}} makes it a parent, and so on, all the way to top
746 level. Yet another {{{kbd(TAB)}}}, and you are back to the
749 - {{{kbd(M-left)}}} (~org-do-promote~) ::
752 #+findex: org-do-promote
753 Promote current heading by one level.
755 - {{{kbd(M-right)}}} (~org-do-demote~) ::
758 #+findex: org-do-demote
759 Demote current heading by one level.
761 - {{{kbd(M-S-left)}}} (~org-promote-subtree~) ::
764 #+findex: org-promote-subtree
765 Promote the current subtree by one level.
767 - {{{kbd(M-S-right)}}} (~org-demote-subtree~) ::
770 #+findex: org-demote-subtree
771 Demote the current subtree by one level.
773 - {{{kbd(M-up)}}} (~org-move-subtree-up~) ::
776 #+findex: org-move-subtree-up
777 Move subtree up -- swap with previous subtree of same level.
779 - {{{kbd(M-down)}}} (~org-move-subtree-down~) ::
782 #+findex: org-move-subtree-down
783 Move subtree down -- swap with next subtree of same level.
785 - {{{kbd(C-c @)}}} (~org-mark-subtree~) ::
788 #+findex: org-mark-subtree
789 Mark the subtree at point. Hitting repeatedly marks subsequent
790 subtrees of the same level as the marked subtree.
792 - {{{kbd(C-c C-x C-w)}}} (~org-cut-subtree~) ::
794 #+kindex: C-c C-x C-w
795 #+findex: org-cut-subtree
796 Kill subtree, i.e., remove it from buffer but save in kill ring.
797 With a numeric prefix argument N, kill N sequential subtrees.
799 - {{{kbd(C-c C-x M-w)}}} (~org-copy-subtree~) ::
801 #+kindex: C-c C-x M-w
802 #+findex: org-copy-subtree
803 Copy subtree to kill ring. With a numeric prefix argument N,
804 copy the N sequential subtrees.
806 - {{{kbd(C-c C-x C-y)}}} (~org-paste-subtree~) ::
808 #+kindex: C-c C-x C-y
809 #+findex: org-paste-subtree
810 Yank subtree from kill ring. This does modify the level of the
811 subtree to make sure the tree fits in nicely at the yank
812 position. The yank level can also be specified with a numeric
813 prefix argument, or by yanking after a headline marker like
816 - {{{kbd(C-y)}}} (~org-yank~) ::
820 #+vindex: org-yank-adjusted-subtrees
821 #+vindex: org-yank-folded-subtrees
822 Depending on the variables ~org-yank-adjusted-subtrees~ and
823 ~org-yank-folded-subtrees~, Org's internal ~yank~ command pastes
824 subtrees folded and in a clever way, using the same command as
825 {{{kbd(C-c C-x C-y)}}}. With the default settings, no level
826 adjustment takes place, but the yanked tree is folded unless
827 doing so would swallow text previously visible. Any prefix
828 argument to this command forces a normal ~yank~ to be executed,
829 with the prefix passed along. A good way to force a normal yank
830 is {{{kbd(C-u C-y)}}}. If you use ~yank-pop~ after a yank, it
831 yanks previous kill items plainly, without adjustment and
834 - {{{kbd(C-c C-x c)}}} (~org-clone-subtree-with-time-shift~) ::
837 #+findex: org-clone-subtree-with-time-shift
838 Clone a subtree by making a number of sibling copies of it. You
839 are prompted for the number of copies to make, and you can also
840 specify if any timestamps in the entry should be shifted. This
841 can be useful, for example, to create a number of tasks related
842 to a series of lectures to prepare. For more details, see the
843 docstring of the command ~org-clone-subtree-with-time-shift~.
845 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
849 Refile entry or region to a different location. See [[Refile and
852 - {{{kbd(C-c ^)}}} (~org-sort~) ::
856 Sort same-level entries. When there is an active region, all
857 entries in the region are sorted. Otherwise the children of the
858 current headline are sorted. The command prompts for the sorting
859 method, which can be alphabetically, numerically, by time --
860 first timestamp with active preferred, creation time, scheduled
861 time, deadline time --, by priority, by TODO keyword -- in the
862 sequence the keywords have been defined in the setup -- or by the
863 value of a property. Reverse sorting is possible as well. You
864 can also supply your own function to extract the sorting key.
865 With a {{{kbd(C-u)}}} prefix, sorting is case-sensitive.
867 - {{{kbd(C-x n s)}}} (~org-narrow-to-subtree~) ::
870 #+findex: org-narrow-to-subtree
871 Narrow buffer to current subtree.
873 - {{{kbd(C-x n b)}}} (~org-narrow-to-block~) ::
876 #+findex: org-narrow-to-block
877 Narrow buffer to current block.
879 - {{{kbd(C-x n w)}}} (~widen~) ::
883 Widen buffer to remove narrowing.
885 - {{{kbd(C-c *)}}} (~org-toggle-heading~) ::
888 #+findex: org-toggle-heading
889 Turn a normal line or plain list item into a headline -- so that
890 it becomes a subheading at its location. Also turn a headline
891 into a normal line by removing the stars. If there is an active
892 region, turn all lines in the region into headlines. If the
893 first line in the region was an item, turn only the item lines
894 into headlines. Finally, if the first line is a headline, remove
895 the stars from all headlines in the region.
897 #+cindex: region, active
898 #+cindex: active region
899 #+cindex: transient mark mode
900 When there is an active region -- i.e., when Transient Mark mode is
901 active --, promotion and demotion work on all headlines in the region.
902 To select a region of headlines, it is best to place both point and
903 mark at the beginning of a line, mark at the beginning of the first
904 headline, and point at the line just after the last headline to
905 change. Note that when the cursor is inside a table (see [[*Tables]]),
906 the Meta-Cursor keys have different functionality.
910 :DESCRIPTION: Matches embedded in context.
911 :ALT_TITLE: Sparse trees
913 #+cindex: sparse trees
914 #+cindex: trees, sparse
915 #+cindex: folding, sparse trees
916 #+cindex: occur, command
918 #+vindex: org-show-context-detail
919 An important feature of Org mode is the ability to construct /sparse
920 trees/ for selected information in an outline tree, so that the entire
921 document is folded as much as possible, but the selected information
922 is made visible along with the headline structure above it[fn:7].
923 Just try it out and you will see immediately how it works.
925 Org mode contains several commands creating such trees, all these
926 commands can be accessed through a dispatcher:
928 - {{{kbd(C-c /)}}} (~org-sparse-tree~) ::
931 #+findex: org-sparse-tree
932 This prompts for an extra key to select a sparse-tree creating
935 - {{{kbd(C-c / r)}}} or {{{kbd(C-c / /)}}} (~org-occur~) ::
940 #+vindex: org-remove-highlights-with-change
941 Prompts for a regexp and shows a sparse tree with all matches.
942 If the match is in a headline, the headline is made visible. If
943 the match is in the body of an entry, headline and body are made
944 visible. In order to provide minimal context, also the full
945 hierarchy of headlines above the match is shown, as well as the
946 headline following the match. Each match is also highlighted;
947 the highlights disappear when the buffer is changed by an editing
948 command, or by pressing {{{kbd(C-c C-c)}}}[fn:8]. When called
949 with a {{{kbd(C-u)}}} prefix argument, previous highlights are
950 kept, so several calls to this command can be stacked.
952 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
957 Jump to the next sparse tree match in this buffer.
959 - {{{kbd(M-g p)}}} or {{{kbd(M-g M-p)}}} (~previous-error~) ::
963 #+findex: previous-error
964 Jump to the previous sparse tree match in this buffer.
966 #+vindex: org-agenda-custom-commands
968 For frequently used sparse trees of specific search strings, you can
969 use the variable ~org-agenda-custom-commands~ to define fast keyboard
970 access to specific sparse trees. These commands will then be
971 accessible through the agenda dispatcher (see [[*The agenda dispatcher]]).
974 #+begin_src emacs-lisp
975 (setq org-agenda-custom-commands
976 '(("f" occur-tree "FIXME")))
980 defines the key {{{kbd(C-c a f)}}} as a shortcut for creating a sparse
981 tree matching the string =FIXME=.
983 The other sparse tree commands select headings based on TODO keywords,
984 tags, or properties and are discussed later in this manual.
987 #+cindex: printing sparse trees
988 #+cindex: visible text, printing
989 To print a sparse tree, you can use the Emacs command
990 ~ps-print-buffer-with-faces~ which does not print invisible parts of
991 the document. Or you can use the command {{{kbd(C-c C-e v)}}} to
992 export only the visible part of the document and print the resulting
997 :DESCRIPTION: Additional structure within an entry.
998 :ALT_TITLE: Plain lists
1000 #+cindex: plain lists
1001 #+cindex: lists, plain
1002 #+cindex: lists, ordered
1003 #+cindex: ordered lists
1005 Within an entry of the outline tree, hand-formatted lists can provide
1006 additional structure. They also provide a way to create lists of
1007 checkboxes (see [[*Checkboxes]]). Org supports editing such lists, and
1008 every exporter (see [[*Exporting]]) can parse and format them.
1010 Org knows ordered lists, unordered lists, and description lists.
1012 #+attr_texinfo: :indic @bullet
1013 - /Unordered/ list items start with =-=, =+=, or =*=[fn:9] as bullets.
1016 #+vindex: org-plain-list-ordered-item-terminator
1017 #+vindex: org-alphabetical-lists
1018 /Ordered/ list items start with a numeral followed by either
1019 a period or a right parenthesis[fn:10], such as =1.= or =1)=[fn:11]
1020 If you want a list to start with a different value -- e.g., 20 --
1021 start the text of the item with =[@20]=[fn:12]. Those constructs
1022 can be used in any item of the list in order to enforce a particular
1025 - /Description/ list items are unordered list items, and contain the
1026 separator =::= to distinguish the description /term/ from the
1029 Items belonging to the same list must have the same indentation on the
1030 first line. In particular, if an ordered list reaches number =10.=,
1031 then the 2-digit numbers must be written left-aligned with the other
1032 numbers in the list. An item ends before the next line that is less
1033 or equally indented than its bullet/number.
1035 A list ends whenever every item has ended, which means before any line
1036 less or equally indented than items at top level. It also ends before
1037 two blank lines. In that case, all items are closed. Here is an
1041 ,* Lord of the Rings
1042 My favorite scenes are (in this order)
1043 1. The attack of the Rohirrim
1044 2. Eowyn's fight with the witch king
1045 + this was already my favorite scene in the book
1046 + I really like Miranda Otto.
1047 3. Peter Jackson being shot by Legolas
1049 He makes a really funny face when it happens.
1050 But in the end, no individual scenes matter but the film as a whole.
1051 Important actors in this film are:
1052 - Elijah Wood :: He plays Frodo
1053 - Sean Astin :: He plays Sam, Frodo's friend. I still remember him
1054 very well from his role as Mikey Walsh in /The Goonies/.
1057 Org supports these lists by tuning filling and wrapping commands to
1058 deal with them correctly, and by exporting them properly (see
1059 [[Exporting]]). Since indentation is what governs the structure of these
1060 lists, many structural constructs like =#+BEGIN_= blocks can be
1061 indented to signal that they belong to a particular item.
1063 #+vindex: org-list-demote-modify-bullet
1064 #+vindex: org-list-indent-offset
1065 If you find that using a different bullet for a sub-list -- than that
1066 used for the current list-level -- improves readability, customize the
1067 variable ~org-list-demote-modify-bullet~. To get a greater difference
1068 of indentation between items and theirs sub-items, customize
1069 ~org-list-indent-offset~.
1071 #+vindex: org-list-automatic-rules
1072 The following commands act on items when the cursor is in the first
1073 line of an item -- the line with the bullet or number. Some of them
1074 imply the application of automatic rules to keep list structure
1075 intact. If some of these actions get in your way, configure
1076 ~org-list-automatic-rules~ to disable them individually.
1078 #+attr_texinfo: :sep ,
1079 - {{{kbd(TAB)}}} (~org-cycle~) ::
1081 #+cindex: cycling, in plain lists
1084 #+vindex: org-cycle-include-plain-lists
1085 Items can be folded just like headline levels. Normally this
1086 works only if the cursor is on a plain list item. For more
1087 details, see the variable ~org-cycle-include-plain-lists~. If
1088 this variable is set to ~integrate~, plain list items are
1089 treated like low-level headlines. The level of an item is then
1090 given by the indentation of the bullet/number. Items are
1091 always subordinate to real headlines, however; the hierarchies
1092 remain completely separated. In a new item with no text yet,
1093 the first {{{kbd(TAB)}}} demotes the item to become a child of
1094 the previous one. Subsequent {{{kbd(TAB)}}}s move the item to
1095 meaningful levels in the list and eventually get it back to its
1098 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
1101 #+findex: org-insert-heading
1102 #+vindex: org-M-RET-may-split-line
1103 Insert new item at current level. With a prefix argument,
1104 force a new heading (see [[Structure editing]]). If this command
1105 is used in the middle of an item, that item is /split/ in two,
1106 and the second part becomes the new item[fn:13]. If this
1107 command is executed /before item's body/, the new item is
1108 created /before/ the current one.
1110 - {{{kbd(M-S-RET)}}} ::
1113 Insert a new item with a checkbox (see [[Checkboxes]]).
1115 - {{{kbd(S-up)}}}, {{{kbd(S-down)}}} ::
1119 #+cindex: shift-selection-mode
1120 #+vindex: org-support-shift-select
1121 #+vindex: org-list-use-circular-motion
1122 Jump to the previous/next item in the current list, but only if
1123 ~org-support-shift-select~ is off[fn:14]. If not, you can
1124 still use paragraph jumping commands like {{{kbd(C-up)}}}
1125 and {{{kbd(C-down)}}} to quite similar effect.
1127 - {{{kbd(M-up)}}}, {{{kbd(M-down)}}} ::
1131 Move the item including subitems up/down[fn:15] -- swap with
1132 previous/next item of same indentation. If the list is
1133 ordered, renumbering is automatic.
1135 - {{{kbd(M-left)}}}, {{{kbd(M-right)}}} ::
1139 Decrease/increase the indentation of an item, leaving children
1142 - {{{kbd(M-S-left)}}}, {{{kbd(M-S-right)}}} ::
1146 Decrease/increase the indentation of the item, including
1147 subitems. Initially, the item tree is selected based on
1148 current indentation. When these commands are executed several
1149 times in direct succession, the initially selected region is
1150 used, even if the new indentation would imply a different
1151 hierarchy. To use the new hierarchy, break the command chain
1152 with a cursor motion or so.
1154 As a special case, using this command on the very first item of
1155 a list moves the whole list. This behavior can be disabled by
1156 configuring ~org-list-automatic-rules~. The global indentation
1157 of a list has no influence on the text /after/ the list.
1159 - {{{kbd(C-c C-c)}}} ::
1162 If there is a checkbox (see [[Checkboxes]]) in the item line,
1163 toggle the state of the checkbox. In any case, verify bullets
1164 and indentation consistency in the whole list.
1166 - {{{kbd(C-c -)}}} ::
1169 #+vindex: org-plain-list-ordered-item-terminator
1170 Cycle the entire list level through the different
1171 itemize/enumerate bullets (=-=, =+=, =*=, =1.=, =1)=) or
1172 a subset of them, depending on
1173 ~org-plain-list-ordered-item-terminator~, the type of list, and
1174 its indentation. With a numeric prefix argument N, select the
1175 Nth bullet from this list. If there is an active region when
1176 calling this, selected text is changed into an item. With
1177 a prefix argument, all lines are converted to list items. If
1178 the first line already was a list item, any item marker is
1179 removed from the list. Finally, even without an active region,
1180 a normal line is converted into a list item.
1182 - {{{kbd(C-c *)}}} ::
1185 Turn a plain list item into a headline -- so that it becomes
1186 a subheading at its location. See [[*Structure editing]], for
1187 a detailed explanation.
1189 - {{{kbd(C-c C-*)}}} ::
1192 Turn the whole plain list into a subtree of the current
1193 heading. Checkboxes (see [[*Checkboxes]]) become TODO --
1194 respectively DONE -- keywords when unchecked -- respectively
1197 - {{{kbd(S-left)}}}, {{{kbd(S-right)}}} ::
1199 #+vindex: org-support-shift-select
1202 This command also cycles bullet styles when the cursor in on
1203 the bullet or anywhere in an item line, details depending on
1204 ~org-support-shift-select~.
1206 - {{{kbd(C-c ^)}}} ::
1209 #+cindex: sorting, of plain list
1210 Sort the plain list. Prompt for the sorting method:
1211 numerically, alphabetically, by time, or by custom function.
1215 :DESCRIPTION: Tucking stuff away.
1218 #+cindex: visibility cycling, drawers
1220 Sometimes you want to keep information associated with an entry, but
1221 you normally do not want to see it. For this, Org mode has /drawers/.
1222 They can contain anything but a headline and another drawer. Drawers
1226 ,** This is a headline
1227 Still outside the drawer
1229 This is inside the drawer.
1235 #+findex: org-insert-drawer
1236 You can interactively insert a drawer at point by calling
1237 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}. With an
1238 active region, this command puts the region inside the drawer. With
1239 a prefix argument, this command calls ~org-insert-property-drawer~,
1240 which creates a =PROPERTIES= drawer right below the current headline.
1241 Org mode uses this special drawer for storing properties (see
1242 [[*Properties and columns]]). You cannot use it for anything else.
1244 Completion over drawer keywords is also possible using
1245 {{{kbd(M-TAB)}}}[fn:16].
1247 Visibility cycling (see [[*Visibility cycling]]) on the headline hides and
1248 shows the entry, but keep the drawer collapsed to a single line. In
1249 order to look inside the drawer, you need to move the cursor to the
1250 drawer line and press {{{kbd(TAB)}}} there.
1252 You can also arrange for state change notes (see [[Tracking TODO state
1253 changes]]) and clock times (see [[*Clocking work time]]) to be stored in
1254 a =LOGBOOK= drawer. If you want to store a quick note there, in
1255 a similar way to state changes, use
1257 - {{{kbd(C-c C-z)}}} ::
1260 Add a time-stamped note to the =LOGBOOK= drawer.
1264 :DESCRIPTION: Folding blocks.
1266 #+vindex: org-hide-block-startup
1267 #+cindex: blocks, folding
1269 Org mode uses =#+BEGIN= ... =#+END= blocks for various purposes from
1270 including source code examples (see [[*Literal examples]]) to capturing
1271 time logging information (see [[*Clocking work time]]). These blocks can
1272 be folded and unfolded by pressing {{{kbd(TAB)}}} in the =#+BEGIN=
1273 line. You can also get all blocks folded at startup by configuring
1274 the variable ~org-hide-block-startup~ or on a per-file basis by using
1276 #+cindex: STARTUP, keyword
1278 ,#+STARTUP: hideblocks
1279 ,#+STARTUP: nohideblocks
1282 ** Creating footnotes
1284 :DESCRIPTION: How footnotes are defined in Org's syntax.
1288 Org mode supports the creation of footnotes.
1290 A footnote is started by a footnote marker in square brackets in
1291 column 0, no indentation allowed. It ends at the next footnote
1292 definition, headline, or after two consecutive empty lines. The
1293 footnote reference is simply the marker in square brackets, inside
1294 text. Markers always start with =fn:=. For example:
1297 The Org homepage[fn:1] now looks a lot better than it used to.
1299 [fn:1] The link is: http://orgmode.org
1302 Org mode extends the number-based syntax to /named/ footnotes and
1303 optional inline definition. Here are the valid references:
1307 A named footnote reference, where {{{var(NAME)}}} is a unique
1308 label word, or, for simplicity of automatic creation, a number.
1310 - =[fn:: This is the inline definition of this footnote]= ::
1312 A LaTeX-like anonymous footnote where the definition is given
1313 directly at the reference point.
1315 - =[fn:NAME: a definition]= ::
1317 An inline definition of a footnote, which also specifies a name
1318 for the note. Since Org allows multiple references to the same
1319 note, you can then use =[fn:NAME]= to create additional
1322 #+vindex: org-footnote-auto-label
1323 Footnote labels can be created automatically, or you can create names
1324 yourself. This is handled by the variable ~org-footnote-auto-label~
1325 and its corresponding =STARTUP= keywords. See the docstring of that
1326 variable for details.
1328 #+texinfo: @noindent
1329 The following command handles footnotes:
1331 - {{{kbd(C-c C-x f)}}} :: The footnote action command.
1334 When the cursor is on a footnote reference, jump to the
1335 definition. When it is at a definition, jump to the -- first --
1338 #+vindex: org-footnote-define-inline
1339 #+vindex: org-footnote-section
1340 Otherwise, create a new footnote. Depending on the variable
1341 ~org-footnote-define-inline~[fn:17], the definition is placed
1342 right into the text as part of the reference, or separately into
1343 the location determined by the variable ~org-footnote-section~.
1345 When this command is called with a prefix argument, a menu of
1346 additional options is offered:
1348 #+attr_texinfo: :columns 0.1 0.9
1349 | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence. |
1350 | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes. |
1351 | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action. |
1352 | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence. |
1353 | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. |
1355 #+vindex: org-footnote-auto-adjust
1356 Depending on the variable ~org-footnote-auto-adjust~[fn:18],
1357 renumbering and sorting footnotes can be automatic after each
1358 insertion or deletion.
1360 - {{{kbd(C-c C-c)}}} ::
1363 If the cursor is on a footnote reference, jump to the definition.
1364 If it is at the definition, jump back to the reference. When
1365 called at a footnote location with a prefix argument, offer the
1366 same menu as {{{kbd(C-c C-x f)}}}.
1368 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} ::
1373 Footnote labels are also links to the corresponding definition or
1374 reference, and you can use the usual commands to follow these
1379 :DESCRIPTION: Formal description of Org's syntax.
1382 A reference document providing a formal description of Org's syntax is
1383 available as [[http://orgmode.org/worg/dev/org-syntax.html][a draft on Worg]], written and maintained by Nicolas
1384 Goaziou. It defines Org's core internal concepts such as =headlines=,
1385 =sections=, =affiliated keywords=, =(greater) elements= and =objects=.
1386 Each part of an Org file falls into one of the categories above.
1388 To explore the abstract structure of an Org buffer, run this in
1391 : M-: (org-element-parse-buffer) <RET>
1393 #+texinfo: @noindent
1394 It outputs a list containing the buffer's content represented as an
1395 abstract structure. The export engine relies on the information
1396 stored in this list. Most interactive commands -- e.g., for structure
1397 editing -- also rely on the syntactic meaning of the surrounding
1400 #+cindex: syntax checker
1403 You can check syntax in your documents using ~org-lint~ command.
1407 :DESCRIPTION: Pure magic for quick formatting.
1410 #+cindex: editing tables
1412 Org comes with a fast and intuitive table editor. Spreadsheet-like
1413 calculations are supported using the Emacs Calc package (see
1416 ** Built-in table editor
1418 :DESCRIPTION: Simple tables.
1420 #+cindex: table editor, built-in
1422 Org makes it easy to format tables in plain ASCII. Any line with =|=
1423 as the first non-whitespace character is considered part of a table.
1424 =|= is also the column separator[fn:19]. A table might look like
1428 | Name | Phone | Age |
1429 |-------+-------+-----|
1430 | Peter | 1234 | 17 |
1431 | Anna | 4321 | 25 |
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. Any line starting with =|-= is considered as a horizontal
1440 separator line and will be expanded on the next re-align to span the
1441 whole table width. So, to create the above table, you would only type
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
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 the cursor 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~.
1461 *** Creation and conversion
1466 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
1469 #+findex: org-table-create-or-convert-from-region
1470 Convert the active region to table. If every line contains at
1471 least one {{{kbd(TAB)}}} character, the function assumes that the
1472 material is tab separated. If every line contains a comma,
1473 comma-separated values (CSV) are assumed. If not, lines are
1474 split at whitespace into fields. You can use a prefix argument
1475 to force a specific separator: {{{kbd(C-u)}}} forces CSV,
1476 {{{kbd(C-u C-u)}}} forces {{{kbd(TAB)}}}, {{{kbd(C-u C-u C-u)}}}
1477 prompts for a regular expression to match the separator, and
1478 a numeric argument N indicates that at least N consecutive
1479 spaces, or alternatively a {{{kbd(TAB)}}} will be the separator.
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)}}}.
1485 *** Re-aligning and field motion
1490 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
1493 #+findex: org-table-align
1494 Re-align the table without moving the cursor.
1496 - {{{kbd(TAB)}}} (~org-table-next-field~) ::
1499 #+findex: org-table-next-field
1500 Re-align the table, move to the next field. Creates a new row if
1503 - {{{kbd(C-c SPC)}}} (~org-table-blank-field~) ::
1506 #+findex: org-table-blank-field
1507 Blank the field at point.
1509 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
1512 #+findex: org-table-previous-field
1513 Re-align, move to previous field.
1515 - {{{kbd(RET)}}} (~org-table-next-row~) ::
1518 #+findex: org-table-next-row
1519 Re-align the table and move down to next row. Creates a new row
1520 if necessary. At the beginning or end of a line, {{{kbd(RET)}}}
1521 still inserts a new line, so it can be used to split a table.
1523 - {{{kbd(M-a)}}} (~org-table-beginning-of-field~) ::
1526 #+findex: org-table-beginning-of-field
1527 Move to beginning of the current table field, or on to the
1530 - {{{kbd(M-e)}}} (~org-table-end-of-field~) ::
1533 #+findex: org-table-end-of-field
1534 Move to end of the current table field, or on to the next field.
1536 *** Column and row editing
1541 - {{{kbd(M-left)}}} (~org-table-move-column-left~) ::
1544 #+findex: org-table-move-column-left
1545 Move the current column left.
1547 - {{{kbd(M-right)}}} (~org-table-move-column-right~) ::
1550 #+findex: org-table-move-column-right
1551 Move the current column right.
1553 - {{{kbd(M-S-left)}}} (~org-table-delete-column~) ::
1556 #+findex: org-table-delete-column
1557 Kill the current column.
1559 - {{{kbd(M-S-right)}}} (~org-table-insert-column~) ::
1562 #+findex: org-table-insert-column
1563 Insert a new column to the left of the cursor position.
1565 - {{{kbd(M-up)}}} (~org-table-move-row-up~) ::
1568 #+findex: org-table-move-row-up
1569 Move the current row up.
1571 - {{{kbd(M-down)}}} (~org-table-move-row-down~) ::
1574 #+findex: org-table-move-row-down
1575 Move the current row down.
1577 - {{{kbd(M-S-up)}}} (~org-table-kill-row~) ::
1580 #+findex: org-table-kill-row
1581 Kill the current row or horizontal line.
1583 - {{{kbd(M-S-down)}}} (~org-table-insert-row~) ::
1586 #+findex: org-table-insert-row
1587 Insert a new row above the current row. With a prefix argument,
1588 the line is created below the current one.
1590 - {{{kbd(C-c -)}}} (~org-table-insert-hline~) ::
1593 #+findex: org-table-insert-hline
1594 Insert a horizontal line below current row. With a prefix
1595 argument, the line is created above the current line.
1597 - {{{kbd(C-c RET)}}} (~org-table-hline-and-move~) ::
1600 #+findex: org-table-hline-and-move
1601 Insert a horizontal line below current row, and move the cursor
1602 into the row below that line.
1604 - {{{kbd(C-c ^)}}} (~org-table-sort-lines~) ::
1607 #+findex: org-table-sort-lines
1608 Sort the table lines in the region. The position of point
1609 indicates the column to be used for sorting, and the range of
1610 lines is the range between the nearest horizontal separator
1611 lines, or the entire table. If point is before the first column,
1612 you are prompted for the sorting column. If there is an active
1613 region, the mark specifies the first line and the sorting column,
1614 while point should be in the last line to be included into the
1615 sorting. The command prompts for the sorting type,
1616 alphabetically, numerically, or by time. You can sort in normal
1617 or reverse order. You can also supply your own key extraction
1618 and comparison functions. When called with a prefix argument,
1619 alphabetic sorting is case-sensitive.
1626 - {{{kbd(C-c C-x M-w)}}} (~org-table-copy-region~) ::
1628 #+kindex: C-c C-x M-w
1629 #+findex: org-table-copy-region
1630 Copy a rectangular region from a table to a special clipboard.
1631 Point and mark determine edge fields of the rectangle. If there
1632 is no active region, copy just the current field. The process
1633 ignores horizontal separator lines.
1635 - {{{kbd(C-c C-x C-w)}}} (~org-table-cut-region~) ::
1637 #+kindex: C-c C-x C-w
1638 #+findex: org-table-cut-region
1639 Copy a rectangular region from a table to a special clipboard,
1640 and blank all fields in the rectangle. So this is the "cut"
1643 - {{{kbd(C-c C-x C-y)}}} (~org-table-paste-rectangle~) ::
1645 #+kindex: C-c C-x C-y
1646 #+findex: org-table-paste-rectangle
1647 Paste a rectangular region into a table. The upper left corner
1648 ends up in the current field. All involved fields are
1649 overwritten. If the rectangle does not fit into the present
1650 table, the table is enlarged as needed. The process ignores
1651 horizontal separator lines.
1653 - {{{kbd(M-RET)}}} (~org-table-wrap-region~) ::
1656 #+findex: org-table-wrap-region
1657 Split the current field at the cursor position and move the rest
1658 to the line below. If there is an active region, and both point
1659 and mark are in the same column, the text in the column is
1660 wrapped to minimum width for the given number of lines.
1661 A numeric prefix argument may be used to change the number of
1662 desired lines. If there is no region, but you specify a prefix
1663 argument, the current field is made blank, and the content is
1664 appended to the field above.
1671 #+cindex: formula, in tables
1672 #+cindex: calculations, in tables
1674 - {{{kbd(C-c +)}}} (~org-table-sum~) ::
1677 #+findex: org-table-sum
1678 Sum the numbers in the current column, or in the rectangle
1679 defined by the active region. The result is shown in the echo
1680 area and can be inserted with {{{kbd(C-y)}}}.
1682 - {{{kbd(S-RET)}}} (~org-table-copy-down~) ::
1685 #+findex: org-table-copy-down
1686 #+vindex: org-table-copy-increment
1687 When current field is empty, copy from first non-empty field
1688 above. When not empty, copy current field down to next row and
1689 move cursor along with it. Depending on the variable
1690 ~org-table-copy-increment~, integer field values can be
1691 incremented during copy. Integers that are too large are not
1692 incremented, however. Also, a ~0~ prefix argument temporarily
1693 disables the increment. This key is also used by shift-selection
1694 and related modes (see [[*Packages that conflict with Org mode]]).
1701 - {{{kbd(C-c `)}}} (~org-table-edit-field~) ::
1704 #+findex: org-table-edit-field
1705 Edit the current field in a separate window. This is useful for
1706 fields that are not fully visible (see [[*Column width and
1707 alignment]]). When called with a {{{kbd(C-u)}}} prefix, just make
1708 the full field visible, so that it can be edited in place. When
1709 called with two {{{kbd(C-u)}}} prefixes, make the editor window
1710 follow the cursor through the table and always show the current
1711 field. The follow mode exits automatically when the cursor
1712 leaves the table, or when you repeat this command with {{{kbd(C-u
1715 - {{{kbd(M-x org-table-import)}}} ::
1717 #+findex: org-table-import
1718 Import a file as a table. The table should be TAB or whitespace
1719 separated. Use, for example, to import a spreadsheet table or
1720 data from a database, because these programs generally can write
1721 TAB-separated text files. This command works by inserting the
1722 file into the buffer and then converting the region to a table.
1723 Any prefix argument is passed on to the converter, which uses it
1724 to determine the separator.
1726 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
1729 #+findex: org-table-create-or-convert-from-region
1730 Tables can also be imported by pasting tabular text into the Org
1731 buffer, selecting the pasted text with {{{kbd(C-x C-x)}}} and
1732 then using the {{{kbd(C-c |)}}} command (see [[*Creation and
1735 - {{{kbd(M-x org-table-export)}}} ::
1737 #+findex: org-table-export
1738 #+vindex: org-table-export-default-format
1739 Export the table, by default as a TAB-separated file. Use for
1740 data exchange with, for example, spreadsheet or database
1741 programs. The format used to export the file can be configured
1742 in the variable ~org-table-export-default-format~. You may also
1743 use properties =TABLE_EXPORT_FILE= and =TABLE_EXPORT_FORMAT= to
1744 specify the file name and the format for table export in
1745 a subtree. Org supports quite general formats for exported
1746 tables. The exporter format is the same as the format used by
1747 Orgtbl radio tables, see [[*Translator functions]], for a detailed
1750 ** Column width and alignment
1752 :DESCRIPTION: Overrule the automatic settings.
1754 #+cindex: narrow columns in tables
1755 #+cindex: alignment in tables
1757 The width of columns is automatically determined by the table editor.
1758 The alignment of a column is determined automatically from the
1759 fraction of number-like versus non-number fields in the column.
1761 #+vindex: org-table-automatic-realign
1762 Editing a field may modify alignment of the table. Moving
1763 a contiguous row or column -- i.e., using {{{kbd(TAB)}}} or
1764 {{{kbd(RET)}}} -- automatically re-aligns it. If you want to disable
1765 this behavior, set ~org-table-automatic-realign~ to ~nil~. In any
1766 case, you can always align manually a table:
1768 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
1771 #+findex: org-table-align
1772 Align the current table.
1774 #+texinfo: @noindent
1775 #+vindex: org-startup-align-all-tables
1776 Setting the option ~org-startup-align-all-tables~ re-aligns all tables
1777 in a file upon visiting it. You can also set this option on
1778 a per-file basis with:
1785 Sometimes a single field or a few fields need to carry more text,
1786 leading to inconveniently wide columns. Maybe you want to hide away
1787 several columns or display them with a fixed width, regardless of
1788 content, as shown in the following example.
1791 |---+---------------------+--------| |---+-------…|…|
1792 | | <6> | | | | <6> …|…|
1793 | 1 | one | some | ----\ | 1 | one …|…|
1794 | 2 | two | boring | ----/ | 2 | two …|…|
1795 | 3 | This is a long text | column | | 3 | This i…|…|
1796 |---+---------------------+--------| |---+-------…|…|
1799 To set the width of a column, one field anywhere in the column may
1800 contain just the string =<N>= where {{{var(N)}}} specifies the width
1801 as a number of characters. You control displayed width of columns
1802 with the following tools:
1804 - {{{kbd(C-c TAB)}}} (~org-table-toggle-column-width~) ::
1807 #+findex: org-table-toggle-column-width
1808 Shrink or expand current column.
1810 If a width cookie specifies a width W for the column, shrinking
1811 it displays the first W visible characters only. Otherwise, the
1812 column is shrunk to a single character.
1814 When called before the first column or after the last one, ask
1815 for a list of column ranges to operate on.
1817 - {{{kbd(C-u C-c TAB)}}} (~org-table-shrink~) ::
1819 #+kindex: C-u C-c TAB
1820 #+findex: org-table-shrink
1821 Shrink all columns with a column width. Expand the others.
1823 - {{{kbd(C-u C-u C-c TAB)}}} (~org-table-expand~) ::
1825 #+kindex: C-u C-u C-c TAB
1826 #+findex: org-table-expand
1829 To see the full text of a shrunk field, hold the mouse over it --
1830 a tool-tip window then shows the full content. Alternatively
1831 {{{kbd(C-h .)}}} (~display-local-help~) reveals the full content.
1832 For convenience, any change to a shrunk column expands it.
1834 #+vindex: org-startup-shrink-all-tables
1835 Setting the option ~org-startup-shrink-all-tables~ shrinks all columns
1836 containing a width cookie in a file the moment it is visited. You can
1837 also set this option on a per-file basis with:
1841 If you would like to overrule the automatic alignment of number-rich
1842 columns to the right and of string-rich columns to the left, you can
1843 use =<r>=, =<c>= or =<l>= in a similar fashion. You may also combine
1844 alignment and field width like this: =<r10>=.
1846 Lines which only contain these formatting cookies are removed
1847 automatically upon exporting the document.
1851 :DESCRIPTION: Grouping to trigger vertical lines.
1853 #+cindex: grouping columns in tables
1855 When Org exports tables, it does so by default without vertical lines
1856 because that is visually more satisfying in general. Occasionally
1857 however, vertical lines can be useful to structure a table into groups
1858 of columns, much like horizontal lines can do for groups of rows. In
1859 order to specify column groups, you can use a special row where the
1860 first field contains only =/=. The further fields can either contain
1861 =<= to indicate that this column should start a group, =>= to indicate
1862 the end of a column, or =<>= (no space between =<= and =>=) to make
1863 a column a group of its own. Upon export, boundaries between column
1864 groups are marked with vertical lines. Here is an example:
1867 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1868 |---+-----+-----+-----+---------+------------|
1869 | / | < | | > | < | > |
1870 | 1 | 1 | 1 | 1 | 1 | 1 |
1871 | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1872 | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1873 |---+-----+-----+-----+---------+------------|
1874 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
1877 It is also sufficient to just insert the column group starters after
1878 every vertical line you would like to have:
1881 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1882 |---+-----+-----+-----+---------+------------|
1886 ** The Orgtbl minor mode
1888 :DESCRIPTION: The table editor as minor mode.
1889 :ALT_TITLE: Orgtbl mode
1891 #+cindex: Orgtbl mode
1892 #+cindex: minor mode for tables
1894 #+findex: orgtbl-mode
1895 If you like the intuitive way the Org table editor works, you might
1896 also want to use it in other modes like Text mode or Mail mode. The
1897 minor mode Orgtbl mode makes this possible. You can always toggle the
1898 mode with {{{kbd(M-x orgtbl-mode)}}}. To turn it on by default, for
1899 example in Message mode, use
1901 #+begin_src emacs-lisp
1902 (add-hook 'message-mode-hook 'turn-on-orgtbl)
1905 Furthermore, with some special setup, it is possible to maintain
1906 tables in arbitrary syntax with Orgtbl mode. For example, it is
1907 possible to construct LaTeX tables with the underlying ease and power
1908 of Orgtbl mode, including spreadsheet capabilities. For details, see
1909 [[*Tables in arbitrary syntax]].
1913 :DESCRIPTION: The table editor has spreadsheet capabilities.
1915 #+cindex: calculations, in tables
1916 #+cindex: spreadsheet capabilities
1917 #+cindex: Calc package
1919 The table editor makes use of the Emacs Calc package to implement
1920 spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms
1921 to derive fields from other fields. While fully featured, Org's
1922 implementation is not identical to other spreadsheets. For example,
1923 Org knows the concept of a /column formula/ that will be applied to
1924 all non-header fields in a column without having to copy the formula
1925 to each relevant field. There is also a formula debugger, and
1926 a formula editor with features for highlighting fields in the table
1927 corresponding to the references at the point in the formula, moving
1928 these references by arrow keys.
1932 :DESCRIPTION: How to refer to another field or range.
1934 #+cindex: references
1936 To compute fields in the table from other fields, formulas must
1937 reference other fields or ranges. In Org, fields can be referenced by
1938 name, by absolute coordinates, and by relative coordinates. To find
1939 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in
1940 that field, or press {{{kbd(C-c })}}} to toggle the display of a grid.
1942 **** Field references
1947 #+cindex: field references
1948 #+cindex: references, to fields
1949 Formulas can reference the value of another field in two ways. Like
1950 in any other spreadsheet, you may reference fields with
1951 a letter/number combination like =B3=, meaning the second field in the
1952 third row. However, Org prefers to use another, more general
1953 representation that looks like this:[fn:20]
1957 Column specifications can be absolute like =$1=, =$2=, ..., =$N=, or
1958 relative to the current column, i.e., the column of the field which is
1959 being computed, like =$+1= or =$-2=. =$<= and =$>= are immutable
1960 references to the first and last column, respectively, and you can use
1961 =$>>>= to indicate the third column from the right.
1963 The row specification only counts data lines and ignores horizontal
1964 separator lines, or "hlines". Like with columns, you can use absolute
1965 row numbers =@1=, =@2=, ..., =@N=, and row numbers relative to the
1966 current row like =@+3= or =@-1=. =@<= and =@>= are immutable
1967 references the first and last row in the table, respectively. You may
1968 also specify the row relative to one of the hlines: =@I= refers to the
1969 first hline, =@II= to the second, etc. =@-I= refers to the first such
1970 line above the current line, =@+I= to the first such line below the
1971 current line. You can also write =@III+2= which is the second data
1972 line after the third hline in the table.
1974 =@0= and =$0= refer to the current row and column, respectively, i.e.,
1975 to the row/column for the field being computed. Also, if you omit
1976 either the column or the row part of the reference, the current
1977 row/column is implied.
1979 Org's references with /unsigned/ numbers are fixed references in the
1980 sense that if you use the same reference in the formula for two
1981 different fields, the same field is referenced each time. Org's
1982 references with /signed/ numbers are floating references because the
1983 same reference operator can reference different fields depending on
1984 the field being calculated by the formula.
1986 Here are a few examples:
1988 #+attr_texinfo: :columns 0.2 0.8
1989 | =@2$3= | 2nd row, 3rd column (same as =C2=) |
1990 | =$5= | column 5 in the current row (same as =E&=) |
1991 | =@2= | current column, row 2 |
1992 | =@-1$-3= | field one row up, three columns to the left |
1993 | =@-I$2= | field just under hline above current row, column 2 |
1994 | =@>$5= | field in the last row, in column 5 |
1996 **** Range references
2001 #+cindex: range references
2002 #+cindex: references, to ranges
2003 You may reference a rectangular range of fields by specifying two
2004 field references connected by two dots =..=. If both fields are in
2005 the current row, you may simply use =$2..$7=, but if at least one
2006 field is in a different row, you need to use the general =@ROW$COLUMN=
2007 format at least for the first field, i.e., the reference must start
2008 with =@= in order to be interpreted correctly. Examples:
2010 #+attr_texinfo: :columns 0.2 0.8
2011 | =$1..$3= | first three fields in the current row |
2012 | =$P..$Q= | range, using column names (see [[*Advanced features]]) |
2013 | =$<<<..$>>= | start in third column, continue to the last but one |
2014 | =@2$1..@4$3= | six fields between these two fields (same as =A2..C4=) |
2015 | =@-1$-2..@-1= | 3 fields in the row above, starting from 2 columns on the left |
2016 | =@I..II= | between first and second hline, short for =@I..@II= |
2018 #+texinfo: @noindent
2019 Range references return a vector of values that can be fed into Calc
2020 vector functions. Empty fields in ranges are normally suppressed, so
2021 that the vector contains only the non-empty fields. For other options
2022 with the mode switches =E=, =N= and examples, see [[*Formula syntax for
2025 **** Field coordinates in formulas
2030 #+cindex: field coordinates
2031 #+cindex: coordinates, of field
2032 #+cindex: row, of field coordinates
2033 #+cindex: column, of field coordinates
2034 #+vindex: org-table-current-column
2035 #+vindex: org-table-current-dline
2036 One of the very first actions during evaluation of Calc formulas and
2037 Lisp formulas is to substitute =@#= and =$#= in the formula with the
2038 row or column number of the field where the current result will go to.
2039 The traditional Lisp formula equivalents are ~org-table-current-dline~
2040 and ~org-table-current-column~. Examples:
2042 - =if(@# % 2, $#, string(""))= ::
2044 Insert column number on odd rows, set field to empty on even
2047 - =$2 = '(identity remote(FOO, @@#$1))= ::
2049 Copy text or values of each row of column 1 of the table named
2050 {{{var(FOO)}}} into column 2 of the current table.
2052 - =@3 = 2 * remote(FOO, @@1$$#)= ::
2054 Insert the doubled value of each column of row 1 of the table
2055 named {{{var(FOO)}}} into row 3 of the current table.
2057 #+texinfo: @noindent
2058 For the second and third examples, table {{{var(FOO)}}} must have at
2059 least as many rows or columns as the current table. Note that this is
2060 inefficient[fn:21] for large number of rows.
2062 **** Named references
2066 #+cindex: named references
2067 #+cindex: references, named
2068 #+cindex: name, of column or field
2069 #+cindex: constants, in calculations
2070 #+cindex: CONSTANTS, keyword
2071 #+vindex: org-table-formula-constants
2073 =$name= is interpreted as the name of a column, parameter or constant.
2074 Constants are defined globally through the variable
2075 ~org-table-formula-constants~, and locally -- for the file -- through
2076 a line like this example:
2078 : #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2080 #+texinfo: @noindent
2081 #+vindex: constants-unit-system
2082 #+pindex: constants.el
2083 Also, properties (see [[*Properties and columns]]) can be used as
2084 constants in table formulas: for a property =Xyz= use the name
2085 =$PROP_Xyz=, and the property will be searched in the current outline
2086 entry and in the hierarchy above it. If you have the =constants.el=
2087 package, it will also be used to resolve constants, including natural
2088 constants like =$h= for Planck's constant, and units like =$km= for
2089 kilometers[fn:22]. Column names and parameters can be specified in
2090 special table lines. These are described below, see [[*Advanced
2091 features]]. All names must start with a letter, and further consist of
2092 letters and numbers.
2094 **** Remote references
2099 #+cindex: remote references
2100 #+cindex: references, remote
2101 #+cindex: references, to a different table
2102 #+cindex: name, of column or field
2103 #+cindex: constants, in calculations
2104 #+cindex: NAME, keyword
2105 You may also reference constants, fields and ranges from a different
2106 table, either in the current file or even in a different file. The
2111 #+texinfo: @noindent
2112 where {{{var(NAME)}}} can be the name of a table in the current file
2113 as set by a =#+NAME:= line before the table. It can also be the ID of
2114 an entry, even in a different file, and the reference then refers to
2115 the first table in that entry. {{{var(REF)}}} is an absolute field or
2116 range reference as described above for example =@3$3= or =$somename=,
2117 valid in the referenced table.
2119 #+cindex: table indirection
2120 When {{{var(NAME)}}} has the format =@ROW$COLUMN=, it is substituted
2121 with the name or ID found in this field of the current table. For
2122 example =remote($1, @@>$2)= \Rightarrow =remote(year_2013, @@>$1)=. The format
2123 =B3= is not supported because it can not be distinguished from a plain
2126 *** Formula syntax for Calc
2128 :DESCRIPTION: Using Calc to compute stuff.
2130 #+cindex: formula syntax, Calc
2131 #+cindex: syntax, of formulas
2133 A formula can be any algebraic expression understood by the Emacs
2134 =Calc= package. Note that =calc= has the non-standard convention that
2135 =/= has lower precedence than =*=, so that =a/b*c= is interpreted as
2136 =(a/(b*c))=. Before evaluation by ~calc-eval~ (see [[info:calc#Calling Calc from Your Programs][Calling Calc from
2137 Your Lisp Programs]]), variable substitution takes place according to
2138 the rules described above.
2140 #+cindex: vectors, in table calculations
2141 The range vectors can be directly fed into the Calc vector functions
2142 like ~vmean~ and ~vsum~.
2144 #+cindex: format specifier, in spreadsheet
2145 #+cindex: mode, for Calc
2146 #+vindex: org-calc-default-modes
2147 A formula can contain an optional mode string after a semicolon. This
2148 string consists of flags to influence Calc and other modes during
2149 execution. By default, Org uses the standard Calc modes (precision
2150 12, angular units degrees, fraction and symbolic modes off). The
2151 display format, however, has been changed to ~(float 8)~ to keep
2152 tables compact. The default settings can be configured using the
2153 variable ~org-calc-default-modes~.
2155 - =p20= :: Set the internal Calc calculation precision to 20 digits.
2156 - =n3=, =s3=, =e2=, =f4= :: Normal, scientific, engineering or fixed
2157 format of the result of Calc passed back to Org. Calc formatting
2158 is unlimited in precision as long as the Calc calculation
2159 precision is greater.
2160 - =D=, =R= :: Degree and radian angle modes of Calc.
2161 - =F=, =S= :: Fraction and symbolic modes of Calc.
2162 - =T=, =t=, =U= :: Duration computations in Calc or Lisp, [[*Durations
2164 - =E= :: If and how to consider empty fields. Without =E= empty
2165 fields in range references are suppressed so that the Calc vector
2166 or Lisp list contains only the non-empty fields. With =E= the
2167 empty fields are kept. For empty fields in ranges or empty field
2168 references the value =nan= (not a number) is used in Calc
2169 formulas and the empty string is used for Lisp formulas. Add =N=
2170 to use 0 instead for both formula types. For the value of
2171 a field the mode =N= has higher precedence than =E=.
2172 - =N= :: Interpret all fields as numbers, use 0 for non-numbers. See
2173 the next section to see how this is essential for computations
2174 with Lisp formulas. In Calc formulas it is used only
2175 occasionally because there number strings are already interpreted
2176 as numbers without =N=.
2177 - =L= :: Literal, for Lisp formulas only. See the next section.
2179 #+texinfo: @noindent
2180 Unless you use large integer numbers or high-precision calculation and
2181 display for floating point numbers you may alternatively provide
2182 a ~printf~ format specifier to reformat the Calc result after it has
2183 been passed back to Org instead of letting Calc already do the
2184 formatting[fn:23]. A few examples:
2186 | =$1+$2= | Sum of first and second field |
2187 | =$1+$2;%.2f= | Same, format result to two decimals |
2188 | =exp($2)+exp($1)= | Math functions can be used |
2189 | =$0;%.1f= | Reformat current cell to 1 decimal |
2190 | =($3-32)*5/9= | Degrees F \to C conversion |
2191 | =$c/$1/$cm= | Hz \to cm conversion, using =constants.el= |
2192 | =tan($1);Dp3s1= | Compute in degrees, precision 3, display SCI 1 |
2193 | =sin($1);Dp3%.1e= | Same, but use ~printf~ specifier for display |
2194 | =vmean($2..$7)= | Compute column range mean, using vector function |
2195 | =vmean($2..$7);EN= | Same, but treat empty fields as 0 |
2196 | =taylor($3,x=7,2)= | Taylor series of $3, at x=7, second degree |
2198 Calc also contains a complete set of logical operations (see [[info:calc#Logical%20Operations][Logical
2199 Operations]]). For example
2201 - =if($1 < 20, teen, string(""))= ::
2203 ="teen"= if age =$1= is less than 20, else the Org table result
2204 field is set to empty with the empty string.
2206 - =if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1= ::
2208 Sum of the first two columns. When at least one of the input
2209 fields is empty the Org table result field is set to empty. =E=
2210 is required to not convert empty fields to 0. =f-1= is an
2211 optional Calc format string similar to =%.1f= but leaves empty
2214 - =if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E= ::
2216 Mean value of a range unless there is any empty field. Every
2217 field in the range that is empty is replaced by =nan= which lets
2218 =vmean= result in =nan=. Then =typeof == 12= detects the =nan=
2219 from ~vmean~ and the Org table result field is set to empty. Use
2220 this when the sample set is expected to never have missing
2223 - =if("$1..$7" == "[]", string(""), vmean($1..$7))= ::
2225 Mean value of a range with empty fields skipped. Every field in
2226 the range that is empty is skipped. When all fields in the range
2227 are empty the mean value is not defined and the Org table result
2228 field is set to empty. Use this when the sample set can have
2231 - =vmean($1..$7); EN= ::
2233 To complete the example before: Mean value of a range with empty
2234 fields counting as samples with value 0. Use this only when
2235 incomplete sample sets should be padded with 0 to the full size.
2237 You can add your own Calc functions defined in Emacs Lisp with
2238 ~defmath~ and use them in formula syntax for Calc.
2240 *** Emacs Lisp forms as formulas
2242 :DESCRIPTION: Writing formulas in Emacs Lisp.
2243 :ALT_TITLE: Formula syntax for Lisp
2245 #+cindex: Lisp forms, as table formulas
2247 It is also possible to write a formula in Emacs Lisp. This can be
2248 useful for string manipulation and control structures, if Calc's
2249 functionality is not enough.
2251 If a formula starts with a single-quote followed by an opening
2252 parenthesis, then it is evaluated as a Lisp form. The evaluation
2253 should return either a string or a number. Just as with Calc
2254 formulas, you can specify modes and a ~printf~ format after
2257 With Emacs Lisp forms, you need to be conscious about the way field
2258 references are interpolated into the form. By default, a reference is
2259 interpolated as a Lisp string (in double-quotes) containing the field.
2260 If you provide the =N= mode switch, all referenced elements are
2261 numbers -- non-number fields will be zero -- and interpolated as Lisp
2262 numbers, without quotes. If you provide the =L= flag, all fields are
2263 interpolated literally, without quotes. I.e., if you want a reference
2264 to be interpreted as a string by the Lisp form, enclose the reference
2265 operator itself in double-quotes, like ="$3"=. Ranges are inserted as
2266 space-separated fields, so you can embed them in list or vector
2269 Here are a few examples -- note how the =N= mode is used when we do
2270 computations in Lisp:
2272 - ='(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))= ::
2274 Swap the first two characters of the content of column 1.
2278 Add columns 1 and 2, equivalent to Calc's =$1+$2=.
2280 - ='(apply '+ '($1..$4));N= ::
2282 Compute the sum of columns 1 to 4, like Calc's =vsum($1..$4)=.
2284 *** Durations and time values
2286 :DESCRIPTION: How to compute durations and time values.
2288 #+cindex: Duration, computing
2289 #+cindex: Time, computing
2290 #+vindex: org-table-duration-custom-format
2292 If you want to compute time values use the =T=, =t=, or =U= flag,
2293 either in Calc formulas or Elisp formulas:
2296 | Task 1 | Task 2 | Total |
2297 |---------+----------+----------|
2298 | 2:12 | 1:47 | 03:59:00 |
2299 | 2:12 | 1:47 | 03:59 |
2300 | 3:02:20 | -2:07:00 | 0.92 |
2301 ,#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t
2304 Input duration values must be of the form =HH:MM[:SS]=, where seconds
2305 are optional. With the =T= flag, computed durations are displayed as
2306 =HH:MM:SS= (see the first formula above). With the =U= flag, seconds
2307 are omitted so that the result is only =HH:MM= (see second formula
2308 above). Zero-padding of the hours field depends upon the value of the
2309 variable ~org-table-duration-hour-zero-padding~.
2311 With the =t= flag, computed durations are displayed according to the
2312 value of the option ~org-table-duration-custom-format~, which defaults
2313 to ~hours~ and displays the result as a fraction of hours (see the
2314 third formula in the example above).
2316 Negative duration values can be manipulated as well, and integers are
2317 considered as seconds in addition and subtraction.
2319 *** Field and range formulas
2321 :DESCRIPTION: Formula for specific (ranges of) fields.
2323 #+cindex: field formula
2324 #+cindex: range formula
2325 #+cindex: formula, for individual table field
2326 #+cindex: formula, for range of fields
2328 To assign a formula to a particular field, type it directly into the
2329 field, preceded by =:==, for example =vsum(@II..III)=. When you press
2330 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with the cursor
2331 still in the field, the formula is stored as the formula for this
2332 field, evaluated, and the current field is replaced with the result.
2334 #+cindex: TBLFM, keyword
2335 Formulas are stored in a special =TBLFM= keyword located directly
2336 below the table. If you type the equation in the fourth field of the
2337 third data line in the table, the formula looks like =@3$4=$1+$2=.
2338 When inserting/deleting/swapping column and rows with the appropriate
2339 commands, /absolute references/ (but not relative ones) in stored
2340 formulas are modified in order to still reference the same field. To
2341 avoid this from happening, in particular in range references, anchor
2342 ranges at the table borders (using =@<=, =@>=, =$<=, =$>=), or at
2343 hlines using the =@I= notation. Automatic adaptation of field
2344 references does of course not happen if you edit the table structure
2345 with normal editing commands -- then you must fix the equations
2348 Instead of typing an equation into the field, you may also use the
2351 - {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
2354 #+findex: org-table-eval-formula
2355 Install a new formula for the current field. The command prompts
2356 for a formula with default taken from the =TBLFM= keyword,
2357 applies it to the current field, and stores it.
2359 The left-hand side of a formula can also be a special expression in
2360 order to assign the formula to a number of different fields. There is
2361 no keyboard shortcut to enter such range formulas. To add them, use
2362 the formula editor (see [[*Editing and debugging formulas]]) or edit the
2363 =TBLFM= keyword directly.
2365 - =$2== :: Column formula, valid for the entire column. This is so
2366 common that Org treats these formulas in a special way, see
2367 [[*Column formulas]].
2368 - ~@3=~ :: Row formula, applies to all fields in the specified row.
2369 =@>== means the last row.
2370 - =@1$2..@4$3== :: Range formula, applies to all fields in the given
2371 rectangular range. This can also be used to assign a formula to
2372 some but not all fields in a row.
2373 - =$NAME== :: Named field, see [[*Advanced features]].
2377 :DESCRIPTION: Formulas valid for an entire column.
2379 #+cindex: column formula
2380 #+cindex: formula, for table column
2382 When you assign a formula to a simple column reference like =$3==, the
2383 same formula is used in all fields of that column, with the following
2384 very convenient exceptions: (i) If the table contains horizontal
2385 separator hlines with rows above and below, everything before the
2386 first such hline is considered part of the table /header/ and is not
2387 modified by column formulas. Therefore a header is mandatory when you
2388 use column formulas and want to add hlines to group rows, like for
2389 example to separate a total row at the bottom from the summand rows
2390 above. (ii) Fields that already get a value from a field/range
2391 formula are left alone by column formulas. These conditions make
2392 column formulas very easy to use.
2394 To assign a formula to a column, type it directly into any field in
2395 the column, preceded by an equal sign, like ==$1+$2=. When you press
2396 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with the cursor
2397 still in the field, the formula is stored as the formula for the
2398 current column, evaluated and the current field replaced with the
2399 result. If the field contains only ===, the previously stored formula
2400 for this column is used. For each column, Org only remembers the most
2401 recently used formula. In the =TBLFM= keyword, column formulas look
2402 like =$4=$1+$2=. The left-hand side of a column formula can not be
2403 the name of column, it must be the numeric column reference or =$>=.
2405 Instead of typing an equation into the field, you may also use the
2408 - {{{kbd(C-c =)}}} (~org-table-eval-formula~) ::
2411 #+findex: org-table-eval-formula
2412 Install a new formula for the current column and replace current
2413 field with the result of the formula. The command prompts for
2414 a formula, with default taken from the =TBLFM= keyword, applies
2415 it to the current field and stores it. With a numeric prefix
2416 argument, e.g., {{{kbd(C-5 C-c =)}}}, the command applies it to
2417 that many consecutive fields in the current column.
2419 *** Lookup functions
2421 :DESCRIPTION: Lookup functions for searching tables.
2423 #+cindex: lookup functions in tables
2424 #+cindex: table lookup functions
2426 Org has three predefined Emacs Lisp functions for lookups in tables.
2428 - ~(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)~ ::
2430 #+findex: org-lookup-first
2431 Searches for the first element {{{var(S)}}} in list
2432 {{{var(S-LIST)}}} for which
2433 #+begin_src emacs-lisp
2436 is non-~nil~; returns the value from the corresponding position
2437 in list {{{var(R-LIST)}}}. The default {{{var(PREDICATE)}}} is
2438 ~equal~. Note that the parameters {{{var(VAL)}}} and
2439 {{{var(S)}}} are passed to {{{var(PREDICATE)}}} in the same order
2440 as the corresponding parameters are in the call to
2441 ~org-lookup-first~, where {{{var(VAL)}}} precedes
2442 {{{var(S-LIST)}}}. If {{{var(R-LIST)}}} is ~nil~, the matching
2443 element {{{var(S)}}} of {{{var(S-LIST)}}} is returned.
2445 - ~(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)~ ::
2447 #+findex: org-lookup-last
2448 Similar to ~org-lookup-first~ above, but searches for the /last/
2449 element for which {{{var(PREDICATE)}}} is non-~nil~.
2451 - ~(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)~ ::
2453 #+findex: org-lookup-all
2454 Similar to ~org-lookup-first~, but searches for /all/ elements
2455 for which {{{var(PREDICATE)}}} is non-~nil~, and returns /all/
2456 corresponding values. This function can not be used by itself in
2457 a formula, because it returns a list of values. However,
2458 powerful lookups can be built when this function is combined with
2459 other Emacs Lisp functions.
2461 If the ranges used in these functions contain empty fields, the =E=
2462 mode for the formula should usually be specified: otherwise empty
2463 fields are not included in {{{var(S-LIST)}}} and/or {{{var(R-LIST)}}}
2464 which can, for example, result in an incorrect mapping from an element
2465 of {{{var(S-LIST)}}} to the corresponding element of
2468 These three functions can be used to implement associative arrays,
2469 count matching cells, rank results, group data, etc. For practical
2470 examples see [[http://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]].
2472 *** Editing and debugging formulas
2474 :DESCRIPTION: Fixing formulas.
2476 #+cindex: formula editing
2477 #+cindex: editing, of table formulas
2479 #+vindex: org-table-use-standard-references
2480 You can edit individual formulas in the minibuffer or directly in the
2481 field. Org can also prepare a special buffer with all active formulas
2482 of a table. When offering a formula for editing, Org converts
2483 references to the standard format (like =B3= or =D&=) if possible. If
2484 you prefer to only work with the internal format (like =@3$2= or
2485 =$4=), configure the variable ~org-table-use-standard-references~.
2487 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
2491 #+findex: org-table-eval-formula
2492 Edit the formula associated with the current column/field in the
2493 minibuffer. See [[*Column formulas]], and [[*Field and range formulas]].
2495 - {{{kbd(C-u C-u C-c =)}}} (~org-table-eval-formula~) ::
2497 #+kindex: C-u C-u C-c =
2498 #+findex: org-table-eval-formula
2499 Re-insert the active formula (either a field formula, or a column
2500 formula) into the current field, so that you can edit it directly
2501 in the field. The advantage over editing in the minibuffer is
2502 that you can use the command {{{kbd(C-c ?)}}}.
2504 - {{{kbd(C-c ?)}}} (~org-table-field-info~) ::
2507 #+findex: org-table-field-info
2508 While editing a formula in a table field, highlight the field(s)
2509 referenced by the reference at the cursor position in the
2512 - {{{kbd(C-c })}}} (~org-table-toggle-coordinate-overlays~) ::
2515 #+findex: org-table-toggle-coordinate-overlays
2516 Toggle the display of row and column numbers for a table, using
2517 overlays. These are updated each time the table is aligned; you
2518 can force it with {{{kbd(C-c C-c)}}}.
2520 - {{{kbd(C-c {)}}} (~org-table-toggle-formula-debugger~) ::
2523 #+findex: org-table-toggle-formula-debugger
2524 Toggle the formula debugger on and off. See below.
2526 - {{{kbd(C-c ')}}} (~org-table-edit-formulas~) ::
2529 #+findex: org-table-edit-formulas
2530 Edit all formulas for the current table in a special buffer,
2531 where the formulas are displayed one per line. If the current
2532 field has an active formula, the cursor in the formula editor
2533 marks it. While inside the special buffer, Org automatically
2534 highlights any field or range reference at the cursor position.
2535 You may edit, remove and add formulas, and use the following
2538 - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}} (~org-table-fedit-finish~) ::
2542 #+findex: org-table-fedit-finish
2543 Exit the formula editor and store the modified formulas. With
2544 {{{kbd(C-u)}}} prefix, also apply the new formulas to the
2547 - {{{kbd(C-c C-q)}}} (~org-table-fedit-abort~) ::
2550 #+findex: org-table-fedit-abort
2551 Exit the formula editor without installing changes.
2553 - {{{kbd(C-c C-r)}}} (~org-table-fedit-toggle-ref-type~) ::
2556 #+findex: org-table-fedit-toggle-ref-type
2557 Toggle all references in the formula editor between standard
2558 (like =B3=) and internal (like =@3$2=).
2560 - {{{kbd(TAB)}}} (~org-table-fedit-lisp-indent~) ::
2563 #+findex: org-table-fedit-lisp-indent
2564 Pretty-print or indent Lisp formula at point. When in a line
2565 containing a Lisp formula, format the formula according to
2566 Emacs Lisp rules. Another {{{kbd(TAB)}}} collapses the formula
2567 back again. In the open formula, {{{kbd(TAB)}}} re-indents
2568 just like in Emacs Lisp mode.
2570 - {{{kbd(M-TAB)}}} (~lisp-complete-symbol~) ::
2573 #+findex: lisp-complete-symbol
2574 Complete Lisp symbols, just like in Emacs Lisp mode.
2576 - {{{kbd(S-up)}}}, {{{kbd(S-down)}}}, {{{kbd(S-left)}}}, {{{kbd(S-right)}}} ::
2582 #+findex: org-table-fedit-ref-up
2583 #+findex: org-table-fedit-ref-down
2584 #+findex: org-table-fedit-ref-left
2585 #+findex: org-table-fedit-ref-right
2586 Shift the reference at point. For example, if the reference
2587 is =B3= and you press {{{kbd(S-right)}}}, it becomes =C3=.
2588 This also works for relative references and for hline
2591 - {{{kbd(M-S-up)}}} (~org-table-fedit-line-up~) ::
2594 #+findex: org-table-fedit-line-up
2595 Move the test line for column formulas up in the Org buffer.
2597 - {{{kbd(M-S-down)}}} (~org-table-fedit-line-down~) ::
2600 #+findex: org-table-fedit-line-down
2601 Move the test line for column formulas down in the Org buffer.
2603 - {{{kbd(M-up)}}} (~org-table-fedit-scroll-up~) ::
2606 #+findex: org-table-fedit-scroll-up
2607 Scroll up the window displaying the table.
2609 - {{{kbd(M-down)}}} (~org-table-fedit-scroll-down~) ::
2612 #+findex: org-table-fedit-scroll-down
2613 Scroll down the window displaying the table.
2615 - {{{kbd(C-c })}}} ::
2618 #+findex: org-table-toggle-coordinate-overlays
2619 Turn the coordinate grid in the table on and off.
2621 Making a table field blank does not remove the formula associated with
2622 the field, because that is stored in a different line -- the =TBLFM=
2623 keyword line. During the next recalculation, the field will be filled
2624 again. To remove a formula from a field, you have to give an empty
2625 reply when prompted for the formula, or to edit the =TBLFM= keyword.
2628 You may edit the =TBLFM= keyword directly and re-apply the changed
2629 equations with {{{kbd(C-c C-c)}}} in that line or with the normal
2630 recalculation commands in the table.
2632 **** Using multiple =TBLFM= lines
2636 #+cindex: multiple formula lines
2637 #+cindex: TBLFM keywords, multiple
2638 #+cindex: TBLFM, switching
2641 You may apply the formula temporarily. This is useful when you switch
2642 the formula. Place multiple =TBLFM= keywords right after the table,
2643 and then press {{{kbd(C-c C-c)}}} on the formula to apply. Here is an
2655 #+texinfo: @noindent
2656 Pressing {{{kbd(C-c C-c)}}} in the line of =#+TBLFM: $2=$1*2= yields:
2667 #+texinfo: @noindent
2668 Note: If you recalculate this table, with {{{kbd(C-u C-c *)}}}, for
2669 example, you get the following result of applying only the first
2681 **** Debugging formulas
2685 #+cindex: formula debugging
2686 #+cindex: debugging, of table formulas
2688 When the evaluation of a formula leads to an error, the field content
2689 becomes the string =#ERROR=. If you would like to see what is going
2690 on during variable substitution and calculation in order to find
2691 a bug, turn on formula debugging in the Tbl menu and repeat the
2692 calculation, for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in
2693 a field. Detailed information are displayed.
2695 *** Updating the table
2697 :DESCRIPTION: Recomputing all dependent fields.
2699 #+cindex: recomputing table fields
2700 #+cindex: updating, table
2702 Recalculation of a table is normally not automatic, but needs to be
2703 triggered by a command. To make recalculation at least
2704 semi-automatic, see [[*Advanced features]].
2706 In order to recalculate a line of a table or the entire table, use the
2709 - {{{kbd(C-c *)}}} (~org-table-recalculate~) ::
2712 #+findex: org-table-recalculate
2713 Recalculate the current row by first applying the stored column
2714 formulas from left to right, and all field/range formulas in the
2717 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} ::
2720 #+kindex: C-u C-c C-c
2721 Recompute the entire table, line by line. Any lines before the
2722 first hline are left alone, assuming that these are part of the
2725 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}} (~org-table-iterate~) ::
2727 #+kindex: C-u C-u C-c *
2728 #+kindex: C-u C-u C-c C-c
2729 #+findex: org-table-iterate
2730 Iterate the table by recomputing it until no further changes
2731 occur. This may be necessary if some computed fields use the
2732 value of other fields that are computed /later/ in the
2733 calculation sequence.
2735 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} ::
2737 #+findex: org-table-recalculate-buffer-tables
2738 Recompute all tables in the current buffer.
2740 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} ::
2742 #+findex: org-table-iterate-buffer-tables
2743 Iterate all tables in the current buffer, in order to converge
2744 table-to-table dependencies.
2746 *** Advanced features
2748 :DESCRIPTION: Field and column names, automatic recalculation...
2751 If you want the recalculation of fields to happen automatically, or if
2752 you want to be able to assign /names/[fn:24] to fields and columns,
2753 you need to reserve the first column of the table for special marking
2756 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
2759 #+findex: org-table-rotate-recalc-marks
2760 Rotate the calculation mark in first column through the states
2761 =#=, =*=, =!=, =$=. When there is an active region, change all
2762 marks in the region.
2764 Here is an example of a table that collects exam results of students
2765 and makes use of these features:
2768 |---+---------+--------+--------+--------+-------+------|
2769 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2770 |---+---------+--------+--------+--------+-------+------|
2771 | ! | | P1 | P2 | P3 | Tot | |
2772 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2773 | ^ | | m1 | m2 | m3 | mt | |
2774 |---+---------+--------+--------+--------+-------+------|
2775 | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2776 | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2777 |---+---------+--------+--------+--------+-------+------|
2778 | | Average | | | | 25.0 | |
2779 | ^ | | | | | at | |
2780 | $ | max=50 | | | | | |
2781 |---+---------+--------+--------+--------+-------+------|
2782 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f
2785 #+texinfo: @noindent
2786 *Important*: please note that for these special tables, recalculating
2787 the table with {{{kbd(C-u C-c *)}}} only affects rows that are marked
2788 =#= or =*=, and fields that have a formula assigned to the field
2789 itself. The column formulas are not applied in rows with empty first
2792 #+cindex: marking characters, tables
2793 The marking characters have the following meaning:
2795 - =!= :: The fields in this line define names for the columns, so that
2796 you may refer to a column as =$Tot= instead of =$6=.
2798 - =^= :: This row defines names for the fields /above/ the row. With
2799 such a definition, any formula in the table may use =$m1= to
2800 refer to the value =10=. Also, if you assign a formula to
2801 a names field, it is stored as =$name = ...=.
2803 - =_= :: Similar to =^=, but defines names for the fields in the row
2806 - =$= :: Fields in this row can define /parameters/ for formulas. For
2807 example, if a field in a =$= row contains =max=50=, then formulas
2808 in this table can refer to the value 50 using =$max=. Parameters
2809 work exactly like constants, only that they can be defined on
2812 - =#= :: Fields in this row are automatically recalculated when
2813 pressing {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(S-TAB)}}} in
2814 this row. Also, this row is selected for a global recalculation
2815 with {{{kbd(C-u C-c *)}}}. Unmarked lines are left alone by this
2818 - =*= :: Selects this line for global recalculation with {{{kbd(C-u
2819 C-c *)}}}, but not for automatic recalculation. Use this when
2820 automatic recalculation slows down editing too much.
2822 - =/= :: Do not export this line. Useful for lines that contain the
2823 narrowing =<N>= markers or column group markers.
2825 Finally, just to whet your appetite for what can be done with the
2826 fantastic Calc package, here is a table that computes the Taylor
2827 series of degree n at location x for a couple of functions.
2830 |---+-------------+---+-----+--------------------------------------|
2831 | | Func | n | x | Result |
2832 |---+-------------+---+-----+--------------------------------------|
2833 | # | exp(x) | 1 | x | 1 + x |
2834 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2835 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2836 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2837 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2838 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2839 |---+-------------+---+-----+--------------------------------------|
2840 ,#+TBLFM: $5=taylor($2,$4,$3);n3
2845 :DESCRIPTION: Plotting from Org tables.
2847 #+cindex: graph, in tables
2848 #+cindex: plot tables using Gnuplot
2850 Org Plot can produce graphs of information stored in Org tables,
2851 either graphically or in ASCII art.
2853 *** Graphical plots using Gnuplot
2858 #+cindex: PLOT, keyword
2859 Org Plot can produce 2D and 3D graphs of information stored in Org
2860 tables using [[http://www.gnuplot.info/][Gnuplot]] and [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][Gnuplot mode]]. To see this in action, ensure
2861 that you have both Gnuplot and Gnuplot mode installed on your system,
2862 then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the
2866 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
2867 | Sede | Max cites | H-index |
2868 |-----------+-----------+---------|
2869 | Chile | 257.72 | 21.39 |
2870 | Leeds | 165.77 | 19.68 |
2871 | Sao Paolo | 71.00 | 11.50 |
2872 | Stockholm | 134.19 | 14.33 |
2873 | Morels | 257.56 | 17.67 |
2876 Notice that Org Plot is smart enough to apply the table's headers as
2877 labels. Further control over the labels, type, content, and
2878 appearance of plots can be exercised through the =PLOT= keyword
2879 preceding a table. See below for a complete list of Org Plot options.
2880 For more information and examples see the [[http://orgmode.org/worg/org-tutorials/org-plot.html][Org Plot tutorial]].
2887 - =set= :: Specify any Gnuplot option to be set when graphing.
2889 - =title= :: Specify the title of the plot.
2891 - =ind= :: Specify which column of the table to use as the =x= axis.
2893 - =deps= :: Specify the columns to graph as a Lisp style list,
2894 surrounded by parentheses and separated by spaces for example
2895 =dep:(3 4)= to graph the third and fourth columns (defaults to
2896 graphing all other columns aside from the =ind= column).
2898 - =type= :: Specify whether the plot is =2d=, =3d=, or =grid=.
2900 - =with= :: Specify a =with= option to be inserted for every col being
2901 plotted (e.g., =lines=, =points=, =boxes=, =impulses=, etc.).
2902 Defaults to =lines=.
2904 - =file= :: If you want to plot to a file, specify
2905 ="path/to/desired/output-file"=.
2907 - =labels= :: List of labels to be used for the =deps=. Defaults to
2908 the column headers if they exist.
2910 - =line= :: Specify an entire line to be inserted in the Gnuplot
2913 - =map= :: When plotting =3d= or =grid= types, set this to =t= to
2914 graph a flat mapping rather than a =3d= slope.
2916 - =timefmt= :: Specify format of Org mode timestamps as they will be
2917 parsed by Gnuplot. Defaults to =%Y-%m-%d-%H:%M:%S=.
2919 - =script= :: If you want total control, you can specify a script
2920 file -- place the file name between double-quotes --, which will
2921 be used to plot. Before plotting, every instance of =$datafile=
2922 in the specified script will be replaced with the path to the
2923 generated data file. Note: even if you set this option, you may
2924 still want to specify the plot type, as that can impact the
2925 content of the data file.
2932 While the cursor is on a column, typing {{{kbd(C-c " a)}}} or
2933 {{{kbd(M-x orgtbl-ascii-plot)}}} create a new column containing an
2934 ASCII-art bars plot. The plot is implemented through a regular column
2935 formula. When the source column changes, the bar plot may be updated
2936 by refreshing the table, for example typing {{{kbd(C-u C-c *)}}}.
2939 | Sede | Max cites | |
2940 |---------------+-----------+--------------|
2941 | Chile | 257.72 | WWWWWWWWWWWW |
2942 | Leeds | 165.77 | WWWWWWWh |
2943 | Sao Paolo | 71.00 | WWW; |
2944 | Stockholm | 134.19 | WWWWWW: |
2945 | Morelia | 257.56 | WWWWWWWWWWWH |
2946 | Rochefourchat | 0.00 | |
2947 ,#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
2950 The formula is an Elisp call.
2952 #+attr_texinfo: :options orgtbl-ascii-draw value min max &optional width
2954 Draw an ASCII bar in a table.
2956 {{{var(VALUE)}}} is the value to plot.
2958 {{{var(MIN)}}} is the value displayed as an empty bar. {{{var(MAX)}}}
2959 is the value filling all the {{{var(WIDTH)}}}. Sources values outside
2960 this range are displayed as =too small= or =too large=.
2962 {{{var(WIDTH)}}} is the number of characters of the bar plot. It
2968 :DESCRIPTION: Notes in context.
2970 #+cindex: hyperlinks
2972 Like HTML, Org provides links inside a file, external links to
2973 other files, Usenet articles, emails, and much more.
2977 :DESCRIPTION: How links in Org are formatted.
2979 #+cindex: link format
2980 #+cindex: format, of links
2982 Org recognizes plain URL-like links and activate them as clickable
2983 links. The general link format, however, looks like this:
2985 : [[LINK][DESCRIPTION]]
2987 #+texinfo: @noindent
2992 #+texinfo: @noindent
2993 Once a link in the buffer is complete (all brackets present), Org
2994 changes the display so that =DESCRIPTION= is displayed instead of
2995 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=. Links are be
2996 highlighted in the face ~org-link~, which by default is an underlined
2997 face. You can directly edit the visible part of a link. Note that
2998 this can be either the LINK part, if there is no description, or the
2999 {{{var(DESCRIPTION)}}} part. To edit also the invisible
3000 {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}} with the cursor on the
3003 If you place the cursor at the beginning or just behind the end of the
3004 displayed text and press {{{kbd(BS)}}}, you remove the -- invisible --
3005 bracket at that location. This makes the link incomplete and the
3006 internals are again displayed as plain text. Inserting the missing
3007 bracket hides the link internals again. To show the internal
3008 structure of all links, use the menu: Org \rarr Hyperlinks \rarr Literal
3013 :DESCRIPTION: Links to other places in the current file.
3015 #+cindex: internal links
3016 #+cindex: links, internal
3017 #+cindex: targets, for links
3019 #+cindex: CUSTOM_ID, property
3020 If the link does not look like a URL, it is considered to be internal
3021 in the current file. The most important case is a link like
3022 =[[#my-custom-id]]= which links to the entry with the =CUSTOM_ID= property
3023 =my-custom-id=. You are responsible yourself to make sure these
3024 custom IDs are unique in a file.
3026 Links such as =[[My Target]]= or =[[My Target][Find my target]]= lead to a text search in
3029 The link can be followed with {{{kbd(C-c C-o)}}} when the cursor is on
3030 the link, or with a mouse click (see [[*Handling links]]). Links to
3031 custom IDs point to the corresponding headline. The preferred match
3032 for a text link is a /dedicated target/: the same string in double
3033 angular brackets, like =<<My Target>>=.
3035 #+cindex: NAME, keyword
3036 If no dedicated target exists, the link tries to match the exact name
3037 of an element within the buffer. Naming is done with the =NAME=
3038 keyword, which has to be put in the line before the element it refers
3039 to, as in the following example
3048 If none of the above succeeds, Org searches for a headline that is
3049 exactly the link text but may also include a TODO keyword and
3052 During export, internal links are used to mark objects and assign them
3053 a number. Marked objects are then referenced by links pointing to
3054 them. In particular, links without a description appear as the number
3055 assigned to the marked object[fn:26]. In the following excerpt from
3060 2. <<target>>another item
3061 Here we refer to item [[target]].
3064 #+texinfo: @noindent
3065 The last sentence will appear as =Here we refer to item 2= when
3068 In non-Org files, the search looks for the words in the link text. In
3069 the above example the search would be for =target=.
3071 Following a link pushes a mark onto Org's own mark ring. You can
3072 return to the previous position with {{{kbd(C-c &)}}}. Using this
3073 command several times in direct succession goes back to positions
3078 :DESCRIPTION: Make targets trigger links in plain text.
3080 #+cindex: radio targets
3081 #+cindex: targets, radio
3082 #+cindex: links, radio targets
3084 Org can automatically turn any occurrences of certain target names in
3085 normal text into a link. So without explicitly creating a link, the
3086 text connects to the target radioing its position. Radio targets are
3087 enclosed by triple angular brackets. For example, a target =<<<My
3088 Target>>>= causes each occurrence of =my target= in normal text to
3089 become activated as a link. The Org file is scanned automatically for
3090 radio targets only when the file is first loaded into Emacs. To
3091 update the target list during editing, press {{{kbd(C-c C-c)}}} with
3092 the cursor on or at a target.
3096 :DESCRIPTION: URL-like links to the world.
3098 #+cindex: links, external
3099 #+cindex: external links
3100 #+cindex: Gnus links
3101 #+cindex: BBDB links
3104 #+cindex: file links
3105 #+cindex: Rmail links
3106 #+cindex: MH-E links
3107 #+cindex: Usenet links
3108 #+cindex: shell links
3109 #+cindex: Info links
3110 #+cindex: Elisp links
3112 Org supports links to files, websites, Usenet and email messages, BBDB
3113 database entries and links to both IRC conversations and their logs.
3114 External links are URL-like locators. They start with a short
3115 identifying string followed by a colon. There can be no space after
3116 the colon. The following list shows examples for each link type.
3118 | =http://www.astro.uva.nl/=dominik= | on the web |
3119 | =doi:10.1000/182= | DOI for an electronic resource |
3120 | =file:/home/dominik/images/jupiter.jpg= | file, absolute path |
3121 | =/home/dominik/images/jupiter.jpg= | same as above |
3122 | =file:papers/last.pdf= | file, relative path |
3123 | =./papers/last.pdf= | same as above |
3124 | =file:/ssh:me@some.where:papers/last.pdf= | file, path on remote machine |
3125 | =/ssh:me@some.where:papers/last.pdf= | same as above |
3126 | =file:sometextfile::NNN= | file, jump to line number |
3127 | =file:projects.org= | another Org file |
3128 | =file:projects.org::some words= | text search in Org file[fn:27] |
3129 | =file:projects.org::*task title= | heading search in Org file |
3130 | =file+sys:/path/to/file= | open via OS, like double-click |
3131 | =file+emacs:/path/to/file= | force opening by Emacs |
3132 | =docview:papers/last.pdf::NNN= | open in doc-view mode at page |
3133 | =id:B7423F4D-2E8A-471B-8810-C40F074717E9= | Link to heading by ID |
3134 | =news:comp.emacs= | Usenet link |
3135 | =mailto:adent@galaxy.net= | Mail link |
3136 | =mhe:folder= | MH-E folder link |
3137 | =mhe:folder#id= | MH-E message link |
3138 | =rmail:folder= | Rmail folder link |
3139 | =rmail:folder#id= | Rmail message link |
3140 | =gnus:group= | Gnus group link |
3141 | =gnus:group#id= | Gnus article link |
3142 | =bbdb:R.*Stallman= | BBDB link (with regexp) |
3143 | =irc:/irc.com/#emacs/bob= | IRC link |
3144 | =info:org#External links= | Info node link |
3145 | =shell:ls *.org= | A shell command |
3146 | =elisp:org-agenda= | Interactive Elisp command |
3147 | =elisp:(find-file-other-frame "Elisp.org")= | Elisp form to evaluate |
3150 #+cindex: Wanderlust links
3151 On top of these built-in link types, some are available through the
3152 =contrib/= directory (see [[*Installation]]). For example, these links to
3153 VM or Wanderlust messages are available when you load the
3154 corresponding libraries from the =contrib/= directory:
3156 | =vm:folder= | VM folder link |
3157 | =vm:folder#id= | VM message link |
3158 | =vm://myself@some.where.org/folder#id= | VM on remote machine |
3159 | =vm-imap:account:folder= | VM IMAP folder link |
3160 | =vm-imap:account:folder#id= | VM IMAP message link |
3161 | =wl:folder= | Wanderlust folder link |
3162 | =wl:folder#id= | Wanderlust message link |
3164 For customizing Org to add new link types, see [[*Adding hyperlink
3167 A link should be enclosed in double brackets and may contain
3168 a descriptive text to be displayed instead of the URL (see [[*Link
3169 format]]), for example:
3171 : [[http://www.gnu.org/software/emacs/][GNU Emacs]]
3173 #+texinfo: @noindent
3174 If the description is a file name or URL that points to an image, HTML
3175 export (see [[*HTML export]]) inlines the image as a clickable button. If
3176 there is no description at all and the link points to an image, that
3177 image is inlined into the exported HTML file.
3179 #+cindex: square brackets, around links
3180 #+cindex: angular brackets, around links
3181 #+cindex: plain text external links
3182 Org also finds external links in the normal text and activates them as
3183 links. If spaces must be part of the link (for example in
3184 =bbdb:Richard Stallman=), or if you need to remove ambiguities about
3185 the end of the link, enclose them in square or angular brackets.
3189 :DESCRIPTION: Creating, inserting and following.
3191 #+cindex: links, handling
3193 Org provides methods to create a link in the correct syntax, to insert
3194 it into an Org file, and to follow the link.
3196 #+attr_texinfo: :sep ,
3197 - {{{kbd(C-c l)}}} (~org-store-link~) ::
3200 #+findex: org-store-link
3201 #+cindex: storing links
3202 Store a link to the current location. This is a /global/
3203 command -- you must create the key binding yourself -- which can
3204 be used in any buffer to create a link. The link is stored for
3205 later insertion into an Org buffer -- see below. What kind of
3206 link is created depends on the current buffer:
3208 - /Org mode buffers/ ::
3210 For Org files, if there is a =<<target>>= at the cursor, the
3211 link points to the target. Otherwise it points to the
3212 current headline, which is also the description[fn:28].
3214 #+vindex: org-link-to-org-use-id
3215 #+cindex: CUSTOM_ID, property
3216 #+cindex: ID, property
3217 If the headline has a =CUSTOM_ID= property, store a link to
3218 this custom ID. In addition or alternatively, depending on
3219 the value of ~org-link-to-org-use-id~, create and/or use
3220 a globally unique ID property for the link[fn:29]. So using
3221 this command in Org buffers potentially creates two links:
3222 a human-readable link from the custom ID, and one that is
3223 globally unique and works even if the entry is moved from
3224 file to file. Later, when inserting the link, you need to
3225 decide which one to use.
3227 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
3229 Pretty much all Emacs mail clients are supported. The link
3230 points to the current article, or, in some Gnus buffers, to
3231 the group. The description is constructed from the author
3234 - /Web browsers: W3 and W3M/ ::
3236 Here the link is the current URL, with the page title as
3239 - /Contacts: BBDB/ ::
3241 Links created in a BBDB buffer point to the current entry.
3245 #+vindex: org-irc-links-to-logs
3246 For IRC links, if the variable ~org-irc-link-to-logs~ is
3247 non-~nil~, create a =file= style link to the relevant point
3248 in the logs for the current conversation. Otherwise store
3249 an =irc= style link to the user/channel/server under the
3254 For any other files, the link points to the file, with
3255 a search string (see [[*Search options in file links][*Search options]]) pointing to the
3256 contents of the current line. If there is an active region,
3257 the selected words form the basis of the search string. If
3258 the automatically created link is not working correctly or
3259 accurately enough, you can write custom functions to select
3260 the search string and to do the search for particular file
3261 types (see [[*Custom searches]]). The key binding {{{kbd(C-c
3262 l)}}} is only a suggestion (see [[*Installation]]).
3266 When the cursor is in an agenda view, the created link
3267 points to the entry referenced by the current line.
3269 - {{{kbd(C-c C-l)}}} (~org-insert-link~) ::
3272 #+findex: org-insert-link
3273 #+cindex: link completion
3274 #+cindex: completion, of links
3275 #+cindex: inserting links
3276 #+vindex: org-keep-stored-link-after-insertion
3277 Insert a link[fn:30]. This prompts for a link to be inserted
3278 into the buffer. You can just type a link, using text for an
3279 internal link, or one of the link type prefixes mentioned in the
3280 examples above. The link is inserted into the buffer, along with
3281 a descriptive text[fn:31]. If some text was selected at this
3282 time, it becomes the default description.
3284 - /Inserting stored links/ ::
3286 All links stored during the current session are part of the
3287 history for this prompt, so you can access them with
3288 {{{kbd(up)}}} and {{{kbd(down)}}} (or {{{kbd(M-p)}}},
3291 - /Completion support/ ::
3293 Completion with {{{kbd(TAB)}}} helps you to insert valid
3294 link prefixes like =http= or =ftp=, including the prefixes
3295 defined through link abbreviations (see [[*Link
3296 abbreviations]]). If you press {{{kbd(RET)}}} after inserting
3297 only the prefix, Org offers specific completion support for
3298 some link types[fn:32]. For example, if you type {{{kbd(f
3299 i l e RET)}}} -- alternative access: {{{kbd(C-u C-c C-l)}}},
3300 see below -- Org offers file name completion, and after
3301 {{{kbd(b b d b RET)}}} you can complete contact names.
3303 - {{{kbd(C-u C-c C-l)}}} ::
3305 #+cindex: file name completion
3306 #+cindex: completion, of file names
3307 #+kindex: C-u C-c C-l
3308 When {{{kbd(C-c C-l)}}} is called with a {{{kbd(C-u)}}} prefix
3309 argument, insert a link to a file. You may use file name
3310 completion to select the name of the file. The path to the file
3311 is inserted relative to the directory of the current Org file, if
3312 the linked file is in the current directory or in a sub-directory
3313 of it, or if the path is written relative to the current
3314 directory using =../=. Otherwise an absolute path is used, if
3315 possible with =~/= for your home directory. You can force an
3316 absolute path with two {{{kbd(C-u)}}} prefixes.
3318 - {{{kbd(C-c C-l)}}} (with cursor on existing link) ::
3320 #+cindex: following links
3321 When the cursor is on an existing link, {{{kbd(C-c C-l)}}} allows
3322 you to edit the link and description parts of the link.
3324 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
3327 #+findex: org-open-at-point
3328 #+vindex: org-file-apps
3329 #+vindex: org-link-frame-setup
3330 Open link at point. This launches a web browser for URL
3331 (using ~browse-url-at-point~), run
3332 VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for the corresponding
3333 links, and execute the command in a shell link. When the
3334 cursor is on an internal link, this command runs the
3335 corresponding search. When the cursor is on a TAG list in
3336 a headline, it creates the corresponding TAGS view. If the
3337 cursor is on a timestamp, it compiles the agenda for that
3338 date. Furthermore, it visits text and remote files in
3339 =file= links with Emacs and select a suitable application
3340 for local non-text files. Classification of files is based
3341 on file extension only. See option ~org-file-apps~. If you
3342 want to override the default application and visit the file
3343 with Emacs, use a {{{kbd(C-u)}}} prefix. If you want to
3344 avoid opening in Emacs, use a {{{kbd(C-u C-u)}}} prefix. \\
3345 If the cursor is on a headline, but not on a link, offer all
3346 links in the headline and entry text. If you want to setup
3347 the frame configuration for following links, customize
3348 ~org-link-frame-setup~.
3352 #+vindex: org-return-follows-link
3354 When ~org-return-follows-link~ is set, {{{kbd(RET)}}} also
3355 follows the link at point.
3357 - {{{kbd(mouse-2)}}} or {{{kbd(mouse-1)}}} ::
3361 On links, {{{kbd(mouse-1)}}} and {{{kbd(mouse-2)}}} opens
3362 the link just as {{{kbd(C-c C-o)}}} does.
3364 - {{{kbd(mouse-3)}}} ::
3366 #+vindex: org-display-internal-link-with-indirect-buffer
3368 Like {{{kbd(mouse-2)}}}, but force file links to be opened
3369 with Emacs, and internal links to be displayed in another
3372 - {{{kbd(C-c C-x C-v)}}} (~org-toggle-inline-images~) ::
3374 #+cindex: inlining images
3375 #+cindex: images, inlining
3376 #+vindex: org-startup-with-inline-images
3377 #+kindex: C-c C-x C-v
3378 #+findex: org-toggle-inline-images
3379 Toggle the inline display of linked images. Normally this
3380 only inlines images that have no description part in the
3381 link, i.e., images that are inlined during export. When
3382 called with a prefix argument, also display images that do
3383 have a link description. You can ask for inline images to
3384 be displayed at startup by configuring the variable
3385 ~org-startup-with-inline-images~[fn:34].
3387 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
3390 #+findex: org-mark-ring-push
3392 Push the current position onto the mark ring, to be able to
3393 return easily. Commands following an internal link do this
3396 - {{{kbd(C-c &)}}} (~org-mark-ring-goto~) ::
3399 #+findex: org-mark-ring-goto
3400 #+cindex: links, returning to
3401 Jump back to a recorded position. A position is recorded by
3402 the commands following internal links, and by {{{kbd(C-c
3403 %)}}}. Using this command several times in direct
3404 succession moves through a ring of previously recorded
3407 - {{{kbd(C-c C-x C-n)}}} (~org-next-link~), {{{kbd(C-c C-x C-p)}}} (~org-previous-link~) ::
3409 #+kindex: C-c C-x C-p
3410 #+findex: org-previous-link
3411 #+kindex: C-c C-x C-n
3412 #+findex: org-next-link
3413 #+cindex: links, finding next/previous
3414 Move forward/backward to the next link in the buffer. At the
3415 limit of the buffer, the search fails once, and then wraps
3416 around. The key bindings for this are really too long; you might
3417 want to bind this also to {{{kbd(C-n)}}} and {{{kbd(C-p)}}}.
3419 #+begin_src emacs-lisp
3420 (add-hook 'org-load-hook
3422 (define-key org-mode-map "\C-n" 'org-next-link)
3423 (define-key org-mode-map "\C-p" 'org-previous-link)))
3426 ** Using links outside Org
3428 :DESCRIPTION: Linking from my C source code?
3431 You can insert and follow links that have Org syntax not only in Org,
3432 but in any Emacs buffer. For this, you should create two global
3433 commands, like this (please select suitable global keys yourself):
3435 #+begin_src emacs-lisp
3436 (global-set-key "\C-c L" 'org-insert-link-global)
3437 (global-set-key "\C-c o" 'org-open-at-point-global)
3440 ** Link abbreviations
3442 :DESCRIPTION: Shortcuts for writing complex links.
3444 #+cindex: link abbreviations
3445 #+cindex: abbreviation, links
3447 Long URL can be cumbersome to type, and often many similar links are
3448 needed in a document. For this you can use link abbreviations. An
3449 abbreviated link looks like this
3451 : [[linkword:tag][description]]
3453 #+texinfo: @noindent
3454 #+vindex: org-link-abbrev-alist
3455 where the tag is optional. The /linkword/ must be a word, starting
3456 with a letter, followed by letters, numbers, =-=, and =_=.
3457 Abbreviations are resolved according to the information in the
3458 variable ~org-link-abbrev-alist~ that relates the linkwords to
3459 replacement text. Here is an example:
3461 #+begin_src emacs-lisp
3462 (setq org-link-abbrev-alist
3463 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
3464 ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
3465 ("google" . "http://www.google.com/search?q=")
3466 ("gmap" . "http://maps.google.com/maps?q=%s")
3467 ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
3468 ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
3471 If the replacement text contains the string =%s=, it is replaced with
3472 the tag. Using =%h= instead of =%s= percent-encodes the tag (see the
3473 example above, where we need to encode the URL parameter). Using
3474 =%(my-function)= passes the tag to a custom function, and replace it
3475 by the resulting string.
3477 If the replacement text do not contain any specifier, it is simply
3478 appended to the string in order to create the link.
3480 Instead of a string, you may also specify a function that will be
3481 called with the tag as the only argument to create the link.
3483 With the above setting, you could link to a specific bug with
3484 =[[bugzilla:129]]=, search the web for =OrgMode= with =[[google:OrgMode]]=,
3485 show the map location of the Free Software Foundation =[[gmap:51
3486 Franklin Street, Boston]]= or of Carsten office =[[omap:Science Park 904,
3487 Amsterdam, The Netherlands]]= and find out what the Org author is doing
3488 besides Emacs hacking with =[[ads:Dominik,C]]=.
3490 If you need special abbreviations just for a single Org buffer, you
3491 can define them in the file with
3493 #+cindex: LINK, keyword
3495 ,#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
3496 ,#+LINK: google http://www.google.com/search?q=%s
3499 #+texinfo: @noindent
3500 In-buffer completion (see [[*Completion]]) can be used after =[= to
3501 complete link abbreviations. You may also define a function that
3502 implements special (e.g., completion) support for inserting such
3503 a link with {{{kbd(C-c C-l)}}}. Such a function should not accept any
3504 arguments, and return the full link with prefix. You can set the link
3505 completion function like this:
3507 #+BEGIN_SRC emacs-lisp
3508 (org-link-set-parameter "type" :complete #'some-completion-function)
3511 ** Search options in file links
3513 :DESCRIPTION: Linking to a specific location.
3514 :ALT_TITLE: Search options
3516 #+cindex: search option in file links
3517 #+cindex: file links, searching
3519 File links can contain additional information to make Emacs jump to
3520 a particular location in the file when following a link. This can be
3521 a line number or a search option after a double colon[fn:35]. For
3522 example, when the command {{{kbd(C-c l)}}} creates a link (see
3523 [[*Handling links]]) to a file, it encodes the words in the current line
3524 as a search string that can be used to find this line back later when
3525 following the link with {{{kbd(C-c C-o)}}}.
3527 Here is the syntax of the different ways to attach a search to a file
3528 link, together with an explanation:
3531 [[file:~/code/main.c::255]]
3532 [[file:~/xx.org::My Target]]
3533 [[file:~/xx.org::*My Target]]
3534 [[file:~/xx.org::#my-custom-id]]
3535 [[file:~/xx.org::/regexp/]]
3538 - =255= :: Jump to line 255.
3539 - =My Target= :: Search for a link target =<<My Target>>=, or do
3540 a text search for =my target=, similar to the search in internal
3541 links, see [[*Internal links]]. In HTML export (see [[*HTML export]]),
3542 such a file link becomes a HTML reference to the corresponding
3543 named anchor in the linked file.
3544 - =*My Target= :: In an Org file, restrict search to headlines.
3545 - =#my-custom-id= :: Link to a heading with a =CUSTOM_ID= property
3546 - =/REGEXP/= :: Do a regular expression search for {{{var(REGEXP)}}}.
3547 This uses the Emacs command ~occur~ to list all matches in
3548 a separate window. If the target file is in Org mode,
3549 ~org-occur~ is used to create a sparse tree with the matches.
3551 As a degenerate case, a file link with an empty file name can be used
3552 to search the current file. For example, =[[file:::find me]]= does
3553 a search for =find me= in the current file, just as =[[find me]]= would.
3557 :DESCRIPTION: When the default search is not enough.
3559 #+cindex: custom search strings
3560 #+cindex: search strings, custom
3562 The default mechanism for creating search strings and for doing the
3563 actual search related to a file link may not work correctly in all
3564 cases. For example, BibTeX database files have many entries like
3565 ~year="1993"~ which would not result in good search strings, because
3566 the only unique identification for a BibTeX entry is the citation key.
3568 #+vindex: org-create-file-search-functions
3569 #+vindex: org-execute-file-search-functions
3570 If you come across such a problem, you can write custom functions to
3571 set the right search string for a particular file type, and to do the
3572 search for the string in the file. Using ~add-hook~, these functions
3573 need to be added to the hook variables
3574 ~org-create-file-search-functions~ and
3575 ~org-execute-file-search-functions~. See the docstring for these
3576 variables for more information. Org actually uses this mechanism for
3577 BibTeX database files, and you can use the corresponding code as an
3578 implementation example. See the file =org-bibtex.el=.
3582 :DESCRIPTION: Every tree branch can be a TODO item.
3583 :ALT_TITLE: TODO Items
3585 #+cindex: TODO items
3587 Org mode does not maintain TODO lists as separate documents[fn:36].
3588 Instead, TODO items are an integral part of the notes file, because
3589 TODO items usually come up while taking notes! With Org mode, simply
3590 mark any entry in a tree as being a TODO item. In this way,
3591 information is not duplicated, and the entire context from which the
3592 TODO item emerged is always present.
3594 Of course, this technique for managing TODO items scatters them
3595 throughout your notes file. Org mode compensates for this by
3596 providing methods to give you an overview of all the things that you
3599 ** Basic TODO functionality
3601 :DESCRIPTION: Marking and displaying TODO entries.
3602 :ALT_TITLE: TODO basics
3605 Any headline becomes a TODO item when it starts with the word =TODO=,
3608 : *** TODO Write letter to Sam Fortune
3610 #+texinfo: @noindent
3611 The most important commands to work with TODO entries are:
3613 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
3616 #+cindex: cycling, of TODO states
3617 Rotate the TODO state of the current item among
3620 ,-> (unmarked) -> TODO -> DONE --.
3621 '--------------------------------'
3624 If TODO keywords have fast access keys (see [[*Fast access to
3625 TODO states]]), prompt for a TODO keyword through the fast
3626 selection interface; this is the default behavior when
3627 ~org-use-fast-todo-selection~ is non-~nil~.
3629 The same rotation can also be done "remotely" from the timeline
3630 and agenda buffers with the {{{kbd(t)}}} command key (see
3631 [[*Commands in the agenda buffer]]).
3633 - {{{kbd(C-u C-c C-t)}}} ::
3635 #+kindex: C-u C-c C-t
3636 When TODO keywords have no selection keys, select a specific
3637 keyword using completion; otherwise force cycling through TODO
3638 states with no prompt. When ~org-use-fast-todo-selection~ is set
3639 to ~prefix~, use the fast selection interface.
3641 - {{{kbd(S-right)}}} {{{kbd(S-left)}}} ::
3645 #+vindex: org-treat-S-cursor-todo-selection-as-state-change
3646 Select the following/preceding TODO state, similar to cycling.
3647 Useful mostly if more than two TODO states are possible (see
3648 [[*Extended use of TODO keywords]]). See also [[*Packages that
3649 conflict with Org mode]], for a discussion of the interaction with
3650 ~shift-selection-mode~. See also the variable
3651 ~org-treat-S-cursor-todo-selection-as-state-change~.
3653 - {{{kbd(C-c / t)}}} (~org-show-todo-tree~) ::
3656 #+cindex: sparse tree, for TODO
3657 #+vindex: org-todo-keywords
3658 #+findex: org-show-todo-tree
3659 View TODO items in a /sparse tree/ (see [[*Sparse trees]]). Folds
3660 the entire buffer, but shows all TODO items -- with not-DONE
3661 state -- and the headings hierarchy above them. With a prefix
3662 argument, or by using {{{kbd(C-c / T)}}}, search for a specific
3663 TODO. You are prompted for the keyword, and you can also give
3664 a list of keywords like =KWD1|KWD2|...= to list entries that
3665 match any one of these keywords. With a numeric prefix argument
3666 N, show the tree for the Nth keyword in the variable
3667 ~org-todo-keywords~. With two prefix arguments, find all TODO
3668 states, both un-done and done.
3670 - {{{kbd(C-c a t)}}} (~org-todo-list~) ::
3673 Show the global TODO list. Collects the TODO items (with
3674 not-DONE states) from all agenda files (see [[*Agenda views]]) into
3675 a single buffer. The new buffer is in Org Agenda mode, which
3676 provides commands to examine and manipulate the TODO entries from
3677 the new buffer (see [[*Commands in the agenda buffer]]). See [[*The
3678 global TODO list]], for more information.
3680 - {{{kbd(S-M-RET)}}} (~org-insert-todo-heading~) ::
3683 #+findex: org-insert-todo-heading
3684 Insert a new TODO entry below the current one.
3686 #+vindex: org-todo-state-tags-triggers
3687 #+texinfo: @noindent
3688 Changing a TODO state can also trigger tag changes. See the docstring
3689 of the option ~org-todo-state-tags-triggers~ for details.
3691 ** Extended use of TODO keywords
3693 :DESCRIPTION: Workflow and assignments.
3694 :ALT_TITLE: TODO extensions
3696 #+cindex: extended TODO keywords
3698 #+vindex: org-todo-keywords
3699 By default, marked TODO entries have one of only two states: TODO and
3700 DONE. Org mode allows you to classify TODO items in more complex ways
3701 with /TODO keywords/ (stored in ~org-todo-keywords~). With special
3702 setup, the TODO keyword system can work differently in different
3705 Note that /tags/ are another way to classify headlines in general and
3706 TODO items in particular (see [[*Tags]]).
3708 *** TODO keywords as workflow states
3710 :DESCRIPTION: From TODO to DONE in steps.
3711 :ALT_TITLE: Workflow states
3713 #+cindex: TODO workflow
3714 #+cindex: workflow states as TODO keywords
3716 You can use TODO keywords to indicate different /sequential/ states in
3717 the process of working on an item, for example[fn:37]:
3719 #+begin_src emacs-lisp
3720 (setq org-todo-keywords
3721 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3724 The vertical bar separates the TODO keywords (states that /need
3725 action/) from the DONE states (which need /no further action/). If
3726 you do not provide the separator bar, the last state is used as the
3729 #+cindex: completion, of TODO keywords
3730 With this setup, the command {{{kbd(C-c C-t)}}} cycles an entry from
3731 =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to =DONE= and
3732 =DELEGATED=. You may also use a numeric prefix argument to quickly
3733 select a specific state. For example {{{kbd(C-3 C-c C-t)}}} changes
3734 the state immediately to =VERIFY=. Or you can use {{{kbd(S-left)}}}
3735 to go backward through the sequence. If you define many keywords, you
3736 can use in-buffer completion (see [[*Completion]]) or even a special
3737 one-key selection scheme (see [[*Fast access to TODO states]]) to insert
3738 these words into the buffer. Changing a TODO state can be logged with
3739 a timestamp, see [[*Tracking TODO state changes]], for more information.
3741 *** TODO keywords as types
3743 :DESCRIPTION: I do this, Fred does the rest.
3744 :ALT_TITLE: TODO types
3746 #+cindex: TODO types
3747 #+cindex: names as TODO keywords
3748 #+cindex: types as TODO keywords
3750 The second possibility is to use TODO keywords to indicate different
3751 /types/ of action items. For example, you might want to indicate that
3752 items are for "work" or "home". Or, when you work with several people
3753 on a single project, you might want to assign action items directly to
3754 persons, by using their names as TODO keywords. This would be set up
3757 #+begin_src emacs-lisp
3758 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3761 In this case, different keywords do not indicate a sequence, but
3762 rather different types. So the normal work flow would be to assign
3763 a task to a person, and later to mark it DONE. Org mode supports this
3764 style by adapting the workings of the command {{{kbd(C-c
3765 C-t)}}}[fn:38]. When used several times in succession, it still
3766 cycles through all names, in order to first select the right type for
3767 a task. But when you return to the item after some time and execute
3768 {{{kbd(C-c C-t)}}} again, it will switch from any name directly to
3769 =DONE=. Use prefix arguments or completion to quickly select
3770 a specific name. You can also review the items of a specific TODO
3771 type in a sparse tree by using a numeric prefix to {{{kbd(C-c / t)}}}.
3772 For example, to see all things Lucy has to do, you would use
3773 {{{kbd(C-3 C-c / t)}}}. To collect Lucy's items from all agenda files
3774 into a single buffer, you would use the numeric prefix argument as
3775 well when creating the global TODO list: {{{kbd(C-3 C-c a t)}}}.
3777 *** Multiple keyword sets in one file
3779 :DESCRIPTION: Mixing it all, still finding your way.
3780 :ALT_TITLE: Multiple sets in one file
3782 #+cindex: TODO keyword sets
3784 Sometimes you may want to use different sets of TODO keywords in
3785 parallel. For example, you may want to have the basic TODO/DONE, but
3786 also a workflow for bug fixing, and a separate state indicating that
3787 an item has been canceled -- so it is not DONE, but also does not
3788 require action. Your setup would then look like this:
3790 #+begin_src emacs-lisp
3791 (setq org-todo-keywords
3792 '((sequence "TODO" "|" "DONE")
3793 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3794 (sequence "|" "CANCELED")))
3797 The keywords should all be different, this helps Org mode to keep
3798 track of which subsequence should be used for a given entry. In this
3799 setup, {{{kbd(C-c C-t)}}} only operates within a subsequence, so it
3800 switches from =DONE= to (nothing) to =TODO=, and from =FIXED= to
3801 (nothing) to =REPORT=. Therefore you need a mechanism to initially
3802 select the correct sequence. Besides the obvious ways like typing
3803 a keyword or using completion, you may also apply the following
3806 #+attr_texinfo: :sep ,
3807 - {{{kbd(C-u C-u C-c C-t)}}}, {{{kbd(C-S-right)}}}, {{{kbd(C-S-left)}}} ::
3811 #+kindex: C-u C-u C-c C-t
3812 These keys jump from one TODO subset to the next. In the above
3813 example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbd(C-S-right)}}} would
3814 jump from =TODO= or =DONE= to =REPORT=, and any of the words in
3815 the second row to =CANCELED=. Note that the {{{kbd(C-S-)}}} key
3816 binding conflict with ~shift-selection-mode~ (see [[*Packages that
3817 conflict with Org mode]]).
3819 - {{{kbd(S-right)}}}, {{{kbd(S-left)}}} ::
3823 {{{kbd(S-left)}}} and {{{kbd(S-right)}}} walk through /all/
3824 keywords from all sets, so for example {{{kbd(S-right)}}} would
3825 switch from =DONE= to =REPORT= in the example above. For
3826 a discussion of the interaction with ~shift-selection-mode~, see
3827 [[*Packages that conflict with Org mode]].
3829 *** Fast access to TODO states
3831 :DESCRIPTION: Single letter selection of state.
3834 If you would like to quickly change an entry to an arbitrary TODO
3835 state instead of cycling through the states, you can set up keys for
3836 single-letter access to the states. This is done by adding the
3837 selection character after each keyword, in parentheses[fn:39]. For
3840 #+begin_src emacs-lisp
3841 (setq org-todo-keywords
3842 '((sequence "TODO(t)" "|" "DONE(d)")
3843 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3844 (sequence "|" "CANCELED(c)")))
3847 #+vindex: org-fast-tag-selection-include-todo
3848 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
3849 the entry is switched to this state. {{{kbd(SPC)}}} can be used to
3850 remove any TODO keyword from an entry[fn:40].
3852 *** Setting up keywords for individual files
3854 :DESCRIPTION: Different files, different requirements.
3855 :ALT_TITLE: Per-file keywords
3857 #+cindex: keyword options
3858 #+cindex: per-file keywords
3859 #+cindex: TODO, keyword
3860 #+cindex: TYP_TODO, keyword
3861 #+cindex: SEQ_TODO, keyword
3863 It can be very useful to use different aspects of the TODO mechanism
3864 in different files. For file-local settings, you need to add special
3865 lines to the file which set the keywords and interpretation for that
3866 file only. For example, to set one of the two examples discussed
3867 above, you need one of the following lines, starting in column zero
3868 anywhere in the file:
3870 : #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3872 #+texinfo: @noindent
3873 you may also write =#+SEQ_TODO= to be explicit about the
3874 interpretation, but it means the same as =#+TODO=, or
3876 : #+TYP_TODO: Fred Sara Lucy Mike | DONE
3878 A setup for using several sets in parallel would be:
3881 ,#+TODO: TODO | DONE
3882 ,#+TODO: REPORT BUG KNOWNCAUSE | FIXED
3886 #+cindex: completion, of option keywords
3888 #+texinfo: @noindent
3889 To make sure you are using the correct keyword, type =#+= into the
3890 buffer and then use {{{kbd(M-TAB)}}} completion.
3892 #+cindex: DONE, final TODO keyword
3893 Remember that the keywords after the vertical bar -- or the last
3894 keyword if no bar is there -- must always mean that the item is DONE,
3895 although you may use a different word. After changing one of these
3896 lines, use {{{kbd(C-c C-c)}}} with the cursor still in the line to
3897 make the changes known to Org mode[fn:41].
3899 *** Faces for TODO keywords
3901 :DESCRIPTION: Highlighting states.
3903 #+cindex: faces, for TODO keywords
3905 #+vindex: org-todo, face
3906 #+vindex: org-done, face
3907 #+vindex: org-todo-keyword-faces
3908 Org mode highlights TODO keywords with special faces: ~org-todo~ for
3909 keywords indicating that an item still has to be acted upon, and
3910 ~org-done~ for keywords indicating that an item is finished. If you
3911 are using more than two different states, you might want to use
3912 special faces for some of them. This can be done using the variable
3913 ~org-todo-keyword-faces~. For example:
3915 #+begin_src emacs-lisp
3916 (setq org-todo-keyword-faces
3917 '(("TODO" . org-warning) ("STARTED" . "yellow")
3918 ("CANCELED" . (:foreground "blue" :weight bold))))
3921 #+vindex: org-faces-easy-properties
3922 While using a list with face properties as shown for =CANCELED=
3923 /should/ work, this does not always seem to be the case. If
3924 necessary, define a special face and use that. A string is
3925 interpreted as a color. The variable ~org-faces-easy-properties~
3926 determines if that color is interpreted as a foreground or
3929 *** TODO dependencies
3931 :DESCRIPTION: When one task needs to wait for others.
3933 #+cindex: TODO dependencies
3934 #+cindex: dependencies, of TODO states
3936 #+vindex: org-enforce-todo-dependencies
3937 #+cindex: ORDERED, property
3938 The structure of Org files -- hierarchy and lists -- makes it easy to
3939 define TODO dependencies. Usually, a parent TODO task should not be
3940 marked DONE until all subtasks, defined as children tasks, are marked
3941 as DONE. And sometimes there is a logical sequence to a number of
3942 (sub)tasks, so that one task cannot be acted upon before all siblings
3943 above it are done. If you customize the variable
3944 ~org-enforce-todo-dependencies~, Org blocks entries from changing
3945 state to DONE while they have children that are not DONE.
3946 Furthermore, if an entry has a property =ORDERED=, each of its
3947 children is blocked until all earlier siblings are marked DONE. Here
3951 ,* TODO Blocked until (two) is done
3960 ,** TODO b, needs to wait for (a)
3961 ,** TODO c, needs to wait for (a) and (b)
3964 #+cindex: TODO dependencies, NOBLOCKING
3965 #+cindex: NOBLOCKING, property
3966 You can ensure an entry is never blocked by using the =NOBLOCKING=
3970 ,* This entry is never blocked
3976 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
3979 #+findex: org-toggle-ordered-property
3980 #+vindex: org-track-ordered-property-with-tag
3981 #+cindex: ORDERED, property
3982 Toggle the =ORDERED= property of the current entry. A property
3983 is used for this behavior because this should be local to the
3984 current entry, not inherited like a tag. However, if you would
3985 like to /track/ the value of this property with a tag for better
3986 visibility, customize the variable
3987 ~org-track-ordered-property-with-tag~.
3989 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
3991 #+kindex: C-u C-u C-u C-c C-t
3992 Change TODO state, circumventing any state blocking.
3994 #+vindex: org-agenda-dim-blocked-tasks
3995 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
3996 that cannot be closed because of such dependencies are shown in
3997 a dimmed font or even made invisible in agenda views (see [[*Agenda
4000 #+cindex: checkboxes and TODO dependencies
4001 #+vindex: org-enforce-todo-dependencies
4002 You can also block changes of TODO states by looking at checkboxes
4003 (see [[*Checkboxes]]). If you set the variable
4004 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
4005 checkboxes is blocked from switching to DONE.
4007 If you need more complex dependency structures, for example
4008 dependencies between entries in different trees or files, check out
4009 the contributed module =org-depend.el=.
4013 :DESCRIPTION: Dates and notes for progress.
4015 #+cindex: progress logging
4016 #+cindex: logging, of progress
4018 Org mode can automatically record a timestamp and possibly a note when
4019 you mark a TODO item as DONE, or even each time you change the state
4020 of a TODO item. This system is highly configurable, settings can be
4021 on a per-keyword basis and can be localized to a file or even
4022 a subtree. For information on how to clock working time for a task,
4023 see [[*Clocking work time]].
4027 :DESCRIPTION: When was this entry marked DONE?
4030 The most basic logging is to keep track of /when/ a certain TODO item
4031 was finished. This is achieved with[fn:42]
4033 #+begin_src emacs-lisp
4034 (setq org-log-done 'time)
4037 #+vindex: org-closed-keep-when-no-todo
4038 #+texinfo: @noindent
4039 Then each time you turn an entry from a TODO (not-done) state into any
4040 of the DONE states, a line =CLOSED: [timestamp]= is inserted just
4041 after the headline. If you turn the entry back into a TODO item
4042 through further state cycling, that line is removed again. If you
4043 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t
4044 SPC)}}} for example), that line is also removed, unless you set
4045 ~org-closed-keep-when-no-todo~ to non-~nil~. If you want to record
4046 a note along with the timestamp, use[fn:43]
4048 #+begin_src emacs-lisp
4049 (setq org-log-done 'note)
4052 #+texinfo: @noindent
4053 You are then be prompted for a note, and that note is stored below the
4054 entry with a =Closing Note= heading.
4056 *** Tracking TODO state changes
4058 :DESCRIPTION: When did the status change?
4060 #+cindex: drawer, for state change recording
4062 #+vindex: org-log-states-order-reversed
4063 #+vindex: org-log-into-drawer
4064 #+cindex: LOG_INTO_DRAWER, property
4065 When TODO keywords are used as workflow states (see [[*TODO keywords as workflow states][*Workflow states]]),
4066 you might want to keep track of when a state change occurred and maybe
4067 take a note about this change. You can either record just
4068 a timestamp, or a time-stamped note for a change. These records are
4069 inserted after the headline as an itemized list, newest first[fn:44].
4070 When taking a lot of notes, you might want to get the notes out of the
4071 way into a drawer (see [[*Drawers]]). Customize the variable
4072 ~org-log-into-drawer~ to get this behavior -- the recommended drawer
4073 for this is called =LOGBOOK=[fn:45]. You can also overrule the
4074 setting of this variable for a subtree by setting a =LOG_INTO_DRAWER=
4077 Since it is normally too much to record a note for every state, Org
4078 mode expects configuration on a per-keyword basis for this. This is
4079 achieved by adding special markers =!= (for a timestamp) or =@= (for
4080 a note with timestamp) in parentheses after each keyword. For
4081 example, with the setting
4083 #+begin_src emacs-lisp
4084 (setq org-todo-keywords
4085 '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
4088 To record a timestamp without a note for TODO keywords configured with
4089 =@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted.
4091 #+vindex: org-log-done
4093 you not only define global TODO keywords and fast access keys, but
4094 also request that a time is recorded when the entry is set to =DONE=,
4095 and that a note is recorded when switching to =WAIT= or
4096 =CANCELED=[fn:46]. The setting for =WAIT= is even more special: the
4097 =!= after the slash means that in addition to the note taken when
4098 entering the state, a timestamp should be recorded when /leaving/ the
4099 =WAIT= state, if and only if the /target/ state does not configure
4100 logging for entering it. So it has no effect when switching from
4101 =WAIT= to =DONE=, because =DONE= is configured to record a timestamp
4102 only. But when switching from =WAIT= back to =TODO=, the =/!= in the
4103 =WAIT= setting now triggers a timestamp even though =TODO= has no
4106 You can use the exact same syntax for setting logging preferences local
4109 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
4111 #+cindex: LOGGING, property
4112 In order to define logging settings that are local to a subtree or
4113 a single item, define a =LOGGING= property in this entry. Any
4114 non-empty =LOGGING= property resets all logging settings to ~nil~.
4115 You may then turn on logging for this specific tree using =STARTUP=
4116 keywords like =lognotedone= or =logrepeat=, as well as adding state
4117 specific settings like =TODO(!)=. For example:
4120 ,* TODO Log each state with only a time
4122 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
4124 ,* TODO Only log when switching to WAIT, and when repeating
4126 :LOGGING: WAIT(@) logrepeat
4128 ,* TODO No logging at all
4134 *** Tracking your habits
4136 :DESCRIPTION: How consistent have you been?
4139 #+cindex: STYLE, property
4141 Org has the ability to track the consistency of a special category of
4142 TODO, called "habits." A habit has the following properties:
4144 1. You have enabled the ~habits~ module by customizing the variable
4147 2. The habit is a TODO item, with a TODO keyword representing an open
4150 3. The property =STYLE= is set to the value =habit=.
4152 4. The TODO has a scheduled date, usually with a =.+= style repeat
4153 interval. A =++= style may be appropriate for habits with time
4154 constraints, e.g., must be done on weekends, or a =+= style for an
4155 unusual habit that can have a backlog, e.g., weekly reports.
4157 5. The TODO may also have minimum and maximum ranges specified by
4158 using the syntax =.+2d/3d=, which says that you want to do the task
4159 at least every three days, but at most every two days.
4161 6. You must also have state logging for the DONE state enabled (see
4162 [[*Tracking TODO state changes]]), in order for historical data to be
4163 represented in the consistency graph. If it is not enabled it is
4164 not an error, but the consistency graphs are largely meaningless.
4166 To give you an idea of what the above rules look like in action, here's an
4167 actual habit with some history:
4171 SCHEDULED: <2009-10-17 Sat .+2d/4d>
4174 :LAST_REPEAT: [2009-10-19 Mon 00:36]
4176 - State "DONE" from "TODO" [2009-10-15 Thu]
4177 - State "DONE" from "TODO" [2009-10-12 Mon]
4178 - State "DONE" from "TODO" [2009-10-10 Sat]
4179 - State "DONE" from "TODO" [2009-10-04 Sun]
4180 - State "DONE" from "TODO" [2009-10-02 Fri]
4181 - State "DONE" from "TODO" [2009-09-29 Tue]
4182 - State "DONE" from "TODO" [2009-09-25 Fri]
4183 - State "DONE" from "TODO" [2009-09-19 Sat]
4184 - State "DONE" from "TODO" [2009-09-16 Wed]
4185 - State "DONE" from "TODO" [2009-09-12 Sat]
4188 What this habit says is: I want to shave at most every 2 days -- given
4189 by the =SCHEDULED= date and repeat interval -- and at least every
4190 4 days. If today is the 15th, then the habit first appears in the
4191 agenda on Oct 17, after the minimum of 2 days has elapsed, and will
4192 appear overdue on Oct 19, after four days have elapsed.
4194 What's really useful about habits is that they are displayed along
4195 with a consistency graph, to show how consistent you've been at
4196 getting that task done in the past. This graph shows every day that
4197 the task was done over the past three weeks, with colors for each day.
4198 The colors used are:
4200 - Blue :: If the task was not to be done yet on that day.
4201 - Green :: If the task could have been done on that day.
4202 - Yellow :: If the task was going to be overdue the next day.
4203 - Red :: If the task was overdue on that day.
4205 In addition to coloring each day, the day is also marked with an
4206 asterisk if the task was actually done that day, and an exclamation
4207 mark to show where the current day falls in the graph.
4209 There are several configuration variables that can be used to change
4210 the way habits are displayed in the agenda.
4212 - ~org-habit-graph-column~ ::
4214 #+vindex: org-habit-graph-column
4215 The buffer column at which the consistency graph should be drawn.
4216 This overwrites any text in that column, so it is a good idea to
4217 keep your habits' titles brief and to the point.
4219 - ~org-habit-preceding-days~ ::
4221 #+vindex: org-habit-preceding-days
4222 The amount of history, in days before today, to appear in
4225 - ~org-habit-following-days~ ::
4227 #+vindex: org-habit-following-days
4228 The number of days after today that appear in consistency graphs.
4230 - ~org-habit-show-habits-only-for-today~ ::
4232 #+vindex: org-habit-show-habits-only-for-today
4233 If non-~nil~, only show habits in today's agenda view. This is
4234 set to true by default.
4236 Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to
4237 temporarily be disabled and do not appear at all. Press {{{kbd(K)}}}
4238 again to bring them back. They are also subject to tag filtering, if
4239 you have habits which should only be done in certain contexts, for
4244 :DESCRIPTION: Some things are more important than others.
4246 #+cindex: priorities
4247 #+cindex: priority cookie
4249 If you use Org mode extensively, you may end up with enough TODO items
4250 that it starts to make sense to prioritize them. Prioritizing can be
4251 done by placing a /priority cookie/ into the headline of a TODO item,
4254 : *** TODO [#A] Write letter to Sam Fortune
4256 #+vindex: org-priority-faces
4257 #+texinfo: @noindent
4258 By default, Org mode supports three priorities: =A=, =B=, and =C=.
4259 =A= is the highest priority. An entry without a cookie is treated
4260 just like priority =B=. Priorities make a difference only for sorting
4261 in the agenda (see [[*Weekly/daily agenda]]); outside the agenda, they
4262 have no inherent meaning to Org mode. The cookies can be highlighted
4263 with special faces by customizing the variable ~org-priority-faces~.
4265 Priorities can be attached to any outline node; they do not need to be
4268 #+attr_texinfo: :sep ;
4269 - {{{kbd(C-c \,)}}} (~org-priority~) ::
4272 #+findex: org-priority
4273 Set the priority of the current headline. The command prompts
4274 for a priority character =A=, =B= or =C=. When you press
4275 {{{kbd(SPC)}}} instead, the priority cookie is removed from the
4276 headline. The priorities can also be changed "remotely" from the
4277 timeline and agenda buffer with the {{{kbd(\,)}}} command (see
4278 [[*Commands in the agenda buffer]]).
4280 - {{{kbd(S-up)}}} (~org-priority-up~); {{{kbd(S-down)}}} (~org-priority-down~) ::
4284 #+findex: org-priority-up
4285 #+findex: org-priority-down
4286 #+vindex: org-priority-start-cycle-with-default
4287 Increase/decrease priority of current headline[fn:47]. Note that
4288 these keys are also used to modify timestamps (see [[*Creating
4289 timestamps]]). See also [[*Packages that conflict with Org mode]], for
4290 a discussion of the interaction with ~shift-selection-mode~.
4292 #+vindex: org-highest-priority
4293 #+vindex: org-lowest-priority
4294 #+vindex: org-default-priority
4295 You can change the range of allowed priorities by setting the
4296 variables ~org-highest-priority~, ~org-lowest-priority~, and
4297 ~org-default-priority~. For an individual buffer, you may set these
4298 values (highest, lowest, default) like this (please make sure that the
4299 highest priority is earlier in the alphabet than the lowest priority):
4301 #+cindex: PRIORITIES, keyword
4302 : #+PRIORITIES: A C B
4304 ** Breaking tasks down tasks into subtasks
4306 :DESCRIPTION: Splitting a task into manageable pieces.
4307 :ALT_TITLE: Breaking down tasks
4309 #+cindex: tasks, breaking down
4310 #+cindex: statistics, for TODO items
4312 #+vindex: org-agenda-todo-list-sublevels
4313 It is often advisable to break down large tasks into smaller,
4314 manageable subtasks. You can do this by creating an outline tree
4315 below a TODO item, with detailed subtasks on the tree[fn:48]. To keep
4316 the overview over the fraction of subtasks that are already completed,
4317 insert either =[/]= or =[%]= anywhere in the headline. These cookies
4318 are updated each time the TODO status of a child changes, or when
4319 pressing {{{kbd(C-c C-c)}}} on the cookie. For example:
4322 ,* Organize Party [33%]
4323 ,** TODO Call people [1/2]
4327 ,** DONE Talk to neighbor
4330 #+cindex: COOKIE_DATA, property
4331 If a heading has both checkboxes and TODO children below it, the
4332 meaning of the statistics cookie become ambiguous. Set the property
4333 =COOKIE_DATA= to either =checkbox= or =todo= to resolve this issue.
4335 #+vindex: org-hierarchical-todo-statistics
4336 If you would like to have the statistics cookie count any TODO entries
4337 in the subtree (not just direct children), configure the variable
4338 ~org-hierarchical-todo-statistics~. To do this for a single subtree,
4339 include the word =recursive= into the value of the =COOKIE_DATA=
4343 ,* Parent capturing statistics [2/20]
4345 :COOKIE_DATA: todo recursive
4349 If you would like a TODO entry to automatically change to DONE when
4350 all children are done, you can use the following setup:
4352 #+begin_src emacs-lisp
4353 (defun org-summary-todo (n-done n-not-done)
4354 "Switch entry to DONE when all subentries are done, to TODO otherwise."
4355 (let (org-log-done org-log-states) ; turn off logging
4356 (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
4358 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
4361 Another possibility is the use of checkboxes to identify (a hierarchy
4362 of) a large number of subtasks (see [[*Checkboxes]]).
4366 :DESCRIPTION: Tick-off lists.
4368 #+cindex: checkboxes
4370 #+vindex: org-list-automatic-rules
4371 Every item in a plain list[fn:49] (see [[*Plain lists]]) can be made into
4372 a checkbox by starting it with the string =[ ]=. This feature is
4373 similar to TODO items (see [[*TODO items]]), but is more lightweight.
4374 Checkboxes are not included into the global TODO list, so they are
4375 often great to split a task into a number of simple steps. Or you can
4376 use them in a shopping list. To toggle a checkbox, use {{{kbd(C-c
4377 C-c)}}}, or use the mouse (thanks to Piotr Zielinski's
4380 Here is an example of a checkbox list.
4383 ,* TODO Organize party [2/4]
4384 - [-] call people [1/3]
4389 - [ ] think about what music to play
4390 - [X] talk to the neighbors
4393 Checkboxes work hierarchically, so if a checkbox item has children
4394 that are checkboxes, toggling one of the children checkboxes makes the
4395 parent checkbox reflect if none, some, or all of the children are
4398 #+cindex: statistics, for checkboxes
4399 #+cindex: checkbox statistics
4400 #+cindex: COOKIE_DATA, property
4401 #+vindex: org-hierarchical-checkbox-statistics
4402 The =[2/4]= and =[1/3]= in the first and second line are cookies
4403 indicating how many checkboxes present in this entry have been checked
4404 off, and the total number of checkboxes present. This can give you an
4405 idea on how many checkboxes remain, even without opening a folded
4406 entry. The cookies can be placed into a headline or into (the first
4407 line of) a plain list item. Each cookie covers checkboxes of direct
4408 children structurally below the headline/item on which the cookie
4409 appears[fn:50]. You have to insert the cookie yourself by typing
4410 either =[/]= or =[%]=. With =[/]= you get an =n out of m= result, as
4411 in the examples above. With =[%]= you get information about the
4412 percentage of checkboxes checked (in the above example, this would be
4413 =[50%]= and =[33%]=, respectively). In a headline, a cookie can count
4414 either checkboxes below the heading or TODO states of children, and it
4415 displays whatever was changed last. Set the property =COOKIE_DATA= to
4416 either =checkbox= or =todo= to resolve this issue.
4418 #+cindex: blocking, of checkboxes
4419 #+cindex: checkbox blocking
4420 #+cindex: ORDERED, property
4421 If the current outline node has an =ORDERED= property, checkboxes must
4422 be checked off in sequence, and an error is thrown if you try to check
4423 off a box while there are unchecked boxes above it.
4425 #+texinfo: @noindent
4426 The following commands work with checkboxes:
4428 - {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
4431 #+findex: org-toggle-checkbox
4432 Toggle checkbox status or -- with prefix argument -- checkbox
4433 presence at point. With a single prefix argument, add an empty
4434 checkbox or remove the current one[fn:51]. With a double prefix
4435 argument, set it to =[-]=, which is considered to be an
4438 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
4440 #+kindex: C-c C-x C-b
4441 Toggle checkbox status or -- with prefix argument -- checkbox
4442 presence at point. With double prefix argument, set it to =[-]=,
4443 which is considered to be an intermediate state.
4445 - If there is an active region, toggle the first checkbox in the
4446 region and set all remaining boxes to the same status as the
4447 first. With a prefix argument, add or remove the checkbox for
4448 all items in the region.
4450 - If the cursor is in a headline, toggle checkboxes in the region
4451 between this headline and the next -- so /not/ the entire
4454 - If there is no active region, just toggle the checkbox at
4457 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
4460 #+findex: org-insert-todo-heading
4461 Insert a new item with a checkbox. This works only if the cursor
4462 is already in a plain list item (see [[*Plain lists]]).
4464 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
4467 #+findex: org-toggle-ordered-property
4468 #+vindex: org-track-ordered-property-with-tag
4469 Toggle the =ORDERED= property of the entry, to toggle if
4470 checkboxes must be checked off in sequence. A property is used
4471 for this behavior because this should be local to the current
4472 entry, not inherited like a tag. However, if you would like to
4473 /track/ the value of this property with a tag for better
4474 visibility, customize ~org-track-ordered-property-with-tag~.
4476 - {{{kbd(C-c #)}}} (~org-update-statistics-cookies~) ::
4479 #+findex: org-update-statistics-cookies
4480 Update the statistics cookie in the current outline entry. When
4481 called with a {{{kbd(C-u)}}} prefix, update the entire file.
4482 Checkbox statistic cookies are updated automatically if you
4483 toggle checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
4484 {{{kbd(M-S-RET)}}}. TODO statistics cookies update when changing
4485 TODO states. If you delete boxes/entries or add/change them by
4486 hand, use this command to get things back into sync.
4490 :DESCRIPTION: Tagging headlines and matching sets of tags.
4493 #+cindex: headline tagging
4494 #+cindex: matching, tags
4495 #+cindex: sparse tree, tag based
4497 An excellent way to implement labels and contexts for
4498 cross-correlating information is to assign /tags/ to headlines. Org
4499 mode has extensive support for tags.
4501 #+vindex: org-tag-faces
4502 Every headline can contain a list of tags; they occur at the end of
4503 the headline. Tags are normal words containing letters, numbers, =_=,
4504 and =@=. Tags must be preceded and followed by a single colon, e.g.,
4505 =:work:=. Several tags can be specified, as in =:work:urgent:=. Tags
4506 by default are in bold face with the same color as the headline. You
4507 may specify special faces for specific tags using the variable
4508 ~org-tag-faces~, in much the same way as you can for TODO keywords
4509 (see [[*Faces for TODO keywords]]).
4513 :DESCRIPTION: Tags use the tree structure of an outline.
4515 #+cindex: tag inheritance
4516 #+cindex: inheritance, of tags
4517 #+cindex: sublevels, inclusion into tags match
4519 /Tags/ make use of the hierarchical structure of outline trees. If
4520 a heading has a certain tag, all subheadings inherit the tag as well.
4521 For example, in the list
4524 ,* Meeting with the French group :work:
4525 ,** Summary by Frank :boss:notes:
4526 ,*** TODO Prepare slides for him :action:
4529 #+texinfo: @noindent
4530 the final heading has the tags =work=, =boss=, =notes=, and =action=
4531 even though the final heading is not explicitly marked with those
4532 tags. You can also set tags that all entries in a file should inherit
4533 just as if these tags were defined in a hypothetical level zero that
4534 surrounds the entire file. Use a line like this[fn:52]
4536 #+cindex: FILETAGS, keyword
4537 : #+FILETAGS: :Peter:Boss:Secret:
4539 #+vindex: org-use-tag-inheritance
4540 #+vindex: org-tags-exclude-from-inheritance
4541 #+texinfo: @noindent
4542 To limit tag inheritance to specific tags, or to turn it off entirely,
4543 use the variables ~org-use-tag-inheritance~ and
4544 ~org-tags-exclude-from-inheritance~.
4546 #+vindex: org-tags-match-list-sublevels
4547 When a headline matches during a tags search while tag inheritance is
4548 turned on, all the sublevels in the same tree -- for a simple match
4549 form -- match as well[fn:53]. The list of matches may then become
4550 very long. If you only want to see the first tags match in a subtree,
4551 configure the variable ~org-tags-match-list-sublevels~ (not
4554 #+vindex: org-agenda-use-tag-inheritance
4555 Tag inheritance is relevant when the agenda search tries to match
4556 a tag, either in the ~tags~ or ~tags-todo~ agenda types. In other
4557 agenda types, ~org-use-tag-inheritance~ has no effect. Still, you may
4558 want to have your tags correctly set in the agenda, so that tag
4559 filtering works fine, with inherited tags. Set
4560 ~org-agenda-use-tag-inheritance~ to control this: the default value
4561 includes all agenda types, but setting this to ~nil~ can really speed
4562 up agenda generation.
4566 :DESCRIPTION: How to assign tags to a headline.
4568 #+cindex: setting tags
4569 #+cindex: tags, setting
4572 Tags can simply be typed into the buffer at the end of a headline.
4573 After a colon, {{{kbd(M-TAB)}}} offers completion on tags. There is
4574 also a special command for inserting tags:
4576 - {{{kbd(C-c C-q)}}} (~org-set-tags-command~) ::
4579 #+findex: org-set-tags-command
4580 #+cindex: completion, of tags
4581 #+vindex: org-tags-column
4582 Enter new tags for the current headline. Org mode either offers
4583 completion or a special single-key interface for setting tags,
4584 see below. After pressing {{{kbd(RET)}}}, the tags are inserted
4585 and aligned to ~org-tags-column~. When called with
4586 a {{{kbd(C-u)}}} prefix, all tags in the current buffer are
4587 aligned to that column, just to make things look nice. Tags are
4588 automatically realigned after promotion, demotion, and TODO state
4589 changes (see [[*Basic TODO functionality]]).
4591 - {{{kbd(C-c C-c)}}} (~org-set-tags-command~) ::
4594 When the cursor is in a headline, this does the same as
4597 #+vindex: org-tag-alist
4598 Org supports tag insertion based on a /list of tags/. By default this
4599 list is constructed dynamically, containing all tags currently used in
4600 the buffer. You may also globally specify a hard list of tags with
4601 the variable ~org-tag-alist~. Finally you can set the default tags
4602 for a given file with lines like
4604 #+cindex: TAGS, keyword
4606 ,#+TAGS: @work @home @tennisclub
4607 ,#+TAGS: laptop car pc sailboat
4610 If you have globally defined your preferred set of tags using the
4611 variable ~org-tag-alist~, but would like to use a dynamic tag list in
4612 a specific file, add an empty =TAGS= keyword to that file:
4616 #+vindex: org-tag-persistent-alist
4617 If you have a preferred set of tags that you would like to use in
4618 every file, in addition to those defined on a per-file basis by =TAGS=
4619 keyword, then you may specify a list of tags with the variable
4620 ~org-tag-persistent-alist~. You may turn this off on a per-file basis
4621 by adding a =STARTUP= keyword to that file:
4625 By default Org mode uses the standard minibuffer completion facilities
4626 for entering tags. However, it also implements another, quicker, tag
4627 selection method called /fast tag selection/. This allows you to
4628 select and deselect tags with just a single key press. For this to
4629 work well you should assign unique letters to most of your commonly
4630 used tags. You can do this globally by configuring the variable
4631 ~org-tag-alist~ in your Emacs init file. For example, you may find
4632 the need to tag many items in different files with =@home=. In this
4633 case you can set something like:
4635 #+begin_src emacs-lisp
4636 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))
4639 #+texinfo: @noindent
4640 If the tag is only relevant to the file you are working on, then you
4641 can instead set the =TAGS= keyword as:
4643 : #+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p)
4645 #+texinfo: @noindent
4646 The tags interface shows the available tags in a splash window. If
4647 you want to start a new line after a specific tag, insert =\n= into
4650 : #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)
4652 #+texinfo: @noindent
4653 or write them in two lines:
4656 ,#+TAGS: @work(w) @home(h) @tennisclub(t)
4657 ,#+TAGS: laptop(l) pc(p)
4660 #+texinfo: @noindent
4661 You can also group together tags that are mutually exclusive by using
4664 : #+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p)
4666 #+texinfo: @noindent
4667 you indicate that at most one of =@work=, =@home=, and =@tennisclub=
4668 should be selected. Multiple such groups are allowed.
4670 #+texinfo: @noindent
4671 Do not forget to press {{{kbd(C-c C-c)}}} with the cursor in one of
4672 these lines to activate any changes.
4674 #+texinfo: @noindent
4675 To set these mutually exclusive groups in the variable
4676 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
4677 ~:endgroup~ instead of the braces. Similarly, you can use ~:newline~
4678 to indicate a line break. The previous example would be set globally
4679 by the following configuration:
4681 #+begin_src emacs-lisp
4682 (setq org-tag-alist '((:startgroup . nil)
4683 ("@work" . ?w) ("@home" . ?h)
4684 ("@tennisclub" . ?t)
4686 ("laptop" . ?l) ("pc" . ?p)))
4689 If at least one tag has a selection key then pressing {{{kbd(C-c
4690 C-c)}}} automatically presents you with a special interface, listing
4691 inherited tags, the tags of the current headline, and a list of all
4692 valid tags with corresponding keys[fn:54].
4694 Pressing keys assigned to tags adds or removes them from the list of
4695 tags in the current line. Selecting a tag in a group of mutually
4696 exclusive tags turns off any other tag from that group.
4698 In this interface, you can also use the following special keys:
4703 Enter a tag in the minibuffer, even if the tag is not in the
4704 predefined list. You can complete on all tags present in the
4705 buffer. You can also add several tags: just separate them with
4711 Clear all tags for this line.
4716 Accept the modified set.
4721 Abort without installing changes.
4726 If {{{kbd(q)}}} is not assigned to a tag, it aborts like
4732 Turn off groups of mutually exclusive tags. Use this to (as an
4733 exception) assign several tags from such a group.
4738 Toggle auto-exit after the next change (see below). If you are
4739 using expert mode, the first {{{kbd(C-c)}}} displays the
4742 #+texinfo: @noindent
4743 This method lets you assign tags to a headline with very few keys.
4744 With the above setup, you could clear the current tags and set
4745 =@home=, =laptop= and =pc= tags with just the following keys:
4746 {{{kbd(C-c C-c SPC h l p RET)}}}. Switching from =@home= to =@work=
4747 would be done with {{{kbd(C-c C-c w RET)}}} or alternatively with
4748 {{{kbd(C-c C-c C-c w)}}}. Adding the non-predefined tag =Sarah= could
4749 be done with {{{kbd(C-c C-c TAB S a r a h RET)}}}.
4751 #+vindex: org-fast-tag-selection-single-key
4752 If you find that most of the time you need only a single key press to
4753 modify your list of tags, set the variable
4754 ~org-fast-tag-selection-single-key~. Then you no longer have to press
4755 {{{kbd(RET)}}} to exit fast tag selection -- it exits after the first
4756 change. If you then occasionally need more keys, press {{{kbd(C-c)}}}
4757 to turn off auto-exit for the current tag selection process (in
4758 effect: start selection with {{{kbd(C-c C-c C-c)}}} instead of
4759 {{{kbd(C-c C-c)}}}). If you set the variable to the value ~expert~,
4760 the special window is not even shown for single-key tag selection, it
4761 comes up only when you press an extra {{{kbd(C-c)}}}.
4765 :DESCRIPTION: Create a hierarchy of tags.
4767 #+cindex: group tags
4768 #+cindex: tags, groups
4769 #+cindex: tags hierarchy
4771 Tags can be defined in hierarchies. A tag can be defined as a /group
4772 tag/ for a set of other tags. The group tag can be seen as the
4773 "broader term" for its set of tags. Defining multiple group tags and
4774 nesting them creates a tag hierarchy.
4776 One use-case is to create a taxonomy of terms (tags) that can be used
4777 to classify nodes in a document or set of documents.
4779 When you search for a group tag, it return matches for all members in
4780 the group and its subgroups. In an agenda view, filtering by a group
4781 tag displays or hide headlines tagged with at least one of the members
4782 of the group or any of its subgroups. This makes tag searches and
4783 filters even more flexible.
4785 You can set group tags by using brackets and inserting a colon between
4786 the group tag and its related tags -- beware that all whitespaces are
4787 mandatory so that Org can parse this line correctly:
4789 : #+TAGS: [ GTD : Control Persp ]
4791 In this example, =GTD= is the group tag and it is related to two other
4792 tags: =Control=, =Persp=. Defining =Control= and =Persp= as group
4793 tags creates an hierarchy of tags:
4796 ,#+TAGS: [ Control : Context Task ]
4797 ,#+TAGS: [ Persp : Vision Goal AOF Project ]
4800 That can conceptually be seen as a hierarchy of tags:
4812 You can use the ~:startgrouptag~, ~:grouptags~ and ~:endgrouptag~
4813 keyword directly when setting ~org-tag-alist~ directly:
4815 #+begin_src emacs-lisp
4816 (setq org-tag-alist '((:startgrouptag)
4830 The tags in a group can be mutually exclusive if using the same group
4831 syntax as is used for grouping mutually exclusive tags together; using
4834 : #+TAGS: { Context : @Home @Work @Call }
4836 When setting ~org-tag-alist~ you can use ~:startgroup~ and ~:endgroup~
4837 instead of ~:startgrouptag~ and ~:endgrouptag~ to make the tags
4840 Furthermore, the members of a group tag can also be regular
4841 expressions, creating the possibility of a more dynamic and rule-based
4842 tag structure. The regular expressions in the group must be specified
4843 within curly brackets. Here is an expanded example:
4846 ,#+TAGS: [ Vision : {V@.+} ]
4847 ,#+TAGS: [ Goal : {G@.+} ]
4848 ,#+TAGS: [ AOF : {AOF@.+} ]
4849 ,#+TAGS: [ Project : {P@.+} ]
4852 Searching for the tag =Project= now lists all tags also including
4853 regular expression matches for =P@.+=, and similarly for tag searches
4854 on =Vision=, =Goal= and =AOF=. For example, this would work well for
4855 a project tagged with a common project-identifier,
4856 e.g. =P@2014_OrgTags=.
4859 #+findex: org-toggle-tags-groups
4860 #+vindex: org-group-tags
4861 If you want to ignore group tags temporarily, toggle group tags
4862 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}.
4863 If you want to disable tag groups completely, set ~org-group-tags~ to
4868 :DESCRIPTION: Searching for combinations of tags.
4870 #+cindex: tag searches
4871 #+cindex: searching for tags
4873 Once a system of tags has been set up, it can be used to collect
4874 related information into special lists.
4876 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
4880 #+findex: org-match-sparse-tree
4881 Create a sparse tree with all headlines matching a tags search.
4882 With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are
4885 - {{{kbd(C-c a m)}}} (~org-tags-view~) ::
4888 #+findex: org-tags-view
4889 Create a global list of tag matches from all agenda files. See
4890 [[*Matching tags and properties]].
4892 - {{{kbd(C-c a M)}}} (~org-tags-view~) ::
4895 #+vindex: org-tags-match-list-sublevels
4896 Create a global list of tag matches from all agenda files, but
4897 check only TODO items and force checking subitems (see the option
4898 ~org-tags-match-list-sublevels~).
4900 These commands all prompt for a match string which allows basic
4901 Boolean logic like =+boss+urgent-project1=, to find entries with tags
4902 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find
4903 entries which are tagged, like =Kathy= or =Sally=. The full syntax of
4904 the search string is rich and allows also matching against TODO
4905 keywords, entry levels and properties. For a complete description
4906 with many examples, see [[*Matching tags and properties]].
4908 * Properties and columns
4910 :DESCRIPTION: Storing information about an entry.
4912 #+cindex: properties
4914 A property is a key-value pair associated with an entry. Properties
4915 can be set so they are associated with a single entry, with every
4916 entry in a tree, or with every entry in an Org file.
4918 There are two main applications for properties in Org mode. First,
4919 properties are like tags, but with a value. Imagine maintaining
4920 a file where you document bugs and plan releases for a piece of
4921 software. Instead of using tags like =release_1=, =release_2=, you
4922 can use a property, say =Release=, that in different subtrees has
4923 different values, such as =1.0= or =2.0=. Second, you can use
4924 properties to implement (very basic) database capabilities in an Org
4925 buffer. Imagine keeping track of your music CDs, where properties
4926 could be things such as the album, artist, date of release, number of
4929 Properties can be conveniently edited and viewed in column view (see
4934 :DESCRIPTION: How properties are spelled out.
4936 #+cindex: property syntax
4937 #+cindex: drawer, for properties
4939 Properties are key--value pairs. When they are associated with
4940 a single entry or with a tree they need to be inserted into a special
4941 drawer (see [[*Drawers]]) with the name =PROPERTIES=, which has to be
4942 located right below a headline, and its planning line (see [[*Deadlines
4943 and scheduling]]) when applicable. Each property is specified on
4944 a single line, with the key -- surrounded by colons -- first, and the
4945 value after it. Keys are case-insensitive. Here is an example:
4950 ,*** Goldberg Variations
4952 :Title: Goldberg Variations
4953 :Composer: J.S. Bach
4955 :Publisher: Deutsche Grammophon
4960 Depending on the value of ~org-use-property-inheritance~, a property
4961 set this way is associated either with a single entry, or with the
4962 sub-tree defined by the entry, see [[*Property inheritance]].
4964 You may define the allowed values for a particular property =Xyz= by
4965 setting a property =Xyz_ALL=. This special property is /inherited/,
4966 so if you set it in a level 1 entry, it applies to the entire tree.
4967 When allowed values are defined, setting the corresponding property
4968 becomes easier and is less prone to typing errors. For the example
4969 with the CD collection, we can pre-define publishers and the number of
4970 disks in a box like this:
4975 :NDisks_ALL: 1 2 3 4
4976 :Publisher_ALL: "Deutsche Grammophon" Philips EMI
4980 If you want to set properties that can be inherited by any entry in
4981 a file, use a line like:
4983 #+cindex: @samp{_ALL} suffix, in properties
4984 #+cindex: PROPERTY, keyword
4985 : #+PROPERTY: NDisks_ALL 1 2 3 4
4987 #+cindex: @samp{+} suffix, in properties
4988 If you want to add to the value of an existing property, append a =+=
4989 to the property name. The following results in the property =var=
4990 having the value =foo=1 bar=2=.
4993 ,#+PROPERTY: var foo=1
4994 ,#+PROPERTY: var+ bar=2
4997 It is also possible to add to the values of inherited properties. The
4998 following results in the =Genres= property having the value =Classic
4999 Baroque= under the =Goldberg Variations= subtree.
5007 ,*** Goldberg Variations
5009 :Title: Goldberg Variations
5010 :Composer: J.S. Bach
5012 :Publisher: Deutsche Grammophon
5018 Note that a property can only have one entry per drawer.
5020 #+vindex: org-global-properties
5021 Property values set with the global variable ~org-global-properties~
5022 can be inherited by all entries in all Org files.
5024 #+texinfo: @noindent
5025 The following commands help to work with properties:
5027 #+attr_texinfo: :sep ,
5028 - {{{kbd(M-TAB)}}} (~pcomplete~) ::
5032 After an initial colon in a line, complete property keys. All
5033 keys used in the current file are offered as possible
5036 - {{{kbd(C-c C-x p)}}} (~org-set-property~) ::
5039 #+findex: org-set-property
5040 Set a property. This prompts for a property name and a value.
5041 If necessary, the property drawer is created as well.
5043 - {{{kbd(C-u M-x org-insert-drawer)}}} ::
5045 #+findex: org-insert-drawer
5046 Insert a property drawer into the current entry. The drawer is
5047 inserted early in the entry, but after the lines with planning
5048 information like deadlines.
5050 - {{{kbd(C-c C-c)}}} (~org-property-action~) ::
5053 #+findex: org-property-action
5054 With the cursor in a property drawer, this executes property
5057 - {{{kbd(C-c C-c s)}}} (~org-set-property~) ::
5060 #+findex: org-set-property
5061 Set a property in the current entry. Both the property and the value
5062 can be inserted using completion.
5064 - {{{kbd(S-right)}}} (~org-property-next-allowed-values~), {{{kbd(S-left)}}} (~org-property-previous-allowed-value~) ::
5068 Switch property at point to the next/previous allowed value.
5070 - {{{kbd(C-c C-c d)}}} (~org-delete-property~) ::
5073 #+findex: org-delete-property
5074 Remove a property from the current entry.
5076 - {{{kbd(C-c C-c D)}}} (~org-delete-property-globally~) ::
5079 #+findex: org-delete-property-globally
5080 Globally remove a property, from all entries in the current file.
5082 - {{{kbd(C-c C-c c)}}} (~org-compute-property-at-point~) ::
5085 #+findex: org-compute-property-at-point
5086 Compute the property at point, using the operator and scope from
5087 the nearest column format definition.
5089 ** Special properties
5091 :DESCRIPTION: Access to other Org mode features.
5093 #+cindex: properties, special
5095 Special properties provide an alternative access method to Org mode
5096 features, like the TODO state or the priority of an entry, discussed
5097 in the previous chapters. This interface exists so that you can
5098 include these states in a column view (see [[*Column view]]), or to use
5099 them in queries. The following property names are special and should
5100 not be used as keys in the properties drawer:
5102 #+cindex: ALLTAGS, special property
5103 #+cindex: BLOCKED, special property
5104 #+cindex: CLOCKSUM, special property
5105 #+cindex: CLOCKSUM_T, special property
5106 #+cindex: CLOSED, special property
5107 #+cindex: DEADLINE, special property
5108 #+cindex: FILE, special property
5109 #+cindex: ITEM, special property
5110 #+cindex: PRIORITY, special property
5111 #+cindex: SCHEDULED, special property
5112 #+cindex: TAGS, special property
5113 #+cindex: TIMESTAMP, special property
5114 #+cindex: TIMESTAMP_IA, special property
5115 #+cindex: TODO, special property
5116 | =ALLTAGS= | All tags, including inherited ones. |
5117 | =BLOCKED= | ~t~ if task is currently blocked by children or siblings. |
5118 | =CATEGORY= | The category of an entry. |
5119 | =CLOCKSUM= | The sum of CLOCK intervals in the subtree. ~org-clock-sum~ |
5120 | | must be run first to compute the values in the current buffer. |
5121 | =CLOCKSUM_T= | The sum of CLOCK intervals in the subtree for today. |
5122 | | ~org-clock-sum-today~ must be run first to compute the |
5123 | | values in the current buffer. |
5124 | =CLOSED= | When was this entry closed? |
5125 | =DEADLINE= | The deadline time string, without the angular brackets. |
5126 | =FILE= | The filename the entry is located in. |
5127 | =ITEM= | The headline of the entry. |
5128 | =PRIORITY= | The priority of the entry, a string with a single letter. |
5129 | =SCHEDULED= | The scheduling timestamp, without the angular brackets. |
5130 | =TAGS= | The tags defined directly in the headline. |
5131 | =TIMESTAMP= | The first keyword-less timestamp in the entry. |
5132 | =TIMESTAMP_IA= | The first inactive timestamp in the entry. |
5133 | =TODO= | The TODO keyword of the entry. |
5135 ** Property searches
5137 :DESCRIPTION: Matching property values.
5139 #+cindex: properties, searching
5140 #+cindex: searching, of properties
5142 To create sparse trees and special lists with selection based on
5143 properties, the same commands are used as for tag searches (see [[*Tag
5146 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
5150 #+findex: org-match-sparse-tree
5151 Create a sparse tree with all matching entries. With
5152 a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
5155 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
5158 Create a global list of tag/property matches from all agenda
5161 - {{{kbd(C-c a M)}}} (~org-tags-view~) ::
5164 #+findex: org-tags-view
5165 #+vindex: org-tags-match-list-sublevels
5166 Create a global list of tag matches from all agenda files, but
5167 check only TODO items and force checking of subitems (see the
5168 option ~org-tags-match-list-sublevels~).
5170 The syntax for the search string is described in [[*Matching tags and
5173 There is also a special command for creating sparse trees based on a
5176 - {{{kbd(C-c / p)}}} ::
5179 Create a sparse tree based on the value of a property. This
5180 first prompts for the name of a property, and then for a value.
5181 A sparse tree is created with all entries that define this
5182 property with the given value. If you enclose the value in curly
5183 braces, it is interpreted as a regular expression and matched
5184 against the property values.
5186 ** Property inheritance
5188 :DESCRIPTION: Passing values down a tree.
5190 #+cindex: properties, inheritance
5191 #+cindex: inheritance, of properties
5193 #+vindex: org-use-property-inheritance
5194 The outline structure of Org documents lends itself to an inheritance
5195 model of properties: if the parent in a tree has a certain property,
5196 the children can inherit this property. Org mode does not turn this
5197 on by default, because it can slow down property searches
5198 significantly and is often not needed. However, if you find
5199 inheritance useful, you can turn it on by setting the variable
5200 ~org-use-property-inheritance~. It may be set to ~t~ to make all
5201 properties inherited from the parent, to a list of properties that
5202 should be inherited, or to a regular expression that matches inherited
5203 properties. If a property has the value ~nil~, this is interpreted as
5204 an explicit un-define of the property, so that inheritance search
5205 stops at this value and returns ~nil~.
5207 Org mode has a few properties for which inheritance is hard-coded, at
5208 least for the special applications for which they are used:
5212 #+cindex: COLUMNS, property
5213 The =COLUMNS= property defines the format of column view (see
5214 [[*Column view]]). It is inherited in the sense that the level where
5215 a =COLUMNS= property is defined is used as the starting point for
5216 a column view table, independently of the location in the subtree
5217 from where columns view is turned on.
5221 #+cindex: CATEGORY, property
5222 For agenda view, a category set through a =CATEGORY= property
5223 applies to the entire subtree.
5227 #+cindex: ARCHIVE, property
5228 For archiving, the =ARCHIVE= property may define the archive
5229 location for the entire subtree (see [[*Moving a tree to an archive
5234 #+cindex: LOGGING, property
5235 The =LOGGING= property may define logging settings for an entry
5236 or a subtree (see [[*Tracking TODO state changes]]).
5240 :DESCRIPTION: Tabular viewing and editing.
5243 A great way to view and edit properties in an outline tree is /column
5244 view/. In column view, each outline node is turned into a table row.
5245 Columns in this table provide access to properties of the entries.
5246 Org mode implements columns by overlaying a tabular structure over the
5247 headline of each item. While the headlines have been turned into
5248 a table row, you can still change the visibility of the outline tree.
5249 For example, you get a compact table by switching to "contents"
5250 view -- {{{kbd(S-TAB)}}} {{{kbd(S-TAB)}}}, or simply {{{kbd(c)}}}
5251 while column view is active -- but you can still open, read, and edit
5252 the entry below each headline. Or, you can switch to column view
5253 after executing a sparse tree command and in this way get a table only
5254 for the selected items. Column view also works in agenda buffers (see
5255 [[*Agenda views]]) where queries have collected selected items, possibly
5256 from a number of files.
5258 *** Defining columns
5260 :DESCRIPTION: The COLUMNS format property.
5262 #+cindex: column view, for properties
5263 #+cindex: properties, column view
5265 Setting up a column view first requires defining the columns. This is
5266 done by defining a column format line.
5268 **** Scope of column definitions
5270 :DESCRIPTION: Where defined, where valid?
5273 To define a column format for an entire file, use a line like:
5275 #+cindex: COLUMNS, keyword
5276 : #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5278 To specify a format that only applies to a specific tree, add
5279 a =COLUMNS= property to the top node of that tree, for example:
5282 ,** Top node for columns view
5284 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5288 If a =COLUMNS= property is present in an entry, it defines columns for
5289 the entry itself, and for the entire subtree below it. Since the
5290 column definition is part of the hierarchical structure of the
5291 document, you can define columns on level 1 that are general enough
5292 for all sublevels, and more specific columns further down, when you
5293 edit a deeper part of the tree.
5295 **** Column attributes
5297 :DESCRIPTION: Appearance and content of a column.
5300 A column definition sets the attributes of a column. The general
5301 definition looks like this:
5303 : %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}]
5305 #+texinfo: @noindent
5306 Except for the percent sign and the property name, all items are
5307 optional. The individual parts have the following meaning:
5309 - {{{var(WIDTH)}}} ::
5311 An integer specifying the width of the column in characters. If
5312 omitted, the width is determined automatically.
5314 - {{{var(PROPERTY)}}} ::
5316 The property that should be edited in this column. Special
5317 properties representing meta data are allowed here as well (see
5318 [[*Special properties]]).
5320 - {{{var(TITLE)}}} ::
5322 The header text for the column. If omitted, the property name is
5325 - {{{var(SUMMARY-TYPE)}}} ::
5327 The summary type. If specified, the column values for parent
5328 nodes are computed from the children[fn:55].
5330 Supported summary types are:
5332 | =+= | Sum numbers in this column. |
5333 | =+;%.1f= | Like =+=, but format result with =%.1f=. |
5334 | =$= | Currency, short for =+;%.2f=. |
5335 | =min= | Smallest number in column. |
5336 | =max= | Largest number. |
5337 | =mean= | Arithmetic mean of numbers. |
5338 | =X= | Checkbox status, =[X]= if all children are =[X]=. |
5339 | =X/= | Checkbox status, =[n/m]=. |
5340 | =X%= | Checkbox status, =[n%]=. |
5341 | =:= | Sum times, HH:MM, plain numbers are hours. |
5342 | =:min= | Smallest time value in column. |
5343 | =:max= | Largest time value. |
5344 | =:mean= | Arithmetic mean of time values. |
5345 | =@min= | Minimum age[fn:56] (in days/hours/mins/seconds). |
5346 | =@max= | Maximum age (in days/hours/mins/seconds). |
5347 | =@mean= | Arithmetic mean of ages (in days/hours/mins/seconds). |
5348 | =est+= | Add low-high estimates. |
5350 #+texinfo: @noindent
5351 #+vindex: org-columns-summary-types
5352 You can also define custom summary types by setting
5353 ~org-columns-summary-types~.
5355 The =est+= summary type requires further explanation. It is used for
5356 combining estimates, expressed as low-high ranges. For example,
5357 instead of estimating a particular task will take 5 days, you might
5358 estimate it as 5-6 days if you're fairly confident you know how much
5359 work is required, or 1-10 days if you do not really know what needs to
5360 be done. Both ranges average at 5.5 days, but the first represents
5361 a more predictable delivery.
5363 When combining a set of such estimates, simply adding the lows and
5364 highs produces an unrealistically wide result. Instead, =est+= adds
5365 the statistical mean and variance of the sub-tasks, generating a final
5366 estimate from the sum. For example, suppose you had ten tasks, each
5367 of which was estimated at 0.5 to 2 days of work. Straight addition
5368 produces an estimate of 5 to 20 days, representing what to expect if
5369 everything goes either extremely well or extremely poorly. In
5370 contrast, =est+= estimates the full job more realistically, at 10-15
5373 Here is an example for a complete columns definition, along with
5374 allowed values[fn:57].
5377 :COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \
5378 %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
5379 :Owner_ALL: Tammy Mark Karl Lisa Don
5380 :Status_ALL: "In progress" "Not started yet" "Finished" ""
5381 :Approved_ALL: "[ ]" "[X]"
5384 #+texinfo: @noindent
5385 The first column, =%25ITEM=, means the first 25 characters of the item
5386 itself, i.e., of the headline. You probably always should start the
5387 column definition with the =ITEM= specifier. The other specifiers
5388 create columns =Owner= with a list of names as allowed values, for
5389 =Status= with four different possible values, and for a checkbox field
5390 =Approved=. When no width is given after the =%= character, the
5391 column is exactly as wide as it needs to be in order to fully display
5392 all values. The =Approved= column does have a modified title
5393 (=Approved?=, with a question mark). Summaries are created for the
5394 =Time_Estimate= column by adding time duration expressions like HH:MM,
5395 and for the =Approved= column, by providing an =[X]= status if all
5396 children have been checked. The =CLOCKSUM= and =CLOCKSUM_T= columns
5397 are special, they lists the sums of CLOCK intervals in the subtree,
5398 either for all clocks or just for today.
5400 *** Using column view
5402 :DESCRIPTION: How to create and use column view.
5405 **** Turning column view on or off
5410 - {{{kbd(C-c C-x C-c)}}} (~org-columns~) ::
5412 #+kindex: C-c C-x C-c
5413 #+vindex: org-columns
5414 #+vindex: org-columns-default-format
5415 Turn on column view. If the cursor is before the first headline
5416 in the file, column view is turned on for the entire file, using
5417 the =#+COLUMNS= definition. If the cursor is somewhere inside
5418 the outline, this command searches the hierarchy, up from point,
5419 for a =COLUMNS= property that defines a format. When one is
5420 found, the column view table is established for the tree starting
5421 at the entry that contains the =COLUMNS= property. If no such
5422 property is found, the format is taken from the =#+COLUMNS= line
5423 or from the variable ~org-columns-default-format~, and column
5424 view is established for the current entry and its subtree.
5426 - {{{kbd(r)}}} or {{{kbd(g)}}} (~org-columns-redo~) ::
5430 #+findex: org-columns-redo
5431 Recreate the column view, to include recent changes made in the
5434 - {{{kbd(q)}}} (~org-columns-quit~) ::
5437 #+findex: org-columns-quit
5445 #+attr_texinfo: :sep and
5446 - {{{kbd(left)}}}, {{{kbd(right)}}}, {{{kbd(up)}}}, {{{kbd(down)}}} ::
5448 Move through the column view from field to field.
5450 - {{{kbd(1..9\,0)}}} ::
5453 Directly select the Nth allowed value, {{{kbd(0)}}} selects the
5456 - {{{kbd(n)}}} or {{{kbd(S-right)}}} (~org-columns-next-allowed-value~) and {{{kbd(p)}}} or {{{kbd(S-left)}}} (~org-columns-previous-allowed-value~) ::
5462 #+findex: org-columns-next-allowed-value
5463 #+findex: org-columns-previous-allowed-value
5464 Switch to the next/previous allowed value of the field. For
5465 this, you have to have specified allowed values for a property.
5467 - {{{kbd(e)}}} (~org-columns-edit-value~) ::
5470 #+findex: org-columns-edit-value
5471 Edit the property at point. For the special properties, this
5472 invokes the same interface that you normally use to change that
5473 property. For example, the tag completion or fast selection
5474 interface pops up when editing a =TAGS= property.
5476 - {{{kbd(C-c C-c)}}} (~org-columns-set-tags-or-toggle~) ::
5479 #+findex: org-columns-set-tags-or-toggle
5480 When there is a checkbox at point, toggle it.
5482 - {{{kbd(v)}}} (~org-columns-show-value~) ::
5485 #+findex: org-columns-show-value
5486 View the full value of this property. This is useful if the
5487 width of the column is smaller than that of the value.
5489 - {{{kbd(a)}}} (~org-columns-edit-allowed~) ::
5492 #+findex: org-columns-edit-allowed
5493 Edit the list of allowed values for this property. If the list
5494 is found in the hierarchy, the modified values is stored there.
5495 If no list is found, the new value is stored in the first entry
5496 that is part of the current column view.
5498 **** Modifying column view on-the-fly:
5503 #+attr_texinfo: :sep and
5504 - {{{kbd(<)}}} (~org-columns-narrow~) and {{{kbd(>)}}} (~org-columns-widen~) ::
5508 #+findex: org-columns-narrow
5509 #+findex: org-columns-widen
5510 Make the column narrower/wider by one character.
5512 - {{{kbd(S-M-right)}}} (~org-columns-new~) ::
5515 #+findex: org-columns-new
5516 Insert a new column, to the left of the current column.
5518 - {{{kbd(S-M-left)}}} (~org-columns-delete~) ::
5521 #+findex: org-columns-delete
5522 Delete the current column.
5524 *** Capturing column view
5526 :DESCRIPTION: A dynamic block for column view.
5529 Since column view is just an overlay over a buffer, it cannot be
5530 exported or printed directly. If you want to capture a column view,
5531 use a =columnview= dynamic block (see [[*Dynamic blocks]]). The frame of
5532 this block looks like this:
5534 #+cindex: BEGIN columnview
5537 ,#+BEGIN: columnview :hlines 1 :id "label"
5542 #+texinfo: @noindent
5543 This dynamic block has the following parameters:
5547 This is the most important parameter. Column view is a feature
5548 that is often localized to a certain (sub)tree, and the capture
5549 block might be at a different location in the file. To identify
5550 the tree whose view to capture, you can use four values:
5554 Use the tree in which the capture block is located.
5558 Make a global view, including all headings in the file.
5560 - =file:FILENAME= ::
5562 Run column view at the top of the {{{var(FILENAME)}}} file
5566 #+cindex: ID, property
5567 Call column view in the tree that has an =ID= property with
5568 the value {{{var(LABEL)}}}. You can use {{{kbd(M-x
5569 org-id-copy)}}} to create a globally unique ID for the
5570 current entry and copy it to the kill-ring.
5574 When ~t~, insert an hline after every line. When a number N,
5575 insert an hline before each headline with level ~<= N~.
5579 When non-~nil~, force column groups to get vertical lines.
5583 When set to a number, do not capture entries below this level.
5585 - =:skip-empty-rows= ::
5587 When non-~nil~, skip rows where the only non-empty specifier of
5588 the column view is =ITEM=.
5592 When non-~nil~, indent each =ITEM= field according to its level.
5594 #+texinfo: @noindent
5595 The following commands insert or update the dynamic block:
5597 - {{{kbd(C-c C-x i)}}} (~org-insert-columns-dblock~) ::
5600 #+findex: org-insert-columns-dblock
5601 Insert a dynamic block capturing a column view. Prompt for the
5602 scope or ID of the view.
5604 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
5607 #+kindex: C-c C-x C-u
5608 #+findex: org-dblock-update
5609 Update dynamic block at point. The cursor needs to be in the
5610 =#+BEGIN= line of the dynamic block.
5612 - {{{kbd(C-u C-c C-x C-u)}}} (~org-update-all-dblocks~) ::
5614 #+kindex: C-u C-c C-x C-u
5615 Update all dynamic blocks (see [[*Dynamic blocks]]). This is useful
5616 if you have several clock table blocks, column-capturing blocks
5617 or other dynamic blocks in a buffer.
5619 You can add formulas to the column view table and you may add plotting
5620 instructions in front of the table -- these survive an update of the
5621 block. If there is a =TBLFM= keyword after the table, the table is
5622 recalculated automatically after an update.
5624 An alternative way to capture and process property values into a table
5625 is provided by Eric Schulte's =org-collector.el= which is
5626 a contributed package[fn:58]. It provides a general API to collect
5627 properties from entries in a certain scope, and arbitrary Lisp
5628 expressions to process these values before inserting them into a table
5633 :DESCRIPTION: Making items useful for planning.
5634 :ALT_TITLE: Dates and Times
5639 #+cindex: date stamp
5641 To assist project planning, TODO items can be labeled with a date
5642 and/or a time. The specially formatted string carrying the date and
5643 time information is called a /timestamp/ in Org mode. This may be
5644 a little confusing because timestamp is often used as indicating when
5645 something was created or last changed. However, in Org mode this term
5646 is used in a much wider sense.
5648 ** Timestamps, deadlines, and scheduling
5650 :DESCRIPTION: Assigning a time to a tree entry.
5651 :ALT_TITLE: Timestamps
5653 #+cindex: timestamps
5654 #+cindex: ranges, time
5655 #+cindex: date stamps
5657 #+cindex: scheduling
5659 A timestamp is a specification of a date (possibly with a time or
5660 a range of times) in a special format, either =<2003-09-16 Tue>= or
5661 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:59].
5662 A timestamp can appear anywhere in the headline or body of an Org tree
5663 entry. Its presence causes entries to be shown on specific dates in
5664 the agenda (see [[*Weekly/daily agenda]]). We distinguish:
5666 - Plain timestamp; Event; Appointment ::
5669 #+cindex: appointment
5670 A simple timestamp just assigns a date/time to an item. This is
5671 just like writing down an appointment or event in a paper agenda.
5672 In the timeline and agenda displays, the headline of an entry
5673 associated with a plain timestamp is shown exactly on that date.
5676 ,* Meet Peter at the movies
5677 <2006-11-01 Wed 19:15>
5678 ,* Discussion on climate change
5679 <2006-11-02 Thu 20:00-22:00>
5682 - Timestamp with repeater interval ::
5684 #+cindex: timestamp, with repeater interval
5685 A timestamp may contain a /repeater interval/, indicating that it
5686 applies not only on the given date, but again and again after
5687 a certain interval of N days (d), weeks (w), months (m), or years
5688 (y). The following shows up in the agenda every Wednesday:
5691 ,* Pick up Sam at school
5692 <2007-05-16 Wed 12:30 +1w>
5695 - Diary-style sexp entries ::
5697 #+cindex: diary style timestamps
5698 #+cindex: sexp timestamps
5699 For more complex date specifications, Org mode supports using the
5700 special sexp diary entries implemented in the Emacs
5701 calendar/diary package[fn:60]. For example, with optional time:
5704 ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5705 <%%(org-float t 4 2)>
5708 - Time/Date range ::
5711 #+cindex: date range
5712 Two timestamps connected by =--= denote a range. The headline is
5713 shown on the first and last day of the range, and on any dates
5714 that are displayed and fall in the range. Here is an example:
5717 ,** Meeting in Amsterdam
5718 <2004-08-23 Mon>--<2004-08-26 Thu>
5721 - Inactive timestamp ::
5723 #+cindex: timestamp, inactive
5724 #+cindex: inactive timestamp
5725 Just like a plain timestamp, but with square brackets instead of
5726 angular ones. These timestamps are inactive in the sense that
5727 they do /not/ trigger an entry to show up in the agenda.
5730 ,* Gillian comes late for the fifth time
5734 ** Creating timestamps
5736 :DESCRIPTION: Commands to insert timestamps.
5739 For Org mode to recognize timestamps, they need to be in the specific
5740 format. All commands listed below produce timestamps in the correct
5743 #+attr_texinfo: :sep ,
5744 - {{{kbd(C-c .)}}} (~org-time-stamp~) ::
5747 #+findex: org-time-stamp
5748 Prompt for a date and insert a corresponding timestamp. When the
5749 cursor is at an existing timestamp in the buffer, the command is
5750 used to modify this timestamp instead of inserting a new one.
5751 When this command is used twice in succession, a time range is
5754 - {{{kbd(C-c !)}}} (~org-time-stamp-inactive~) ::
5757 #+findex: org-time-stamp-inactive
5758 Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does
5759 not cause an agenda entry.
5761 - {{{kbd(C-u C-c .)}}}, {{{kbd(C-u C-c !)}}} ::
5766 #+vindex: org-time-stamp-rounding-minutes
5767 Like {{{kbd(C-c .)}}} and {{{kbd(C-c !)}}}, but use the
5768 alternative format which contains date and time. The default
5769 time can be rounded to multiples of 5 minutes, see the option
5770 ~org-time-stamp-rounding-minutes~.
5772 - {{{kbd(C-c C-c)}}} ::
5775 Normalize timestamp, insert/fix day name if missing or wrong.
5777 - {{{kbd(C-c <)}}} (~org-date-from-calendar~) ::
5780 #+findex: org-date-from-calendar
5781 Insert a timestamp corresponding to the cursor date in the Calendar.
5783 - {{{kbd(C-c >)}}} (~org-goto-calendar~) ::
5786 #+findex: org-goto-calendar
5787 Access the Emacs calendar for the current date. If there is a
5788 timestamp in the current line, go to the corresponding date instead.
5790 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
5793 #+findex: org-open-at-point
5794 Access the agenda for the date given by the timestamp or -range
5795 at point (see [[*Weekly/daily agenda]]).
5797 - {{{kbd(S-left)}}} (~org-timestamp-down-day~), {{{kbd(S-right)}}} (~org-timestamp-up-day~) ::
5801 #+findex: org-timestamp-down-day
5802 #+findex: org-timestamp-up-day
5803 Change date at cursor by one day. These key bindings conflict
5804 with shift-selection and related modes (see [[*Packages that
5805 conflict with Org mode]]).
5807 - {{{kbd(S-up)}}} (~org-timestamp-up~), {{{kbd(S-down)}}} (~org-timestamp-down~) ::
5810 Change the item under the cursor in a timestamp. The cursor can
5811 be on a year, month, day, hour or minute. When the timestamp
5812 contains a time range like =15:30-16:30=, modifying the first
5813 time also shifts the second, shifting the time block with
5814 constant length. To change the length, modify the second time.
5815 Note that if the cursor is in a headline and not at a timestamp,
5816 these same keys modify the priority of an item. (see
5817 [[*Priorities]]). The key bindings also conflict with
5818 shift-selection and related modes (see [[*Packages that conflict
5821 - {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
5824 #+findex: org-evaluate-time-range
5825 #+cindex: evaluate time range
5826 Evaluate a time range by computing the difference between start
5827 and end. With a prefix argument, insert result after the time
5828 range (in a table: into the following column).
5830 *** The date/time prompt
5832 :DESCRIPTION: How Org mode helps you enter dates and times.
5834 #+cindex: date, reading in minibuffer
5835 #+cindex: time, reading in minibuffer
5837 #+vindex: org-read-date-prefer-future
5838 When Org mode prompts for a date/time, the default is shown in default
5839 date/time format, and the prompt therefore seems to ask for a specific
5840 format. But it in fact accepts date/time information in a variety of
5841 formats. Generally, the information should start at the beginning of
5842 the string. Org mode finds whatever information is in there and
5843 derives anything you have not specified from the /default date and
5844 time/. The default is usually the current date and time, but when
5845 modifying an existing timestamp, or when entering the second stamp of
5846 a range, it is taken from the stamp in the buffer. When filling in
5847 information, Org mode assumes that most of the time you want to enter
5848 a date in the future: if you omit the month/year and the given
5849 day/month is /before/ today, it assumes that you mean a future
5850 date[fn:61]. If the date has been automatically shifted into the
5851 future, the time prompt shows this with =(=>F)=.
5853 For example, let's assume that today is *June 13, 2006*. Here is how
5854 various inputs are interpreted, the items filled in by Org mode are in
5857 | =3-2-5= | \rArr{} 2003-02-05 |
5858 | =2/5/3= | \rArr{} 2003-02-05 |
5859 | =14= | \rArr{} *2006*-*06*-14 |
5860 | =12= | \rArr{} *2006*-*07*-12 |
5861 | =2/5= | \rArr{} *2007*-02-05 |
5862 | =Fri= | \rArr{} nearest Friday (default date or later) |
5863 | =sep 15= | \rArr{} *2006*-09-15 |
5864 | =feb 15= | \rArr{} *2007*-02-15 |
5865 | =sep 12 9= | \rArr{} 2009-09-12 |
5866 | =12:45= | \rArr{} *2006*-*06*-*13* 12:45 |
5867 | =22 sept 0:34= | \rArr{} *2006*-09-22 0:34 |
5868 | =w4= | \rArr{} ISO week for of the current year *2006* |
5869 | =2012 w4 fri= | \rArr{} Friday of ISO week 4 in 2012 |
5870 | =2012-w04-5= | \rArr{} Same as above |
5872 Furthermore you can specify a relative date by giving, as the /first/
5873 thing in the input: a plus/minus sign, a number and a letter -- =d=,
5874 =w=, =m= or =y= -- to indicate change in days, weeks, months, or
5875 years. With a single plus or minus, the date is always relative to
5876 today. With a double plus or minus, it is relative to the default
5877 date. If instead of a single letter, you use the abbreviation of day
5878 name, the date is the Nth such day, e.g.:
5880 | =+0= | \rArr{} today |
5881 | =.= | \rArr{} today |
5882 | =+4d= | \rArr{} four days from today |
5883 | =+4= | \rArr{} same as +4d |
5884 | =+2w= | \rArr{} two weeks from today |
5885 | =++5= | \rArr{} five days from default date |
5886 | =+2tue= | \rArr{} second Tuesday from now |
5888 #+vindex: parse-time-months
5889 #+vindex: parse-time-weekdays
5890 The function understands English month and weekday abbreviations. If
5891 you want to use un-abbreviated names and/or other languages, configure
5892 the variables ~parse-time-months~ and ~parse-time-weekdays~.
5894 #+vindex: org-read-date-force-compatible-dates
5895 Not all dates can be represented in a given Emacs implementation. By
5896 default Org mode forces dates into the compatibility range 1970--2037
5897 which works on all Emacs implementations. If you want to use dates
5898 outside of this range, read the docstring of the variable
5899 ~org-read-date-force-compatible-dates~.
5901 You can specify a time range by giving start and end times or by
5902 giving a start time and a duration (in HH:MM format). Use one or two
5903 dash(es) as the separator in the former case and use =+= as the
5904 separator in the latter case, e.g.:
5906 | =11am-1:15pm= | \rArr{} 11:00-13:15 |
5907 | =11am--1:15pm= | \rArr{} same as above |
5908 | =11am+2:15= | \rArr{} same as above |
5910 #+cindex: calendar, for selecting date
5911 #+vindex: org-popup-calendar-for-date-prompt
5912 Parallel to the minibuffer prompt, a calendar is popped up[fn:62].
5913 When you exit the date prompt, either by clicking on a date in the
5914 calendar, or by pressing {{{kbd(RET)}}}, the date selected in the
5915 calendar is combined with the information entered at the prompt. You
5916 can control the calendar fully from the minibuffer:
5930 #+attr_texinfo: :columns 0.25 0.55
5931 | {{{kbd(RET)}}} | Choose date at cursor in calendar. |
5932 | {{{kbd(mouse-1)}}} | Select date by clicking on it. |
5933 | {{{kbd(S-right)}}} | One day forward. |
5934 | {{{kbd(S-left)}}} | One day backward. |
5935 | {{{kbd(S-down)}}} | One week forward. |
5936 | {{{kbd(S-up)}}} | One week backward. |
5937 | {{{kbd(M-S-right)}}} | One month forward. |
5938 | {{{kbd(M-S-left)}}} | One month backward. |
5939 | {{{kbd(>)}}} | Scroll calendar forward by one month. |
5940 | {{{kbd(<)}}} | Scroll calendar backward by one month. |
5941 | {{{kbd(M-v)}}} | Scroll calendar forward by 3 months. |
5942 | {{{kbd(C-v)}}} | Scroll calendar backward by 3 months. |
5944 #+vindex: org-read-date-display-live
5945 The actions of the date/time prompt may seem complex, but I assure you
5946 they will grow on you, and you will start getting annoyed by pretty
5947 much any other way of entering a date/time out there. To help you
5948 understand what is going on, the current interpretation of your input
5949 is displayed live in the minibuffer[fn:63].
5951 *** Custom time format
5953 :DESCRIPTION: Making dates look different.
5955 #+cindex: custom date/time format
5956 #+cindex: time format, custom
5957 #+cindex: date format, custom
5959 #+vindex: org-display-custom-times
5960 #+vindex: org-time-stamp-custom-formats
5961 Org mode uses the standard ISO notation for dates and times as it is
5962 defined in ISO 8601. If you cannot get used to this and require
5963 another representation of date and time to keep you happy, you can get
5964 it by customizing the variables ~org-display-custom-times~ and
5965 ~org-time-stamp-custom-formats~.
5967 - {{{kbd(C-c C-x C-t)}}} (~org-toggle-time-stamp-overlays~) ::
5969 #+kindex: C-c C-x C-t
5970 #+findex: org-toggle-time-stamp-overlays
5971 Toggle the display of custom formats for dates and times.
5973 #+texinfo: @noindent
5974 Org mode needs the default format for scanning, so the custom
5975 date/time format does not /replace/ the default format. Instead, it
5976 is put /over/ the default format using text properties. This has the
5977 following consequences:
5979 - You cannot place the cursor onto a timestamp anymore, only before or
5982 - The {{{kbd(S-up)}}} and {{{kbd(S-down)}}} keys can no longer be used
5983 to adjust each component of a timestamp. If the cursor is at the
5984 beginning of the stamp, {{{kbd(S-up)}}} and {{{kbd(S-down)}}} change
5985 the stamp by one day, just like {{{kbd(S-left)}}}
5986 {{{kbd(S-right)}}}. At the end of the stamp, change the time by one
5989 - If the timestamp contains a range of clock times or a repeater,
5990 these are not overlaid, but remain in the buffer as they were.
5992 - When you delete a timestamp character-by-character, it only
5993 disappears from the buffer after /all/ (invisible) characters
5994 belonging to the ISO timestamp have been removed.
5996 - If the custom timestamp format is longer than the default and you
5997 are using dates in tables, table alignment will be messed up. If
5998 the custom format is shorter, things do work as expected.
6000 ** Deadlines and scheduling
6002 :DESCRIPTION: Planning your work.
6005 A timestamp may be preceded by special keywords to facilitate
6006 planning. Both the timestamp and the keyword have to be positioned
6007 immediately after the task they refer to.
6012 Meaning: the task (most likely a TODO item, though not
6013 necessarily) is supposed to be finished on that date.
6015 #+vindex: org-deadline-warning-days
6016 On the deadline date, the task is listed in the agenda. In
6017 addition, the agenda for /today/ carries a warning about the
6018 approaching or missed deadline, starting
6019 ~org-deadline-warning-days~ before the due date, and continuing
6020 until the entry is marked DONE. An example:
6023 ,*** TODO write article about the Earth for the Guide
6024 DEADLINE: <2004-02-29 Sun>
6025 The editor in charge is [[bbdb:Ford Prefect]]
6028 #+vindex: org-agenda-skip-deadline-prewarning-if-scheduled
6029 You can specify a different lead time for warnings for a specific
6030 deadlines using the following syntax. Here is an example with
6031 a warning period of 5 days =DEADLINE: <2004-02-29 Sun -5d>=.
6032 This warning is deactivated if the task gets scheduled and you
6033 set ~org-agenda-skip-deadline-prewarning-if-scheduled~ to ~t~.
6038 Meaning: you are planning to start working on that task on the
6041 #+vindex: org-agenda-skip-scheduled-if-done
6042 The headline is listed under the given date[fn:64]. In addition,
6043 a reminder that the scheduled date has passed is present in the
6044 compilation for /today/, until the entry is marked DONE, i.e.,
6045 the task is automatically forwarded until completed.
6048 ,*** TODO Call Trillian for a date on New Years Eve.
6049 SCHEDULED: <2004-12-25 Sat>
6052 #+vindex: org-scheduled-delay-days
6053 #+vindex: org-agenda-skip-scheduled-delay-if-deadline
6054 If you want to /delay/ the display of this task in the agenda,
6055 use =SCHEDULED: <2004-12-25 Sat -2d>=: the task is still
6056 scheduled on the 25th but will appear two days later. In case
6057 the task contains a repeater, the delay is considered to affect
6058 all occurrences; if you want the delay to only affect the first
6059 scheduled occurrence of the task, use =--2d= instead. See
6060 ~org-scheduled-delay-days~ and
6061 ~org-agenda-skip-scheduled-delay-if-deadline~ for details on how
6062 to control this globally or per agenda.
6064 #+texinfo: @noindent
6065 *Important:* Scheduling an item in Org mode should /not/ be
6066 understood in the same way that we understand /scheduling
6067 a meeting/. Setting a date for a meeting is just a simple
6068 appointment, you should mark this entry with a simple plain
6069 timestamp, to get this item shown on the date where it applies.
6070 This is a frequent misunderstanding by Org users. In Org mode,
6071 /scheduling/ means setting a date when you want to start working
6074 You may use timestamps with repeaters in scheduling and deadline
6075 entries. Org mode issues early and late warnings based on the
6076 assumption that the timestamp represents the /nearest instance/ of the
6077 repeater. However, the use of diary S-exp entries like
6079 : <%%(org-float t 42)>
6081 #+texinfo: @noindent
6082 in scheduling and deadline timestamps is limited. Org mode does not
6083 know enough about the internals of each S-exp function to issue early
6084 and late warnings. However, it shows the item on each day where the
6085 S-exp entry matches.
6087 *** Inserting deadlines or schedules
6089 :DESCRIPTION: Planning items.
6090 :ALT_TITLE: Inserting deadline/schedule
6093 The following commands allow you to quickly insert a deadline or to
6094 schedule an item:[fn:65]
6096 - {{{kbd(C-c C-d)}}} (~org-deadline~) ::
6099 #+findex: org-deadline
6100 #+vindex: org-log-redeadline
6101 Insert =DEADLINE= keyword along with a stamp. The insertion
6102 happens in the line directly following the headline. Remove any
6103 =CLOSED= timestamp . When called with a prefix argument, also
6104 remove any existing deadline from the entry. Depending on the
6105 variable ~org-log-redeadline~, take a note when changing an
6106 existing deadline[fn:66].
6108 - {{{kbd(C-c C-s)}}} (~org-schedule~) ::
6111 #+findex: org-schedule
6112 #+vindex: org-log-reschedule
6113 Insert =SCHEDULED= keyword along with a stamp. The insertion
6114 happens in the line directly following the headline. Remove any
6115 =CLOSED= timestamp. When called with a prefix argument, also
6116 remove the scheduling date from the entry. Depending on the
6117 variable ~org-log-reschedule~, take a note when changing an
6118 existing scheduling time[fn:67].
6120 - {{{kbd(C-c C-x C-k)}}} (~org-mark-entry-for-agenda-action~) ::
6122 #+kindex: C-c C-x C-k
6125 #+findex: org-mark-entry-for-agenda-action
6126 Mark the current entry for agenda action. After you have marked
6127 the entry like this, you can open the agenda or the calendar to
6128 find an appropriate date. With the cursor on the selected date,
6129 press {{{kbd(k s)}}} or {{{kbd(k d)}}} to schedule the marked
6132 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
6135 #+findex: org-check-deadlines
6136 #+cindex: sparse tree, for deadlines
6137 #+vindex: org-deadline-warning-days
6138 Create a sparse tree with all deadlines that are either past-due,
6139 or which will become due within ~org-deadline-warning-days~.
6140 With {{{kbd(C-u)}}} prefix, show all deadlines in the file. With
6141 a numeric prefix, check that many days. For example, {{{kbd(C-1
6142 C-c / d)}}} shows all deadlines due tomorrow.
6144 - {{{kbd(C-c / b)}}}, ~org-check-before-date~ ::
6147 #+findex: org-check-before-date
6148 Sparse tree for deadlines and scheduled items before a given
6151 - {{{kbd(C-c / a)}}}, ~org-check-after-date~ ::
6154 #+findex: org-check-after-date
6155 Sparse tree for deadlines and scheduled items after a given date.
6157 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
6158 by indicating a relative time e.g., =+1d= sets the date to the next
6159 day after today, and =--1w= sets the date to the previous week before
6160 any current timestamp.
6164 :DESCRIPTION: Items that show up again and again.
6166 #+cindex: tasks, repeated
6167 #+cindex: repeated tasks
6169 Some tasks need to be repeated again and again. Org mode helps to
6170 organize such tasks using a so-called repeater in a =DEADLINE=,
6171 =SCHEDULED=, or plain timestamp. In the following example:
6174 ,** TODO Pay the rent
6175 DEADLINE: <2005-10-01 Sat +1m>
6179 the =+1m= is a repeater; the intended interpretation is that the task
6180 has a deadline on =<2005-10-01>= and repeats itself every (one) month
6181 starting from that time. You can use yearly, monthly, weekly, daily
6182 and hourly repeat cookies by using the ~y/w/m/d/h~ letters. If you
6183 need both a repeater and a special warning period in a deadline entry,
6184 the repeater should come first and the warning period last: =DEADLINE:
6185 <2005-10-01 Sat +1m -3d>=.
6187 #+vindex: org-todo-repeat-to-state
6188 Deadlines and scheduled items produce entries in the agenda when they
6189 are over-due, so it is important to be able to mark such an entry as
6190 completed once you have done so. When you mark a =DEADLINE= or
6191 a =SCHEDULED= with the TODO keyword =DONE=, it no longer produces
6192 entries in the agenda. The problem with this is, however, is that
6193 then also the /next/ instance of the repeated entry will not be
6194 active. Org mode deals with this in the following way: when you try
6195 to mark such an entry DONE, using {{{kbd(C-c C-t)}}}, it shifts the
6196 base date of the repeating timestamp by the repeater interval, and
6197 immediately sets the entry state back to TODO[fn:68]. In the example
6198 above, setting the state to DONE would actually switch the date like
6202 ,** TODO Pay the rent
6203 DEADLINE: <2005-11-01 Tue +1m>
6206 To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}},
6207 i.e., ~org-todo~ with a numeric prefix argument of =-1=.
6209 #+vindex: org-log-repeat
6210 A timestamp[fn:69] is added under the deadline, to keep a record that
6211 you actually acted on the previous instance of this deadline.
6213 As a consequence of shifting the base date, this entry is no longer
6214 visible in the agenda when checking past dates, but all future
6215 instances will be visible.
6217 With the =+1m= cookie, the date shift is always exactly one month. So
6218 if you have not paid the rent for three months, marking this entry
6219 DONE still keeps it as an overdue deadline. Depending on the task,
6220 this may not be the best way to handle it. For example, if you forgot
6221 to call your father for 3 weeks, it does not make sense to call him
6222 3 times in a single day to make up for it. Finally, there are tasks
6223 like changing batteries which should always repeat a certain time
6224 /after/ the last time you did it. For these tasks, Org mode has
6225 special repeaters =++= and =.+=. For example:
6228 ,** TODO Call Father
6229 DEADLINE: <2008-02-10 Sun ++1w>
6230 Marking this DONE shifts the date by at least one week, but also
6231 by as many weeks as it takes to get this date into the future.
6232 However, it stays on a Sunday, even if you called and marked it
6235 ,** TODO Empty kitchen trash
6236 DEADLINE: <2008-02-08 Fri 20:00 ++1d>
6237 Marking this DONE shifts the date by at least one day, and also
6238 by as many days as it takes to get the timestamp into the future.
6239 Since there is a time in the timestamp, the next deadline in the
6240 future will be on today's date if you complete the task before
6243 ,** TODO Check the batteries in the smoke detectors
6244 DEADLINE: <2005-11-01 Tue .+1m>
6245 Marking this DONE will shift the date to one month after today.
6248 #+vindex: org-agenda-skip-scheduled-if-deadline-is-shown
6249 You may have both scheduling and deadline information for a specific
6250 task. If the repeater is set for the scheduling information only, you
6251 probably want the repeater to be ignored after the deadline. If so,
6252 set the variable ~org-agenda-skip-scheduled-if-deadline-is-shown~ to
6253 ~repeated-after-deadline~. However, any scheduling information
6254 without a repeater is no longer relevant once the task is done, and
6255 thus, removed upon repeating the task. If you want both scheduling
6256 and deadline information to repeat after the same interval, set the
6257 same repeater for both timestamps.
6259 An alternative to using a repeater is to create a number of copies of
6260 a task subtree, with dates shifted in each copy. The command
6261 {{{kbd(C-c C-x c)}}} was created for this purpose; it is described in
6262 [[*Structure editing]].
6264 ** Clocking work time
6266 :DESCRIPTION: Tracking how long you spend on a task.
6268 #+cindex: clocking time
6269 #+cindex: time clocking
6271 Org mode allows you to clock the time you spend on specific tasks in
6272 a project. When you start working on an item, you can start the
6273 clock. When you stop working on that task, or when you mark the task
6274 done, the clock is stopped and the corresponding time interval is
6275 recorded. It also computes the total time spent on each
6276 subtree[fn:70] of a project. And it remembers a history or tasks
6277 recently clocked, to that you can jump quickly between a number of
6278 tasks absorbing your time.
6280 To save the clock history across Emacs sessions, use:
6282 #+begin_src emacs-lisp
6283 (setq org-clock-persist 'history)
6284 (org-clock-persistence-insinuate)
6287 #+vindex: org-clock-persist
6288 When you clock into a new task after resuming Emacs, the incomplete
6289 clock[fn:71] is retrieved (see [[*Resolving idle time]]) and you are
6290 prompted about what to do with it.
6292 *** Clocking commands
6294 :DESCRIPTION: Starting and stopping a clock.
6297 #+attr_texinfo: :sep ,
6298 - {{{kbd(C-c C-x C-i)}}} (~org-clock-in~) ::
6300 #+kindex: C-c C-x C-i
6301 #+findex: org-clock-in
6302 #+vindex: org-clock-into-drawer
6303 #+vindex: org-clock-continuously
6304 #+cindex: LOG_INTO_DRAWER, property
6305 Start the clock on the current item (clock-in). This inserts the
6306 CLOCK keyword together with a timestamp. If this is not the
6307 first clocking of this item, the multiple CLOCK lines are wrapped
6308 into a =LOGBOOK= drawer (see also the variable
6309 ~org-clock-into-drawer~). You can also overrule the setting of
6310 this variable for a subtree by setting a =CLOCK_INTO_DRAWER= or
6311 =LOG_INTO_DRAWER= property. When called with a {{{kbd(C-u)}}}
6312 prefix argument, select the task from a list of recently clocked
6313 tasks. With two {{{kbd(C-u C-u)}}} prefixes, clock into the task
6314 at point and mark it as the default task; the default task is
6315 always be available with letter {{{kbd(d)}}} when selecting
6316 a clocking task. With three {{{kbd(C-u C-u C-u)}}} prefixes,
6317 force continuous clocking by starting the clock when the last
6320 #+cindex: CLOCK_MODELINE_TOTAL, property
6321 #+cindex: LAST_REPEAT, property
6322 #+vindex: org-clock-modeline-total
6323 #+vindex: org-clock-in-prepare-hook
6324 While the clock is running, Org shows the current clocking time
6325 in the mode line, along with the title of the task. The clock
6326 time shown is all time ever clocked for this task and its
6327 children. If the task has an effort estimate (see [[*Effort
6328 estimates]]), the mode line displays the current clocking time
6329 against it[fn:72]. If the task is a repeating one (see [[*Repeated
6330 tasks]]), show only the time since the last reset of the
6331 task[fn:73]. You can exercise more control over show time with
6332 the =CLOCK_MODELINE_TOTAL= property. It may have the values
6333 =current= to show only the current clocking instance, =today= to
6334 show all time clocked on this tasks today -- see also the
6335 variable ~org-extend-today-until~, ~all~ to include all time, or
6336 ~auto~ which is the default[fn:74]. Clicking with
6337 {{{kbd(mouse-1)}}} onto the mode line entry pops up a menu with
6340 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
6342 #+kindex: C-c C-x C-o
6343 #+findex: org-clock-out
6344 #+vindex: org-log-note-clock-out
6345 Stop the clock (clock-out). This inserts another timestamp at
6346 the same location where the clock was last started. It also
6347 directly computes the resulting time in inserts it after the time
6348 range as ==>HH:MM=. See the variable ~org-log-note-clock-out~
6349 for the possibility to record an additional note together with
6350 the clock-out timestamp[fn:75].
6352 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
6354 #+kindex: C-c C-x C-x
6355 #+findex: org-clock-in-last
6356 #+vindex: org-clock-continuously
6357 Re-clock the last clocked task. With one {{{kbd(C-u)}}} prefix
6358 argument, select the task from the clock history. With two
6359 {{{kbd(C-u)}}} prefixes, force continuous clocking by starting
6360 the clock when the last clock stopped.
6362 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
6364 #+kindex: C-c C-x C-e
6365 #+findex: org-clock-modify-effort-estimate
6366 Update the effort estimate for the current clock task.
6368 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
6372 #+findex: org-evaluate-time-range
6373 Recompute the time interval after changing one of the timestamps.
6374 This is only necessary if you edit the timestamps directly. If
6375 you change them with {{{kbd(S-<cursor>)}}} keys, the update is
6378 - {{{kbd(C-S-up)}}} (~org-clock-timestamps-up~), {{{kbd(C-S-down)}}} (~org-clock-timestamps-down~) ::
6381 #+findex: org-clock-timestamps-up
6383 #+findex: org-clock-timestamps-down
6384 On CLOCK log lines, increase/decrease both timestamps so that the
6385 clock duration keeps the same value.
6387 - {{{kbd(S-M-up)}}} (~org-timestamp-up~), {{{kbd(S-M-down)}}} (~org-timestamp-down~) ::
6390 #+findex: org-clock-timestamp-up
6392 #+findex: org-clock-timestamp-down
6393 On =CLOCK= log lines, increase/decrease the timestamp at point
6394 and the one of the previous, or the next, clock timestamp by the
6395 same duration. For example, if you hit {{{kbd(S-M-up)}}} to
6396 increase a clocked-out timestamp by five minutes, then the
6397 clocked-in timestamp of the next clock is increased by five
6400 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
6404 Changing the TODO state of an item to DONE automatically stops
6405 the clock if it is running in this same item.
6407 - {{{kbd(C-c C-x C-q)}}} (~org-clock-cancel~) ::
6409 #+kindex: C-c C-x C-q
6410 #+findex: org-clock-cancel
6411 Cancel the current clock. This is useful if a clock was started
6412 by mistake, or if you ended up working on something else.
6414 - {{{kbd(C-c C-x C-j)}}} (~org-clock-goto~) ::
6416 #+kindex: C-c C-x C-j
6417 #+findex: or-clock-goto
6418 Jump to the headline of the currently clocked in task. With
6419 a {{{kbd(C-u)}}} prefix argument, select the target task from
6420 a list of recently clocked tasks.
6422 - {{{kbd(C-c C-x C-d)}}} (~org-clock-display~) ::
6424 #+kindex: C-c C-x C-d
6425 #+findex: org-clock-display
6426 #+vindex: org-remove-highlights-with-change
6427 Display time summaries for each subtree in the current buffer.
6428 This puts overlays at the end of each headline, showing the total
6429 time recorded under that heading, including the time of any
6430 subheadings. You can use visibility cycling to study the tree,
6431 but the overlays disappear when you change the buffer (see
6432 variable ~org-remove-highlights-with-change~) or press {{{kbd(C-c
6435 The {{{kbd(l)}}} key may be used in the agenda (see [[*Weekly/daily
6436 agenda]]) to show which tasks have been worked on or closed during
6439 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
6440 can have a global keybinding and do not modify the window disposition.
6444 :DESCRIPTION: Detailed reports.
6446 #+cindex: clocktable, dynamic block
6447 #+cindex: report, of clocked time
6449 Org mode can produce quite complex reports based on the time clocking
6450 information. Such a report is called a /clock table/, because it is
6451 formatted as one or several Org tables.
6453 #+attr_texinfo: :sep ,
6454 - {{{kbd(C-c C-x C-r)}}} (~org-clock-report~) ::
6456 #+kindex: C-c C-x C-r
6457 #+findex: org-clock-report
6458 Insert a dynamic block (see [[*Dynamic blocks]]) containing a clock
6459 report as an Org mode table into the current file. When the
6460 cursor is at an existing clock table, just update it. When
6461 called with a prefix argument, jump to the first clock report in
6462 the current document and update it. The clock table always
6463 includes also trees with =ARCHIVE= tag.
6465 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
6468 #+kindex: C-c C-x C-u
6469 #+findex: org-dblock-update
6470 Update dynamic block at point. The cursor needs to be in the
6471 ~#+BEGIN~ line of the dynamic block.
6473 - {{{kbd(C-u C-c C-x C-u)}}} ::
6475 #+kindex: C-u C-c C-x C-u
6476 Update all dynamic blocks (see [[*Dynamic blocks]]). This is useful
6477 if you have several clock table blocks in a buffer.
6479 - {{{kbd(S-left)}}}, {{{kbd(S-right)}}} (~org-clocktable-try-shift~) ::
6483 #+findex: org-clocktable-try-shift
6484 Shift the current =:block= interval and update the table. The
6485 cursor needs to be in the =#+BEGIN: clocktable= line for this
6486 command. If =:block= is =today=, it is shifted to =today-1=,
6489 Here is an example of the frame for a clock table as it is inserted
6490 into the buffer with the {{{kbd(C-c C-x C-r)}}} command:
6492 #+cindex: BEGIN clocktable
6494 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
6498 #+texinfo: @noindent
6499 #+vindex: org-clocktable-defaults
6500 The =#+BEGIN= line and specify a number of options to define the
6501 scope, structure, and formatting of the report. Defaults for all
6502 these options can be configured in the variable
6503 ~org-clocktable-defaults~.
6505 #+texinfo: @noindent
6506 First there are options that determine which clock entries are to
6511 Maximum level depth to which times are listed in the table.
6512 Clocks at deeper levels are summed into the upper level.
6516 The scope to consider. This can be any of the following:
6518 | ~nil~ | the current buffer or narrowed region |
6519 | ~file~ | the full current buffer |
6520 | ~subtree~ | the subtree where the clocktable is located |
6521 | ~treeN~ | the surrounding level N tree, for example =tree3= |
6522 | ~tree~ | the surrounding level 1 tree |
6523 | ~agenda~ | all agenda files |
6524 | =("file" ...)= | scan these files |
6525 | =FUNCTION= | scan files returned by calling FUNCTION with no argument |
6526 | ~file-with-archives~ | current file and its archives |
6527 | ~agenda-with-archives~ | all agenda files, including archives |
6531 The time block to consider. This block is specified either
6532 absolute, or relative to the current time and may be any of these
6535 | =2007-12-31= | New year eve 2007 |
6536 | =2007-12= | December 2007 |
6537 | =2007-W50= | ISO-week 50 in 2007 |
6538 | =2007-Q2= | 2nd quarter in 2007 |
6539 | =2007= | the year 2007 |
6540 | ~today~, ~yesterday~, ~today-N~ | a relative day |
6541 | ~thisweek~, ~lastweek~, ~thisweek-N~ | a relative week |
6542 | ~thismonth~, ~lastmonth~, ~thismonth-N~ | a relative month |
6543 | ~thisyear~, ~lastyear~, ~thisyear-N~ | a relative year |
6545 Use {{{kbd(S-left)}}} or {{{kbd(S-right)}}} to shift the
6550 A time string specifying when to start considering times.
6554 A time string specifying when to stop considering times.
6558 The starting day of the week. The default is 1 for Monday.
6562 The starting day of the month. The default is 1 for the first.
6566 Set to ~week~ or ~day~ to split the table into chunks. To use
6567 this, ~:block~ or ~:tstart~, ~:tend~ are needed.
6571 Do not show steps that have zero time.
6575 Do not show table sections from files which did not contribute.
6579 A tags match to select entries that should contribute. See
6580 [[*Matching tags and properties]] for the match syntax.
6582 #+findex: org-clocktable-write-default
6583 Then there are options which determine the formatting of the table.
6584 There options are interpreted by the function
6585 ~org-clocktable-write-default~, but you can specify your own function
6586 using the ~:formatter~ parameter.
6590 When ~t~, emphasize level one and level two items.
6594 Language[fn:76] to use for descriptive cells like "Task".
6598 Link the item headlines in the table to their origins.
6602 An integer to limit the width of the headline column in the Org
6603 table. If you write it like =50!=, then the headline is also
6604 shortened in export.
6608 Indent each headline field according to its level.
6612 Number of columns to be used for times. If this is smaller than
6613 ~:maxlevel~, lower levels are lumped into one column.
6617 Should a level number column be included?
6621 A cons cell containing the column to sort and a sorting type.
6622 E.g., =:sort (1 . ?a)= sorts the first column alphabetically.
6626 Abbreviation for =:level nil :indent t :narrow 40! :tcolumns 1=.
6627 All are overwritten except if there is an explicit =:narrow=.
6631 A timestamp for the entry, when available. Look for SCHEDULED,
6632 DEADLINE, TIMESTAMP and TIMESTAMP_IA special properties (see
6633 [[*Special properties]]), in this order.
6637 List of properties shown in the table. Each property gets its
6642 When this flag is non-~nil~, the values for =:properties= are
6647 Content of a =TBLFM= keyword to be added and evaluated. As
6648 a special case, =:formula %= adds a column with % time. If you
6649 do not specify a formula here, any existing formula below the
6650 clock table survives updates and is evaluated.
6654 A function to format clock data and insert it into the buffer.
6656 To get a clock summary of the current level 1 tree, for the current
6657 day, you could write:
6660 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
6664 #+texinfo: @noindent
6665 To use a specific time range you could write[fn:77]
6668 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
6669 :tend "<2006-08-10 Thu 12:00>"
6673 A range starting a week ago and ending right now could be written as
6676 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
6680 A summary of the current subtree with % times would be:
6683 ,#+BEGIN: clocktable :scope subtree :link t :formula %
6687 A horizontally compact representation of everything clocked during
6691 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
6695 *** Resolving idle time and continuous clocking
6697 :DESCRIPTION: Resolving time when you've been idle.
6698 :ALT_TITLE: Resolving idle time
6701 **** Resolving idle time
6706 #+cindex: resolve idle time
6707 #+cindex: idle, resolve, dangling
6709 If you clock in on a work item, and then walk away from your
6710 computer -- perhaps to take a phone call -- you often need to
6711 "resolve" the time you were away by either subtracting it from the
6712 current clock, or applying it to another one.
6714 #+vindex: org-clock-idle-time
6715 #+vindex: org-clock-x11idle-program-name
6716 By customizing the variable ~org-clock-idle-time~ to some integer,
6717 such as 10 or 15, Emacs can alert you when you get back to your
6718 computer after being idle for that many minutes[fn:78], and ask what
6719 you want to do with the idle time. There will be a question waiting
6720 for you when you get back, indicating how much idle time has passed
6721 constantly updated with the current amount, as well as a set of
6722 choices to correct the discrepancy:
6727 To keep some or all of the minutes and stay clocked in, press
6728 {{{kbd(k)}}}. Org asks how many of the minutes to keep. Press
6729 {{{kbd(RET)}}} to keep them all, effectively changing nothing, or
6730 enter a number to keep that many minutes.
6735 If you use the shift key and press {{{kbd(K)}}}, it keeps however
6736 many minutes you request and then immediately clock out of that
6737 task. If you keep all of the minutes, this is the same as just
6738 clocking out of the current task.
6743 To keep none of the minutes, use {{{kbd(s)}}} to subtract all the
6744 away time from the clock, and then check back in from the moment
6750 To keep none of the minutes and just clock out at the start of
6751 the away time, use the shift key and press {{{kbd(S)}}}.
6752 Remember that using shift always leave you clocked out, no matter
6753 which option you choose.
6758 To cancel the clock altogether, use {{{kbd(C)}}}. Note that if
6759 instead of canceling you subtract the away time, and the
6760 resulting clock amount is less than a minute, the clock is still
6761 canceled rather than cluttering up the log with an empty entry.
6763 What if you subtracted those away minutes from the current clock, and
6764 now want to apply them to a new clock? Simply clock in to any task
6765 immediately after the subtraction. Org will notice that you have
6766 subtracted time "on the books", so to speak, and will ask if you want
6767 to apply those minutes to the next task you clock in on.
6769 There is one other instance when this clock resolution magic occurs.
6770 Say you were clocked in and hacking away, and suddenly your cat chased
6771 a mouse who scared a hamster that crashed into your UPS's power
6772 button! You suddenly lose all your buffers, but thanks to auto-save
6773 you still have your recent Org mode changes, including your last clock
6776 If you restart Emacs and clock into any task, Org will notice that you
6777 have a dangling clock which was never clocked out from your last
6778 session. Using that clock's starting time as the beginning of the
6779 unaccounted-for period, Org will ask how you want to resolve that
6780 time. The logic and behavior is identical to dealing with away time
6781 due to idleness; it is just happening due to a recovery event rather
6782 than a set amount of idle time.
6784 You can also check all the files visited by your Org agenda for
6785 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks
6786 RET)}}} (or {{{kbd(C-c C-x C-z)}}}).
6788 **** Continuous clocking
6792 #+cindex: continuous clocking
6794 #+vindex: org-clock-continuously
6795 You may want to start clocking from the time when you clocked out the
6796 previous task. To enable this systematically, set
6797 ~org-clock-continuously~ to non-~nil~. Each time you clock in, Org
6798 retrieves the clock-out time of the last clocked entry for this
6799 session, and start the new clock from there.
6801 If you only want this from time to time, use three universal prefix
6802 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
6803 ~org-clock-in-last~.
6807 :DESCRIPTION: Planning work effort in advance.
6809 #+cindex: effort estimates
6810 #+cindex: EFFORT, property
6811 #+vindex: org-effort-property
6813 If you want to plan your work in a very detailed way, or if you need
6814 to produce offers with quotations of the estimated work effort, you
6815 may want to assign effort estimates to entries. If you are also
6816 clocking your work, you may later want to compare the planned effort
6817 with the actual working time, a great way to improve planning
6818 estimates. Effort estimates are stored in a special property
6819 =EFFORT=. You can set the effort for an entry with the following
6822 - {{{kbd(C-c C-x e)}}} (~org-set-effort~) ::
6825 #+findex: org-set-effort
6826 Set the effort estimate for the current entry. With a numeric
6827 prefix argument, set it to the Nth allowed value (see below).
6828 This command is also accessible from the agenda with the
6831 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
6833 #+kindex: C-c C-x C-e
6834 #+findex: org-clock-modify-effort-estimate
6835 Modify the effort estimate of the item currently being clocked.
6837 Clearly the best way to work with effort estimates is through column
6838 view (see [[*Column view]]). You should start by setting up discrete
6839 values for effort estimates, and a =COLUMNS= format that displays
6840 these values together with clock sums -- if you want to clock your
6841 time. For a specific buffer you can use:
6844 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
6845 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
6849 #+vindex: org-global-properties
6850 #+vindex: org-columns-default-format
6851 or, even better, you can set up these values globally by customizing
6852 the variables ~org-global-properties~ and
6853 ~org-columns-default-format~. In particular if you want to use this
6854 setup also in the agenda, a global setup may be advised.
6856 The way to assign estimates to individual items is then to switch to
6857 column mode, and to use {{{kbd(S-right)}}} and {{{kbd(S-left)}}} to
6858 change the value. The values you enter are immediately summed up in
6859 the hierarchy. In the column next to it, any clocked time is
6862 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
6863 If you switch to column view in the daily/weekly agenda, the effort
6864 column summarizes the estimated work effort for each day[fn:79], and
6865 you can use this to find space in your schedule. To get an overview
6866 of the entire part of the day that is committed, you can set the
6867 option ~org-agenda-columns-add-appointments-to-effort-sum~. The
6868 appointments on a day that take place over a specified time interval
6869 are then also added to the load estimate of the day.
6871 Effort estimates can be used in secondary agenda filtering that is
6872 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in
6873 the agenda buffer]]). If you have these estimates defined consistently,
6874 two or three key presses narrow down the list to stuff that fits into
6875 an available time slot.
6877 ** Taking notes with a relative timer
6879 :DESCRIPTION: Notes with a running timer.
6882 #+cindex: relative timer
6883 #+cindex: countdown timer
6885 Org provides two types of timers. There is a relative timer that
6886 counts up, which can be useful when taking notes during, for example,
6887 a meeting or a video viewing. There is also a countdown timer.
6889 The relative and countdown are started with separate commands.
6891 - {{{kbd(C-c C-x 0)}}} (~org-timer-start~) ::
6894 #+findex: org-timer-start
6895 Start or reset the relative timer. By default, the timer is set
6896 to 0. When called with a {{{kbd(C-u)}}} prefix, prompt the user
6897 for a starting offset. If there is a timer string at point, this
6898 is taken as the default, providing a convenient way to restart
6899 taking notes after a break in the process. When called with
6900 a double prefix argument {{{kbd(C-u C-u)}}}, change all timer
6901 strings in the active region by a certain amount. This can be
6902 used to fix timer strings if the timer was not started at exactly
6905 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
6908 #+findex: org-timer-set-timer
6909 #+vindex: org-timer-default-timer
6910 Start a countdown timer. The user is prompted for a duration.
6911 ~org-timer-default-timer~ sets the default countdown value.
6912 Giving a numeric prefix argument overrides this default value.
6913 This command is available as {{{kbd(;)}}} in agenda buffers.
6915 Once started, relative and countdown timers are controlled with the
6918 - {{{kbd(C-c C-x .)}}} (~org-timer~) ::
6922 Insert a relative time into the buffer. The first time you use
6923 this, the timer starts. Using a prefix argument restarts it.
6925 - {{{kbd(C-c C-x -)}}} (~org-timer-item~) ::
6928 #+findex: org-timer-item
6929 Insert a description list item with the current relative time.
6930 With a prefix argument, first reset the timer to 0.
6932 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
6935 #+findex: org-insert-heading
6936 Once the timer list is started, you can also use
6937 {{{kbd(M-RET)}}} to insert new timer items.
6939 - {{{kbd(C-c C-x \,)}}} (~org-timer-pause-or-continue~) ::
6942 #+findex: org-timer-pause-or-continue
6943 Pause the timer, or continue it if it is already paused.
6945 - {{{kbd(C-c C-x _)}}} (~org-timer-stop~) ::
6948 #+findex: org-timer-stop
6949 Stop the timer. After this, you can only start a new timer, not
6950 continue the old one. This command also removes the timer from
6953 * Capture - Refile - Archive
6955 :DESCRIPTION: The ins and outs for projects.
6959 An important part of any organization system is the ability to quickly
6960 capture new ideas and tasks, and to associate reference material with
6961 them. Org does this using a process called /capture/. It also can
6962 store files related to a task (/attachments/) in a special directory.
6963 Once in the system, tasks and projects need to be moved around.
6964 Moving completed project trees to an archive file keeps the system
6969 :DESCRIPTION: Capturing new stuff.
6973 Capture lets you quickly store notes with little interruption of your
6974 work flow. Org's method for capturing new items is heavily inspired
6975 by John Wiegley's excellent =remember.el= package.
6977 *** Setting up capture
6979 :DESCRIPTION: Where notes will be stored.
6982 The following customization sets a default target file for notes, and
6983 defines a global key[fn:80] for capturing new material.
6985 #+vindex: org-default-notes-file
6986 #+begin_src emacs-lisp
6987 (setq org-default-notes-file (concat org-directory "/notes.org"))
6988 (define-key global-map "\C-cc" 'org-capture)
6993 :DESCRIPTION: Commands to invoke and terminate capture.
6996 - {{{kbd(C-c c)}}} (~org-capture~) ::
6999 #+findex: org-capture
7001 Call the command ~org-capture~. Note that this keybinding is
7002 global and not active by default: you need to install it. If you
7003 have templates defined (see [[*Capture templates]]), it offers these
7004 templates for selection or use a new Org outline node as the
7005 default template. It inserts the template into the target file
7006 and switch to an indirect buffer narrowed to this new node. You
7007 may then insert the information you want.
7009 - {{{kbd(C-c C-c)}}} (~org-capture-finalize~) ::
7012 #+findex: org-capture-finalize
7013 Once you have finished entering information into the capture
7014 buffer, {{{kbd(C-c C-c)}}} returns you to the window
7015 configuration before the capture process, so that you can resume
7016 your work without further distraction. When called with a prefix
7017 argument, finalize and then jump to the captured item.
7019 - {{{kbd(C-c C-w)}}} (~org-capture-refile~) ::
7022 #+findex: org-capture-refile
7023 Finalize the capture process by refiling the note to a different
7024 place (see [[*Refile and copy]]). Please realize that this is
7025 a normal refiling command that will be executed -- so the cursor
7026 position at the moment you run this command is important. If you
7027 have inserted a tree with a parent and children, first move the
7028 cursor back to the parent. Any prefix argument given to this
7029 command is passed on to the ~org-refile~ command.
7031 - {{{kbd(C-c C-k)}}} (~org-capture-kill~) ::
7034 #+findex: org-capture-kill
7035 Abort the capture process and return to the previous state.
7037 You can also call ~org-capture~ in a special way from the agenda,
7038 using the {{{kbd(k c)}}} key combination. With this access, any
7039 timestamps inserted by the selected capture template defaults to the
7040 cursor date in the agenda, rather than to the current date.
7042 To find the locations of the last stored capture, use ~org-capture~
7043 with prefix commands:
7045 - {{{kbd(C-u C-c c)}}} ::
7048 Visit the target location of a capture template. You get to
7049 select the template in the usual way.
7051 - {{{kbd(C-u C-u C-c c)}}} ::
7053 #+kindex: C-u C-u C-c c
7054 Visit the last stored capture item in its buffer.
7056 #+vindex: org-capture-bookmark
7057 #+cindex: org-capture-last-stored
7058 You can also jump to the bookmark ~org-capture-last-stored~, which is
7059 automatically created unless you set ~org-capture-bookmark~ to ~nil~.
7061 To insert the capture at point in an Org buffer, call ~org-capture~
7062 with a ~C-0~ prefix argument.
7064 *** Capture templates
7066 :DESCRIPTION: Define the outline of different note types.
7068 #+cindex: templates, for Capture
7070 You can use templates for different types of capture items, and for
7071 different target locations. The easiest way to create such templates
7072 is through the customize interface.
7074 - {{{kbd(C-c c C)}}} ::
7077 Customize the variable ~org-capture-templates~.
7079 Before we give the formal description of template definitions, let's
7080 look at an example. Say you would like to use one template to create
7081 general TODO entries, and you want to put these entries under the
7082 heading =Tasks= in your file =~/org/gtd.org=. Also, a date tree in
7083 the file =journal.org= should capture journal entries. A possible
7084 configuration would look like:
7086 #+begin_src emacs-lisp
7087 (setq org-capture-templates
7088 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
7089 "* TODO %?\n %i\n %a")
7090 ("j" "Journal" entry (file+datetree "~/org/journal.org")
7091 "* %?\nEntered on %U\n %i\n %a")))
7094 #+texinfo: @noindent
7095 If you then press {{{kbd(C-c c t)}}}, Org will prepare the template
7100 [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
7103 #+texinfo: @noindent
7104 During expansion of the template, ~%a~ has been replaced by a link to
7105 the location from where you called the capture command. This can be
7106 extremely useful for deriving tasks from emails, for example. You
7107 fill in the task definition, press {{{kbd(C-c C-c)}}} and Org returns
7108 you to the same place where you started the capture process.
7110 To define special keys to capture to a particular template without
7111 going through the interactive template selection, you can create your
7112 key binding like this:
7114 #+begin_src emacs-lisp
7115 (define-key global-map "\C-cx"
7116 (lambda () (interactive) (org-capture nil "x")))
7119 **** Template elements
7121 :DESCRIPTION: What is needed for a complete template entry.
7124 Now lets look at the elements of a template definition. Each entry in
7125 ~org-capture-templates~ is a list with the following items:
7129 The keys that selects the template, as a string, characters only,
7130 for example ="a"=, for a template to be selected with a single
7131 key, or ="bt"= for selection with two keys. When using several
7132 keys, keys using the same prefix key must be sequential in the
7133 list and preceded by a 2-element entry explaining the prefix key,
7136 #+begin_src emacs-lisp
7137 ("b" "Templates for marking stuff to buy")
7140 #+texinfo: @noindent
7141 If you do not define a template for the {{{kbd(C)}}} key, this
7142 key opens the Customize buffer for this complex variable.
7146 A short string describing the template, shown during selection.
7150 The type of entry, a symbol. Valid values are:
7154 An Org mode node, with a headline. Will be filed as the child
7155 of the target entry or as a top-level entry. The target file
7156 should be an Org file.
7160 A plain list item, placed in the first plain list at the
7161 target location. Again the target file should be an Org
7166 A checkbox item. This only differs from the plain list item
7167 by the default template.
7171 A new line in the first table at the target location. Where
7172 exactly the line will be inserted depends on the properties
7173 ~:prepend~ and ~:table-line-pos~ (see below).
7177 Text to be inserted as it is.
7181 #+vindex: org-default-notes-file
7182 #+vindex: org-directory
7183 Specification of where the captured item should be placed. In
7184 Org files, targets usually define a node. Entries will become
7185 children of this node. Other types will be added to the table or
7186 list in the body of this node. Most target specifications
7187 contain a file name. If that file name is the empty string, it
7188 defaults to ~org-default-notes-file~. A file can also be given
7189 as a variable or as a function called with no argument. When an
7190 absolute path is not specified for a target, it is taken as
7191 relative to ~org-directory~.
7195 - =(file "path/to/file")= ::
7197 Text will be placed at the beginning or end of that file.
7199 - =(id "id of existing org entry")= ::
7201 Filing as child of this entry, or in the body of the entry.
7203 - =(file+headline "filename" "node headline")= ::
7205 Fast configuration if the target heading is unique in the file.
7207 - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= ::
7209 For non-unique headings, the full path is safer.
7211 - =(file+regexp "filename" "regexp to find location")= ::
7213 Use a regular expression to position the cursor.
7215 - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
7217 This target[fn:81] creates a heading in a date tree[fn:82] for
7218 today's date. If the optional outline path is given, the tree
7219 will be built under the node it is pointing to, instead of at
7220 top level. Check out the ~:time-prompt~ and ~:tree-type~
7221 properties below for additional options.
7223 - ~(file+function "filename" function-finding-location)~ ::
7225 A function to find the right location in the file.
7229 File to the entry that is currently being clocked.
7231 - ~(function function-finding-location)~ ::
7233 Most general way: write your own function which both visits the
7234 file and moves point to the right location.
7238 The template for creating the capture item. If you leave this
7239 empty, an appropriate default template will be used. Otherwise
7240 this is a string with escape codes, which will be replaced
7241 depending on time and context of the capture call. The string
7242 with escapes may be loaded from a template file, using the
7243 special syntax =(file "template filename")=. See below for more
7248 The rest of the entry is a property list of additional options.
7249 Recognized properties are:
7253 Normally new captured information will be appended at the
7254 target location (last child, last table line, last list item,
7255 ...). Setting this property changes that.
7257 - ~:immediate-finish~ ::
7259 When set, do not offer to edit the information, just file it
7260 away immediately. This makes sense if the template only needs
7261 information that can be added automatically.
7265 Set this to the number of lines to insert before and after the
7266 new item. Default 0, and the only other common value is 1.
7270 Start the clock in this item.
7274 Keep the clock running when filing the captured entry.
7276 - ~:clock-resume~ ::
7278 If starting the capture interrupted a clock, restart that clock
7279 when finished with the capture. Note that ~:clock-keep~ has
7280 precedence over ~:clock-resume~. When setting both to
7281 non-~nil~, the current clock will run and the previous one will
7286 Prompt for a date/time to be used for date/week trees and when
7287 filling the template. Without this property, capture uses the
7288 current date and time. Even if this property has not been set,
7289 you can force the same behavior by calling ~org-capture~ with
7290 a {{{kbd(C-1)}}} prefix argument.
7294 When ~week~, make a week tree instead of the month tree, i.e.,
7295 place the headings for each day under a heading with the
7300 Do not narrow the target buffer, simply show the full buffer. Default
7301 is to narrow it so that you only see the new material.
7303 - ~:table-line-pos~ ::
7305 Specification of the location in the table where the new line
7306 should be inserted. It should be a string like =II-3= meaning
7307 that the new line should become the third line before the
7308 second horizontal separator line.
7312 If the target file was not yet visited when capture was invoked, kill
7313 the buffer again after capture is completed.
7315 **** Template expansion
7317 :DESCRIPTION: Filling in information about time and context.
7320 In the template itself, special "%-escapes"[fn:83] allow dynamic
7321 insertion of content. The templates are expanded in the order given
7326 Insert the contents of the file given by {{{var(FILE)}}}.
7330 Evaluate Elisp SEXP and replace with the result. The
7331 {{{var(SEXP)}}} must return a string.
7335 The result of format-time-string on the {{{var(FORMAT)}}}
7340 Timestamp, date only.
7344 Timestamp, with date and time.
7348 Like ~%t~, ~%T~ above, but inactive timestamps.
7352 Initial content, the region when capture is called while the
7353 region is active. The entire text will be indented like ~%i~
7358 Annotation, normally the link created with ~org-store-link~.
7362 Like ~%a~, but prompt for the description part.
7366 Like ~%a~, but only insert the literal link.
7370 Current kill ring head.
7374 Content of the X clipboard.
7378 Title of the currently clocked task.
7382 Link to the currently clocked task.
7386 User name (taken from ~user-full-name~).
7390 File visited by current buffer when org-capture was called.
7394 Full path of the file or directory visited by current buffer.
7398 Specific information for certain link types, see below.
7402 Prompt for tags, with completion on tags in target file.
7406 Prompt for tags, with completion all tags in all agenda files.
7410 Like ~%t~, but prompt for date. Similarly ~%^T~, ~%^u~, ~%^U~. You may
7411 define a prompt like ~%^{Birthday}t~.
7415 Interactive selection of which kill or clip to use.
7419 Like ~%^C~, but insert as link.
7423 Prompt the user for a value for property PROP.
7427 Prompt the user for a string and replace this sequence with it.
7428 You may specify a default value and a completion table with
7429 ~%^{prompt|default|completion2|completion3...}~. The arrow keys
7430 access a prompt-specific history.
7434 Insert the text entered at the Nth ~%^{PROMPT}~, where N is
7435 a number, starting from 1.
7439 After completing the template, position cursor here.
7441 #+texinfo: @noindent
7442 #+vindex: org-store-link-props
7443 For specific link types, the following keywords are defined[fn:84]:
7445 #+vindex: org-from-is-user-regexp
7446 | Link type | Available keywords |
7447 |--------------+----------------------------------------------------------|
7448 | bbdb | ~%:name~, ~%:company~ |
7449 | irc | ~%:server~, ~%:port~, ~%:nick~ |
7450 | mh, rmail | ~%:type~, ~%:subject~, ~%:message-id~ |
7451 | | ~%:from~, ~%:fromname~, ~%:fromaddress~ |
7452 | | ~%:to~, ~%:toname~, ~%:toaddress~ |
7453 | | ~%:date~ (message date header field) |
7454 | | ~%:date-timestamp~ (date as active timestamp) |
7455 | | ~%:date-timestamp-inactive~ (date as inactive timestamp) |
7456 | | ~%:fromto~ (either "to NAME" or "from NAME")[fn:85] |
7457 | gnus | ~%:group~, for messages also all email fields |
7458 | w3, w3m | ~%:url~ |
7459 | info | ~%:file~, ~%:node~ |
7460 | calendar | ~%:date~ |
7461 | org-protocol | ~%:link~, ~%:description~, ~%:annotation~ |
7463 **** Templates in contexts
7465 :DESCRIPTION: Only show a template in a specific context.
7468 #+vindex: org-capture-templates-contexts
7469 To control whether a capture template should be accessible from
7470 a specific context, you can customize
7471 ~org-capture-templates-contexts~. Let's say, for example, that you
7472 have a capture template "p" for storing Gnus emails containing
7473 patches. Then you would configure this option like this:
7475 #+begin_src emacs-lisp
7476 (setq org-capture-templates-contexts
7477 '(("p" (in-mode . "message-mode"))))
7480 You can also tell that the command key {{{kbd(p)}}} should refer to
7481 another template. In that case, add this command key like this:
7483 #+begin_src emacs-lisp
7484 (setq org-capture-templates-contexts
7485 '(("p" "q" (in-mode . "message-mode"))))
7488 See the docstring of the variable for more information.
7492 :DESCRIPTION: Add files to tasks.
7494 #+cindex: attachments
7495 #+vindex: org-attach-directory
7497 It is often useful to associate reference material with an outline
7498 node/task. Small chunks of plain text can simply be stored in the
7499 subtree of a project. Hyperlinks (see [[*Hyperlinks]]) can establish
7500 associations with files that live elsewhere on your computer or in the
7501 cloud, like emails or source code files belonging to a project.
7502 Another method is /attachments/, which are files located in
7503 a directory belonging to an outline node. Org uses directories named
7504 by the unique ID of each entry. These directories are located in the
7505 ~data~ directory which lives in the same directory where your Org file
7506 lives[fn:86]. If you initialize this directory with =git init=, Org
7507 automatically commits changes when it sees them. The attachment
7508 system has been contributed to Org by John Wiegley.
7510 In cases where it seems better to do so, you can attach a directory of
7511 your choice to an entry. You can also make children inherit the
7512 attachment directory from a parent, so that an entire subtree uses the
7513 same attached directory.
7515 #+texinfo: @noindent
7516 The following commands deal with attachments:
7518 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
7521 #+findex: org-attach
7522 The dispatcher for commands related to the attachment system.
7523 After these keys, a list of commands is displayed and you must
7524 press an additional key to select a command:
7526 - {{{kbd(a)}}} (~org-attach-attach~) ::
7529 #+findex: org-attach-attach
7530 #+vindex: org-attach-method
7531 Select a file and move it into the task's attachment
7532 directory. The file is copied, moved, or linked, depending
7533 on ~org-attach-method~. Note that hard links are not
7534 supported on all systems.
7536 - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
7541 Attach a file using the copy/move/link method. Note that
7542 hard links are not supported on all systems.
7544 - {{{kbd(n)}}} (~org-attach-new~) ::
7547 #+findex: org-attach-new
7548 Create a new attachment as an Emacs buffer.
7550 - {{{kbd(z)}}} (~org-attach-sync~) ::
7553 #+findex: org-attach-sync
7554 Synchronize the current task with its attachment directory, in case
7555 you added attachments yourself.
7557 - {{{kbd(o)}}} (~org-attach-open~) ::
7560 #+findex: org-attach-open
7561 #+vindex: org-file-apps
7562 Open current task's attachment. If there is more than one,
7563 prompt for a file name first. Opening follows the rules set
7564 by ~org-file-apps~. For more details, see the information
7565 on following hyperlinks (see [[*Handling links]]).
7567 - {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
7570 #+findex: org-attach-open-in-emacs
7571 Also open the attachment, but force opening the file in
7574 - {{{kbd(f)}}} (~org-attach-reveal~) ::
7577 #+findex: org-attach-reveal
7578 Open the current task's attachment directory.
7580 - {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
7583 #+findex: org-attach-reveal-in-emacs
7584 Also open the directory, but force using Dired in Emacs.
7586 - {{{kbd(d)}}} (~org-attach-delete-one~) ::
7589 Select and delete a single attachment.
7591 - {{{kbd(D)}}} (~org-attach-delete-all~) ::
7594 Delete all of a task's attachments. A safer way is to open
7595 the directory in Dired and delete from there.
7597 - {{{kbd(s)}}} (~org-attach-set-directory~) ::
7600 #+cindex: ATTACH_DIR, property
7601 Set a specific directory as the entry's attachment
7602 directory. This works by putting the directory path into
7603 the =ATTACH_DIR= property.
7605 - {{{kbd(i)}}} (~org-attach-set-inherit~) ::
7608 #+cindex: ATTACH_DIR_INHERIT, property
7609 Set the =ATTACH_DIR_INHERIT= property, so that children use
7610 the same directory for attachments as the parent does.
7612 #+cindex: attach from Dired
7613 #+findex: org-attach-dired-to-subtree
7614 It is possible to attach files to a subtree from a Dired buffer. To
7615 use this feature, have one window in Dired mode containing the file(s)
7616 to be attached and another window with point in the subtree that shall
7617 get the attachments. In the Dired window, with point on a file,
7618 {{{kbd(M-x org-attach-dired-to-subtree)}}} attaches the file to the
7619 subtree using the attachment method set by variable
7620 ~org-attach-method~. When files are marked in the Dired window then
7621 all marked files get attached.
7623 Add the following lines to the Emacs init file to have {{{kbd(C-c C-x
7624 a)}}} attach files in Dired buffers.
7626 #+begin_src emacs-lisp
7627 (add-hook 'dired-mode-hook
7629 (define-key dired-mode-map
7631 #'org-attach-dired-to-subtree))))
7634 The following code shows how to bind the previous command with
7635 a specific attachment method.
7637 #+begin_src emacs-lisp
7638 (add-hook 'dired-mode-hook
7640 (define-key dired-mode-map (kbd "C-c C-x c")
7643 (let ((org-attach-method 'cp))
7644 (call-interactively #'org-attach-dired-to-subtree))))))
7649 :DESCRIPTION: Getting input from RSS feeds.
7652 #+cindex: Atom feeds
7654 Org can add and change entries based on information found in RSS feeds
7655 and Atom feeds. You could use this to make a task out of each new
7656 podcast in a podcast feed. Or you could use a phone-based
7657 note-creating service on the web to import tasks into Org. To access
7658 feeds, configure the variable ~org-feed-alist~. The docstring of this
7659 variable has detailed information. With the following
7661 #+begin_src emacs-lisp
7662 (setq org-feed-alist
7664 "http://rss.slashdot.org/Slashdot/slashdot"
7665 "~/txt/org/feeds.org" "Slashdot Entries")))
7668 #+texinfo: @noindent
7669 new items from the feed provided by =rss.slashdot.org= result in new
7670 entries in the file =~/org/feeds.org= under the heading =Slashdot
7671 Entries=, whenever the following command is used:
7673 - {{{kbd(C-c C-x g)}}} (~org-feed-update-all~) ::
7676 Collect items from the feeds configured in ~org-feed-alist~ and
7679 - {{{kbd(C-c C-x G)}}} (~org-feed-goto-inbox~) ::
7682 Prompt for a feed name and go to the inbox configured for this feed.
7684 Under the same headline, Org creates a drawer =FEEDSTATUS= in which it
7685 stores information about the status of items in the feed, to avoid
7686 adding the same item several times.
7688 For more information, including how to read atom feeds, see
7689 =org-feed.el= and the docstring of ~org-feed-alist~.
7691 ** Protocols for external access
7693 :DESCRIPTION: External access to Emacs and Org.
7694 :ALT_TITLE: Protocols
7696 #+cindex: protocols, for external access
7698 Org protocol is a means to trigger custom actions in Emacs from
7699 external applications. Any application that supports calling external
7700 programs with an URL as argument may be used with this functionality.
7701 For example, you can configure bookmarks in your web browser to send
7702 a link to the current page to Org and create a note from it using
7703 capture (see [[*Capture]]). You can also create a bookmark that tells
7704 Emacs to open the local source file of a remote website you are
7707 #+cindex: Org protocol, set-up
7708 #+cindex: Installing Org protocol
7709 In order to use Org protocol from an application, you need to register
7710 =org-protocol://= as a valid scheme-handler. External calls are
7711 passed to Emacs through the =emacsclient= command, so you also need to
7712 ensure an Emacs server is running. More precisely, when the
7715 : emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
7717 #+texinfo: @noindent
7718 Emacs calls the handler associated to {{{var(PROTOCOL)}}} with
7719 argument =(:key1 val1 :key2 val2)=.
7721 #+cindex: protocol, new protocol
7722 #+cindex: defining new protocols
7723 Org protocol comes with three predefined protocols, detailed in the
7724 following sections. Configure ~org-protocol-protocol-alist~ to define
7727 *** ~store-link~ protocol
7729 :DESCRIPTION: Store a link, push URL to kill-ring.
7731 #+cindex: store-link protocol
7732 #+cindex: protocol, store-link
7734 Using ~store-link~ handler, you can copy links, insertable through
7735 {{{kbd(M-x org-insert-link)}}} or yanking thereafter. More precisely,
7738 : emacsclient org-protocol://store-link?url=URL&title=TITLE
7740 #+texinfo: @noindent
7741 stores the following link:
7745 In addition, {{{var(URL)}}} is pushed on the kill-ring for yanking.
7746 You need to encode {{{var(URL)}}} and {{{var(TITLE)}}} if they contain
7747 slashes, and probably quote those for the shell.
7749 To use this feature from a browser, add a bookmark with an arbitrary
7750 name, e.g., =Org: store-link= and enter this as /Location/:
7753 javascript:location.href='org-protocol://store-link?url='+
7754 encodeURIComponent(location.href);
7757 *** ~capture~ protocol
7759 :DESCRIPTION: Fill a buffer with external information.
7761 #+cindex: capture protocol
7762 #+cindex: protocol, capture
7764 Activating "capture" handler pops up a =Capture= buffer and fills the
7765 capture template associated to the =X= key with them.
7767 : emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
7769 To use this feature, add a bookmark with an arbitrary name, e.g.
7770 =Org: capture= and enter this as =Location=:
7773 javascript:location.href='org-protocol://template=x'+
7774 '&url='+encodeURIComponent(window.location.href)+
7775 '&title='+encodeURIComponent(document.title)+
7776 '&body='+encodeURIComponent(window.getSelection());
7779 #+vindex: org-protocol-default-template-key
7780 The result depends on the capture template used, which is set in the
7781 bookmark itself, as in the example above, or in
7782 ~org-protocol-default-template-key~.
7784 The following template placeholders are available:
7788 %:description The webpage title
7789 %:annotation Equivalent to [[%:link][%:description]]
7790 %i The selected text
7793 *** ~open-source~ protocol
7795 :DESCRIPTION: Edit published contents.
7797 #+cindex: open-source protocol
7798 #+cindex: protocol, open-source
7800 The ~open-source~ handler is designed to help with editing local
7801 sources when reading a document. To that effect, you can use
7802 a bookmark with the following location:
7805 javascript:location.href='org-protocol://open-source?&url='+
7806 encodeURIComponent(location.href)
7809 #+vindex: org-protocol-project-alist
7810 The variable ~org-protocol-project-alist~ maps URLs to local file
7811 names, by stripping URL parameters from the end and replacing the
7812 ~:base-url~ with ~:working-directory~ and ~:online-suffix~ with
7813 ~:working-suffix~. For example, assuming you own a local copy of
7814 =http://orgmode.org/worg/= contents at =/home/user/worg=, you can set
7815 ~org-protocol-project-alist~ to the following
7817 #+begin_src emacs-lisp
7818 (setq org-protocol-project-alist
7820 :base-url "http://orgmode.org/worg/"
7821 :working-directory "/home/user/worg/"
7822 :online-suffix ".html"
7823 :working-suffix ".org")))
7826 #+texinfo: @noindent
7827 If you are now browsing
7828 =http://orgmode.org/worg/org-contrib/org-protocol.html= and find
7829 a typo or have an idea about how to enhance the documentation, simply
7830 click the bookmark and start editing.
7832 #+cindex: rewritten URL in open-source protocol
7833 #+cindex: protocol, open-source rewritten URL
7834 However, such mapping may not yield the desired results. Suppose you
7835 maintain an online store located at =http://example.com/=. The local
7836 sources reside in =/home/user/example/=. It is common practice to
7837 serve all products in such a store through one file and rewrite URLs
7838 that do not match an existing file on the server. That way, a request
7839 to =http://example.com/print/posters.html= might be rewritten on the
7840 server to something like
7841 =http://example.com/shop/products.php/posters.html.php=. The
7842 ~open-source~ handler probably cannot find a file named
7843 =/home/user/example/print/posters.html.php= and fails.
7845 Such an entry in ~org-protocol-project-alist~ may hold an additional
7846 property ~:rewrites~. This property is a list of cons cells, each of
7847 which maps a regular expression to a path relative to the
7848 ~:working-directory~.
7850 Now map the URL to the path =/home/user/example/products.php= by
7851 adding ~:rewrites~ rules like this:
7853 #+begin_src emacs-lisp
7854 (setq org-protocol-project-alist
7856 :base-url "http://example.com/"
7857 :working-directory "/home/user/example/"
7858 :online-suffix ".php"
7859 :working-suffix ".php"
7860 :rewrites (("example.com/print/" . "products.php")
7861 ("example.com/$" . "index.php")))))
7864 #+texinfo: @noindent
7865 Since =example.com/$= is used as a regular expression, it maps
7866 =http://example.com/=, =https://example.com=,
7867 =http://www.example.com/= and similar to
7868 =/home/user/example/index.php=.
7870 The ~:rewrites~ rules are searched as a last resort if and only if no
7871 existing file name is matched.
7873 #+cindex: protocol, open-source, set-up mapping
7874 #+cindex: mappings in open-source protocol
7875 #+findex: org-protocol-create
7876 #+findex: org-protocol-create-for-org
7877 Two functions can help you filling ~org-protocol-project-alist~ with
7878 valid contents: ~org-protocol-create~ and
7879 ~org-protocol-create-for-org~. The latter is of use if you're editing
7880 an Org file that is part of a publishing project.
7884 :DESCRIPTION: Moving/copying a tree from one place to another.
7886 #+cindex: refiling notes
7887 #+cindex: copying notes
7889 When reviewing the captured data, you may want to refile or to copy
7890 some of the entries into a different list, for example into a project.
7891 Cutting, finding the right location, and then pasting the note is
7892 cumbersome. To simplify this process, you can use the following
7895 - {{{kbd(C-c M-w)}}} (~org-copy~) ::
7899 Copying works like refiling, except that the original note is not
7902 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
7905 #+findex: org-refile
7906 #+vindex: org-reverse-note-order
7907 #+vindex: org-refile-targets
7908 #+vindex: org-refile-use-outline-path
7909 #+vindex: org-outline-path-complete-in-steps
7910 #+vindex: org-refile-allow-creating-parent-nodes
7911 #+vindex: org-log-refile
7912 Refile the entry or region at point. This command offers
7913 possible locations for refiling the entry and lets you select one
7914 with completion. The item (or all items in the region) is filed
7915 below the target heading as a subitem. Depending on
7916 ~org-reverse-note-order~, it is either the first or last subitem.
7918 By default, all level 1 headlines in the current buffer are
7919 considered to be targets, but you can have more complex
7920 definitions across a number of files. See the variable
7921 ~org-refile-targets~ for details. If you would like to select
7922 a location via a file-path-like completion along the outline
7923 path, see the variables ~org-refile-use-outline-path~ and
7924 ~org-outline-path-complete-in-steps~. If you would like to be
7925 able to create new nodes as new parents for refiling on the fly,
7926 check the variable ~org-refile-allow-creating-parent-nodes~.
7927 When the variable ~org-log-refile~[fn:87] is set, a timestamp or
7928 a note is recorded whenever an entry is refiled.
7930 - {{{kbd(C-u C-c C-w)}}} ::
7932 #+kindex: C-u C-c C-w
7933 Use the refile interface to jump to a heading.
7935 - {{{kbd(C-u C-u C-c C-w)}}} (~org-refile-goto-last-stored~) ::
7937 #+kindex: C-u C-u C-c C-w
7938 #+findex: org-refile-goto-last-stored
7939 Jump to the location where ~org-refile~ last moved a tree to.
7941 - {{{kbd(C-2 C-c C-w)}}} ::
7943 #+kindex: C-2 C-c C-w
7944 Refile as the child of the item currently being clocked.
7946 - {{{kbd(C-3 C-c C-w)}}} ::
7948 #+kindex: C-3 C-c C-w
7949 #+vindex: org-refile-keep
7950 Refile and keep the entry in place. Also see ~org-refile-keep~
7951 to make this the default behavior, and beware that this may
7952 result in duplicated ~ID~ properties.
7954 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}} (~org-refile-cache-clear~) ::
7956 #+kindex: C-u C-u C-u C-c C-w
7957 #+kindex: C-0 C-c C-w
7958 #+findex: org-refile-cache-clear
7959 #+vindex: org-refile-use-cache
7960 Clear the target cache. Caching of refile targets can be turned
7961 on by setting ~org-refile-use-cache~. To make the command see
7962 new possible targets, you have to clear the cache with this
7967 :DESCRIPTION: What to do with finished products.
7971 When a project represented by a (sub)tree is finished, you may want to
7972 move the tree out of the way and to stop it from contributing to the
7973 agenda. Archiving is important to keep your working files compact and
7974 global searches like the construction of agenda views fast.
7976 - {{{kbd(C-c C-x C-a)}}} (~org-archive-subtree-default~) ::
7978 #+kindex: C-c C-x C-a
7979 #+findex: org-archive-subtree-default
7980 #+vindex: org-archive-default-command
7981 Archive the current entry using the command specified in the
7982 variable ~org-archive-default-command~.
7984 *** Moving a tree to an archive file
7986 :DESCRIPTION: Moving a tree to an archive file.
7987 :ALT_TITLE: Moving subtrees
7989 #+cindex: external archiving
7991 The most common archiving action is to move a project tree to another
7992 file, the archive file.
7994 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} (~org-archive-subtree~) ::
7996 #+kindex: C-c C-x C-s
7998 #+findex: org-archive-subtree
7999 #+vindex: org-archive-location
8000 Archive the subtree starting at the cursor position to the
8001 location given by ~org-archive-location~.
8003 - {{{kbd(C-u C-c C-x C-s)}}} ::
8005 #+kindex: C-u C-c C-x C-s
8006 Check if any direct children of the current headline could be
8007 moved to the archive. To do this, check each subtree for open
8008 TODO entries. If none is found, the command offers to move it to
8009 the archive location. If the cursor is /not/ on a headline when
8010 this command is invoked, check level 1 trees.
8012 - {{{kbd(C-u C-u C-c C-x C-s)}}} ::
8014 #+kindex: C-u C-u C-c C-x C-s
8015 As above, but check subtree for timestamps instead of TODO
8016 entries. The command offers to archive the subtree if it /does/
8017 contain a timestamp, and that timestamp is in the past.
8019 #+cindex: archive locations
8020 The default archive location is a file in the same directory as the
8021 current file, with the name derived by appending =_archive= to the
8022 current file name. You can also choose what heading to file archived
8023 items under, with the possibility to add them to a datetree in a file.
8024 For information and examples on how to specify the file and the
8025 heading, see the documentation string of the variable
8026 ~org-archive-location~.
8028 There is also an in-buffer option for setting this variable, for
8031 #+cindex: ARCHIVE, keyword
8032 : #+ARCHIVE: %s_done::
8034 #+texinfo: @noindent
8035 #+cindex: ARCHIVE, property
8036 If you would like to have a special archive location for a single
8037 entry or a (sub)tree, give the entry an =ARCHIVE= property with the
8038 location as the value (see [[*Properties and columns]]).
8040 #+vindex: org-archive-save-context-info
8041 When a subtree is moved, it receives a number of special properties
8042 that record context information like the file from where the entry
8043 came, its outline path the archiving time etc. Configure the variable
8044 ~org-archive-save-context-info~ to adjust the amount of information
8047 *** Internal archiving
8049 :DESCRIPTION: Switch off a tree but keep it in the file.
8052 If you want to just switch off -- for agenda views -- certain subtrees
8053 without moving them to a different file, you can use the =ARCHIVE=
8056 A headline that is marked with the =ARCHIVE= tag (see [[*Tags]]) stays at
8057 its location in the outline tree, but behaves in the following way:
8060 #+vindex: org-cycle-open-archived-trees
8061 It does not open when you attempt to do so with a visibility cycling
8062 command (see [[*Visibility cycling]]). You can force cycling archived
8063 subtrees with {{{kbd(C-TAB)}}}, or by setting the option
8064 ~org-cycle-open-archived-trees~. Also normal outline commands, like
8065 ~outline-show-all~, open archived subtrees.
8068 #+vindex: org-sparse-tree-open-archived-trees
8069 During sparse tree construction (see [[*Sparse trees]]), matches in
8070 archived subtrees are not exposed, unless you configure the option
8071 ~org-sparse-tree-open-archived-trees~.
8074 #+vindex: org-agenda-skip-archived-trees
8075 During agenda view construction (see [[*Agenda views]]), the content of
8076 archived trees is ignored unless you configure the option
8077 ~org-agenda-skip-archived-trees~, in which case these trees are
8078 always included. In the agenda you can press {{{kbd(v a)}}} to get
8079 archives temporarily included.
8082 #+vindex: org-export-with-archived-trees
8083 Archived trees are not exported (see [[*Exporting]]), only the headline
8084 is. Configure the details using the variable
8085 ~org-export-with-archived-trees~.
8088 #+vindex: org-columns-skip-archived-trees
8089 Archived trees are excluded from column view unless the variable
8090 ~org-columns-skip-archived-trees~ is configured to ~nil~.
8092 The following commands help manage the =ARCHIVE= tag:
8094 - {{{kbd(C-c C-x a)}}} (~org-toggle-archive-tag~) ::
8097 #+findex: org-toggle-archive-tag
8098 Toggle the archive tag for the current headline. When the tag is
8099 set, the headline changes to a shadowed face, and the subtree
8102 - {{{kbd(C-u C-c C-x a)}}} ::
8104 #+kindex: C-u C-c C-x a
8105 Check if any direct children of the current headline should be
8106 archived. To do this, check each subtree for open TODO entries.
8107 If none is found, the command offers to set the =ARCHIVE= tag for
8108 the child. If the cursor is /not/ on a headline when this
8109 command is invoked, check the level 1 trees.
8111 - {{{kbd(C-TAB)}}}, ~org-force-cycle-archived~ ::
8114 Cycle a tree even if it is tagged with =ARCHIVE=.
8116 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
8119 #+findex: org-archive-to-archive-sibling
8120 Move the current entry to the /Archive Sibling/. This is
8121 a sibling of the entry with the heading =Archive= and the archive
8122 tag. The entry becomes a child of that sibling and in this way
8123 retains a lot of its original context, including inherited tags
8124 and approximate position in the outline.
8128 :DESCRIPTION: Collecting information into views.
8129 :ALT_TITLE: Agenda Views
8131 #+cindex: agenda views
8133 Due to the way Org works, TODO items, time-stamped items, and tagged
8134 headlines can be scattered throughout a file or even a number of
8135 files. To get an overview of open action items, or of events that are
8136 important for a particular date, this information must be collected,
8137 sorted and displayed in an organized way.
8139 Org can select items based on various criteria and display them in
8140 a separate buffer. Seven different view types are provided:
8142 - an /agenda/ that is like a calendar and shows information for
8145 - a /TODO list/ that covers all unfinished action items,
8147 - a /match view/, showings headlines based on the tags, properties,
8148 and TODO state associated with them,
8150 - a /timeline view/ that shows all events in a single Org file, in
8153 - a /text search view/ that shows all entries from multiple files that
8154 contain specified keywords,
8156 - a /stuck projects view/ showing projects that currently do not move
8159 - /custom views/ that are special searches and combinations of
8162 #+texinfo: @noindent
8163 The extracted information is displayed in a special /agenda buffer/.
8164 This buffer is read-only, but provides commands to visit the
8165 corresponding locations in the original Org files, and even to edit
8166 these files remotely.
8168 #+vindex: org-agenda-skip-comment-trees
8169 #+vindex: org-agenda-skip-archived-trees
8170 #+cindex: commented entries, in agenda views
8171 #+cindex: archived entries, in agenda views
8172 By default, the report ignores commented (see [[*Comment lines]]) and
8173 archived (see [[*Internal archiving]]) entries. You can override this by
8174 setting ~org-agenda-skip-comment-trees~ and
8175 ~org-agenda-skip-archived-trees~ to ~nil~.
8177 #+vindex: org-agenda-window-setup
8178 #+vindex: org-agenda-restore-windows-after-quit
8179 Two variables control how the agenda buffer is displayed and whether
8180 the window configuration is restored when the agenda exits:
8181 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
8185 :DESCRIPTION: Files being searched for agenda information.
8187 #+cindex: agenda files
8188 #+cindex: files for agenda
8190 #+vindex: org-agenda-files
8191 The information to be shown is normally collected from all /agenda
8192 files/, the files listed in the variable ~org-agenda-files~[fn:88].
8193 If a directory is part of this list, all files with the extension
8194 =.org= in this directory are part of the list.
8196 Thus, even if you only work with a single Org file, that file should
8197 be put into the list[fn:89]. You can customize ~org-agenda-files~,
8198 but the easiest way to maintain it is through the following commands
8200 #+attr_texinfo: :sep and
8201 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
8204 #+findex: org-agenda-file-to-front
8205 #+cindex: files, adding to agenda list
8206 Add current file to the list of agenda files. The file is added
8207 to the front of the list. If it was already in the list, it is
8208 moved to the front. With a prefix argument, file is added/moved
8211 - {{{kbd(C-c ])}}} (~org-remove-file~) ::
8214 #+findex: org-remove-file
8215 Remove current file from the list of agenda files.
8217 - {{{kbd(C-')}}} and {{{kbd(C-\,)}}} (~org-cycle-agenda-files~) ::
8221 #+findex: org-cycle-agenda-files
8222 #+cindex: cycling, of agenda files
8223 Cycle through agenda file list, visiting one file after the other.
8225 - {{{kbd(M-x org-iswitchb)}}} ::
8227 #+findex: org-iswitchb
8228 Command to use an ~iswitchb~-like interface to switch to and
8229 between Org buffers.
8231 #+texinfo: @noindent
8232 The Org menu contains the current list of files and can be used to
8235 If you would like to focus the agenda temporarily on a file not in
8236 this list, or on just one file in the list, or even on only a subtree
8237 in a file, then this can be done in different ways. For a single
8238 agenda command, you may press {{{kbd(<)}}} once or several times in
8239 the dispatcher (see [[*The agenda dispatcher]]). To restrict the agenda
8240 scope for an extended period, use the following commands:
8242 - {{{kbd(C-c C-x <)}}} (~org-agenda-set-restriction-lock~) ::
8245 #+findex: org-agenda-set-restriction-lock
8246 Permanently restrict the agenda to the current subtree. When
8247 called with a prefix argument, or with the cursor before the
8248 first headline in a file, set the agenda scope to the entire
8249 file. This restriction remains in effect until removed with
8250 {{{kbd(C-c C-x >)}}}, or by typing either {{{kbd(<)}}} or
8251 {{{kbd(>)}}} in the agenda dispatcher. If there is a window
8252 displaying an agenda view, the new restriction takes effect
8255 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
8258 #+findex: org-agenda-remove-restriction-lock
8259 Remove the permanent restriction created by {{{kbd(C-c C-x <)}}}.
8261 #+texinfo: @noindent
8262 When working with =speedbar.el=, you can use the following commands in
8265 - {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) ::
8267 #+findex: org-speedbar-set-agenda-restriction
8268 Permanently restrict the agenda to the item -- either an Org file
8269 or a subtree in such a file -- at the cursor in the Speedbar
8270 frame. If there is a window displaying an agenda view, the new
8271 restriction takes effect immediately.
8273 - {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) ::
8275 #+findex: org-agenda-remove-restriction-lock
8276 Lift the restriction.
8278 ** The agenda dispatcher
8280 :DESCRIPTION: Keyboard access to agenda views.
8281 :ALT_TITLE: Agenda dispatcher
8283 #+cindex: agenda dispatcher
8284 #+cindex: dispatching agenda commands
8286 The views are created through a dispatcher, which should be bound to
8287 a global key -- for example {{{kbd(C-c a)}}} (see [[*Activation]]). In
8288 the following we will assume that {{{kbd(C-c a)}}} is indeed how the
8289 dispatcher is accessed and list keyboard access to commands
8290 accordingly. After pressing {{{kbd(C-c a)}}}, an additional letter is
8291 required to execute a command. The dispatcher offers the following
8297 Create the calendar-like agenda (see [[*Weekly/daily agenda]]).
8299 - {{{kbd(t)}}} or {{{kbd(T)}}} ::
8303 Create a list of all TODO items (see [[*The global TODO list]]).
8305 - {{{kbd(m)}}} or {{{kbd(M)}}} ::
8309 Create a list of headlines matching a given expression (see
8310 [[*Matching tags and properties]]).
8315 Create a list of entries selected by a boolean expression of
8316 keywords and/or regular expressions that must or must not occur
8322 #+vindex: org-agenda-text-search-extra-files
8323 Search for a regular expression in all agenda files and
8324 additionally in the files listed in
8325 ~org-agenda-text-search-extra-files~. This uses the Emacs
8326 command ~multi-occur~. A prefix argument can be used to specify
8327 the number of context lines for each match, default is
8330 - {{{kbd(#)}}} or {{{kbd(!)}}} ::
8334 Create a list of stuck projects (see [[*Stuck projects]]).
8339 Restrict an agenda command to the current buffer[fn:90]. After
8340 pressing {{{kbd(<)}}}, you still need to press the character
8341 selecting the command.
8346 If there is an active region, restrict the following agenda
8347 command to the region. Otherwise, restrict it to the current
8348 subtree[fn:91]. After pressing {{{kbd(< <)}}}, you still need to
8349 press the character selecting the command.
8354 #+vindex: org-agenda-sticky
8355 #+findex: org-toggle-sticky-agenda
8356 Toggle sticky agenda views. By default, Org maintains only
8357 a single agenda buffer and rebuilds it each time you change the
8358 view, to make sure everything is always up to date. If you
8359 switch between views often and the build time bothers you, you
8360 can turn on sticky agenda buffers (make this the default by
8361 customizing the variable ~org-agenda-sticky~). With sticky
8362 agendas, the dispatcher only switches to the selected view, you
8363 need to update it by hand with {{{kbd(r)}}} or {{{kbd(g)}}}. You
8364 can toggle sticky agenda view any time with
8365 ~org-toggle-sticky-agenda~.
8367 You can also define custom commands that are accessible through the
8368 dispatcher, just like the default commands. This includes the
8369 possibility to create extended agenda buffers that contain several
8370 blocks together, for example the weekly agenda, the global TODO list
8371 and a number of special tags matches. See [[*Custom agenda views]].
8373 ** The built-in agenda views
8375 :DESCRIPTION: What is available out of the box?
8376 :ALT_TITLE: Built-in agenda views
8379 In this section we describe the built-in views.
8381 *** Weekly/daily agenda
8383 :DESCRIPTION: The calendar page with current tasks.
8386 #+cindex: weekly agenda
8387 #+cindex: daily agenda
8389 The purpose of the weekly/daily /agenda/ is to act like a page of
8390 a paper agenda, showing all the tasks for the current week or day.
8392 - {{{kbd(C-c a a)}}} (~org-agenda-list~) ::
8395 #+findex: org-agenda-list
8396 #+cindex: org-agenda, command
8397 Compile an agenda for the current week from a list of Org files.
8398 The agenda shows the entries for each day. With a numeric
8399 prefix[fn:92] (like {{{kbd(C-u 2 1 C-c a a)}}}) you may set the
8400 number of days to be displayed.
8402 #+vindex: org-agenda-span
8403 #+vindex: org-agenda-start-day
8404 #+vindex: org-agenda-start-on-weekday
8405 The default number of days displayed in the agenda is set by the
8406 variable ~org-agenda-span~. This variable can be set to any number of
8407 days you want to see by default in the agenda, or to a span name, such
8408 a ~day~, ~week~, ~month~ or ~year~. For weekly agendas, the default
8409 is to start on the previous Monday (see
8410 ~org-agenda-start-on-weekday~). You can also set the start date using
8411 a date shift: ~(setq org-agenda-start-day "+10d")~ starts the agenda
8412 ten days from today in the future.
8414 Remote editing from the agenda buffer means, for example, that you can
8415 change the dates of deadlines and appointments from the agenda buffer.
8416 The commands available in the Agenda buffer are listed in [[*Commands
8417 in the agenda buffer]].
8419 **** Calendar/Diary integration
8423 #+cindex: calendar integration
8424 #+cindex: diary integration
8426 Emacs contains the calendar and diary by Edward M. Reingold. The
8427 calendar displays a three-month calendar with holidays from different
8428 countries and cultures. The diary allows you to keep track of
8429 anniversaries, lunar phases, sunrise/set, recurrent appointments
8430 (weekly, monthly) and more. In this way, it is quite complementary to
8431 Org. It can be very useful to combine output from Org with the diary.
8433 In order to include entries from the Emacs diary into Org mode's
8434 agenda, you only need to customize the variable
8436 #+begin_src emacs-lisp
8437 (setq org-agenda-include-diary t)
8440 #+texinfo: @noindent
8441 After that, everything happens automatically. All diary entries
8442 including holidays, anniversaries, etc., are included in the agenda
8443 buffer created by Org mode. {{{kbd(SPC)}}}, {{{kbd(TAB)}}}, and
8444 {{{kbd(RET)}}} can be used from the agenda buffer to jump to the diary
8445 file in order to edit existing diary entries. The {{{kbd(i)}}}
8446 command to insert new entries for the current date works in the agenda
8447 buffer, as well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and
8448 {{{kbd(C)}}} to display Sunrise/Sunset times, show lunar phases and to
8449 convert to other calendars, respectively. {{{kbd(c)}}} can be used to
8450 switch back and forth between calendar and agenda.
8452 If you are using the diary only for S-exp entries and holidays, it is
8453 faster to not use the above setting, but instead to copy or even move
8454 the entries into an Org file. Org mode evaluates diary-style sexp
8455 entries, and does it faster because there is no overhead for first
8456 creating the diary display. Note that the sexp entries must start at
8457 the left margin, no whitespace is allowed before them, as seen in the
8458 following segment of an Org file:[fn:93]
8465 %%(org-calendar-holiday) ; special function for holiday names
8471 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
8472 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
8475 **** Anniversaries from BBDB
8479 #+cindex: BBDB, anniversaries
8480 #+cindex: anniversaries, from BBDB
8482 #+findex: org-bbdb-anniversaries
8483 If you are using the Insidious Big Brother Database to store your
8484 contacts, you very likely prefer to store anniversaries in BBDB rather
8485 than in a separate Org or diary file. Org supports this and can show
8486 BBDB anniversaries as part of the agenda. All you need to do is to
8487 add the following to one of your agenda files:
8494 %%(org-bbdb-anniversaries)
8497 You can then go ahead and define anniversaries for a BBDB record.
8498 Basically, you need to press {{{kbd(C-o anniversary RET)}}} with the
8499 cursor in a BBDB record and then add the date in the format
8500 =YYYY-MM-DD= or =MM-DD=, followed by a space and the class of the
8501 anniversary (=birthday=, =wedding=, or a format string). If you omit
8502 the class, it defaults to =birthday=. Here are a few examples, the
8503 header for the file =org-bbdb.el= contains more detailed information.
8509 2008-04-14 %s released version 6.01 of Org mode, %d years ago
8512 After a change to BBDB, or for the first agenda display during an
8513 Emacs session, the agenda display suffers a short delay as Org updates
8514 its hash with anniversaries. However, from then on things will be
8515 very fast, much faster in fact than a long list of
8516 =%%(diary-anniversary)= entries in an Org or Diary file.
8518 #+findex: org-bbdb-anniversaries-future
8519 If you would like to see upcoming anniversaries with a bit of
8520 forewarning, you can use the following instead:
8527 %%(org-bbdb-anniversaries-future 3)
8530 That will give you three days' warning: on the anniversary date itself
8531 and the two days prior. The argument is optional: if omitted, it
8534 **** Appointment reminders
8538 #+cindex: @file{appt.el}
8539 #+cindex: appointment reminders
8540 #+cindex: appointment
8543 #+cindex: APPT_WARNTIME, keyword
8544 Org can interact with Emacs appointments notification facility. To
8545 add the appointments of your agenda files, use the command
8546 ~org-agenda-to-appt~. This command lets you filter through the list
8547 of your appointments and add only those belonging to a specific
8548 category or matching a regular expression. It also reads
8549 a =APPT_WARNTIME= property which overrides the value of
8550 ~appt-message-warning-time~ for this appointment. See the docstring
8553 *** The global TODO list
8555 :DESCRIPTION: All unfinished action items.
8556 :ALT_TITLE: Global TODO list
8558 #+cindex: global TODO list
8559 #+cindex: TODO list, global
8561 The global TODO list contains all unfinished TODO items formatted and
8562 collected into a single place.
8564 - {{{kbd(C-c a t)}}} (~org-todo-list~) ::
8567 #+findex: org-todo-list
8568 Show the global TODO list. This collects the TODO items from all
8569 agenda files (see [[*Agenda views]]) into a single buffer. By
8570 default, this lists items with a state the is not a DONE state.
8571 The buffer is in ~agenda-mode~, so there are commands to examine
8572 and manipulate the TODO entries directly from that buffer (see
8573 [[*Commands in the agenda buffer]]).
8575 - {{{kbd(C-c a T)}}} (~org-todo-list~) ::
8578 #+findex: org-todo-list
8579 #+cindex: TODO keyword matching
8580 #+vindex: org-todo-keywords
8581 Like the above, but allows selection of a specific TODO keyword.
8582 You can also do this by specifying a prefix argument to
8583 {{{kbd(C-c a t)}}}. You are prompted for a keyword, and you may
8584 also specify several keywords by separating them with =|= as the
8585 boolean OR operator. With a numeric prefix, the Nth keyword in
8586 ~org-todo-keywords~ is selected.
8589 The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you
8590 can give a prefix argument to this command to change the selected
8591 TODO keyword, for example {{{kbd(3 r)}}}. If you often need
8592 a search for a specific keyword, define a custom command for it
8593 (see [[*The agenda dispatcher]]).
8595 Matching specific TODO keywords can also be done as part of
8596 a tags search (see [[*Tag searches]]).
8598 Remote editing of TODO items means that you can change the state of
8599 a TODO entry with a single key press. The commands available in the
8600 TODO list are described in [[*Commands in the agenda buffer]].
8602 #+cindex: sublevels, inclusion into TODO list
8603 Normally the global TODO list simply shows all headlines with TODO
8604 keywords. This list can become very long. There are two ways to keep
8608 #+vindex: org-agenda-todo-ignore-scheduled
8609 #+vindex: org-agenda-todo-ignore-deadlines
8610 #+vindex: org-agenda-todo-ignore-timestamp
8611 #+vindex: org-agenda-todo-ignore-with-date
8612 Some people view a TODO item that has been /scheduled/ for execution
8613 or have a /deadline/ (see [[*Timestamps, deadlines, and scheduling]]) as
8614 no longer /open/. Configure the variables
8615 ~org-agenda-todo-ignore-scheduled~,
8616 ~org-agenda-todo-ignore-deadlines~,
8617 ~org-agenda-todo-ignore-timestamp~ and/or
8618 ~org-agenda-todo-ignore-with-date~ to exclude such items from the
8622 #+vindex: org-agenda-todo-list-sublevels
8623 TODO items may have sublevels to break up the task into subtasks.
8624 In such cases it may be enough to list only the highest level TODO
8625 headline and omit the sublevels from the global list. Configure the
8626 variable ~org-agenda-todo-list-sublevels~ to get this behavior.
8628 *** Matching tags and properties
8630 :DESCRIPTION: Structured information with fine-tuned search.
8632 #+cindex: matching, of tags
8633 #+cindex: matching, of properties
8635 #+cindex: match view
8637 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]),
8638 or have properties (see [[*Properties and columns]]), you can select
8639 headlines based on this metadata and collect them into an agenda
8640 buffer. The match syntax described here also applies when creating
8641 sparse trees with {{{kbd(C-c / m)}}}.
8643 - {{{kbd(C-c a m)}}} (~org-tags-view~) ::
8646 #+findex: org-tags-view
8647 Produce a list of all headlines that match a given set of tags.
8648 The command prompts for a selection criterion, which is a boolean
8649 logic expression with tags, like =+work+urgent-withboss= or
8650 =work|home= (see [[*Tags]]). If you often need a specific search,
8651 define a custom command for it (see [[*The agenda dispatcher]]).
8653 - {{{kbd(C-c a M)}}} (~org-tags-view~) ::
8656 #+findex: org-tags-view
8657 #+vindex: org-tags-match-list-sublevels
8658 #+vindex: org-agenda-tags-todo-honor-ignore-options
8659 Like {{{kbd(C-c a m)}}}, but only select headlines that are also
8660 TODO items and force checking subitems (see the variable
8661 ~org-tags-match-list-sublevels~). To exclude scheduled/deadline
8662 items, see the variable
8663 ~org-agenda-tags-todo-honor-ignore-options~. Matching specific
8664 TODO keywords together with a tags match is also possible, see
8667 The commands available in the tags list are described in [[*Commands
8668 in the agenda buffer]].
8670 #+cindex: boolean logic, for agenda searches
8671 A search string can use Boolean operators =&= for AND and =|= for OR.
8672 =&= binds more strongly than =|=. Parentheses are currently not
8673 implemented. Each element in the search is either a tag, a regular
8674 expression matching tags, or an expression like =PROPERTY OPERATOR
8675 VALUE= with a comparison operator, accessing a property value. Each
8676 element may be preceded by =-= to select against it, and =+= is
8677 syntactic sugar for positive selection. The AND operator =&= is
8678 optional when =+= or =-= is present. Here are some examples, using
8683 Select headlines tagged =work=, but discard those also tagged
8688 Selects lines tagged =work= or =laptop=.
8690 - ~work|laptop+night~ ::
8692 Like before, but require the =laptop= lines to be tagged
8695 #+cindex: regular expressions, with tags search
8696 Instead of a tag, you may also specify a regular expression enclosed
8697 in curly braces. For example, =work+{^boss.*}= matches headlines that
8698 contain the tag =:work:= and any tag /starting/ with =boss=.
8700 #+cindex: group tags, as regular expressions
8701 Group tags (see [[*Tag hierarchy]]) are expanded as regular expressions.
8702 E.g., if =work= is a group tag for the group =:work:lab:conf:=, then
8703 searching for =work= also searches for ={\(?:work\|lab\|conf\)}= and
8704 searching for =-work= searches for all headlines but those with one of
8705 the tags in the group (i.e., =-{\(?:work\|lab\|conf\)}=).
8707 #+cindex: TODO keyword matching, with tags search
8708 #+cindex: level, for tags/property match
8709 #+cindex: category, for tags/property match
8710 #+vindex: org-odd-levels-only
8711 You may also test for properties (see [[*Properties and columns]]) at the
8712 same time as matching tags. The properties may be real properties, or
8713 special properties that represent other metadata (see [[*Special
8714 properties]]). For example, the property =TODO= represents the TODO
8715 keyword of the entry. Or, the property =LEVEL= represents the level
8716 of an entry. So searching =+LEVEL=3+boss-TODO​="DONE"= lists all level
8717 three headlines that have the tag =boss= and are /not/ marked with the
8718 TODO keyword =DONE=. In buffers with ~org-odd-levels-only~ set,
8719 =LEVEL= does not count the number of stars, but =LEVEL=2= corresponds
8722 Here are more examples:
8724 - =work+TODO​="WAITING"= ::
8726 Select =work=-tagged TODO lines with the specific TODO keyword
8729 - =work+TODO​="WAITING"|home+TODO​="WAITING"= ::
8731 Waiting tasks both at work and at home.
8733 When matching properties, a number of different operators can be used
8734 to test the value of a property. Here is a complex example:
8737 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
8738 +With={Sarah|Denny}+SCHEDULED>="<2008-10-11>"
8741 #+texinfo: @noindent
8742 The type of comparison depends on how the comparison value is written:
8744 - If the comparison value is a plain number, a numerical comparison is
8745 done, and the allowed operators are =<=, ===, =>=, =<==, =>==, and
8748 - If the comparison value is enclosed in double-quotes, a string
8749 comparison is done, and the same operators are allowed.
8751 - If the comparison value is enclosed in double-quotes /and/ angular
8752 brackets (like =DEADLINE<​="<2008-12-24 18:30>"=), both values are
8753 assumed to be date/time specifications in the standard Org way, and
8754 the comparison is done accordingly. Valid values also include
8755 ="<now>"= for now (including time), ="<today>"=, and ="<tomorrow>"=
8756 for these days at 0:00 hours, i.e., without a time specification.
8757 You can also use strings like ="<+5d>"= or ="<-2m>"= with units =d=,
8758 =w=, =m=, and =y= for day, week, month, and year, respectively.
8760 - If the comparison value is enclosed in curly braces, a regexp match
8761 is performed, with === meaning that the regexp matches the property
8762 value, and =<>= meaning that it does not match.
8764 So the search string in the example finds entries tagged =work= but
8765 not =boss=, which also have a priority value =A=, a =Coffee= property
8766 with the value =unlimited=, an =EFFORT= property that is numerically
8767 smaller than 2, a =With= property that is matched by the regular
8768 expression =Sarah|Denny=, and that are scheduled on or after October
8771 You can configure Org mode to use property inheritance during
8772 a search, but beware that this can slow down searches considerably.
8773 See [[*Property inheritance]], for details.
8775 For backward compatibility, and also for typing speed, there is also
8776 a different way to test TODO states in a search. For this, terminate
8777 the tags/property part of the search string (which may include several
8778 terms connected with =|=) with a =/= and then specify a Boolean
8779 expression just for TODO keywords. The syntax is then similar to that
8780 for tags, but should be applied with care: for example, a positive
8781 selection on several TODO keywords cannot meaningfully be combined
8782 with boolean AND. However, /negative selection/ combined with AND can
8783 be meaningful. To make sure that only lines are checked that actually
8784 have any TODO keyword (resulting in a speed-up), use {{{kbd(C-c
8785 a M)}}}, or equivalently start the TODO part after the slash with =!=.
8786 Using {{{kbd(C-c a M)}}} or =/!= does not match TODO keywords in
8787 a DONE state. Examples:
8791 Same as =work+TODO​="WAITING"=.
8793 - =work/!-WAITING-NEXT= ::
8795 Select =work=-tagged TODO lines that are neither =WAITING= nor
8798 - =work/!+WAITING|+NEXT= ::
8800 Select =work=-tagged TODO lines that are either =WAITING= or
8805 :DESCRIPTION: Find entries by searching for text.
8807 #+cindex: search view
8808 #+cindex: text search
8809 #+cindex: searching, for text
8811 This agenda view is a general text search facility for Org mode
8812 entries. It is particularly useful to find notes.
8814 - {{{kbd(C-c a s)}}} (~org-search-view~) ::
8817 #+findex: org-search-view
8818 This is a special search that lets you select entries by matching
8819 a substring or specific words using a boolean logic.
8821 For example, the search string =computer equipment= matches entries
8822 that contain =computer equipment= as a substring, even if the two
8823 words are separated by more space or a line break.
8825 Search view can also search for specific keywords in the entry, using
8826 Boolean logic. The search string =+computer
8827 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the
8828 keywords =computer= and =wifi=, but not the keyword =ethernet=, and
8829 which are also not matched by the regular expression =8\.11[bg]=,
8830 meaning to exclude both =8.11b= and =8.11g=. The first =+= is
8831 necessary to turn on boolean search, other =+= characters are
8832 optional. For more details, see the docstring of the command
8835 You can incrementally adjust a boolean search with the following keys
8837 #+attr_texinfo: :columns 0.1 0.6
8838 | {{{kbd([)}}} | Add a positive search word |
8839 | {{{kbd(])}}} | Add a negative search word |
8840 | {{{kbd({)}}} | Add a positive regular expression |
8841 | {{{kbd(})}}} | Add a negative regular expression |
8843 #+vindex: org-agenda-text-search-extra-files
8844 Note that in addition to the agenda files, this command also searches
8845 the files listed in ~org-agenda-text-search-extra-files~.
8849 :DESCRIPTION: Find projects you need to review.
8851 #+pindex: GTD, Getting Things Done
8853 If you are following a system like David Allen's GTD to organize your
8854 work, one of the "duties" you have is a regular review to make sure
8855 that all projects move along. A /stuck/ project is a project that has
8856 no defined next actions, so it never shows up in the TODO lists Org
8857 mode produces. During the review, you need to identify such projects
8858 and define next actions for them.
8860 - {{{kbd(C-c a #)}}} (~org-agenda-list-stuck-projects~) ::
8863 #+findex: org-agenda-list-stuck-projects
8864 List projects that are stuck.
8866 - {{{kbd(C-c a !)}}} ::
8869 #+vindex: org-stuck-projects
8870 Customize the variable ~org-stuck-projects~ to define what
8871 a stuck project is and how to find it.
8873 You almost certainly need to configure this view before it works for
8874 you. The built-in default assumes that all your projects are level-2
8875 headlines, and that a project is not stuck if it has at least one
8876 entry marked with a TODO keyword =TODO= or =NEXT= or =NEXTACTION=.
8878 Let's assume that you, in your own way of using Org mode, identify
8879 projects with a tag =:PROJECT:=, and that you use a TODO keyword
8880 =MAYBE= to indicate a project that should not be considered yet.
8881 Let's further assume that the TODO keyword =DONE= marks finished
8882 projects, and that =NEXT= and =TODO= indicate next actions. The tag
8883 =:@shop:= indicates shopping and is a next action even without the
8884 NEXT tag. Finally, if the project contains the special word =IGNORE=
8885 anywhere, it should not be listed either. In this case you would
8886 start by identifying eligible projects with a tags/TODO match (see
8887 [[*Tag searches]]) =+PROJECT/-MAYBE-DONE=, and then check for =TODO=,
8888 =NEXT=, =@shop=, and =IGNORE= in the subtree to identify projects that
8889 are not stuck. The correct customization for this is:
8891 #+begin_src emacs-lisp
8892 (setq org-stuck-projects
8893 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop")
8897 Note that if a project is identified as non-stuck, the subtree of this
8898 entry is searched for stuck projects.
8900 ** Presentation and sorting
8902 :DESCRIPTION: How agenda items are prepared for display.
8904 #+cindex: presentation, of agenda items
8906 #+vindex: org-agenda-prefix-format
8907 #+vindex: org-agenda-tags-column
8908 Before displaying items in an agenda view, Org mode visually prepares
8909 the items and sorts them. Each item occupies a single line. The line
8910 starts with a /prefix/ that contains the /category/ (see [[*Categories]])
8911 of the item and other important information. You can customize in
8912 which column tags are displayed through ~org-agenda-tags-column~. You
8913 can also customize the prefix using the option
8914 ~org-agenda-prefix-format~. This prefix is followed by a cleaned-up
8915 version of the outline headline associated with the item.
8919 :DESCRIPTION: Not all tasks are equal.
8922 #+cindex: CATEGORY, keyword
8924 The category is a broad label assigned to each agenda item. By
8925 default, the category is simply derived from the file name, but you
8926 can also specify it with a special line in the buffer, like
8929 : #+CATEGORY: Thesis
8931 #+texinfo: @noindent
8932 #+cindex: CATEGORY, property
8933 If you would like to have a special category for a single entry or
8934 a (sub)tree, give the entry a =CATEGORY= property with the special
8935 category you want to apply as the value.
8937 #+texinfo: @noindent
8938 The display in the agenda buffer looks best if the category is not
8939 longer than 10 characters.
8941 #+texinfo: @noindent
8942 #+vindex: org-agenda-category-icon-alist
8943 You can set up icons for category by customizing the
8944 ~org-agenda-category-icon-alist~ variable.
8946 *** Time-of-day specifications
8948 :DESCRIPTION: How the agenda knows the time.
8950 #+cindex: time-of-day specification
8952 Org mode checks each agenda item for a time-of-day specification. The
8953 time can be part of the timestamp that triggered inclusion into the
8956 : <2005-05-10 Tue 19:00>
8958 #+texinfo: @noindent
8959 Time ranges can be specified with two timestamps:
8961 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
8963 In the headline of the entry itself, a time(range) may also appear as
8964 plain text (like =12:45= or a =8:30-1pm=). If the agenda integrates
8965 the Emacs diary (see [[*Weekly/daily agenda]]), time specifications in
8966 diary entries are recognized as well.
8968 For agenda display, Org mode extracts the time and displays it in
8969 a standard 24 hour format as part of the prefix. The example times in
8970 the previous paragraphs would end up in the agenda like this:
8973 8:30-13:00 Arthur Dent lies in front of the bulldozer
8974 12:45...... Ford Prefect arrives and takes Arthur to the pub
8975 19:00...... The Vogon reads his poem
8976 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
8980 If the agenda is in single-day mode, or for the display of today, the
8981 timed entries are embedded in a time grid, like
8984 8:00...... ------------------
8985 8:30-13:00 Arthur Dent lies in front of the bulldozer
8986 10:00...... ------------------
8987 12:00...... ------------------
8988 12:45...... Ford Prefect arrives and takes Arthur to the pub
8989 14:00...... ------------------
8990 16:00...... ------------------
8991 18:00...... ------------------
8992 19:00...... The Vogon reads his poem
8993 20:00...... ------------------
8994 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
8997 #+vindex: org-agenda-use-time-grid
8998 #+vindex: org-agenda-time-grid
8999 The time grid can be turned on and off with the variable
9000 ~org-agenda-use-time-grid~, and can be configured with
9001 ~org-agenda-time-grid~.
9003 *** Sorting of agenda items
9005 :DESCRIPTION: The order of things.
9007 #+cindex: sorting, of agenda items
9008 #+cindex: priorities, of agenda items
9010 Before being inserted into a view, the items are sorted. How this is
9011 done depends on the type of view.
9014 #+vindex: org-agenda-files
9015 For the daily/weekly agenda, the items for each day are sorted. The
9016 default order is to first collect all items containing an explicit
9017 time-of-day specification. These entries are shown at the beginning
9018 of the list, as a /schedule/ for the day. After that, items remain
9019 grouped in categories, in the sequence given by ~org-agenda-files~.
9020 Within each category, items are sorted by priority (see
9021 [[*Priorities]]), which is composed of the base priority (2000 for
9022 priority =A=, 1000 for =B=, and 0 for =C=), plus additional
9023 increments for overdue scheduled or deadline items.
9025 - For the TODO list, items remain in the order of categories, but
9026 within each category, sorting takes place according to priority (see
9027 [[*Priorities]]). The priority used for sorting derives from the
9028 priority cookie, with additions depending on how close an item is to
9029 its due or scheduled date.
9031 - For tags matches, items are not sorted at all, but just appear in
9032 the sequence in which they are found in the agenda files.
9034 #+vindex: org-agenda-sorting-strategy
9035 Sorting can be customized using the variable
9036 ~org-agenda-sorting-strategy~, and may also include criteria based on
9037 the estimated effort of an entry (see [[*Effort estimates]]).
9039 *** Filtering/limiting agenda times
9041 :DESCRIPTION: Dynamically narrow the agenda.
9044 Agenda built-in or customized commands are statically defined. Agenda
9045 filters and limits provide two ways of dynamically narrowing down the
9046 list of agenda entries: /filters/ and /limits/. Filters only act on
9047 the display of the items, while limits take effect before the list of
9048 agenda entries is built. Filters are more often used interactively,
9049 while limits are mostly useful when defined as local variables within
9050 custom agenda commands.
9052 **** Filtering in the agenda
9056 #+cindex: agenda filtering
9057 #+cindex: filtering entries, in agenda
9058 #+cindex: tag filtering, in agenda
9059 #+cindex: category filtering, in agenda
9060 #+cindex: top headline filtering, in agenda
9061 #+cindex: effort filtering, in agenda
9062 #+cindex: query editing, in agenda
9064 - {{{kbd(/)}}} (~org-agenda-filter-by-tag~) ::
9066 #+findex: org-agenda-filter-by-tag
9067 #+vindex: org-agenda-tag-filter-preset
9068 Filter the agenda view with respect to a tag and/or effort
9069 estimates. The difference between this and a custom agenda
9070 command is that filtering is very fast, so that you can switch
9071 quickly between different filters without having to recreate the
9074 You are prompted for a tag selection letter; {{{kbd(SPC)}}} means
9075 any tag at all. Pressing {{{kbd(TAB)}}} at that prompt offers
9076 completion to select a tag, including any tags that do not have
9077 a selection character. The command then hides all entries that
9078 do not contain or inherit this tag. When called with prefix
9079 argument, remove the entries that /do/ have the tag. A second
9080 {{{kbd(/)}}} at the prompt turns off the filter and shows any
9081 hidden entries. Pressing {{{kbd(+)}}} or {{{kbd(-)}}} switches
9082 between filtering and excluding the next tag.
9084 #+vindex: org-agenda-auto-exclude-function
9085 Org also supports automatic, context-aware tag filtering. If the
9086 variable ~org-agenda-auto-exclude-function~ is set to
9087 a user-defined function, that function can decide which tags
9088 should be excluded from the agenda automatically. Once this is
9089 set, the {{{kbd(/)}}} command then accepts {{{kbd(RET)}}} as
9090 a sub-option key and runs the auto exclusion logic. For example,
9091 let's say you use a =Net= tag to identify tasks which need
9092 network access, an =Errand= tag for errands in town, and a =Call=
9093 tag for making phone calls. You could auto-exclude these tags
9094 based on the availability of the Internet, and outside of
9095 business hours, with something like this:
9097 #+begin_src emacs-lisp
9098 (defun org-my-auto-exclude-function (tag)
9100 ((string= tag "Net")
9101 (/= 0 (call-process "/sbin/ping" nil nil nil
9102 "-c1" "-q" "-t1" "mail.gnu.org")))
9103 ((or (string= tag "Errand") (string= tag "Call"))
9104 (let ((hour (nth 2 (decode-time))))
9105 (or (< hour 8) (> hour 21)))))
9108 (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
9111 - {{{kbd(<)}}} (~org-agenda-filter-by-category~) ::
9113 #+findex: org-agenda-filter-by-category
9114 Filter the current agenda view with respect to the category of
9115 the item at point. Pressing {{{kbd(<)}}} another time removes
9116 this filter. When called with a prefix argument exclude the
9117 category of the item at point from the agenda.
9119 #+vindex: org-agenda-category-filter-preset
9120 You can add a filter preset in custom agenda commands through the
9121 option ~org-agenda-category-filter-preset~. See [[*Setting options
9122 for custom commands]].
9124 - {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) ::
9126 #+findex: org-agenda-filter-by-top-headline
9127 Filter the current agenda view and only display the siblings and
9128 the parent headline of the one at point.
9130 - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) ::
9132 #+findex: org-agenda-filter-by-regexp
9133 Filter the agenda view by a regular expression: only show agenda
9134 entries matching the regular expression the user entered. When
9135 called with a prefix argument, it filters /out/ entries matching
9136 the regexp. With two universal prefix arguments, it removes all
9137 the regexp filters, which can be accumulated.
9139 #+vindex: org-agenda-regexp-filter-preset
9140 You can add a filter preset in custom agenda commands through the
9141 option ~org-agenda-regexp-filter-preset~. See [[*Setting options
9142 for custom commands]].
9144 - {{{kbd(_)}}} (~org-agenda-filter-by-effort~) ::
9146 #+findex: org-agenda-filter-by-effort
9147 Filter the agenda view with respect to effort estimates. You
9148 first need to set up allowed efforts globally, for example
9150 #+begin_src emacs-lisp
9151 (setq org-global-properties
9152 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
9155 #+vindex: org-sort-agenda-noeffort-is-high
9156 You can then filter for an effort by first typing an operator,
9157 one of {{{kbd(<)}}}, {{{kbd(>)}}} and {{{kbd(=)}}}, and then the
9158 one-digit index of an effort estimate in your array of allowed
9159 values, where {{{kbd(0)}}} means the 10th value. The filter then
9160 restricts to entries with effort smaller-or-equal, equal, or
9161 larger-or-equal than the selected value. For application of the
9162 operator, entries without a defined effort are treated according
9163 to the value of ~org-sort-agenda-noeffort-is-high~.
9165 When called with a prefix argument, it removes entries matching
9166 the condition. With two universal prefix arguments, it clears
9167 effort filters, which can be accumulated.
9169 #+vindex: org-agenda-effort-filter-preset
9170 You can add a filter preset in custom agenda commands through the
9171 option ~org-agenda-effort-filter-preset~. See [[*Setting options
9172 for custom commands]].
9174 - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) ::
9176 Remove all filters in the current agenda view.
9178 **** Setting limits for the agenda
9182 #+cindex: limits, in agenda
9184 Here is a list of options that you can set, either globally, or
9185 locally in your custom agenda views (see [[*Custom agenda views]]).
9187 - ~org-agenda-max-entries~ ::
9189 #+vindex: org-agenda-max-entries
9190 Limit the number of entries.
9192 - ~org-agenda-max-effort~ ::
9194 #+vindex: org-agenda-max-effort
9195 Limit the duration of accumulated efforts (as minutes).
9197 - ~org-agenda-max-todos~ ::
9199 #+vindex: org-agenda-max-todos
9200 Limit the number of entries with TODO keywords.
9202 - ~org-agenda-max-tags~ ::
9204 #+vindex: org-agenda-max-tags
9205 Limit the number of tagged entries.
9207 When set to a positive integer, each option excludes entries from
9208 other categories: for example, ~(setq org-agenda-max-effort 100)~
9209 limits the agenda to 100 minutes of effort and exclude any entry that
9210 has no effort property. If you want to include entries with no effort
9211 property, use a negative value for ~org-agenda-max-effort~. One
9212 useful setup is to use ~org-agenda-max-entries~ locally in a custom
9213 command. For example, this custom command displays the next five
9214 entries with a =NEXT= TODO keyword.
9216 #+begin_src emacs-lisp
9217 (setq org-agenda-custom-commands
9219 ((org-agenda-max-entries 5)))))
9222 Once you mark one of these five entry as DONE, rebuilding the agenda
9223 will again the next five entries again, including the first entry that
9224 was excluded so far.
9226 You can also dynamically set temporary limits, which are lost when
9227 rebuilding the agenda:
9229 - {{{kbd(~ )}}} (~org-agenda-limit-interactively~) ::
9231 #+findex: org-agenda-limit-interactively
9232 This prompts for the type of limit to apply and its value.
9234 ** Commands in the agenda buffer
9236 :DESCRIPTION: Remote editing of Org trees.
9237 :ALT_TITLE: Agenda commands
9239 #+cindex: commands, in agenda buffer
9241 Entries in the agenda buffer are linked back to the Org file or diary
9242 file where they originate. You are not allowed to edit the agenda
9243 buffer itself, but commands are provided to show and jump to the
9244 original entry location, and to edit the Org files "remotely" from the
9245 agenda buffer. In this way, all information is stored only once,
9246 removing the risk that your agenda and note files may diverge.
9248 Some commands can be executed with mouse clicks on agenda lines. For
9249 the other commands, the cursor needs to be in the desired line.
9255 #+cindex: motion commands in agenda
9257 - {{{kbd(n)}}} (~org-agenda-next-line~) ::
9260 #+findex: org-agenda-next-line
9261 Next line (same as {{{kbd(down)}}} and {{{kbd(C-n)}}}).
9263 - {{{kbd(p)}}} (~org-agenda-previous-line~) ::
9266 #+findex: org-agenda-previous-line
9267 Previous line (same as {{{kbd(up)}}} and {{{kbd(C-p)}}}).
9269 *** View/Go to Org file
9273 #+cindex: view file commands in agenda
9275 - {{{kbd(SPC)}}} or {{{kbd(mouse-3)}}} (~org-agenda-show-and-scroll-up~) ::
9279 #+findex: org-agenda-show-and-scroll-up
9280 Display the original location of the item in another window.
9281 With a prefix argument, make sure that drawers stay folded.
9283 - {{{kbd(L)}}} (~org-agenda-recenter~) ::
9285 #+findex: org-agenda-recenter
9286 Display original location and recenter that window.
9288 - {{{kbd(TAB)}}} or {{{kbd(mouse-2)}}} (~org-agenda-goto~) ::
9292 #+findex: org-agenda-goto
9293 Go to the original location of the item in another window.
9295 - {{{kbd(RET)}}} (~org-agenda-switch-to~) ::
9298 #+findex: org-agenda-switch-to
9299 Go to the original location of the item and delete other windows.
9301 - {{{kbd(F)}}} (~org-agenda-follow-mode~) ::
9304 #+findex: org-agenda-follow-mode
9305 #+vindex: org-agenda-start-with-follow-mode
9306 Toggle Follow mode. In Follow mode, as you move the cursor
9307 through the agenda buffer, the other window always shows the
9308 corresponding location in the Org file. The initial setting for
9309 this mode in new agenda buffers can be set with the variable
9310 ~org-agenda-start-with-follow-mode~.
9312 - {{{kbd(C-c C-x b)}}} (~org-agenda-tree-to-indirect-buffer~) ::
9315 #+findex: org-agenda-tree-to-indirect-buffer
9316 Display the entire subtree of the current item in an indirect
9317 buffer. With a numeric prefix argument N, go up to level N and
9318 then take that tree. If N is negative, go up that many levels.
9319 With a {{{kbd(C-u)}}} prefix, do not remove the previously used
9322 - {{{kbd(C-c C-o)}}} (~org-agenda-open-link~) ::
9325 #+findex: org-agenda-open-link
9326 Follow a link in the entry. This offers a selection of any links
9327 in the text belonging to the referenced Org node. If there is
9328 only one link, follow it without a selection prompt.
9334 #+cindex: change agenda display
9335 #+cindex: display changing, in agenda
9337 #+attr_texinfo: :sep ,
9341 Interactively select another agenda view and append it to the
9347 Delete other windows.
9349 - {{{kbd(v d)}}} or short {{{kbd(d)}}} (~org-agenda-day-view~) ::
9353 #+findex: org-agenda-day-view
9354 Switch to day view. When switching to day view, this setting
9355 becomes the default for subsequent agenda refreshes. A numeric
9356 prefix argument may be used to jump directly to a specific day of
9357 the year. For example, {{{kbd(32 d)}}} jumps to February 1st.
9358 When setting day view, a year may be encoded in the prefix
9359 argument as well. For example, {{{kbd(200712 d)}}} jumps to
9360 January 12, 2007. If such a year specification has only one or
9361 two digits, it is expanded into one of the 30 next years or the
9364 - {{{kbd(v w)}}} or short {{{kbd(w)}}} (~org-agenda-week-view~) ::
9368 #+findex: org-agenda-week-view
9369 Switch to week view. When switching week view, this setting
9370 becomes the default for subsequent agenda refreshes. A numeric
9371 prefix argument may be used to jump directly to a specific day of
9372 the ISO week. For example {{{kbd(9 w)}}} to ISO week number 9.
9373 When setting week view, a year may be encoded in the prefix
9374 argument as well. For example, {{{kbd(200712 w)}}} jumps to week
9375 12 in 2007. If such a year specification has only one or two
9376 digits, it is expanded into one of the 30 next years or the last
9379 - {{{kbd(v m)}}} (~org-agenda-month-view~) ::
9382 #+findex: org-agenda-month-view
9383 Switch to month view. Because month views are slow to create,
9384 they do not become the default for subsequent agenda refreshes.
9385 A numeric prefix argument may be used to jump directly to
9386 a specific day of the month. When setting month view, a year may
9387 be encoded in the prefix argument as well. For example,
9388 {{{kbd(200712 m)}}} jumps to December, 2007. If such a year
9389 specification has only one or two digits, it is expanded into one
9390 of the 30 next years or the last 69 years.
9392 - {{{kbd(v y)}}} (~org-agenda-year-view~) ::
9395 #+findex: org-agenda-year-view
9396 Switch to year view. Because year views are slow to create, they
9397 do not become the default for subsequent agenda refreshes.
9398 A numeric prefix argument may be used to jump directly to
9399 a specific day of the year.
9401 - {{{kbd(v SPC)}}} (~org-agenda-reset-view~) ::
9404 #+findex: org-agenda-reset-view
9405 #+vindex: org-agenda-span
9406 Reset the current view to ~org-agenda-span~.
9408 - {{{kbd(f)}}} (~org-agenda-later~) ::
9411 #+findex: org-agenda-later
9412 Go forward in time to display the span following the current one.
9413 For example, if the display covers a week, switch to the
9414 following week. With a prefix argument, repeat that many times.
9416 - {{{kbd(b)}}} (~org-agenda-earlier~) ::
9419 #+findex: org-agenda-earlier
9420 Go backward in time to display earlier dates.
9422 - {{{kbd(.)}}} (~org-agenda-goto-today~) ::
9425 #+findex: org-agenda-goto-today
9428 - {{{kbd(j)}}} (~org-agenda-goto-date~) ::
9431 #+findex: org-agenda-goto-date
9432 Prompt for a date and go there.
9434 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
9437 #+findex: org-agenda-clock-goto
9438 Go to the currently clocked-in task /in the agenda buffer/.
9440 - {{{kbd(D)}}} (~org-agenda-toggle-diary~) ::
9443 #+findex: org-agenda-toggle-diary
9444 Toggle the inclusion of diary entries. See [[*Weekly/daily agenda]].
9446 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} (~org-agenda-log-mode~) ::
9451 #+findex: org-agenda-log-mode
9452 #+vindex: org-log-done
9453 #+vindex: org-agenda-log-mode-items
9454 Toggle Logbook mode. In Logbook mode, entries that were marked
9455 DONE while logging was on (see the variable ~org-log-done~) are
9456 shown in the agenda, as are entries that have been clocked on
9457 that day. You can configure the entry types that should be
9458 included in log mode using the variable
9459 ~org-agenda-log-mode-items~. When called with a {{{kbd(C-u)}}}
9460 prefix, show all possible logbook entries, including state
9461 changes. When called with two prefix arguments {{{kbd(C-u
9462 C-u)}}}, show only logging information, nothing else. {{{kbd(v
9463 L)}}} is equivalent to {{{kbd(C-u v l)}}}.
9465 - {{{kbd(v [)}}} or short {{{kbd([)}}} (~org-agenda-manipulate-query-add~) ::
9469 #+findex: org-agenda-manipulate-query-add
9470 Include inactive timestamps into the current view. Only for
9471 weekly/daily agenda and timeline views.
9473 - {{{kbd(v a)}}} (~org-agenda-archives-mode~) ::
9476 #+findex: org-agenda-archives-mode
9477 Toggle Archives mode. In Archives mode, trees that are archived
9478 (see [[*Internal archiving]]) are also scanned when producing the
9479 agenda. To exit archives mode, press {{{kbd(v a)}}} again.
9484 Toggle Archives mode. Include all archive files as well.
9486 - {{{kbd(v R)}}} or short {{{kbd(R)}}} (~org-agenda-clockreport-mode~) ::
9490 #+findex: org-agenda-clockreport-mode
9491 #+vindex: org-agenda-start-with-clockreport-mode
9492 #+vindex: org-clock-report-include-clocking-task
9493 Toggle Clockreport mode. In Clockreport mode, the daily/weekly
9494 agenda always shows a table with the clocked times for the time
9495 span and file scope covered by the current agenda view. The
9496 initial setting for this mode in new agenda buffers can be set
9497 with the variable ~org-agenda-start-with-clockreport-mode~. By
9498 using a prefix argument when toggling this mode (i.e., {{{kbd(C-u
9499 R)}}}), the clock table does not show contributions from entries
9500 that are hidden by agenda filtering[fn:95]. See also the
9501 variable ~org-clock-report-include-clocking-task~.
9506 #+vindex: org-agenda-clock-consistency-checks
9507 Show overlapping clock entries, clocking gaps, and other clocking
9508 problems in the current agenda range. You can then visit
9509 clocking lines and fix them manually. See the variable
9510 ~org-agenda-clock-consistency-checks~ for information on how to
9511 customize the definition of what constituted a clocking problem.
9512 To return to normal agenda display, press {{{kbd(l)}}} to exit
9515 - {{{kbd(v E)}}} or short {{{kbd(E)}}} (~org-agenda-entry-text-mode~) ::
9519 #+findex: org-agenda-entry-text-mode
9520 #+vindex: org-agenda-start-with-entry-text-mode
9521 #+vindex: org-agenda-entry-text-maxlines
9522 Toggle entry text mode. In entry text mode, a number of lines
9523 from the Org outline node referenced by an agenda line are
9524 displayed below the line. The maximum number of lines is given
9525 by the variable ~org-agenda-entry-text-maxlines~. Calling this
9526 command with a numeric prefix argument temporarily modifies that
9527 number to the prefix value.
9529 - {{{kbd(G)}}} (~org-agenda-toggle-time-grid~) ::
9532 #+vindex: org-agenda-use-time-grid
9533 #+vindex: org-agenda-time-grid
9534 Toggle the time grid on and off. See also the variables
9535 ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
9537 - {{{kbd(r)}}} (~org-agenda-redo~), {{{kbd(g)}}} ::
9541 #+findex: org-agenda-redo
9542 Recreate the agenda buffer, for example to reflect the changes
9543 after modification of the timestamps of items with
9544 {{{kbd(S-left)}}} and {{{kbd(S-right)}}}. When the
9545 buffer is the global TODO list, a prefix argument is interpreted
9546 to create a selective list for a specific TODO keyword.
9548 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}} (~org-save-all-org-buffers~) ::
9551 #+findex: org-save-all-org-buffers
9553 Save all Org buffers in the current Emacs session, and also the
9556 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
9558 #+kindex: C-c C-x C-c
9559 #+findex: org-agenda-columns
9560 #+vindex: org-columns-default-format
9561 Invoke column view (see [[*Column view]]) in the agenda buffer. The
9562 column view format is taken from the entry at point, or, if there
9563 is no entry at point, from the first entry in the agenda view.
9564 So whatever the format for that entry would be in the original
9565 buffer (taken from a property, from a =COLUMNS= keyword, or from
9566 the default variable ~org-columns-default-format~) is used in the
9569 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
9572 #+findex: org-agenda-remove-restriction-lock
9573 Remove the restriction lock on the agenda, if it is currently
9574 restricted to a file or subtree (see [[*Agenda files]]).
9576 - {{{kbd(M-up)}}} (~org-agenda-drag-line-backward~) ::
9579 #+findex: org-agenda-drag-line-backward
9580 Drag the line at point backward one line. With a numeric prefix
9581 argument, drag backward by that many lines.
9583 Moving agenda lines does not persist after an agenda refresh and
9584 does not modify the contributing Org files.
9586 - {{{kbd(M-down)}}} (~org-agenda-drag-line-forward~) ::
9589 #+findex: org-agenda-drag-line-forward
9590 Drag the line at point forward one line. With a numeric prefix
9591 argument, drag forward by that many lines.
9597 #+cindex: remote editing, from agenda
9599 - {{{kbd(0--9)}}} ::
9603 - {{{kbd(C-_)}}} (~org-agenda-undo~) ::
9606 #+findex: org-agenda-undo
9607 #+cindex: undoing remote-editing events
9608 #+cindex: remote editing, undo
9609 Undo a change due to a remote editing command. The change is
9610 undone both in the agenda buffer and in the remote buffer.
9612 - {{{kbd(t)}}} (~org-agenda-todo~) ::
9615 #+findex: org-agenda-todo
9616 Change the TODO state of the item, both in the agenda and in the
9619 - {{{kbd(C-S-right)}}} (~org-agenda-todo-nextset~) ::
9622 #+findex: org-agenda-todo-nextset
9623 Switch to the next set of TODO keywords.
9625 - {{{kbd(C-S-left)}}}, ~org-agenda-todo-previousset~ ::
9628 Switch to the previous set of TODO keywords.
9630 - {{{kbd(C-k)}}} (~org-agenda-kill~) ::
9633 #+findex: org-agenda-kill
9634 #+vindex: org-agenda-confirm-kill
9635 Delete the current agenda item along with the entire subtree
9636 belonging to it in the original Org file. If the text to be
9637 deleted remotely is longer than one line, the kill needs to be
9638 confirmed by the user. See variable ~org-agenda-confirm-kill~.
9640 - {{{kbd(C-c C-w)}}} (~org-agenda-refile~) ::
9643 #+findex: org-agenda-refile
9644 Refile the entry at point.
9646 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}} (~org-agenda-archive-default-with-confirmation~) ::
9648 #+kindex: C-c C-x C-a
9650 #+findex: org-agenda-archive-default-with-confirmation
9651 #+vindex: org-archive-default-command
9652 Archive the subtree corresponding to the entry at point using the
9653 default archiving command set in ~org-archive-default-command~.
9654 When using the {{{kbd(a)}}} key, confirmation is required.
9656 - {{{kbd(C-c C-x a)}}} (~org-agenda-toggle-archive-tag~) ::
9659 #+findex: org-agenda-toggle-archive-tag
9660 Toggle the archive tag (see [[*Internal archiving]]) for the current
9663 - {{{kbd(C-c C-x A)}}} (~org-agenda-archive-to-archive-sibling~) ::
9666 #+findex: org-agenda-archive-to-archive-sibling
9667 Move the subtree corresponding to the current entry to its
9670 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}} (~org-agenda-archive~) ::
9672 #+kindex: C-c C-x C-s
9674 #+findex: org-agenda-archive
9675 Archive the subtree corresponding to the current headline. This
9676 means the entry is moved to the configured archive location, most
9677 likely a different file.
9679 - {{{kbd(T)}}} (~org-agenda-show-tags~) ::
9682 #+findex: org-agenda-show-tags
9683 #+vindex: org-agenda-show-inherited-tags
9684 Show all tags associated with the current item. This is useful
9685 if you have turned off ~org-agenda-show-inherited-tags~, but
9686 still want to see all tags of a headline occasionally.
9688 - {{{kbd(:)}}} (~org-agenda-set-tags~) ::
9691 #+findex: org-agenda-set-tags
9692 Set tags for the current headline. If there is an active region
9693 in the agenda, change a tag for all headings in the region.
9695 - {{{kbd(\,)}}} (~org-agenda-priority~) ::
9698 #+findex: org-agenda-priority
9699 Set the priority for the current item. Org mode prompts for the
9700 priority character. If you reply with {{{kbd(SPC)}}}, the
9701 priority cookie is removed from the entry.
9703 - {{{kbd(P)}}} (~org-agenda-show-priority~) ::
9706 #+findex: org-agenda-show-priority
9707 Display weighted priority of current item.
9709 - {{{kbd(+)}}} or {{{kbd(S-up)}}} (~org-agenda-priority-up~) ::
9713 #+findex: org-agenda-priority-up
9714 Increase the priority of the current item. The priority is
9715 changed in the original buffer, but the agenda is not resorted.
9716 Use the {{{kbd(r)}}} key for this.
9718 - {{{kbd(-)}}} or {{{kbd(S-down)}}} (~org-agenda-priority-down~) ::
9722 #+findex: orga-agenda-priority-down
9723 Decrease the priority of the current item.
9725 - {{{kbd(C-c C-z)}}} or short {{{kbd(z)}}} (~org-agenda-add-note~) ::
9729 #+findex: org-agenda-add-note
9730 #+vindex: org-log-into-drawer
9731 Add a note to the entry. This note is recorded, and then filed
9732 to the same location where state change notes are put. Depending
9733 on ~org-log-into-drawer~, this may be inside a drawer.
9735 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
9738 #+findex: org-attach
9739 Dispatcher for all command related to attachments.
9741 - {{{kbd(C-c C-s)}}} (~org-agenda-schedule~) ::
9744 #+findex: org-agenda-schedule
9745 Schedule this item. With a prefix argument, remove the
9746 scheduling timestamp
9748 - {{{kbd(C-c C-d)}}} (~org-agenda-deadline~) ::
9751 #+findex: org-agenda-deadline
9752 Set a deadline for this item. With a prefix argument, remove the
9755 - {{{kbd(S-right)}}} (~org-agenda-do-date-later~) ::
9758 #+findex: org-agenda-do-date-later
9759 Change the timestamp associated with the current line by one day
9760 into the future. If the date is in the past, the first call to
9761 this command moves it to today. With a numeric prefix argument,
9762 change it by that many days. For example, {{{kbd(3
9763 6 5 S-right)}}} changes it by a year. With a {{{kbd(C-u)}}}
9764 prefix, change the time by one hour. If you immediately repeat
9765 the command, it will continue to change hours even without the
9766 prefix argument. With a double {{{kbd(C-u C-u)}}} prefix, do the
9767 same for changing minutes. The stamp is changed in the original
9768 Org file, but the change is not directly reflected in the agenda
9769 buffer. Use {{{kbd(r)}}} or {{{kbd(g)}}} to update the buffer.
9771 - {{{kbd(S-left)}}} (~org-agenda-do-date-earlier~) ::
9774 #+findex: org-agenda-do-date-earlier
9775 Change the timestamp associated with the current line by one day
9778 - {{{kbd(>)}}} (~org-agenda-date-prompt~) ::
9781 #+findex: org-agenda-date-prompt
9782 Change the timestamp associated with the current line. The key
9783 {{{kbd(>)}}} has been chosen, because it is the same as
9784 {{{kbd(S-.)}}} on my keyboard.
9786 - {{{kbd(I)}}} (~org-agenda-clock-in~) ::
9789 #+findex: org-agenda-clock-in
9790 Start the clock on the current item. If a clock is running
9791 already, it is stopped first.
9793 - {{{kbd(O)}}} (~org-agenda-clock-out~) ::
9796 #+findex: org-agenda-clock-out
9797 Stop the previously started clock.
9799 - {{{kbd(X)}}} (~org-agenda-clock-cancel~) ::
9802 #+findex: org-agenda-clock-cancel
9803 Cancel the currently running clock.
9805 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
9808 #+findex: org-agenda-clock-goto
9809 Jump to the running clock in another window.
9811 - {{{kbd(k)}}} (~org-agenda-capture~) ::
9814 #+findex: org-agenda-capture
9815 #+cindex: capturing, from agenda
9816 #+vindex: org-capture-use-agenda-date
9817 Like ~org-capture~, but use the date at point as the default date
9818 for the capture template. See ~org-capture-use-agenda-date~ to
9819 make this the default behavior of ~org-capture~.
9821 *** Bulk remote editing selected entries
9825 #+cindex: remote editing, bulk, from agenda
9826 #+vindex: org-agenda-bulk-custom-functions
9828 - {{{kbd(m)}}} (~org-agenda-bulk-mark~) ::
9830 #+findex: org-agenda-bulk-mark
9832 Mark the entry at point for bulk action. If there is an active
9833 region in the agenda, mark the entries in the region. With
9834 numeric prefix argument, mark that many successive entries.
9836 - {{{kbd(*)}}} (~org-agenda-bulk-mark-all~) ::
9838 #+findex: org-agenda-bulk-mark-all
9840 Mark all visible agenda entries for bulk action.
9842 - {{{kbd(u)}}} (~org-agenda-bulk-unmark~) ::
9844 #+findex: org-agenda-bulk-unmark
9846 Unmark entry for bulk action.
9848 - {{{kbd(U)}}} (~org-agenda-bulk-remove-all-marks~) ::
9850 #+findex: org-agenda-bulk-remove-all-marks
9852 Unmark all marked entries for bulk action.
9854 - {{{kbd(M-m)}}} (~org-agenda-bulk-toggle~) ::
9856 #+findex: org-agenda-bulk-toggle
9858 Toggle mark of the entry at point for bulk action.
9860 - {{{kbd(M-*)}}} (~org-agenda-bulk-toggle-all~) ::
9862 #+findex: org-agenda-bulk-toggle-all
9864 Mark entries matching a regular expression for bulk action.
9866 - {{{kbd(%)}}} (~org-agenda-bulk-mark-regexp~) ::
9868 #+findex: org-agenda-bulk-mark-regexp
9870 Mark entries matching a regular expression for bulk action.
9872 - {{{kbd(B)}}} (~org-agenda-bulk-action~) ::
9874 #+findex: org-agenda-bulk-action
9875 #+vindex: org-agenda-bulk-persistent-marks
9877 Bulk action: act on all marked entries in the agenda. This
9878 prompts for another key to select the action to be applied. The
9879 prefix argument to {{{kbd(B)}}} is passed through to the
9880 {{{kbd(s)}}} and {{{kbd(d)}}} commands, to bulk-remove these
9881 special timestamps. By default, marks are removed after the
9882 bulk. If you want them to persist, set
9883 ~org-agenda-bulk-persistent-marks~ to ~t~ or hit {{{kbd(p)}}} at
9888 Toggle persistent marks.
9892 Archive all selected entries.
9896 Archive entries by moving them to their respective archive
9901 Change TODO state. This prompts for a single TODO keyword and
9902 changes the state of all selected entries, bypassing blocking
9903 and suppressing logging notes -- but not timestamps.
9907 Add a tag to all selected entries.
9911 Remove a tag from all selected entries.
9915 Schedule all items to a new date. To shift existing schedule
9916 dates by a fixed number of days, use something starting with
9917 double plus at the prompt, for example =++8d= or =++2w=.
9921 Set deadline to a specific date.
9925 Prompt for a single refile target and move all entries. The
9926 entries are no longer in the agenda; refresh ({{{kbd(g)}}}) to
9931 Reschedule randomly into the coming N days. N is prompted for.
9932 With a prefix argument ({{{kbd(C-u B S)}}}), scatter only
9937 #+vindex: org-agenda-bulk-custom-functions
9938 Apply a function[fn:96] to marked entries. For example, the
9939 function below sets the =CATEGORY= property of the entries to
9942 #+begin_src emacs-lisp
9943 (defun set-category ()
9945 (let ((marker (or (org-get-at-bol 'org-hd-marker)
9946 (org-agenda-error))))
9947 (org-with-point-at marker
9948 (org-back-to-heading t)
9949 (org-set-property "CATEGORY" "web"))))
9952 *** Calendar commands
9956 #+cindex: calendar commands, from agenda
9958 - {{{kbd(c)}}} (~org-agenda-goto-calendar~) ::
9961 #+findex: org-agenda-goto-calendar
9962 Open the Emacs calendar and move to the date at the agenda
9965 - {{{kbd(c)}}} (~org-calendar-goto-agenda~) ::
9968 #+findex: org-calendar-goto-agenda
9969 When in the calendar, compute and show the Org agenda for the
9972 - {{{kbd(i)}}} (~org-agenda-diary-entry~) ::
9974 #+findex: org-agenda-diary-entry
9976 #+cindex: diary entries, creating from agenda
9977 Insert a new entry into the diary, using the date at the cursor
9978 and (for block entries) the date at the mark. This adds to the
9979 Emacs diary file[fn:97], in a way similar to the {{{kbd(i)}}}
9980 command in the calendar. The diary file pops up in another
9981 window, where you can add the entry.
9983 #+vindex: org-agenda-diary-file
9984 If you configure ~org-agenda-diary-file~ to point to an Org file,
9985 Org creates entries in that file instead. Most entries are
9986 stored in a date-based outline tree that will later make it easy
9987 to archive appointments from previous months/years. The tree is
9988 built under an entry with a =DATE_TREE= property, or else with
9989 years as top-level entries. Emacs prompts you for the entry
9990 text -- if you specify it, the entry is created in
9991 ~org-agenda-diary-file~ without further interaction. If you
9992 directly press {{{kbd(RET)}}} at the prompt without typing text,
9993 the target file is shown in another window for you to finish the
9994 entry there. See also the {{{kbd(k r)}}} command.
9996 - {{{kbd(M)}}} (~org-agenda-phases-of-moon~) ::
9999 #+findex: org-agenda-phases-of-moon
10000 Show the phases of the moon for the three months around current
10003 - {{{kbd(S)}}} (~org-agenda-sunrise-sunset~) ::
10006 #+findex: org-agenda-sunrise-sunset
10007 Show sunrise and sunset times. The geographical location must be
10008 set with calendar variables, see the documentation for the Emacs
10011 - {{{kbd(C)}}} (~org-agenda-convert-date~) ::
10014 #+findex: org-agenda-convert-date
10015 Convert the date at cursor into many other cultural and historic
10018 - {{{kbd(H)}}} (~org-agenda-holidays~) ::
10021 #+findex: org-agenda-holidays
10022 Show holidays for three months around the cursor date.
10029 - {{{kbd(q)}}} (~org-agenda-quit~) ::
10031 #+findex: org-agenda-quit
10033 Quit agenda, remove the agenda buffer.
10035 - {{{kbd(x)}}} (~org-agenda-exit~) ::
10037 #+findex: org-agenda-exit
10039 #+cindex: agenda files, removing buffers
10040 Exit agenda, remove the agenda buffer and all buffers loaded by
10041 Emacs for the compilation of the agenda. Buffers created by the
10042 user to visit Org files are not removed.
10044 ** Custom agenda views
10046 :DESCRIPTION: Defining special searches and views.
10048 #+cindex: custom agenda views
10049 #+cindex: agenda views, custom
10051 Custom agenda commands serve two purposes: to store and quickly access
10052 frequently used TODO and tags searches, and to create special
10053 composite agenda buffers. Custom agenda commands are accessible
10054 through the dispatcher (see [[*The agenda dispatcher]]), just like the
10057 *** Storing searches
10059 :DESCRIPTION: Type once, use often.
10062 The first application of custom searches is the definition of keyboard
10063 shortcuts for frequently used searches, either creating an agenda
10064 buffer, or a sparse tree (the latter covering of course only the
10068 #+vindex: org-agenda-custom-commands
10069 #+cindex: agenda views, main example
10070 #+cindex: agenda, as an agenda views
10071 #+cindex: agenda*, as an agenda views
10072 #+cindex: tags, as an agenda view
10073 #+cindex: todo, as an agenda view
10074 #+cindex: tags-todo
10075 #+cindex: todo-tree
10076 #+cindex: occur-tree
10077 #+cindex: tags-tree
10078 Custom commands are configured in the variable
10079 ~org-agenda-custom-commands~. You can customize this variable, for
10080 example by pressing {{{kbd(C-c a C)}}}. You can also directly set it
10081 with Emacs Lisp in the Emacs init file. The following example
10082 contains all valid agenda views:
10084 #+begin_src emacs-lisp
10085 (setq org-agenda-custom-commands
10088 ("w" todo "WAITING")
10089 ("W" todo-tree "WAITING")
10090 ("u" tags "+boss-urgent")
10091 ("v" tags-todo "+boss-urgent")
10092 ("U" tags-tree "+boss-urgent")
10093 ("f" occur-tree "\\<FIXME\\>")
10094 ("h" . "HOME+Name tags searches") ;description for "h" prefix
10095 ("hl" tags "+home+Lisa")
10096 ("hp" tags "+home+Peter")
10097 ("hk" tags "+home+Kim")))
10100 #+texinfo: @noindent
10101 The initial string in each entry defines the keys you have to press
10102 after the dispatcher command {{{kbd(C-c a)}}} in order to access the
10103 command. Usually this will be just a single character, but if you
10104 have many similar commands, you can also define two-letter
10105 combinations where the first character is the same in several
10106 combinations and serves as a prefix key[fn:98]. The second parameter
10107 is the search type, followed by the string or regular expression to be
10108 used for the matching. The example above will therefore define:
10110 - {{{kbd(C-c a x)}}} ::
10112 as a global search for agenda entries planned[fn:99] this
10115 - {{{kbd(C-c a y)}}} ::
10117 as the same search, but only for entries with an hour
10118 specification like =[h]h:mm= -- think of them as appointments.
10120 - {{{kbd(C-c a w)}}} ::
10122 as a global search for TODO entries with =WAITING= as the TODO
10125 - {{{kbd(C-c a W)}}} ::
10127 as the same search, but only in the current buffer and displaying
10128 the results as a sparse tree.
10130 - {{{kbd(C-c a u)}}} ::
10132 as a global tags search for headlines tagged =boss= but not
10135 - {{{kbd(C-c a v)}}} ::
10137 The same search, but limiting it to headlines that are also TODO
10140 - {{{kbd(C-c a U)}}} ::
10142 as the same search, but only in the current buffer and displaying
10143 the result as a sparse tree.
10145 - {{{kbd(C-c a f)}}} ::
10147 to create a sparse tree (again, current buffer only) with all
10148 entries containing the word =FIXME=.
10150 - {{{kbd(C-c a h)}}} ::
10152 as a prefix command for a =HOME= tags search where you have to
10153 press an additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or
10154 {{{kbd(k)}}}) to select a name (Lisa, Peter, or Kim) as
10155 additional tag to match.
10157 Note that ~*-tree~ agenda views need to be called from an Org buffer
10158 as they operate on the current buffer only.
10161 :DESCRIPTION: All the stuff you need in a single buffer.
10163 #+cindex: block agenda
10164 #+cindex: agenda, with block views
10166 Another possibility is the construction of agenda views that comprise
10167 the results of /several/ commands, each of which creates a block in
10168 the agenda buffer. The available commands include ~agenda~ for the
10169 daily or weekly agenda (as created with {{{kbd(C-c a a)}}}), ~alltodo~
10170 for the global TODO list (as constructed with {{{kbd(C-c a t)}}}), and
10171 the matching commands discussed above: ~todo~, ~tags~, and
10172 ~tags-todo~. Here are two examples:
10174 #+begin_src emacs-lisp
10175 (setq org-agenda-custom-commands
10176 '(("h" "Agenda and Home-related tasks"
10180 ("o" "Agenda and Office-related tasks"
10183 (tags "office")))))
10186 #+texinfo: @noindent
10187 This defines {{{kbd(C-c a h)}}} to create a multi-block view for stuff
10188 you need to attend to at home. The resulting agenda buffer contains
10189 your agenda for the current week, all TODO items that carry the tag
10190 =home=, and also all lines tagged with =garden=. Finally the command
10191 {{{kbd(C-c a o)}}} provides a similar view for office tasks.
10193 *** Setting options for custom commands
10195 :DESCRIPTION: Changing the rules.
10196 :ALT_TITLE: Setting options
10198 #+cindex: options, for custom agenda views
10200 #+vindex: org-agenda-custom-commands
10201 Org mode contains a number of variables regulating agenda construction
10202 and display. The global variables define the behavior for all agenda
10203 commands, including the custom commands. However, if you want to
10204 change some settings just for a single custom view, you can do so.
10205 Setting options requires inserting a list of variable names and values
10206 at the right spot in ~org-agenda-custom-commands~. For example:
10208 #+begin_src emacs-lisp
10209 (setq org-agenda-custom-commands
10210 '(("w" todo "WAITING"
10211 ((org-agenda-sorting-strategy '(priority-down))
10212 (org-agenda-prefix-format " Mixed: ")))
10213 ("U" tags-tree "+boss-urgent"
10214 ((org-show-context-detail 'minimal)))
10216 ((org-agenda-files '("~org/notes.org"))
10217 (org-agenda-text-search-extra-files nil)))))
10220 #+texinfo: @noindent
10221 Now the {{{kbd(C-c a w)}}} command sorts the collected entries only by
10222 priority, and the prefix format is modified to just say =Mixed:=
10223 instead of giving the category of the entry. The sparse tags tree of
10224 {{{kbd(C-c a U)}}} now turns out ultra-compact, because neither the
10225 headline hierarchy above the match, nor the headline following the
10226 match are shown. The command {{{kbd(C-c a N)}}} does a text search
10227 limited to only a single file.
10229 For command sets creating a block agenda, ~org-agenda-custom-commands~
10230 has two separate spots for setting options. You can add options that
10231 should be valid for just a single command in the set, and options that
10232 should be valid for all commands in the set. The former are just
10233 added to the command entry; the latter must come after the list of
10234 command entries. Going back to the block agenda example (see [[*Block
10235 agenda]]), let's change the sorting strategy for the {{{kbd(C-c a h)}}}
10236 commands to ~priority-down~, but let's sort the results for GARDEN
10237 tags query in the opposite order, ~priority-up~. This would look like
10240 #+begin_src emacs-lisp
10241 (setq org-agenda-custom-commands
10242 '(("h" "Agenda and Home-related tasks"
10246 ((org-agenda-sorting-strategy '(priority-up)))))
10247 ((org-agenda-sorting-strategy '(priority-down))))
10248 ("o" "Agenda and Office-related tasks"
10251 (tags "office")))))
10254 As you see, the values and parentheses setting is a little complex.
10255 When in doubt, use the customize interface to set this variable -- it
10256 fully supports its structure. Just one caveat: when setting options
10257 in this interface, the /values/ are just Lisp expressions. So if the
10258 value is a string, you need to add the double-quotes around the value
10261 #+vindex: org-agenda-custom-commands-contexts
10262 To control whether an agenda command should be accessible from
10263 a specific context, you can customize
10264 ~org-agenda-custom-commands-contexts~. Let's say for example that you
10265 have an agenda command {{{kbd(o)}}} displaying a view that you only
10266 need when reading emails. Then you would configure this option like
10269 #+begin_src emacs-lisp
10270 (setq org-agenda-custom-commands-contexts
10271 '(("o" (in-mode . "message-mode"))))
10274 You can also tell that the command key {{{kbd(o)}}} should refer to
10275 another command key {{{kbd(r)}}}. In that case, add this command key
10278 #+begin_src emacs-lisp
10279 (setq org-agenda-custom-commands-contexts
10280 '(("o" "r" (in-mode . "message-mode"))))
10283 See the docstring of the variable for more information.
10285 ** Exporting agenda views
10287 :DESCRIPTION: Writing a view to a file.
10289 #+cindex: agenda views, exporting
10291 If you are away from your computer, it can be very useful to have
10292 a printed version of some agenda views to carry around. Org mode can
10293 export custom agenda views as plain text, HTML[fn:100], Postscript,
10294 PDF[fn:101], and iCalendar files. If you want to do this only
10295 occasionally, use the following command:
10297 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
10299 #+findex: org-agenda-write
10300 #+cindex: exporting agenda views
10301 #+cindex: agenda views, exporting
10303 #+vindex: org-agenda-exporter-settings
10304 Write the agenda view to a file.
10306 If you need to export certain agenda views frequently, you can
10307 associate any custom agenda command with a list of output file
10308 names[fn:102]. Here is an example that first defines custom commands
10309 for the agenda and the global TODO list, together with a number of
10310 files to which to export them. Then we define two block agenda
10311 commands and specify file names for them as well. File names can be
10312 relative to the current working directory, or absolute.
10314 #+begin_src emacs-lisp
10315 (setq org-agenda-custom-commands
10316 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
10317 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
10318 ("h" "Agenda and Home-related tasks"
10323 ("~/views/home.html"))
10324 ("o" "Agenda and Office-related tasks"
10329 ("~/views/office.ps" "~/calendars/office.ics"))))
10332 The extension of the file name determines the type of export. If it
10333 is =.html=, Org mode uses the htmlize package to convert the buffer to
10334 HTML and save it to this file name. If the extension is =.ps=,
10335 ~ps-print-buffer-with-faces~ is used to produce Postscript output. If
10336 the extension is =.ics=, iCalendar export is run export over all files
10337 that were used to construct the agenda, and limit the export to
10338 entries listed in the agenda. Any other extension produces a plain
10341 The export files are /not/ created when you use one of those
10342 commands interactively because this might use too much overhead.
10343 Instead, there is a special command to produce /all/ specified
10346 #+attr_texinfo: :table-type table :indic @asis
10347 - {{{kbd(C-c a e)}}} (~org-store-agenda-views~) ::
10349 #+findex: org-store-agenda-views
10351 Export all agenda views that have export file names associated
10354 You can use the options section of the custom agenda commands to also
10355 set options for the export commands. For example:
10357 #+begin_src emacs-lisp
10358 (setq org-agenda-custom-commands
10360 ((ps-number-of-columns 2)
10361 (ps-landscape-mode t)
10362 (org-agenda-prefix-format " [ ] ")
10363 (org-agenda-with-colors nil)
10364 (org-agenda-remove-tags t))
10365 ("theagenda.ps"))))
10368 #+texinfo: @noindent
10369 #+vindex: org-agenda-exporter-settings
10370 This command sets two options for the Postscript exporter, to make it
10371 print in two columns in landscape format -- the resulting page can be
10372 cut in two and then used in a paper agenda. The remaining settings
10373 modify the agenda prefix to omit category and scheduling information,
10374 and instead include a checkbox to check off items. We also remove the
10375 tags to make the lines compact, and we do not want to use colors for
10376 the black-and-white printer. Settings specified in
10377 ~org-agenda-exporter-settings~ also apply, e.g.,
10379 #+begin_src emacs-lisp
10380 (setq org-agenda-exporter-settings
10381 '((ps-number-of-columns 2)
10382 (ps-landscape-mode t)
10383 (org-agenda-add-entry-text-maxlines 5)
10384 (htmlize-output-type 'css)))
10387 #+texinfo: @noindent
10388 but the settings in ~org-agenda-custom-commands~ take precedence.
10390 #+texinfo: @noindent
10391 From the command line you may also use:
10394 emacs -eval (org-batch-store-agenda-views) -kill
10397 #+texinfo: @noindent
10398 or, if you need to modify some parameters[fn:103]
10401 emacs -eval '(org-batch-store-agenda-views \
10402 org-agenda-span (quote month) \
10403 org-agenda-start-day "2007-11-01" \
10404 org-agenda-include-diary nil \
10405 org-agenda-files (quote ("~/org/project.org")))' \
10409 #+texinfo: @noindent
10410 which creates the agenda views restricted to the file
10411 =~/org/project.org=, without diary entries and with a 30-day extent.
10413 You can also extract agenda information in a way that allows further
10414 processing by other programs. See [[*Extracting agenda information]], for
10417 ** Using column view in the agenda
10419 :DESCRIPTION: Using column view for collected entries.
10420 :ALT_TITLE: Agenda column view
10422 #+cindex: column view, in agenda
10423 #+cindex: agenda, column view
10425 Column view (see [[*Column view]]) is normally used to view and edit
10426 properties embedded in the hierarchical structure of an Org file. It
10427 can be quite useful to use column view also from the agenda, where
10428 entries are collected by certain criteria.
10430 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
10431 #+kindex: C-c C-x C-c
10432 #+findex: org-agenda-columns
10434 Turn on column view in the agenda.
10436 To understand how to use this properly, it is important to realize
10437 that the entries in the agenda are no longer in their proper outline
10438 environment. This causes the following issues:
10441 #+vindex: org-columns-default-format
10442 #+vindex: org-overriding-columns-format
10443 Org needs to make a decision which columns format to use. Since
10444 the entries in the agenda are collected from different files, and
10445 different files may have different columns formats, this is
10446 a non-trivial problem. Org first checks if the variable
10447 ~org-agenda-overriding-columns-format~ is currently set, and if so,
10448 takes the format from there. Otherwise it takes the format
10449 associated with the first item in the agenda, or, if that item does
10450 not have a specific format (defined in a property, or in its file),
10451 it uses ~org-columns-default-format~.
10454 #+cindex: CLOCKSUM, special property
10455 If any of the columns has a summary type defined (see [[*Column
10456 attributes]]), turning on column view in the agenda visits all
10457 relevant agenda files and make sure that the computations of this
10458 property are up to date. This is also true for the special
10459 =CLOCKSUM= property. Org then sums the values displayed in the
10460 agenda. In the daily/weekly agenda, the sums cover a single day;
10461 in all other views they cover the entire block.
10463 It is important to realize that the agenda may show the same entry
10464 /twice/ -- for example as scheduled and as a deadline -- and it may
10465 show two entries from the same hierarchy (for example a /parent/
10466 and its /child/). In these cases, the summation in the agenda
10467 leads to incorrect results because some values count double.
10469 3. When the column view in the agenda shows the =CLOCKSUM= property,
10470 that is always the entire clocked time for this item. So even in
10471 the daily/weekly agenda, the clocksum listed in column view may
10472 originate from times outside the current view. This has the
10473 advantage that you can compare these values with a column listing
10474 the planned total effort for a task -- one of the major
10475 applications for column view in the agenda. If you want
10476 information about clocked time in the displayed period use clock
10477 table mode (press {{{kbd(R)}}} in the agenda).
10480 #+cindex: CLOCKSUM_T, special property
10481 When the column view in the agenda shows the =CLOCKSUM_T= property,
10482 that is always today's clocked time for this item. So even in the
10483 weekly agenda, the clocksum listed in column view only originates
10484 from today. This lets you compare the time you spent on a task for
10485 today, with the time already spent -- via =CLOCKSUM= -- and with
10486 the planned total effort for it.
10488 * Markup for rich export
10490 :DESCRIPTION: Prepare text for rich export.
10494 When exporting Org documents, the exporter tries to reflect the
10495 structure of the document as accurately as possible in the back-end.
10496 Since export targets like HTML and LaTeX allow much richer formatting,
10497 Org mode has rules on how to prepare text for rich export. This
10498 section summarizes the markup rules used in an Org mode buffer.
10502 :DESCRIPTION: The basic unit of text.
10504 #+cindex: paragraphs, markup rules
10506 Paragraphs are separated by at least one empty line. If you need to
10507 enforce a line break within a paragraph, use ~\\~ at the end of
10510 To preserve the line breaks, indentation and blank lines in a region,
10511 but otherwise use normal formatting, you can use this construct, which
10512 can also be used to format poetry.
10514 #+cindex: BEGIN_VERSE
10515 #+cindex: verse blocks
10518 Great clouds overhead
10519 Tiny black birds rise and fall
10526 When quoting a passage from another document, it is customary to
10527 format this as a paragraph that is indented on both the left and the
10528 right margin. You can include quotations in Org documents like this:
10530 #+cindex: BEGIN_QUOTE
10531 #+cindex: quote blocks
10534 Everything should be made as simple as possible,
10535 but not any simpler -- Albert Einstein
10539 If you would like to center some text, do it like this:
10541 #+cindex: BEGIN_CENTER
10542 #+cindex: center blocks
10545 Everything should be made as simple as possible, \\
10546 but not any simpler
10550 ** Emphasis and monospace
10552 :DESCRIPTION: Bold, italic, etc.
10554 #+cindex: underlined text, markup rules
10555 #+cindex: bold text, markup rules
10556 #+cindex: italic text, markup rules
10557 #+cindex: verbatim text, markup rules
10558 #+cindex: code text, markup rules
10559 #+cindex: strike-through text, markup rules
10561 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
10562 and =~code~=, and, if you must, =+strike-through+=. Text in the code
10563 and verbatim string is not processed for Org mode specific syntax; it
10564 is exported verbatim.
10566 #+vindex: org-fontify-emphasized-text
10567 To turn off fontification for marked up text, you can set
10568 ~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of
10569 available markup syntax, you can customize ~org-emphasis-alist~.
10571 ** Horizontal rules
10573 :DESCRIPTION: Make a line.
10575 #+cindex: horizontal rules, markup rules
10577 A line consisting of only dashes, and at least 5 of them, is exported
10578 as a horizontal line.
10580 ** Images and tables
10582 :DESCRIPTION: Images, tables and caption mechanism.
10584 #+cindex: tables, markup rules
10585 #+cindex: CAPTION, keyword
10586 #+cindex: NAME, keyword
10588 Both the native Org mode tables (see [[*Tables]]) and tables formatted
10589 with the =table.el= package are exported properly. For Org mode
10590 tables, the lines before the first horizontal separator line become
10591 table header lines. You can use the following lines somewhere before
10592 the table to assign a caption and a label for cross references, and in
10593 the text you can refer to the object with =[[tab:basic-data]]= (see
10594 [[*Internal links]]):
10597 ,#+CAPTION: This is the caption for the next table (or link)
10598 ,#+NAME: tab:basic-data
10603 Optionally, the caption can take the form:
10605 : #+CAPTION[Caption for list of tables]: Caption for table.
10607 #+cindex: inlined images, markup rules
10608 Some back-ends allow you to directly include images into the exported
10609 document. Org does this, if a link to an image file does not have
10610 a description part, for example =[[./img/a.jpg]]=. If you wish to define
10611 a caption for the image and maybe a label for internal cross
10612 references, make sure that the link is on a line by itself and precede
10613 it with =CAPTION= and =NAME= keywords as follows:
10616 ,#+CAPTION: This is the caption for the next figure link (or table)
10617 ,#+NAME: fig:SED-HR4049
10621 #+texinfo: @noindent
10622 Such images can be displayed within the buffer. See [[*Handling links][the discussion of
10625 Even though images and tables are prominent examples of captioned
10626 structures, the same caption mechanism can apply to many others --
10627 e.g., LaTeX equations, source code blocks. Depending on the export
10628 back-end, those may or may not be handled.
10630 ** Literal examples
10632 :DESCRIPTION: Source code examples with special formatting.
10634 #+cindex: literal examples, markup
10635 #+cindex: code line references, markup
10637 You can include literal examples that should not be subjected to
10638 markup. Such examples are typeset in monospace, so this is well
10639 suited for source code and similar examples.
10641 #+cindex: BEGIN_EXAMPLE
10642 #+cindex: example block
10645 Some example from a text file.
10649 Note that such blocks may be /indented/ in order to align nicely with
10650 indented text and in particular with plain list structure (see
10651 [[*Plain lists]]). For simplicity when using small examples, you can
10652 also start the example lines with a colon followed by a space. There
10653 may also be additional whitespace before the colon:
10657 : Some example from a text file.
10660 #+cindex: formatting source code, markup rules
10661 #+vindex: org-latex-listings
10662 If the example is source code from a programming language, or any
10663 other text that can be marked up by Font Lock in Emacs, you can ask
10664 for the example to look like the fontified Emacs buffer[fn:104]. This
10665 is done with the code block, where you also need to specify the name
10666 of the major mode that should be used to fontify the example[fn:105],
10667 see [[*Structure templates]] for shortcuts to easily insert code blocks.
10669 #+cindex: BEGIN_SRC
10670 #+cindex: src block
10672 ,#+BEGIN_SRC emacs-lisp
10673 (defun org-xor (a b)
10679 Both in =example= and in =src= snippets, you can add a =-n= switch to
10680 the end of the =#+BEGIN= line, to get the lines of the example
10681 numbered. The =-n= takes an optional numeric argument specifying the
10682 starting line number of the block. If you use a =+n= switch, the
10683 numbering from the previous numbered snippet is continued in the
10684 current one. The =+n= switch can also take a numeric argument. This
10685 adds the value of the argument to the last line of the previous block
10686 to determine the starting line number.
10689 ,#+BEGIN_SRC emacs-lisp -n 20
10690 ;; This exports with line number 20.
10691 (message "This is line 21")
10694 ,#+BEGIN_SRC emacs-lisp +n 10
10695 ;; This is listed as line 31.
10696 (message "This is line 32")
10700 In literal examples, Org interprets strings like =(ref:name)= as
10701 labels, and use them as targets for special hyperlinks like
10702 =[[(name)]]= -- i.e., the reference name enclosed in single parenthesis.
10703 In HTML, hovering the mouse over such a link remote-highlights the
10704 corresponding code line, which is kind of cool.
10706 You can also add a =-r= switch which /removes/ the labels from the
10707 source code[fn:106]. With the =-n= switch, links to these references
10708 are labeled by the line numbers from the code listing. Otherwise
10709 links use the labels with no parentheses. Here is an example:
10711 #+begin_example -l "(dumb-reference:%s)"
10712 ,#+BEGIN_SRC emacs-lisp -n -r
10713 (save-excursion (ref:sc)
10714 (goto-char (point-min)) (ref:jump)
10716 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
10717 jumps to point-min.
10720 #+cindex: indentation, in source blocks
10721 Finally, you can use =-i= to preserve the indentation of a specific
10722 code block (see [[*Editing source code]]).
10724 #+vindex: org-coderef-label-format
10725 If the syntax for the label format conflicts with the language syntax,
10726 use a =-l= switch to change the format, for example
10728 : #+BEGIN_SRC pascal -n -r -l "((%s))"
10730 #+texinfo: @noindent
10731 See also the variable ~org-coderef-label-format~.
10733 HTML export also allows examples to be published as text areas (see
10734 [[*Text areas in HTML export]]).
10736 Because the =#+BEGIN= ... =#+END= patterns need to be added so often,
10737 a shortcut is provided (see [[*Structure templates]]).
10739 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
10742 #+findex: org-edit-special
10743 Edit the source code example at point in its native mode. This
10744 works by switching to a temporary buffer with the source code.
10745 You need to exit by pressing {{{kbd(C-c ')}}} again[fn:107]. The
10746 edited version then replaces the old version in the Org buffer.
10747 Fixed-width regions -- where each line starts with a colon
10748 followed by a space -- are edited using ~artist-mode~[fn:108] to
10749 allow creating ASCII drawings easily. Using this command in an
10750 empty line creates a new fixed-width region.
10752 - {{{kbd(C-c l)}}} (~org-store-link~) ::
10755 #+findex: org-store-link
10756 Calling ~org-store-link~ while editing a source code example in
10757 a temporary buffer created with {{{kbd(C-c ')}}} prompts for
10758 a label. Make sure that it is unique in the current buffer, and
10759 insert it with the proper formatting like =(ref:label)= at the
10760 end of the current line. Then the label is stored as a link
10761 =(label)=, for retrieval with {{{kbd(C-c C-l)}}}.
10765 :DESCRIPTION: Greek letters and other symbols.
10767 #+cindex: math symbols
10768 #+cindex: special symbols
10769 #+cindex: @TeX{} macros
10770 #+cindex: @LaTeX{} fragments, markup rules
10771 #+cindex: HTML entities
10772 #+cindex: @LaTeX{} entities
10774 You can use LaTeX-like syntax to insert special symbols -- named
10775 entities -- like =\alpha= to indicate the Greek letter, or =\to= to indicate
10776 an arrow. Completion for these symbols is available, just type =\=
10777 and maybe a few letters, and press {{{kbd(M-TAB)}}} to see possible
10778 completions. If you need such a symbol inside a word, terminate it
10779 with a pair of curly brackets. For example
10782 Pro tip: Given a circle \Gamma of diameter d, the length of its
10783 circumference is \pi{}d.
10786 #+findex: org-entities-help
10787 #+vindex: org-entities-user
10788 A large number of entities is provided, with names taken from both
10789 HTML and LaTeX; you can comfortably browse the complete list from
10790 a dedicated buffer using the command ~org-entities-help~. It is also
10791 possible to provide your own special symbols in the variable
10792 ~org-entities-user~.
10794 During export, these symbols are transformed into the native format of
10795 the exporter back-end. Strings like =\alpha= are exported as =α= in
10796 the HTML output, and as =\(\alpha\)= in the LaTeX output. Similarly, =\nbsp=
10797 becomes = = in HTML and =~= in LaTeX.
10799 #+cindex: escaping characters
10800 Entities may also be used as a way to escape markup in an Org
10801 document, e.g., =\under{}not underlined\under= exports as =_not underlined_=.
10803 #+cindex: special symbols, in-buffer display
10804 If you would like to see entities displayed as UTF-8 characters, use
10805 the following command[fn:109]:
10807 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
10808 #+kindex: C-c C-x \
10809 #+findex: org-toggle-pretty-entities
10811 Toggle display of entities as UTF-8 characters. This does not
10812 change the buffer content which remains plain ASCII, but it
10813 overlays the UTF-8 character for display purposes only.
10815 #+cindex: shy hyphen, special symbol
10816 #+cindex: dash, special symbol
10817 #+cindex: ellipsis, special symbol
10818 In addition to regular entities defined above, Org exports in
10819 a special way[fn:110] the following commonly used character
10820 combinations: =\-= is treated as a shy hyphen, =--= and =---= are
10821 converted into dashes, and =...= becomes a compact set of dots.
10823 ** Subscripts and superscripts
10825 :DESCRIPTION: Simple syntax for raising/lowering text.
10827 #+cindex: subscript
10828 #+cindex: superscript
10830 =^= and =_= are used to indicate super- and subscripts. To increase
10831 the readability of ASCII text, it is not necessary, but OK, to
10832 surround multi-character sub- and superscripts with curly braces. For
10836 The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
10837 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
10840 #+vindex: org-use-sub-superscripts
10841 If you write a text where the underscore is often used in a different
10842 context, Org's convention to always interpret these as subscripts can
10843 get in your way. Configure the variable ~org-use-sub-superscripts~ to
10844 change this convention. For example, when setting this variable to
10845 ~{}~, =a_b= is not interpreted as a subscript, but =a_{b}= is.
10847 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~~) ::
10848 #+kindex: C-c C-x \
10849 #+findex: org-toggle-pretty-entities
10851 In addition to showing entities as UTF-8 characters, this command
10852 also formats sub- and superscripts in a WYSIWYM way.
10856 :DESCRIPTION: LaTeX can be freely used inside Org documents.
10857 :ALT_TITLE: Embedded Latex
10859 #+cindex: @TeX{} interpretation
10860 #+cindex: @LaTeX{} interpretation
10862 Plain ASCII is normally sufficient for almost all note taking.
10863 Exceptions include scientific notes, which often require mathematical
10864 symbols and the occasional formula. LaTeX[fn:111] is widely used to
10865 typeset scientific documents. Org mode supports embedding LaTeX code
10866 into its files, because many academics are used to writing and reading
10867 LaTeX source code, and because it can be readily processed to produce
10868 pretty output for a number of export back-ends.
10870 *** LaTeX fragments
10872 :DESCRIPTION: Complex formulas made easy.
10874 #+cindex: @LaTeX{} fragments
10876 #+vindex: org-format-latex-header
10877 Org mode can contain LaTeX math fragments, and it supports ways to
10878 process these for several export back-ends. When exporting to LaTeX,
10879 the code is left as it is. When exporting to HTML, Org can use either
10880 [[http://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math
10881 into images (see [[*Previewing LaTeX fragments]]).
10883 LaTeX fragments do not need any special marking at all. The following
10884 snippets are identified as LaTeX source code:
10886 - Environments of any kind[fn:112]. The only requirement is that the
10887 =\begin= statement appears on a new line, preceded by only
10890 - Text within the usual LaTeX math delimiters. To avoid conflicts
10891 with currency specifications, single =$= characters are only
10892 recognized as math delimiters if the enclosed text contains at most
10893 two line breaks, is directly attached to the =$= characters with no
10894 whitespace in between, and if the closing =$= is followed by
10895 whitespace, punctuation or a dash. For the other delimiters, there
10896 is no such restriction, so when in doubt, use =\(...\)= as inline
10899 #+texinfo: @noindent
10903 \begin{equation} % arbitrary environments,
10904 x=\sqrt{b} % even tables, figures
10905 \end{equation} % etc
10907 If $a^2=b$ and \( b=2 \), then the solution must be
10908 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
10911 #+vindex: org-export-with-latex
10912 LaTeX processing can be configured with the variable
10913 ~org-export-with-latex~. The default setting is ~t~ which means
10914 MathJax for HTML, and no processing for ASCII and LaTeX back-ends.
10915 You can also set this variable on a per-file basis using one of these
10918 | =#+OPTIONS: tex:t= | Do the right thing automatically (MathJax) |
10919 | =#+OPTIONS: tex:nil= | Do not process LaTeX fragments at all |
10920 | =#+OPTIONS: tex:verbatim= | Verbatim export, for jsMath or so |
10922 *** Previewing LaTeX fragments
10924 :DESCRIPTION: What will this snippet look like?
10926 #+cindex: @LaTeX{} fragments, preview
10928 #+vindex: org-preview-latex-default-process
10929 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
10930 =convert= installed[fn:113], LaTeX fragments can be processed to
10931 produce images of the typeset expressions to be used for inclusion
10932 while exporting to HTML (see [[*LaTeX fragments]]), or for inline
10933 previewing within Org mode.
10935 #+vindex: org-format-latex-options
10936 #+vindex: org-format-latex-header
10937 You can customize the variables ~org-format-latex-options~ and
10938 ~org-format-latex-header~ to influence some aspects of the preview.
10939 In particular, the ~:scale~ (and for HTML export, ~:html-scale~)
10940 property of the former can be used to adjust the size of the preview
10943 - {{{kbd(C-c C-x C-l)}}} (~org-toggle-latex-fragment~) ::
10944 #+kindex: C-c C-x C-l
10945 #+findex: org-toggle-latex-fragment
10947 Produce a preview image of the LaTeX fragment at point and
10948 overlay it over the source code. If there is no fragment at
10949 point, process all fragments in the current entry (between two
10950 headlines). When called with a prefix argument, process the
10951 entire subtree. When called with two prefix arguments, or when
10952 the cursor is before the first headline, process the entire
10955 #+vindex: org-startup-with-latex-preview
10956 You can turn on the previewing of all LaTeX fragments in a file with
10958 : #+STARTUP: latexpreview
10960 To disable it, simply use
10962 : #+STARTUP: nolatexpreview
10964 *** Using CDLaTeX to enter math
10966 :DESCRIPTION: Speed up entering of formulas.
10967 :ALT_TITLE: CDLaTeX mode
10969 #+cindex: CD@LaTeX{}
10971 CDLaTeX mode is a minor mode that is normally used in combination with
10972 a major LaTeX mode like AUCTeX in order to speed-up insertion of
10973 environments and math templates. Inside Org mode, you can make use of
10974 some of the features of CDLaTeX mode. You need to install
10975 =cdlatex.el= and =texmathp.el= (the latter comes also with AUCTeX)
10976 from [[http://www.astro.uva.nl/~dominik/Tools/cdlatex]]. Do not use
10977 CDLaTeX mode itself under Org mode, but use the light version
10978 ~org-cdlatex-mode~ that comes as part of Org mode. Turn it on for the
10979 current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org
10982 #+begin_src emacs-lisp
10983 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
10986 When this mode is enabled, the following features are present (for
10987 more details see the documentation of CDLaTeX mode):
10989 #+attr_texinfo: :sep ,
10990 - {{{kbd(C-c {)}}} ::
10993 Insert an environment template.
10995 - {{{kbd(TAB)}}} ::
10998 The {{{kbd(TAB)}}} expands the template if the cursor is inside
10999 a LaTeX fragment[fn:114]. For example, {{{kbd(TAB)}}} expands
11000 =fr= to =\frac{}{}= and position the cursor correctly inside the
11001 first brace. Another {{{kbd(TAB)}}} gets you into the second
11004 Even outside fragments, {{{kbd(TAB)}}} expands environment
11005 abbreviations at the beginning of a line. For example, if you
11006 write =equ= at the beginning of a line and press {{{kbd(TAB)}}},
11007 this abbreviation is expanded to an =equation= environment. To
11008 get a list of all abbreviations, type {{{kbd(M-x
11009 cdlatex-command-help)}}}.
11011 - {{{kbd(^)}}}, {{{kbd(_)}}} ::
11014 #+vindex: cdlatex-simplify-sub-super-scripts
11016 Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment
11017 inserts these characters together with a pair of braces. If you
11018 use {{{kbd(TAB)}}} to move out of the braces, and if the braces
11019 surround only a single character or macro, they are removed again
11020 (depending on the variable ~cdlatex-simplify-sub-super-scripts~).
11025 Pressing the backquote followed by a character inserts math
11026 macros, also outside LaTeX fragments. If you wait more than 1.5
11027 seconds after the backquote, a help window pops up.
11032 Pressing the single-quote followed by another character modifies
11033 the symbol before point with an accent or a font. If you wait
11034 more than 1.5 seconds after the single-quote, a help window pops
11035 up. Character modification works only inside LaTeX fragments;
11036 outside the quote is normal.
11040 :DESCRIPTION: Sharing and publishing notes.
11042 #+cindex: exporting
11044 Sometimes, you may want to pretty print your notes, publish them on
11045 the web or even share them with people not using Org. In these cases,
11046 the Org export facilities can be used to convert your documents to
11047 a variety of other formats, while retaining as much structure (see
11048 [[*Document structure]]) and markup (see [[*Markup for rich export]]) as
11051 #+cindex: export back-end
11052 Libraries responsible for such translation are called back-ends. Org
11053 ships with the following ones
11055 - /ascii/ (ASCII format)
11056 - /beamer/ (LaTeX Beamer format)
11057 - /html/ (HTML format)
11058 - /icalendar/ (iCalendar format)
11059 - /latex/ (LaTeX format)
11060 - /md/ (Markdown format)
11061 - /odt/ (OpenDocument Text format)
11062 - /org/ (Org format)
11063 - /texinfo/ (Texinfo format)
11064 - /man/ (Man page format)
11066 #+texinfo: @noindent
11067 Org also uses additional libraries located in =contrib/= directory
11068 (see [[*Installation]]). Users can install additional export libraries
11069 for additional formats from the Emacs packaging system. For easy
11070 discovery, these packages have a common naming scheme: ~ox-NAME~,
11071 where {{{var(NAME)}}} is one of the formats. For example,
11072 ~ox-koma-letter~ /koma-letter/ back-end.
11074 #+vindex: org-export-backends
11075 Org loads back-ends for the following formats by default: ASCII, HTML,
11076 iCalendar, LaTeX and ODT. Org can load additional back-ends either of
11077 two ways: through the ~org-export-backends~ variable configuration;
11078 or, by requiring the library in the Emacs init file like this:
11080 #+begin_src emacs-lisp
11084 ** The export dispatcher
11086 :DESCRIPTION: The main interface.
11088 #+cindex: dispatcher, for export commands
11089 #+cindex: Export, dispatcher
11091 The export dispatcher is the main interface for Org's exports.
11092 A hierarchical menu presents the currently configured export formats.
11093 Options are shown as easy toggle switches on the same screen.
11095 #+vindex: org-export-dispatch-use-expert-ui
11096 Org also has a minimal prompt interface for the export dispatcher.
11097 When the variable ~org-export-dispatch-use-expert-ui~ is set to
11098 a non-~nil~ value, Org prompts in the minibuffer. To switch back to
11099 the hierarchical menu, press {{{kbd(?)}}}.
11101 - {{{kbd(C-c C-e)}}} (~org-export~) ::
11103 #+findex: org-export
11105 Invokes the export dispatcher interface. The options show
11106 default settings. The {{{kbd(C-u)}}} prefix argument preserves
11107 options from the previous export, including any sub-tree
11110 Org exports the entire buffer by default. If the Org buffer has an
11111 active region, then Org exports just that region.
11113 Within the dispatcher interface, the following key combinations can
11114 further alter what is exported, and how.
11116 - {{{kbd(C-a)}}} ::
11117 #+kindex: C-c C-e C-a
11119 Toggle asynchronous export. Asynchronous export uses an external
11120 Emacs process with a specially configured initialization file to
11121 complete the exporting process in the background thereby
11122 releasing the current interface. This is particularly useful
11123 when exporting long documents.
11125 Output from an asynchronous export is saved on the "the export
11126 stack". To view this stack, call the export dispatcher with
11127 a double {{{kbd(C-u)}}} prefix argument. If already in the
11128 export dispatcher menu, {{{kbd(&)}}} displays the stack.
11130 #+vindex: org-export-async-init-file
11131 To make the background export process the default, customize the
11132 variable, ~org-export-in-background~. Additionally, you can set
11133 the initialization file used by the background process with
11134 ~org-export-async-init-file~.
11136 #+vindex: org-export-in-background
11137 You can make asynchronous export the default by setting
11138 ~org-export-in-background~.
11140 - {{{kbd(C-b)}}} ::
11141 #+kindex: C-c C-e C-b
11143 Toggle body-only export. Useful for excluding headers and
11144 footers in the export. Affects only those back-end formats that
11145 have such sections -- like =<head>...</head>= in HTML.
11148 #+kindex: C-c C-e C-s
11150 Toggle sub-tree export. When turned on, Org exports only the
11151 sub-tree starting from the cursor position at the time the export
11152 dispatcher was invoked. Org uses the top heading of this
11153 sub-tree as the document's title. If the cursor is not on
11154 a heading, Org uses the nearest enclosing header. If the cursor
11155 is in the document preamble, Org signals an error and aborts
11158 #+vindex: org-export-initial-scope
11159 To make the sub-tree export the default, customize the variable
11160 ~org-export-initial-scope~.
11162 - {{{kbd(C-v)}}} ::
11163 #+kindex: C-c C-e C-v
11165 Toggle visible-only export. Useful for exporting only visible
11166 parts of an Org document by adjusting outline visibility
11171 :DESCRIPTION: Common export settings.
11173 #+cindex: options, for export
11174 #+cindex: Export, settings
11176 #+cindex: OPTIONS, keyword
11177 Export options can be set: globally with variables; for an individual
11178 file by making variables buffer-local with in-buffer settings (see
11179 [[*Summary of in-buffer settings]]), by setting individual keywords, or by
11180 specifying them in a compact form with the =OPTIONS= keyword; or for
11181 a tree by setting properties (see [[*Properties and columns]]). Options
11182 set at a specific level override options set at a more general level.
11184 #+cindex: SETUPFILE, keyword
11185 In-buffer settings may appear anywhere in the file, either directly or
11186 indirectly through a file included using =#+SETUPFILE: filename or
11187 URL= syntax. Option keyword sets tailored to a particular back-end
11188 can be inserted from the export dispatcher (see [[*The export
11189 dispatcher]]) using the =Insert template= command by pressing
11190 {{{kbd(#)}}}. To insert keywords individually, a good way to make
11191 sure the keyword is correct is to type =#+= and then to use
11192 {{{kbd(M-TAB)}}}[fn:16] for completion.
11194 The export keywords available for every back-end, and their equivalent
11195 global variables, include:
11199 #+cindex: AUTHOR, keyword
11200 #+vindex: user-full-name
11201 The document author (~user-full-name~).
11205 #+cindex: CREATOR, keyword
11206 #+vindex: org-expot-creator-string
11207 Entity responsible for output generation
11208 (~org-export-creator-string~).
11212 #+cindex: DATE, keyword
11213 #+vindex: org-export-date-timestamp-format
11214 A date or a time-stamp[fn:115].
11218 #+cindex: EMAIL, keyword
11219 #+vindex: user-mail-address
11220 The email address (~user-mail-address~).
11224 #+cindex: LANGUAGE, keyword
11225 #+vindex: org-export-default-language
11226 Language to use for translating certain strings
11227 (~org-export-default-language~). With =#+LANGUAGE: fr=, for
11228 example, Org translates =Table of contents= to the French =Table
11233 #+cindex: SELECT_TAGS, keyword
11234 #+vindex: org-export-select-tags
11235 The default value is ~("export")~. When a tree is tagged with
11236 =export= (~org-export-select-tags~), Org selects that tree and
11237 its sub-trees for export. Org excludes trees with =noexport=
11238 tags, see below. When selectively exporting files with =export=
11239 tags set, Org does not export any text that appears before the
11242 - =EXCLUDE_TAGS= ::
11244 #+cindex: EXCLUDE_TAGS, keyword
11245 #+vindex: org-export-exclude-tags
11246 The default value is ~("noexport")~. When a tree is tagged with
11247 =noexport= (~org-export-exclude-tags~), Org excludes that tree
11248 and its sub-trees from export. Entries tagged with =noexport=
11249 are unconditionally excluded from the export, even if they have
11250 an =export= tag. Even if a sub-tree is not exported, Org
11251 executes any code blocks contained there.
11255 #+cindex: TITLE, keyword
11256 #+cindex: document title
11257 Org displays this title. For long titles, use multiple =#+TITLE=
11260 - =EXPORT_FILE_NAME= ::
11262 #+cindex: EXPORT_FILE_NAME, keyword
11263 The name of the output file to be generated. Otherwise, Org
11264 generates the file name based on the buffer name and the
11265 extension based on the back-end format.
11267 The =OPTIONS= keyword is a compact form. To configure multiple
11268 options, use several =OPTIONS= lines. =OPTIONS= recognizes the
11269 following arguments.
11273 #+vindex: org-export-with-smart-quotes
11274 Toggle smart quotes (~org-export-with-smart-quotes~). Depending
11275 on the language used, when activated, Org treats pairs of double
11276 quotes as primary quotes, pairs of single quotes as secondary
11277 quotes, and single quote marks as apostrophes.
11281 #+vindex: org-export-with-emphasize
11282 Toggle emphasized text (~org-export-with-emphasize~).
11286 #+vindex: org-export-with-special-strings
11287 Toggle conversion of special strings
11288 (~org-export-with-special-strings~).
11292 #+vindex: org-export-with-fixed-width
11293 Toggle fixed-width sections (~org-export-with-fixed-width~).
11297 #+vindex: org-export-with-timestamps
11298 Toggle inclusion of time/date active/inactive stamps
11299 (~org-export-with-timestamps~).
11303 #+vindex: org-export-preserve-breaks
11304 Toggles whether to preserve line breaks
11305 (~org-export-preserve-breaks~).
11309 #+vindex: org-export-with-sub-superscripts
11310 Toggle TeX-like syntax for sub- and superscripts. If you write
11311 =^:{}=, =a_{b}= is interpreted, but the simple =a_b= is left as
11312 it is (~org-export-with-sub-superscripts~).
11316 #+vindex: org-export-with-archived-trees
11317 Configure how archived trees are exported. When set to
11318 ~headline~, the export process skips the contents and processes
11319 only the headlines (~org-export-with-archived-trees~).
11323 #+vindex: org-export-with-author
11324 Toggle inclusion of author name into exported file
11325 (~org-export-with-author~).
11327 - ~broken-links~ ::
11329 #+vindex: org-export-with-broken-links
11330 Toggles if Org should continue exporting upon finding a broken
11331 internal link. When set to ~mark~, Org clearly marks the problem
11332 link in the output (~org-export-with-broken-links~).
11336 #+vindex: org-export-with-clocks
11337 Toggle inclusion of CLOCK keywords (~org-export-with-clocks~).
11341 #+vindex: org-export-with-creator
11342 Toggle inclusion of creator information in the exported file
11343 (~org-export-with-creator~).
11347 #+vindex: org-export-with-drawers
11348 Toggles inclusion of drawers, or list of drawers to include, or
11349 list of drawers to exclude (~org-export-with-drawers~).
11353 #+vindex: org-export-with-date
11354 Toggle inclusion of a date into exported file
11355 (~org-export-with-date~).
11359 #+vindex: org-export-with-entities
11360 Toggle inclusion of entities (~org-export-with-entities~).
11364 #+vindex: org-export-with-email
11365 Toggle inclusion of the author's e-mail into exported file
11366 (~org-export-with-email~).
11370 #+vindex: org-export-with-footnotes
11371 Toggle the inclusion of footnotes (~org-export-with-footnotes~).
11375 #+vindex: org-export-headline-levels
11376 Set the number of headline levels for export
11377 (~org-export-headline-levels~). Below that level, headlines are
11378 treated differently. In most back-ends, they become list items.
11382 #+vindex: org-export-with-inlinetasks
11383 Toggle inclusion of inlinetasks (~org-export-with-inlinetasks~).
11387 #+vindex: org-export-with-section-numbers
11388 #+cindex: UNNUMBERED, property
11389 Toggle section-numbers (~org-export-with-section-numbers~). When
11390 set to number N, Org numbers only those headlines at level N or
11391 above. Set =UNNUMBERED= property to non-~nil~ to disable
11392 numbering of heading and subheadings entirely. Moreover, when
11393 the value is =notoc= the headline, and all its children, do not
11394 appear in the table of contents either (see [[*Table of contents]]).
11398 #+vindex: org-export-with-planning
11399 Toggle export of planning information
11400 (~org-export-with-planning~). "Planning information" comes from
11401 lines located right after the headline and contain any
11402 combination of these cookies: =SCHEDULED=, =DEADLINE=, or
11407 #+vindex: org-export-with-priority
11408 Toggle inclusion of priority cookies
11409 (~org-export-with-priority~).
11413 #+vindex: org-export-with-properties
11414 Toggle inclusion of property drawers, or list the properties to
11415 include (~org-export-with-properties~).
11419 #+vindex: org-export-with-statistics-cookies
11420 Toggle inclusion of statistics cookies
11421 (~org-export-with-statistics-cookies~).
11425 #+vindex: org-export-with-tags
11426 Toggle inclusion of tags, may also be ~not-in-toc~
11427 (~org-export-with-tags~).
11431 #+vindex: org-export-with-tasks
11432 Toggle inclusion of tasks (TODO items); or ~nil~ to remove all
11433 tasks; or ~todo~ to remove DONE tasks; or list the keywords to
11434 keep (~org-export-with-tasks~).
11438 #+vindex: org-export-with-latex
11439 ~nil~ does not export; ~t~ exports; ~verbatim~ keeps everything
11440 in verbatim (~org-export-with-latex~).
11444 #+vindex: org-export-time-stamp-file
11445 Toggle inclusion of the creation time in the exported file
11446 (~org-export-time-stamp-file~).
11450 #+vindex: org-export-with-title
11451 Toggle inclusion of title (~org-export-with-title~).
11455 #+vindex: org-export-with-toc
11456 Toggle inclusion of the table of contents, or set the level limit
11457 (~org-export-with-toc~).
11461 #+vindex: org-export-with-todo-keywords
11462 Toggle inclusion of TODO keywords into exported text
11463 (~org-export-with-todo-keywords~).
11467 #+vindex: org-export-with-tables
11468 Toggle inclusion of tables (~org-export-with-tables~).
11470 When exporting sub-trees, special node properties in them can override
11471 the above keywords. They are special because they have an =EXPORT_=
11472 prefix. For example, =DATE= and =EXPORT_FILE_NAME= keywords become,
11473 respectively, =EXPORT_DATE= and =EXPORT_FILE_NAME=. Except for
11474 =SETUPFILE=, all other keywords listed above have an =EXPORT_=
11477 #+cindex: BIND, keyword
11478 #+vindex: org-export-allow-bind-keywords
11479 If ~org-export-allow-bind-keywords~ is non-~nil~, Emacs variables can
11480 become buffer-local during export by using the =BIND= keyword. Its
11481 syntax is =#+BIND: variable value=. This is particularly useful for
11482 in-buffer settings that cannot be changed using keywords.
11484 ** Table of contents
11486 :DESCRIPTION: The if and where of the table of contents.
11488 #+cindex: table of contents
11489 #+cindex: list of tables
11490 #+cindex: list of listings
11492 #+cindex: @samp{toc}, in OPTIONS keyword
11493 #+vindex: org-export-with-toc
11494 The table of contents includes all headlines in the document. Its
11495 depth is therefore the same as the headline levels in the file. If
11496 you need to use a different depth, or turn it off entirely, set the
11497 ~org-export-with-toc~ variable accordingly. You can achieve the same
11498 on a per file basis, using the following =toc= item in =OPTIONS=
11502 ,#+OPTIONS: toc:2 (only include two levels in TOC)
11503 ,#+OPTIONS: toc:nil (no default TOC at all)
11506 #+cindex: excluding entries from table of contents
11507 #+cindex: table of contents, exclude entries
11508 Org includes both numbered and unnumbered headlines in the table of
11509 contents[fn:116]. If you need to exclude an unnumbered headline,
11510 along with all its children, set the =UNNUMBERED= property to =notoc=
11514 ,* Subtree not numbered, not in table of contents either
11520 #+cindex: TOC, keyword
11521 Org normally inserts the table of contents directly before the first
11522 headline of the file. To move the table of contents to a different
11523 location, first turn off the default with ~org-export-with-toc~
11524 variable or with =#+OPTIONS: toc:nil=. Then insert =#+TOC: headlines
11525 N= at the desired location(s).
11528 ,#+OPTIONS: toc:nil
11530 ,#+TOC: headlines 2
11533 To adjust the table of contents depth for a specific section of the
11534 Org document, append an additional =local= parameter. This parameter
11535 becomes a relative depth for the current level. The following example
11536 inserts a local table of contents, with direct children only.
11540 ,#+TOC: headlines 1 local
11543 Note that for this feature to work properly in LaTeX export, the Org
11544 file requires the inclusion of the titletoc package. Because of
11545 compatibility issues, titletoc has to be loaded /before/ hyperref.
11546 Customize the ~org-latex-default-packages-alist~ variable.
11548 Use the =TOC= keyword to generate list of tables -- respectively, all
11549 listings -- with captions.
11556 #+cindex: ALT_TITLE, property
11557 Normally Org uses the headline for its entry in the table of contents.
11558 But with =ALT_TITLE= property, a different entry can be specified for
11559 the table of contents.
11563 :DESCRIPTION: Include additional files into a document.
11565 #+cindex: include files, during export
11566 #+cindex: Export, include files
11567 #+cindex: INCLUDE, keyword
11569 During export, you can include the content of another file. For
11570 example, to include your =.emacs= file, you could use:
11572 : #+INCLUDE: "~/.emacs" src emacs-lisp
11574 #+texinfo: @noindent
11575 The optional second and third parameter are the markup (e.g., =quote=,
11576 =example=, or =src=), and, if the markup is =src=, the language for
11577 formatting the contents. The markup is optional; if it is not given,
11578 assume text is in Org syntax and process it normally. The =INCLUDE=
11579 keyword also allows additional parameters =:prefix1= and =:prefix= to
11580 specify prefixes for the first line and for each following line,
11581 =:minlevel= in order to get Org mode content demoted to a specified
11582 level, as well as any options accepted by the selected markup. For
11583 example, to include a file as an item, use:
11585 : #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
11587 You can also include a portion of a file by specifying a lines range
11588 using the =:lines= parameter. The line at the upper end of the range
11589 is not included. The start and/or the end of the range may be omitted
11590 to use the obvious defaults.
11592 - =#+INCLUDE: "~/.emacs" :lines "5-10"= ::
11594 Include lines 5 to 10, 10 excluded.
11596 - =#+INCLUDE: "~/.emacs" :lines "-10"= ::
11598 Include lines 1 to 10, 10 excluded.
11600 - =#+INCLUDE: "~/.emacs" :lines "10-"= ::
11602 Include lines from 10 to EOF.
11604 You can visit the file being included with the following command.
11606 - {{{kbd(C-c ')}}} (~org-edit~special~) ::
11608 #+findex: org-edit-special
11610 Visit the include file at point.
11612 ** Macro replacement
11614 :DESCRIPTION: Use macros to create templates.
11616 #+cindex: macro replacement, during export
11617 #+cindex: MACRO, keyword
11619 #+vindex: org-export-global-macros
11620 Macros replace text snippets during export. Macros are defined
11621 globally in ~org-export-global-macros~, or document-wise with the
11624 : #+MACRO: name replacement text; $1, $2 are arguments
11626 #+texinfo: @noindent
11627 which can be referenced using ={{{name(arg1, arg2)}}}=[fn:117]. For
11631 ,#+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
11632 {{{poem(red,blue)}}}
11635 #+texinfo: @noindent
11638 : The rose is red, The violet's blue. Life's ordered: Org assists you.
11640 As a special case, Org parses any replacement text starting with
11641 =(eval= as an Emacs Lisp expression and evaluates it accordingly.
11642 Within such templates, arguments become strings. Thus, the following
11645 : #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
11647 #+texinfo: @noindent
11648 turns ={{{gnucheck(linux)}}}= into =GNU/Linux= during export.
11650 Org recognizes macro references in following Org markup areas:
11651 paragraphs, headlines, verse blocks, tables cells and lists. Org also
11652 recognizes macro references in keywords, such as =CAPTION=, =TITLE=,
11653 =AUTHOR=, =DATE=, and for some back-end specific export options.
11655 Org comes with following pre-defined macros:
11657 #+attr_texinfo: :sep ;
11658 - ={{{keyword(NAME)}}}=; ={{{title}}}=; ={{{author}}}=; ={{{email}}}= ::
11660 #+cindex: keyword, macro
11661 #+cindex: title, macro
11662 #+cindex: author, macro
11663 #+cindex: email, macro
11664 The =keyword= macro collects all values from {{{var(NAME)}}}
11665 keywords throughout the buffer, separated with white space.
11666 =title=, =author= and =email= macros are shortcuts for,
11667 respectively, ={{{keyword(TITLE)}}}=, ={{{keyword(AUTHOR)}}}= and
11668 ={{{keyword(EMAIL)}}}=.
11670 - ={{{date}}}=; ={{{date(FORMAT)}}}= ::
11672 #+cindex: date, macro
11673 This macro refers to the =DATE= keyword. {{{var(FORMAT)}}} is an
11674 optional argument to the =date= macro that is used only if =DATE=
11675 is a single timestamp. {{{var(FORMAT)}}} should be a format
11676 string understood by ~format-time-string~.
11678 - ={{{time(FORMAT)}}}=; ={{{modification-time(FORMAT, VC)}}}= ::
11680 #+cindex: time, macro
11681 #+cindex: modification time, macro
11682 These macros refer to the document's date and time of export and
11683 date and time of modification. {{{var(FORMAT)}}} is a string
11684 understood by ~format-time-string~. If the second argument to
11685 the ~modification-time~ macro is non-~nil~, Org uses =vc.el= to
11686 retrieve the document's modification time from the version
11687 control system. Otherwise Org reads the file attributes.
11689 - ={{{input-file}}}= ::
11691 #+cindex: input file, macro
11692 This macro refers to the filename of the exported file.
11694 - ={{{property(PROPERTY-NAME)}}}=; ={{{property(PROPERTY-NAME, SEARCH OPTION)}}}= ::
11696 #+cindex: property, macro
11697 This macro returns the value of property {{{var(PROPERTY-NAME)}}}
11698 in the current entry. If {{{var(SEARCH-OPTION)}}} (see [[*Search
11699 options in file links]]) refers to a remote entry, use it instead.
11701 - ={{{n}}}=; ={{{n(NAME)}}}=; ={{{n(NAME, ACTION)}}}= ::
11704 #+cindex: counter, macro
11705 This macro implements custom counters by returning the number of
11706 times the macro has been expanded so far while exporting the
11707 buffer. You can create more than one counter using different
11708 {{{var(NAME)}}} values. If {{{var(ACTION)}}} is =-=, previous
11709 value of the counter is held, i.e., the specified counter is not
11710 incremented. If the value is a number, the specified counter is
11711 set to that value. If it is any other non-empty string, the
11712 specified counter is reset to 1. You may leave {{{var(NAME)}}}
11713 empty to reset the default counter.
11715 #+vindex: org-hide-macro-markers
11716 The surrounding brackets can be made invisible by setting
11717 ~org-hide-macro-markers~ non-~nil~.
11719 Org expands macros at the very beginning of the export process.
11723 :DESCRIPTION: What will not be exported.
11725 #+cindex: exporting, not
11727 #+cindex: comment lines
11728 Lines starting with zero or more whitespace characters followed by one
11729 =#= and a whitespace are treated as comments and, as such, are not
11732 #+cindex: BEGIN_COMMENT
11733 #+cindex: comment block
11734 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT=
11737 #+cindex: comment trees
11738 Finally, a =COMMENT= keyword at the beginning of an entry, but after
11739 any other keyword or priority cookie, comments out the entire subtree.
11740 In this case, the subtree is not exported and no code block within it
11741 is executed either[fn:118]. The command below helps changing the
11742 comment status of a headline.
11744 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
11746 #+findex: org-toggle-comment
11748 Toggle the =COMMENT= keyword at the beginning of an entry.
11750 ** ASCII/Latin-1/UTF-8 export
11752 :DESCRIPTION: Exporting to flat files with encoding.
11754 #+cindex: ASCII export
11755 #+cindex: Latin-1 export
11756 #+cindex: UTF-8 export
11758 ASCII export produces an output file containing only plain ASCII
11759 characters. This is the simplest and most direct text output. It
11760 does not contain any Org markup. Latin-1 and UTF-8 export use
11761 additional characters and symbols available in these encoding
11762 standards. All three of these export formats offer the most basic of
11763 text output for maximum portability.
11765 #+vindex: org-ascii-text-width
11766 On export, Org fills and justifies text according to the text width
11767 set in ~org-ascii-text-width~.
11769 #+vindex: org-ascii-links-to-notes
11770 Org exports links using a footnote-like style where the descriptive
11771 part is in the text and the link is in a note before the next heading.
11772 See the variable ~org-ascii-links-to-notes~ for details.
11774 *** ASCII export commands
11779 #+attr_texinfo: :sep ,
11780 - {{{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)}}} ::
11781 #+kindex: C-c C-e t a
11782 #+kindex: C-c C-e t l
11783 #+kindex: C-c C-e t u
11784 #+findex: org-ascii-export-to-ascii
11786 Export as an ASCII file with a =.txt= extension. For
11787 =myfile.org=, Org exports to =myfile.txt=, overwriting without
11788 warning. For =myfile.txt=, Org exports to =myfile.txt.txt= in
11789 order to prevent data loss.
11791 #+attr_texinfo: :sep ,
11792 - {{{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)}}} ::
11793 #+kindex: C-c C-e t A
11794 #+kindex: C-c C-e t L
11795 #+kindex: C-c C-e t U
11796 #+findex: org-ascii-export-to-ascii
11798 Export to a temporary buffer. Does not create a file.
11800 *** ASCII specific export settings
11805 The ASCII export back-end has one extra keyword for customizing ASCII
11806 output. Setting this keyword works similar to the general options
11807 (see [[*Export settings]]).
11811 #+cindex: SUBTITLE, keyword
11812 The document subtitle. For long subtitles, use multiple
11813 =#+SUBTITLE= lines in the Org file. Org prints them on one
11814 continuous line, wrapping into multiple lines if necessary.
11816 *** Header and sectioning structure
11821 Org converts the first three outline levels into headlines for ASCII
11822 export. The remaining levels are turned into lists. To change this
11823 cut-off point where levels become lists, see [[*Export settings]].
11825 *** Quoting ASCII text
11830 To insert text within the Org file by the ASCII back-end, use one the
11831 following constructs, inline, keyword, or export block:
11833 #+cindex: ASCII, keyword
11834 #+cindex: BEGIN_EXPORT ascii
11836 Inline text @@ascii:and additional text@@ within a paragraph.
11838 ,#+ASCII: Some text
11840 ,#+BEGIN_EXPORT ascii
11841 Org exports text in this block only when using ASCII back-end.
11845 *** ASCII specific attributes
11849 #+cindex: ATTR_ASCII, keyword
11850 #+cindex: horizontal rules, in ASCII export
11852 ASCII back-end recognizes only one attribute, ~:width~, which
11853 specifies the width of an horizontal rule in number of characters.
11854 The keyword and syntax for specifying widths is:
11857 ,#+ATTR_ASCII: :width 10
11861 *** ASCII special blocks
11865 #+cindex: special blocks, in ASCII export
11866 #+cindex: BEGIN_JUSTIFYLEFT
11867 #+cindex: BEGIN_JUSTIFYRIGHT
11869 Besides =#+BEGIN_CENTER= blocks (see [[*Paragraphs]]), ASCII back-end has
11870 these two left and right justification blocks:
11873 ,#+BEGIN_JUSTIFYLEFT
11874 It's just a jump to the left...
11877 ,#+BEGIN_JUSTIFYRIGHT
11878 ...and then a step to the right.
11879 ,#+END_JUSTIFYRIGHT
11883 #+cindex: Beamer export
11885 Org uses Beamer export to convert an Org file tree structure into
11886 high-quality interactive slides for presentations. Beamer is a LaTeX
11887 document class for creating presentations in PDF, HTML, and other
11888 popular display formats.
11890 *** Beamer export commands
11892 :DESCRIPTION: For creating Beamer documents.
11895 - {{{kbd(C-c C-e l b)}}} (~org-beamer-export-to-latex~) ::
11896 #+kindex: C-c C-e l b
11897 #+findex: org-beamer-export-to-latex
11899 Export as LaTeX file with a =.tex= extension. For =myfile.org=,
11900 Org exports to =myfile.tex=, overwriting without warning.
11902 - {{{kbd(C-c C-e l B)}}} (~org-beamer-export-as-latex~) ::
11903 #+kindex: C-c C-e l B
11904 #+findex: org-beamer-export-as-latex
11906 Export to a temporary buffer. Does not create a file.
11908 - {{{kbd(C-c C-e l P)}}} (~org-beamer-export-to-pdf~) ::
11909 #+kindex: C-c C-e l P
11910 #+findex: org-beamer-export-to-pdf
11912 Export as LaTeX file and then convert it to PDF format.
11914 - {{{kbd(C-c C-e l O)}}} ::
11915 #+kindex: C-c C-e l O
11917 Export as LaTeX file, convert it to PDF format, and then open the
11920 *** Beamer specific export settings
11922 :DESCRIPTION: For customizing Beamer export.
11925 Beamer export back-end has several additional keywords for customizing
11926 Beamer output. These keywords work similar to the general options
11927 settings (see [[*Export settings]]).
11929 - =BEAMER_THEME= ::
11931 #+cindex: BEAMER_THEME, keyword
11932 #+vindex: org-beamer-theme
11933 The Beamer layout theme (~org-beamer-theme~). Use square
11934 brackets for options. For example:
11936 : #+BEAMER_THEME: Rochester [height=20pt]
11938 - =BEAMER_FONT_THEME= ::
11940 #+cindex: BEAMER_FONT_THEME, keyword
11941 The Beamer font theme.
11943 - =BEAMER_INNER_THEME= ::
11945 #+cindex: BEAMER_INNER_THEME, keyword
11946 The Beamer inner theme.
11948 - =BEAMER_OUTER_THEME= ::
11950 #+cindex: BEAMER_OUTER_THEME, keyword
11951 The Beamer outer theme.
11953 - =BEAMER_HEADER= ::
11955 #+cindex: BEAMER_HEADER, keyword
11956 Arbitrary lines inserted in the preamble, just before the
11957 =hyperref= settings.
11961 #+cindex: DESCRIPTION, keyword
11962 The document description. For long descriptions, use multiple
11963 =DESCRIPTION= keywords. By default, =hyperref= inserts
11964 =DESCRIPTION= as metadata. Use ~org-latex-hyperref-template~ to
11965 configure document metadata. Use ~org-latex-title-command~ to
11966 configure typesetting of description as part of front matter.
11970 #+cindex: KEYWORDS, keyword
11971 The keywords for defining the contents of the document. Use
11972 multiple =KEYWORDS= lines if necessary. By default, =hyperref=
11973 inserts =KEYWORDS= as metadata. Use
11974 ~org-latex-hyperref-template~ to configure document metadata.
11975 Use ~org-latex-title-command~ to configure typesetting of
11976 keywords as part of front matter.
11980 #+cindex: SUBTITLE, keyword
11981 Document's subtitle. For typesetting, use
11982 ~org-beamer-subtitle-format~ string. Use
11983 ~org-latex-hyperref-template~ to configure document metadata.
11984 Use ~org-latex-title-command~ to configure typesetting of
11985 subtitle as part of front matter.
11987 *** Frames and Blocks in Beamer
11989 :DESCRIPTION: For composing Beamer slides.
11992 Org transforms heading levels into Beamer's sectioning elements,
11993 frames and blocks. Any Org tree with a not-too-deep-level nesting
11994 should in principle be exportable as a Beamer presentation.
11997 #+vindex: org-beamer-frame-level
11998 Org headlines become Beamer frames when the heading level in Org is
11999 equal to ~org-beamer-frame-level~ or =H= value in a =OPTIONS= line
12000 (see [[*Export settings]]).
12002 #+cindex: BEAMER_ENV, property
12003 Org overrides headlines to frames conversion for the current tree of
12004 an Org file if it encounters the =BEAMER_ENV= property set to
12005 =frame= or =fullframe=. Org ignores whatever
12006 ~org-beamer-frame-level~ happens to be for that headline level in
12007 the Org tree. In Beamer terminology, a full frame is a frame
12010 - Org exports a Beamer frame's objects as block environments. Org can
12011 enforce wrapping in special block types when =BEAMER_ENV= property
12012 is set[fn:119]. For valid values see
12013 ~org-beamer-environments-default~. To add more values, see
12014 ~org-beamer-environments-extra~.
12015 #+vindex: org-beamer-environments-default
12016 #+vindex: org-beamer-environments-extra
12019 #+cindex: BEAMER_REF, property
12020 If =BEAMER_ENV= is set to =appendix=, Org exports the entry as an
12021 appendix. When set to =note=, Org exports the entry as a note
12022 within the frame or between frames, depending on the entry's heading
12023 level. When set to =noteNH=, Org exports the entry as a note
12024 without its title. When set to =againframe=, Org exports the entry
12025 with =\againframe= command, which makes setting the =BEAMER_REF=
12026 property mandatory because =\againframe= needs frame to resume.
12028 When =ignoreheading= is set, Org export ignores the entry's headline
12029 but not its content. This is useful for inserting content between
12030 frames. It is also useful for properly closing a =column=
12031 environment. @end itemize
12033 #+cindex: BEAMER_ACT, property
12034 #+cindex: BEAMER_OPT, property
12035 When =BEAMER_ACT= is set for a headline, Org export translates that
12036 headline as an overlay or action specification. When enclosed in
12037 square brackets, Org export makes the overlay specification
12038 a default. Use =BEAMER_OPT= to set any options applicable to the
12039 current Beamer frame or block. The Beamer export back-end wraps
12040 with appropriate angular or square brackets. It also adds the
12041 =fragile= option for any code that may require a verbatim block.
12043 #+cindex: BEAMER_COL, property
12044 To create a column on the Beamer slide, use the =BEAMER_COL=
12045 property for its headline in the Org file. Set the value of
12046 =BEAMER_COL= to a decimal number representing the fraction of the
12047 total text width. Beamer export uses this value to set the column's
12048 width and fills the column with the contents of the Org entry. If
12049 the Org entry has no specific environment defined, Beamer export
12050 ignores the heading. If the Org entry has a defined environment,
12051 Beamer export uses the heading as title. Behind the scenes, Beamer
12052 export automatically handles LaTeX column separations for contiguous
12053 headlines. To manually adjust them for any unique configurations
12054 needs, use the =BEAMER_ENV= property.
12056 *** Beamer specific syntax
12058 :DESCRIPTION: For using in Org documents.
12061 Since Org's Beamer export back-end is an extension of the LaTeX
12062 back-end, it recognizes other LaTeX specific syntax -- for example,
12063 =#+LATEX:= or =#+ATTR_LATEX:=. See [[*LaTeX export]], for details.
12065 Beamer export wraps the table of contents generated with =toc:t=
12066 =OPTION= keyword in a =frame= environment. Beamer export does not
12067 wrap the table of contents generated with =TOC= keyword (see [[*Table of
12068 contents]]). Use square brackets for specifying options.
12070 : #+TOC: headlines [currentsection]
12072 Insert Beamer-specific code using the following constructs:
12074 #+cindex: BEAMER, keyword
12075 #+cindex: BEGIN_EXPORT beamer
12079 ,#+BEGIN_EXPORT beamer
12080 Only Beamer export back-end exports this.
12083 Text @@beamer:some code@@ within a paragraph.
12086 Inline constructs, such as the last one above, are useful for adding
12087 overlay specifications to objects with ~bold~, ~item~, ~link~,
12088 ~radio-target~ and ~target~ types. Enclose the value in angular
12089 brackets and place the specification at the beginning of the object as
12090 shown in this example:
12092 : A *@@beamer:<2->@@useful* feature
12094 #+cindex: ATTR_BEAMER, keyword
12095 Beamer export recognizes the =ATTR_BEAMER= keyword with the following
12096 attributes from Beamer configurations: =:environment= for changing
12097 local Beamer environment, =:overlay= for specifying Beamer overlays in
12098 angular or square brackets, and =:options= for inserting optional
12102 ,#+ATTR_BEAMER: :environment nonindentlist
12103 - item 1, not indented
12104 - item 2, not indented
12105 - item 3, not indented
12109 ,#+ATTR_BEAMER: :overlay <+->
12115 ,#+ATTR_BEAMER: :options [Lagrange]
12116 Let $G$ be a finite group, and let $H$ be
12117 a subgroup of $G$. Then the order of $H$ divides the order of $G$.
12120 *** Editing support
12122 :DESCRIPTION: Editing support.
12125 The ~org-beamer-mode~ is a special minor mode for faster editing of
12128 : #+STARTUP: beamer
12130 - {{{kbd(C-c C-b)}}} (~org-beamer-select-environment~) ::
12132 #+findex: org-beamer-select-environment
12134 The ~org-beamer-mode~ provides this key for quicker selections in
12135 Beamer normal environments, and for selecting the =BEAMER_COL=
12138 *** A Beamer example
12140 :DESCRIPTION: A complete presentation.
12143 Here is an example of an Org document ready for Beamer export.
12146 ;#+TITLE: Example Presentation
12147 ;#+AUTHOR: Carsten Dominik
12148 ;#+OPTIONS: H:2 toc:t num:t
12149 ;#+LATEX_CLASS: beamer
12150 ;#+LATEX_CLASS_OPTIONS: [presentation]
12151 ;#+BEAMER_THEME: Madrid
12152 ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
12154 ,* This is the first structural section
12157 ,*** Thanks to Eric Fraga :B_block:
12162 for the first viable Beamer setup in Org
12163 ,*** Thanks to everyone else :B_block:
12169 for contributing to the discussion
12170 ,**** This will be formatted as a beamer note :B_note:
12174 ,** Frame 2 (where we will not use columns)
12176 Please test this stuff!
12181 :DESCRIPTION: Exporting to HTML.
12183 #+cindex: HTML export
12185 Org mode contains an HTML exporter with extensive HTML formatting
12186 compatible with XHTML 1.0 strict standard.
12188 *** HTML export commands
12190 :DESCRIPTION: Invoking HTML export.
12193 - {{{kbd(C-c C-e h h)}}} (~org-html-export-to-html~) ::
12194 #+kindex: C-c C-e h h
12195 #+kindex: C-c C-e h o
12196 #+findex: org-html-export-to-html
12198 Export as HTML file with a =.html= extension. For =myfile.org=,
12199 Org exports to =myfile.html=, overwriting without warning.
12200 {{{kbd{C-c C-e h o)}}} exports to HTML and opens it in a web
12203 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) ::
12204 #+kindex: C-c C-e h H
12205 #+findex: org-html-export-as-html
12207 Exports to a temporary buffer. Does not create a file.
12209 *** HTML specific export settings
12211 :DESCRIPTION: Settings for HTML export.
12214 HTML export has a number of keywords, similar to the general options
12215 settings described in [[*Export settings]].
12219 #+cindex: DESCRIPTION, keyword
12220 This is the document's description, which the HTML exporter
12221 inserts it as a HTML meta tag in the HTML file. For long
12222 descriptions, use multiple =DESCRIPTION= lines. The exporter
12223 takes care of wrapping the lines properly.
12225 - =HTML_DOCTYPE= ::
12227 #+cindex: HTML_DOCTYPE, keyword
12228 #+vindex: org-html-doctype
12229 Specify the document type, for example: HTML5
12230 (~org-html-doctype~).
12232 - =HTML_CONTAINER= ::
12234 #+cindex: HTML_CONTAINER, keyword
12235 #+vindex: org-html-container-element
12236 Specify the HTML container, such as =div=, for wrapping sections
12237 and elements (~org-html-container-element~).
12239 - =HTML_LINK_HOME= ::
12241 #+cindex: HTML_LINK_HOME, keyword
12242 #+vindex: org-html-link-home
12243 The URL for home link (~org-html-link-home~).
12245 - =HTML_LINK_UP= ::
12247 #+cindex: HTML_LINK_UP, keyword
12248 #+vindex: org-html-link-up
12249 The URL for the up link of exported HTML pages
12250 (~org-html-link-up~).
12252 - =HTML_MATHJAX= ::
12254 #+cindex: HTML_MATHJAX, keyword
12255 #+vindex: org-html-mathjax-options
12256 Options for MathJax (~org-html-mathjax-options~). MathJax is
12257 used to typeset LaTeX math in HTML documents. See [[*Math
12258 formatting in HTML export]], for an example.
12262 #+cindex: HTML_HEAD, keyword
12263 #+vindex: org-html-head
12264 Arbitrary lines for appending to the HTML document's head
12267 - =HTML_HEAD_EXTRA= ::
12269 #+cindex: HTML_HEAD_EXTRA, keyword
12270 #+vindex: org-html-head-extra
12271 More arbitrary lines for appending to the HTML document's head
12272 (~org-html-head-extra~).
12276 #+cindex: KEYWORDS, keyword
12277 Keywords to describe the document's content. HTML exporter
12278 inserts these keywords as HTML meta tags. For long keywords, use
12279 multiple =KEYWORDS= lines.
12281 - =LATEX_HEADER= ::
12283 #+cindex: LATEX_HEADER, keyword
12284 Arbitrary lines for appending to the preamble; HTML exporter
12285 appends when transcoding LaTeX fragments to images (see [[*Math
12286 formatting in HTML export]]).
12290 #+cindex: SUBTITLE, keyword
12291 The document's subtitle. HTML exporter formats subtitle if
12292 document type is =HTML5= and the CSS has a =subtitle= class.
12294 Some of these keywords are explained in more detail in the following
12295 sections of the manual.
12299 :DESCRIPTION: Exporting various (X)HTML flavors.
12302 Org can export to various (X)HTML flavors.
12304 #+vindex: org-html-doctype
12305 #+vindex: org-html-doctype-alist
12306 Set the ~org-html-doctype~ variable for different (X)HTML variants.
12307 Depending on the variant, the HTML exporter adjusts the syntax of HTML
12308 conversion accordingly. Org includes the following ready-made
12312 - ~"html4-transitional"~
12313 - ~"html4-frameset"~
12315 - ~"xhtml-transitional"~
12316 - ~"xhtml-frameset"~
12321 #+texinfo: @noindent
12322 See the variable ~org-html-doctype-alist~ for details. The default is
12325 #+vindex: org-html-html5-fancy
12326 #+cindex: HTML5, export new elements
12327 Org's HTML exporter does not by default enable new block elements
12328 introduced with the HTML5 standard. To enable them, set
12329 ~org-html-html5-fancy~ to non-~nil~. Or use an =OPTIONS= line in the
12330 file to set =html5-fancy=.
12332 HTML5 documents can now have arbitrary =#+BEGIN= ... =#+END= blocks.
12341 #+texinfo: @noindent
12350 #+texinfo: @noindent
12354 ,#+ATTR_HTML: :controls controls :width 350
12356 ,#+HTML: <source src="movie.mp4" type="video/mp4">
12357 ,#+HTML: <source src="movie.ogg" type="video/ogg">
12358 Your browser does not support the video tag.
12362 #+texinfo: @noindent
12366 <video controls="controls" width="350">
12367 <source src="movie.mp4" type="video/mp4">
12368 <source src="movie.ogg" type="video/ogg">
12369 <p>Your browser does not support the video tag.</p>
12373 #+vindex: org-html-html5-elements
12374 When special blocks do not have a corresponding HTML5 element, the
12375 HTML exporter reverts to standard translation (see
12376 ~org-html-html5-elements~). For example, =#+BEGIN_lederhosen= exports
12377 to ~<div class="lederhosen">~.
12379 Special blocks cannot have headlines. For the HTML exporter to wrap
12380 the headline and its contents in ~<section>~ or ~<article>~ tags, set
12381 the =HTML_CONTAINER= property for the headline.
12383 *** HTML preamble and postamble
12385 :DESCRIPTION: Inserting preamble and postamble.
12387 #+vindex: org-html-preamble
12388 #+vindex: org-html-postamble
12389 #+vindex: org-html-preamble-format
12390 #+vindex: org-html-postamble-format
12391 #+vindex: org-html-validation-link
12392 #+vindex: org-export-creator-string
12393 #+vindex: org-export-time-stamp-file
12395 The HTML exporter has delineations for preamble and postamble. The
12396 default value for ~org-html-preamble~ is ~t~, which makes the HTML
12397 exporter insert the preamble. See the variable
12398 ~org-html-preamble-format~ for the format string.
12400 Set ~org-html-preamble~ to a string to override the default format
12401 string. If the string is a function, the HTML exporter expects the
12402 function to return a string upon execution. The HTML exporter inserts
12403 this string in the preamble. The HTML exporter does not insert
12404 a preamble if ~org-html-preamble~ is set ~nil~.
12406 The default value for ~org-html-postamble~ is ~auto~, which makes the
12407 HTML exporter build a postamble from looking up author's name, email
12408 address, creator's name, and date. Set ~org-html-postamble~ to ~t~ to
12409 insert the postamble in the format specified in the
12410 ~org-html-postamble-format~ variable. The HTML exporter does not
12411 insert a postamble if ~org-html-postamble~ is set to ~nil~.
12413 *** Quoting HTML tags
12415 :DESCRIPTION: Using direct HTML in Org files.
12418 The HTML export back-end transforms =<= and =>= to =<= and =>=.
12420 To include raw HTML code in the Org file so the HTML export back-end
12421 can insert that HTML code in the output, use this inline syntax:
12422 =@@html:...@@=. For example:
12424 : @@html:<b>@@bold text@@html:</b>@@
12426 #+cindex: HTML, keyword
12427 #+cindex: BEGIN_EXPORT html
12428 For larger raw HTML code blocks, use these HTML export code blocks:
12431 ,#+HTML: Literal HTML code for export
12433 ,#+BEGIN_EXPORT html
12434 All lines between these markers are exported literally
12438 *** Links in HTML export
12440 :DESCRIPTION: Inserting and formatting links.
12442 #+cindex: links, in HTML export
12443 #+cindex: internal links, in HTML export
12444 #+cindex: external links, in HTML export
12446 The HTML export back-end transforms Org's internal links (see
12447 [[*Internal links]]) to equivalent HTML links in the output. The back-end
12448 similarly handles Org's automatic links created by radio targets (see
12449 [[*Radio targets]]) similarly. For Org links to external files, the
12450 back-end transforms the links to /relative/ paths.
12452 #+vindex: org-html-link-org-files-as-html
12453 For Org links to other =.org= files, the back-end automatically
12454 changes the file extension to =.html= and makes file paths relative.
12455 If the =.org= files have an equivalent =.html= version at the same
12456 location, then the converted links should work without any further
12457 manual intervention. However, to disable this automatic path
12458 translation, set ~org-html-link-org-files-as-html~ to ~nil~. When
12459 disabled, the HTML export back-end substitutes the ID-based links in
12460 the HTML output. For more about linking files when publishing to
12461 a directory, see [[*Publishing links]].
12463 Org files can also have special directives to the HTML export
12464 back-end. For example, by using =#+ATTR_HTML= lines to specify new
12465 format attributes to ~<a>~ or ~<img>~ tags. This example shows
12466 changing the link's title and style:
12468 #+cindex: ATTR_HTML, keyword
12470 ,#+ATTR_HTML: :title The Org mode homepage :style color:red;
12471 [[http://orgmode.org]]
12474 *** Tables in HTML export
12476 :DESCRIPTION: How to modify the formatting of tables.
12478 #+cindex: tables, in HTML
12479 #+vindex: org-export-html-table-tag
12481 The HTML export back-end uses ~org-html-table-default-attributes~ when
12482 exporting Org tables to HTML. By default, the exporter does not draw
12483 frames and cell borders. To change for this for a table, use the
12484 following lines before the table in the Org file:
12486 #+cindex: CAPTION, keyword
12487 #+cindex: ATTR_HTML, keyword
12489 ,#+CAPTION: This is a table with lines around and between cells
12490 ,#+ATTR_HTML: border="2" rules="all" frame="border"
12493 The HTML export back-end preserves column groupings in Org tables (see
12494 [[*Column groups]]) when exporting to HTML.
12496 Additional options for customizing tables for HTML export.
12498 - ~org-html-table-align-individual-fields~ ::
12500 #+vindex: org-html-table-align-individual-fields
12501 Non-~nil~ attaches style attributes for alignment to each table
12504 - ~org-html-table-caption-above~ ::
12506 #+vindex: org-html-table-caption-above
12507 Non-~nil~ places caption string at the beginning of the table.
12509 - ~org-html-table-data-tags~ ::
12511 #+vindex: org-html-table-data-tags
12512 Opening and ending tags for table data fields.
12514 - ~org-html-table-default-attributes~ ::
12516 #+vindex: org-html-table-default-attributes
12517 Default attributes and values for table tags.
12519 - ~org-html-table-header-tags~ ::
12521 #+vindex: org-html-table-header-tags
12522 Opening and ending tags for table's header fields.
12524 - ~org-html-table-row-tags~ ::
12526 #+vindex: org-html-table-row-tags
12527 Opening and ending tags for table rows.
12529 - ~org-html-table-use-header-tags-for-first-column~ ::
12531 #+vindex: org-html-table-use-header-tags-for-first-column
12532 Non-~nil~ formats column one in tables with header tags.
12534 *** Images in HTML export
12536 :DESCRIPTION: How to insert figures into HTML output.
12538 #+cindex: images, inline in HTML
12539 #+cindex: inlining images in HTML
12541 The HTML export back-end has features to convert Org image links to
12542 HTML inline images and HTML clickable image links.
12544 #+vindex: org-html-inline-images
12545 When the link in the Org file has no description, the HTML export
12546 back-end by default in-lines that image. For example:
12547 =[[file:myimg.jpg]]= is in-lined, while =[[file:myimg.jpg][the image]]= links to the text,
12548 =the image=. For more details, see the variable
12549 ~org-html-inline-images~.
12551 On the other hand, if the description part of the Org link is itself
12552 another link, such as =file:= or =http:= URL pointing to an image, the
12553 HTML export back-end in-lines this image and links to the main image.
12554 This Org syntax enables the back-end to link low-resolution thumbnail
12555 to the high-resolution version of the image, as shown in this example:
12557 : [[file:highres.jpg][file:thumb.jpg]]
12559 To change attributes of in-lined images, use =#+ATTR_HTML= lines in
12560 the Org file. This example shows realignment to right, and adds ~alt~
12561 and ~title~ attributes in support of text viewers and modern web
12562 accessibility standards.
12564 #+cindex: CAPTION, keyword
12565 #+cindex: ATTR_HTML, keyword
12567 ,#+CAPTION: A black cat stalking a spider
12568 ,#+ATTR_HTML: :alt cat/spider image :title Action! :align right
12572 #+texinfo: @noindent
12573 The HTML export back-end copies the =http= links from the Org file as
12576 *** Math formatting in HTML export
12578 :DESCRIPTION: Beautiful math also on the web.
12583 #+cindex: ImageMagick
12585 #+vindex: org-html-mathjax-options~
12586 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
12587 different ways on HTML pages. The default is to use the [[http://www.mathjax.org][MathJax]],
12588 which should work out of the box with Org[fn:120]. Some MathJax
12589 display options can be configured via ~org-html-mathjax-options~, or
12590 in the buffer. For example, with the following settings,
12593 ,#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
12594 ,#+HTML_MATHJAX: cancel.js noErrors.js
12597 #+texinfo: @noindent
12598 equation labels are displayed on the left margin and equations are
12599 five em from the left margin. In addition, it loads the two MathJax
12600 extensions =cancel.js= and =noErrors.js=[fn:121].
12602 #+vindex: org-html-mathjax-template
12603 See the docstring of ~org-html-mathjax-options~ for all supported
12604 variables. The MathJax template can be configure via
12605 ~org-html-mathjax-template~.
12607 If you prefer, you can also request that LaTeX fragments are processed
12608 into small images that will be inserted into the browser page. Before
12609 the availability of MathJax, this was the default method for Org
12610 files. This method requires that the dvipng program, dvisvgm or
12611 ImageMagick suite is available on your system. You can still get this
12614 : #+OPTIONS: tex:dvipng
12616 : #+OPTIONS: tex:dvisvgm
12618 #+texinfo: @noindent
12621 : #+OPTIONS: tex:imagemagick
12623 *** Text areas in HTML export
12625 :DESCRIPTION: An alternate way to show an example.
12628 #+cindex: text areas, in HTML
12629 Before Org mode's Babel, one popular approach to publishing code in
12630 HTML was by using =:textarea=. The advantage of this approach was
12631 that copying and pasting was built into browsers with simple
12632 JavaScript commands. Even editing before pasting was made simple.
12634 The HTML export back-end can create such text areas. It requires an
12635 =#+ATTR_HTML= line as shown in the example below with the =:textarea=
12636 option. This must be followed by either an example or a source code
12637 block. Other Org block types do not honor the =:textarea= option.
12639 By default, the HTML export back-end creates a text area 80 characters
12640 wide and height just enough to fit the content. Override these
12641 defaults with =:width= and =:height= options on the =#+ATTR_HTML=
12645 ,#+ATTR_HTML: :textarea t :width 40
12647 (defun org-xor (a b)
12655 :DESCRIPTION: Changing the appearance of the output.
12657 #+cindex: CSS, for HTML export
12658 #+cindex: HTML export, CSS
12660 #+vindex: org-export-html-todo-kwd-class-prefix
12661 #+vindex: org-export-html-tag-class-prefix
12662 You can modify the CSS style definitions for the exported file. The
12663 HTML exporter assigns the following special CSS classes[fn:122] to
12664 appropriate parts of the document -- your style specifications may
12665 change these, in addition to any of the standard classes like for
12666 headlines, tables, etc.
12668 | ~p.author~ | author information, including email |
12669 | ~p.date~ | publishing date |
12670 | ~p.creator~ | creator info, about org mode version |
12671 | ~.title~ | document title |
12672 | ~.subtitle~ | document subtitle |
12673 | ~.todo~ | TODO keywords, all not-done states |
12674 | ~.done~ | the DONE keywords, all states that count as done |
12675 | ~.WAITING~ | each TODO keyword also uses a class named after itself |
12676 | ~.timestamp~ | timestamp |
12677 | ~.timestamp-kwd~ | keyword associated with a timestamp, like =SCHEDULED= |
12678 | ~.timestamp-wrapper~ | span around keyword plus timestamp |
12679 | ~.tag~ | tag in a headline |
12680 | ~._HOME~ | each tag uses itself as a class, "@" replaced by "_" |
12681 | ~.target~ | target for links |
12682 | ~.linenr~ | the line number in a code example |
12683 | ~.code-highlighted~ | for highlighting referenced code lines |
12684 | ~div.outline-N~ | div for outline level N (headline plus text) |
12685 | ~div.outline-text-N~ | extra div for text at outline level N |
12686 | ~.section-number-N~ | section number in headlines, different for each level |
12687 | ~.figure-number~ | label like "Figure 1:" |
12688 | ~.table-number~ | label like "Table 1:" |
12689 | ~.listing-number~ | label like "Listing 1:" |
12690 | ~div.figure~ | how to format an in-lined image |
12691 | ~pre.src~ | formatted source code |
12692 | ~pre.example~ | normal example |
12693 | ~p.verse~ | verse paragraph |
12694 | ~div.footnotes~ | footnote section headline |
12695 | ~p.footnote~ | footnote definition paragraph, containing a footnote |
12696 | ~.footref~ | a footnote reference number (always a <sup>) |
12697 | ~.footnum~ | footnote number in footnote definition (always <sup>) |
12698 | ~.org-svg~ | default class for a linked =.svg= image |
12700 #+vindex: org-html-style-default
12701 #+vindex: org-html-head
12702 #+vindex: org-html-head-extra
12703 #+cindex: HTML_INCLUDE_STYLE, keyword
12704 The HTML export back-end includes a compact default style in each
12705 exported HTML file. To override the default style with another style,
12706 use these keywords in the Org file. They will replace the global
12707 defaults the HTML exporter uses.
12709 #+cindex: HTML_HEAD, keyword
12710 #+cindex: HTML_HEAD_EXTRA, keyword
12712 ,#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
12713 ,#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
12716 #+vindex: org-html-head-include-default-style
12717 To just turn off the default style, customize
12718 ~org-html-head-include-default-style~ variable, or use this option
12719 line in the Org file.
12721 #+cindex: html-style, OPTIONS item
12722 : #+OPTIONS: html-style:nil
12724 For longer style definitions, either use several =HTML_HEAD= and
12725 =HTML_HEAD_EXTRA= keywords, or use ~<style> ... </style>~ blocks
12726 around them. Both of these approaches can avoid referring to an
12729 #+cindex: HTML_CONTAINER_CLASS, property
12730 In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
12731 property to assign a class to the tree. In order to specify CSS
12732 styles for a particular headline, you can use the id specified in
12733 a =CUSTOM_ID= property.
12735 Never change the ~org-html-style-default~ constant. Instead use other
12736 simpler ways of customizing as described above.
12738 *** JavaScript supported display of web pages
12740 :DESCRIPTION: Info and folding in a web browser.
12741 :ALT_TITLE: JavaScript support
12744 Sebastian Rose has written a JavaScript program especially designed to
12745 enhance the web viewing experience of HTML files created with Org.
12746 This program enhances large files in two different ways of viewing.
12747 One is an /Info/-like mode where each section is displayed separately
12748 and navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}}
12749 keys, and some other keys as well, press {{{kbd(?)}}} for an overview
12750 of the available keys. The second one has a /folding/ view, much like
12751 Org provides inside Emacs. The script is available at
12752 http://orgmode.org/org-info.js and the documentation at
12753 http://orgmode.org/worg/code/org-info-js/. The script is hosted on
12754 http://orgmode.org, but for reliability, prefer installing it on your
12757 To use this program, just add this line to the Org file:
12759 #+cindex: INFOJS_OPT, keyword
12760 : #+INFOJS_OPT: view:info toc:nil
12762 #+texinfo: @noindent
12763 The HTML header now has the code needed to automatically invoke the
12764 script. For setting options, use the syntax from the above line for
12765 options described below:
12769 The path to the script. The default is to grab the script from
12770 [[http://orgmode.org/org-info.js]], but you might want to have
12771 a local copy and use a path like =../scripts/org-info.js=.
12775 Initial view when the website is first shown. Possible values are:
12777 | =info= | Info-like interface with one section per page |
12778 | =overview= | Folding interface, initially showing only top-level |
12779 | =content= | Folding interface, starting with all headlines visible |
12780 | =showall= | Folding interface, all headlines and text visible |
12784 Maximum headline level still considered as an independent section
12785 for info and folding modes. The default is taken from
12786 ~org-export-headline-levels~, i.e., the =H= switch in =OPTIONS=.
12787 If this is smaller than in ~org-export-headline-levels~, each
12788 info/folding section can still contain child headlines.
12792 Should the table of contents /initially/ be visible? Even when
12793 =nil=, you can always get to the "toc" with {{{kbd(i)}}}.
12797 The depth of the table of contents. The defaults are taken from
12798 the variables ~org-export-headline-levels~ and
12799 ~org-export-with-toc~.
12803 Does the CSS of the page specify a fixed position for the "toc"?
12804 If yes, the toc is displayed as a section.
12808 Should there be short contents (children) in each section? Make
12809 this =above= if the section should be above initial text.
12813 Headings are highlighted when the mouse is over them. Should be
12814 =underline= (default) or a background color like =#cccccc=.
12818 Should view-toggle buttons be everywhere? When =nil= (the
12819 default), only one such button is present.
12821 #+texinfo: @noindent
12822 #+vindex: org-infojs-options
12823 #+vindex: org-export-html-use-infojs
12824 You can choose default values for these options by customizing the
12825 variable ~org-infojs-options~. If you always want to apply the script
12826 to your pages, configure the variable ~org-export-html-use-infojs~.
12830 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF.
12832 #+cindex: @LaTeX{} export
12833 #+cindex: PDF export
12835 The LaTeX export back-end can handle complex documents, incorporate
12836 standard or custom LaTeX document classes, generate documents using
12837 alternate LaTeX engines, and produce fully linked PDF files with
12838 indexes, bibliographies, and tables of contents, destined for
12839 interactive online viewing or high-quality print publication.
12841 While the details are covered in-depth in this section, here are some
12842 quick references to variables for the impatient: for engines, see
12843 ~org-latex-compiler~; for build sequences, see
12844 ~org-latex-pdf-process~; for packages, see
12845 ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~.
12847 An important note about the LaTeX export back-end: it is sensitive to
12848 blank lines in the Org document. That's because LaTeX itself depends
12849 on blank lines to tell apart syntactical elements, such as paragraphs.
12851 *** LaTeX/PDF export commands
12853 :DESCRIPTION: For producing @LaTeX{} and PDF documents.
12856 - {{{kbd(C-c C-e l l)}}} (~org-latex-export-to-latex~) ::
12858 #+kindex: C-c C-e l l
12859 #+findex: org-latex-export-to-latex~
12860 Export to a LaTeX file with a =.tex= extension. For
12861 =myfile.org=, Org exports to =myfile.tex=, overwriting without
12864 - {{{kbd(C-c C-e l L)}}} (~org-latex-export-as-latex~) ::
12866 #+kindex: C-c C-e l L
12867 #+findex: org-latex-export-as-latex
12868 Export to a temporary buffer. Do not create a file.
12870 - {{{kbd(C-c C-e l p)}}} (~org-latex-export-to-pdf~) ::
12872 #+kindex: C-c C-e l p
12873 #+findex: org-latex-export-to-pdf
12874 Export as LaTeX file and convert it to PDF file.
12876 - {{{kbd(C-c C-e l o)}}} ::
12878 #+kindex: C-c C-e l o
12879 Export as LaTeX file and convert it to PDF, then open the PDF
12880 using the default viewer.
12882 - {{{kbd(M-x org-export-region-as-latex)}}} ::
12884 Convert the region to LaTeX under the assumption that it was in Org
12885 mode syntax before. This is a global command that can be invoked in
12888 #+vindex: org-latex-compiler
12889 #+vindex: org-latex-bibtex-compiler
12890 #+vindex: org-latex-default-packages-alist
12894 #+cindex: LATEX_COMPILER, keyword
12895 The LaTeX export back-end can use any of these LaTeX engines:
12896 =pdflatex=, =xelatex=, and =lualatex=. These engines compile LaTeX
12897 files with different compilers, packages, and output options. The
12898 LaTeX export back-end finds the compiler version to use from
12899 ~org-latex-compiler~ variable or the =#+LATEX_COMPILER= keyword in the
12900 Org file. See the docstring for the
12901 ~org-latex-default-packages-alist~ for loading packages with certain
12902 compilers. Also see ~org-latex-bibtex-compiler~ to set the
12903 bibliography compiler[fn:123].
12905 *** LaTeX specific export settings
12907 :DESCRIPTION: Unique to this @LaTeX{} back-end.
12910 The LaTeX export back-end has several additional keywords for
12911 customizing LaTeX output. Setting these keywords works similar to the
12912 general options (see [[*Export settings]]).
12914 #+attr_texinfo: :sep ,
12916 #+cindex: DESCRIPTION, keyword
12917 #+vindex: org-latex-hyperref-template
12918 #+vindex: org-latex-title-command
12919 The document's description. The description along with author
12920 name, keywords, and related file metadata are inserted in the
12921 output file by the hyperref package. See
12922 ~org-latex-hyperref-template~ for customizing metadata items.
12923 See ~org-latex-title-command~ for typesetting description into
12924 the document's front matter. Use multiple =DESCRIPTION= keywords
12925 for long descriptions.
12929 #+cindex: LATEX_CLASS, keyword
12930 #+vindex: org-latex-default-class
12931 #+vindex: org-latex-classes
12932 This is LaTeX document class, such as /article/, /report/,
12933 /book/, and so on, which contain predefined preamble and headline
12934 level mapping that the LaTeX export back-end needs. The back-end
12935 reads the default class name from the ~org-latex-default-class~
12936 variable. Org has /article/ as the default class. A valid
12937 default class must be an element of ~org-latex-classes~.
12939 - =LATEX_CLASS_OPTIONS= ::
12941 #+cindex: LATEX_CLASS_OPTIONS, keyword
12942 Options the LaTeX export back-end uses when calling the LaTeX
12945 - =LATEX_COMPILER= ::
12947 #+cindex: LATEX_COMPILER, keyword
12948 #+vindex: org-latex-compiler
12949 The compiler, such as =pdflatex=, =xelatex=, =lualatex=, for
12950 producing the PDF. See ~org-latex-compiler~.
12952 - =LATEX_HEADER=, =LATEX_HEADER_EXTRA= ::
12954 #+cindex: LATEX_HEADER, keyword
12955 #+cindex: LATEX_HEADER_EXTRA, keyword
12956 #+vindex: org-latex-classes
12957 Arbitrary lines to add to the document's preamble, before the
12958 hyperref settings. See ~org-latex-classes~ for adjusting the
12959 structure and order of the LaTeX headers.
12963 #+cindex: KEYWORDS, keyword
12964 #+vindex: org-latex-hyperref-template
12965 #+vindex: org-latex-title-command
12966 The keywords for the document. The description along with author
12967 name, keywords, and related file metadata are inserted in the
12968 output file by the hyperref package. See
12969 ~org-latex-hyperref-template~ for customizing metadata items.
12970 See ~org-latex-title-command~ for typesetting description into
12971 the document's front matter. Use multiple =KEYWORDS= lines if
12976 #+cindex: SUBTITLE, keyword
12977 #+vindex: org-latex-subtitle-separate
12978 #+vindex: org-latex-subtitle-format
12979 The document's subtitle. It is typeset as per
12980 ~org-latex-subtitle-format~. If ~org-latex-subtitle-separate~ is
12981 non-~nil~, it is typed as part of the ~\title~ macro. See
12982 ~org-latex-hyperref-template~ for customizing metadata items.
12983 See ~org-latex-title-command~ for typesetting description
12984 into the document's front matter.
12986 The following sections have further details.
12988 *** LaTeX header and sectioning structure
12990 :DESCRIPTION: Setting up the export file structure.
12991 :ALT_TITLE: LaTeX header and sectioning
12993 #+cindex: @LaTeX{} class
12994 #+cindex: @LaTeX{} sectioning structure
12995 #+cindex: @LaTeX{} header
12996 #+cindex: header, for @LaTeX{} files
12997 #+cindex: sectioning structure, for @LaTeX{} export
12999 The LaTeX export back-end converts the first three of Org's outline
13000 levels into LaTeX headlines. The remaining Org levels are exported as
13001 lists. To change this globally for the cut-off point between levels
13002 and lists, (see [[*Export settings]]).
13004 By default, the LaTeX export back-end uses the /article/ class.
13006 #+vindex: org-latex-default-class
13007 #+vindex: org-latex-classes
13008 #+vindex: org-latex-default-packages-alist
13009 #+vindex: org-latex-packages-alist
13010 To change the default class globally, edit ~org-latex-default-class~.
13011 To change the default class locally in an Org file, add option lines
13012 =#+LATEX_CLASS: myclass=. To change the default class for just a part
13013 of the Org file, set a sub-tree property, =EXPORT_LATEX_CLASS=. The
13014 class name entered here must be valid member of ~org-latex-classes~.
13015 This variable defines a header template for each class into which the
13016 exporter splices the values of ~org-latex-default-packages-alist~ and
13017 ~org-latex-packages-alist~. Use the same three variables to define
13018 custom sectioning or custom classes.
13020 #+cindex: LATEX_CLASS, keyword
13021 #+cindex: LATEX_CLASS_OPTIONS, keyword
13022 #+cindex: EXPORT_LATEX_CLASS, property
13023 #+cindex: EXPORT_LATEX_CLASS_OPTIONS, property
13024 The LaTeX export back-end sends the =LATEX_CLASS_OPTIONS= keyword and
13025 =EXPORT_LATEX_CLASS_OPTIONS= property as options to the LaTeX
13026 ~\documentclass~ macro. The options and the syntax for specifying
13027 them, including enclosing them in square brackets, follow LaTeX
13030 : #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
13032 #+cindex: LATEX_HEADER, keyword
13033 #+cindex: LATEX_HEADER_EXTRA, keyword
13034 The LaTeX export back-end appends values from =LATEX_HEADER= and
13035 =LATEX_HEADER_EXTRA= keywords to the LaTeX header. The docstring for
13036 ~org-latex-classes~ explains in more detail. Also note that LaTeX
13037 export back-end does not append =LATEX_HEADER_EXTRA= to the header
13038 when previewing LaTeX snippets (see [[*Previewing LaTeX fragments]]).
13040 A sample Org file with the above headers:
13043 ,#+LATEX_CLASS: article
13044 ,#+LATEX_CLASS_OPTIONS: [a4paper]
13045 ,#+LATEX_HEADER: \usepackage{xyz}
13053 *** Quoting LaTeX code
13055 :DESCRIPTION: Incorporating literal @LaTeX{} code.
13058 The LaTeX export back-end can insert any arbitrary LaTeX code, see
13059 [[*Embedded LaTeX]]. There are three ways to embed such code in the Org
13060 file and they all use different quoting syntax.
13062 #+cindex: inline, in @LaTeX{} export
13063 Inserting in-line quoted with @ symbols:
13065 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph.
13067 #+cindex: LATEX, keyword
13068 Inserting as one or more keyword lines in the Org file:
13070 : #+LATEX: any arbitrary LaTeX code
13072 #+cindex: BEGIN_EXPORT latex
13073 Inserting as an export block in the Org file, where the back-end
13074 exports any code between begin and end markers:
13077 ,#+BEGIN_EXPORT latex
13078 any arbitrary LaTeX code
13082 *** Tables in LaTeX export
13084 :DESCRIPTION: Options for exporting tables to @LaTeX{}.
13086 #+cindex: tables, in @LaTeX{} export
13088 The LaTeX export back-end can pass several LaTeX attributes for table
13089 contents and layout. Besides specifying label and caption (see
13090 [[*Images and tables]]), the other valid LaTeX attributes include:
13092 #+attr_texinfo: :sep ,
13095 #+vindex: org-latex-default-table-mode
13096 The LaTeX export back-end wraps the table differently depending
13097 on the mode for accurate rendering of math symbols. Mode is
13098 either =table=, =math=, =inline-math= or =verbatim=.
13100 For =math= or =inline-math= mode, LaTeX export back-end wraps the
13101 table in a math environment, but every cell in it is exported
13102 as-is. The LaTeX export back-end determines the default mode
13103 from ~org-latex-default-table-mode~. The LaTeX export back-end
13104 merges contiguous tables in the same mode into a single
13107 - =:environment= ::
13109 #+vindex: org-latex-default-table-environment
13110 Set the default LaTeX table environment for the LaTeX export
13111 back-end to use when exporting Org tables. Common LaTeX table
13112 environments are provided by these packages: tabularx, longtable,
13113 array, tabu, and bmatrix. For packages, such as tabularx and
13114 tabu, or any newer replacements, include them in the
13115 ~org-latex-packages-alist~ variable so the LaTeX export back-end
13116 can insert the appropriate load package headers in the converted
13117 LaTeX file. Look in the docstring for the
13118 ~org-latex-packages-alist~ variable for configuring these
13119 packages for LaTeX snippet previews, if any.
13123 Use =CAPTION= keyword to set a simple caption for a table (see
13124 [[*Images and tables]]). For custom captions, use =:caption=
13125 attribute, which accepts raw LaTeX code. =:caption= value
13126 overrides =CAPTION= value.
13128 - =:float=, =:placement= ::
13130 The table environments by default are not floats in LaTeX. To
13131 make them floating objects use =:float= with one of the following
13132 options: =sideways=, =multicolumn=, =t=, and =nil=.
13134 LaTeX floats can also have additional layout =:placement=
13135 attributes. These are the usual =[h t b p ! H]= permissions
13136 specified in square brackets. Note that for =:float sideways=
13137 tables, the LaTeX export back-end ignores =:placement=
13140 - =:align=, =:font=, =:width= ::
13142 The LaTeX export back-end uses these attributes for regular
13143 tables to set their alignments, fonts, and widths.
13147 When =:spread= is non-~nil~, the LaTeX export back-end spreads or
13148 shrinks the table by the =:width= for tabu and longtabu
13149 environments. =:spread= has no effect if =:width= is not set.
13151 - =:booktabs=, =:center=, =:rmlines= ::
13153 #+vindex: org-latex-tables-booktabs
13154 #+vindex: org-latex-tables-centered
13155 All three commands are toggles. =:booktabs= brings in modern
13156 typesetting enhancements to regular tables. The booktabs package
13157 has to be loaded through ~org-latex-packages-alist~. =:center=
13158 is for centering the table. =:rmlines= removes all but the very
13159 first horizontal line made of ASCII characters from "table.el"
13162 - =:math-prefix=, =:math-suffix=, =:math-arguments= ::
13164 The LaTeX export back-end inserts =:math-prefix= string value in
13165 a math environment before the table. The LaTeX export back-end
13166 inserts =:math-suffix= string value in a math environment after
13167 the table. The LaTeX export back-end inserts =:math-arguments=
13168 string value between the macro name and the table's contents.
13169 =:math-arguments= comes in use for matrix macros that require
13170 more than one argument, such as =qbordermatrix=.
13172 LaTeX table attributes help formatting tables for a wide range of
13173 situations, such as matrix product or spanning multiple pages:
13176 ,#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
13180 ,#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
13183 ,#+ATTR_LATEX: :mode math :environment bmatrix
13188 Set the caption with the LaTeX command
13189 =\bicaption{HeadingA}{HeadingB}=:
13192 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
13197 *** Images in LaTeX export
13199 :DESCRIPTION: How to insert figures into @LaTeX{} output.
13201 #+cindex: images, inline in LaTeX
13202 #+cindex: inlining images in LaTeX
13203 #+cindex: ATTR_LATEX, keyword
13205 The LaTeX export back-end processes image links in Org files that do
13206 not have descriptions, such as these links =[[file:img.jpg]]= or
13207 =[[./img.jpg]]=, as direct image insertions in the final PDF output. In
13208 the PDF, they are no longer links but actual images embedded on the
13209 page. The LaTeX export back-end uses =\includegraphics= macro to
13210 insert the image. But for TikZ (http://sourceforge.net/projects/pgf/)
13211 images, the back-end uses an ~\input~ macro wrapped within
13212 a ~tikzpicture~ environment.
13214 For specifying image =:width=, =:height=, and other =:options=, use
13218 ,#+ATTR_LATEX: :width 5cm :options angle=90
13219 [[./img/sed-hr4049.pdf]]
13222 For custom commands for captions, use the =:caption= attribute. It
13223 overrides the default =#+CAPTION= value:
13226 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
13227 [[./img/sed-hr4049.pdf]]
13230 When captions follow the method as described in [[*Images and tables]],
13231 the LaTeX export back-end wraps the picture in a floating =figure=
13232 environment. To float an image without specifying a caption, set the
13233 =:float= attribute to one of the following:
13237 For a standard =figure= environment; used by default whenever an
13238 image has a caption.
13242 To span the image across multiple columns of a page; the back-end
13243 wraps the image in a =figure*= environment.
13247 For text to flow around the image on the right; the figure
13248 occupies the left half of the page.
13252 For a new page with the image sideways, rotated ninety degrees,
13253 in a =sidewaysfigure= environment; overrides =:placement=
13258 To avoid a =:float= even if using a caption.
13260 #+texinfo: @noindent
13261 Use the =placement= attribute to modify a floating environment's
13265 ,#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth}
13269 #+vindex: org-latex-images-centered
13270 #+cindex: center image in LaTeX export
13271 #+cindex: image, centering in LaTeX export
13272 The LaTeX export back-end centers all images by default. Setting
13273 =:center= to =nil= disables centering. To disable centering globally,
13274 set ~org-latex-images-centered~ to =t=.
13276 Set the =:comment-include= attribute to non-~nil~ value for the LaTeX
13277 export back-end to comment out the =\includegraphics= macro.
13279 *** Plain lists in LaTeX export
13281 :DESCRIPTION: Attributes specific to lists.
13284 #+cindex: plain lists, in @LaTeX{} export
13285 #+cindex: ATTR_LATEX, keyword
13286 The LaTeX export back-end accepts the =environment= and =options=
13287 attributes for plain lists. Both attributes work together for
13288 customizing lists, as shown in the examples:
13291 ,#+LATEX_HEADER: \usepackage[inline]{enumitem}
13292 Some ways to say "Hello":
13293 ,#+ATTR_LATEX: :environment itemize*
13294 ,#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}]
13300 Since LaTeX supports only four levels of nesting for lists, use an
13301 external package, such as =enumitem= in LaTeX, for levels deeper than
13305 ,#+LATEX_HEADER: \usepackage{enumitem}
13306 ,#+LATEX_HEADER: \renewlist{itemize}{itemize}{9}
13307 ,#+LATEX_HEADER: \setlist[itemize]{label=$\circ$}
13315 *** Source blocks in LaTeX export
13317 :DESCRIPTION: Attributes specific to source code blocks.
13319 #+cindex: source blocks, in @LaTeX{} export
13320 #+cindex: ATTR_LATEX, keyword
13322 The LaTeX export back-end can make source code blocks into floating
13323 objects through the attributes =:float= and =:options=. For =:float=:
13327 Makes a source block float; by default floats any source block
13332 Spans the source block across multiple columns of a page.
13336 Avoids a =:float= even if using a caption; useful for source code
13337 blocks that may not fit on a page.
13340 ,#+ATTR_LATEX: :float nil
13341 ,#+BEGIN_SRC emacs-lisp
13342 Lisp code that may not fit in a single page.
13346 #+vindex: org-latex-listings-options
13347 #+vindex: org-latex-minted-options
13348 The LaTeX export back-end passes string values in =:options= to LaTeX
13349 packages for customization of that specific source block. In the
13350 example below, the =:options= are set for Minted. Minted is a source
13351 code highlighting LaTeX package with many configurable options.
13354 ,#+ATTR_LATEX: :options commentstyle=\bfseries
13355 ,#+BEGIN_SRC emacs-lisp
13357 (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
13361 To apply similar configuration options for all source blocks in
13362 a file, use the ~org-latex-listings-options~ and
13363 ~org-latex-minted-options~ variables.
13365 *** Example blocks in LaTeX export
13367 :DESCRIPTION: Attributes specific to example blocks.
13369 #+cindex: example blocks, in @LaTeX{} export
13370 #+cindex: verbatim blocks, in @LaTeX{} export
13371 #+cindex: ATTR_LATEX, keyword
13373 The LaTeX export back-end wraps the contents of example blocks in
13374 a =verbatim= environment. To change this behavior to use another
13375 environment globally, specify an appropriate export filter (see
13376 [[*Advanced configuration]]). To change this behavior to use another
13377 environment for each block, use the =:environment= parameter to
13378 specify a custom environment.
13381 ,#+ATTR_LATEX: :environment myverbatim
13383 This sentence is false.
13387 *** Special blocks in LaTeX export
13389 :DESCRIPTION: Attributes specific to special blocks.
13392 #+cindex: special blocks, in @LaTeX{} export
13393 #+cindex: abstract, in @LaTeX{} export
13394 #+cindex: proof, in @LaTeX{} export
13395 #+cindex: ATTR_LATEX, keyword
13397 For other special blocks in the Org file, the LaTeX export back-end
13398 makes a special environment of the same name. The back-end also takes
13399 =:options=, if any, and appends as-is to that environment's opening
13400 string. For example:
13404 We demonstrate how to solve the Syracuse problem.
13407 ,#+ATTR_LATEX: :options [Proof of important theorem]
13410 Therefore, any even number greater than 2 is the sum of two primes.
13414 #+texinfo: @noindent
13419 We demonstrate how to solve the Syracuse problem.
13422 \begin{proof}[Proof of important theorem]
13424 Therefore, any even number greater than 2 is the sum of two primes.
13428 If you need to insert a specific caption command, use =:caption=
13429 attribute. It overrides standard =CAPTION= value, if any. For
13433 ,#+ATTR_LATEX: :caption \MyCaption{HeadingA}
13439 *** Horizontal rules in LaTeX export
13441 :DESCRIPTION: Attributes specific to horizontal rules.
13443 #+cindex: horizontal rules, in @LaTeX{} export
13444 #+cindex: ATTR_LATEX, keyword
13446 The LaTeX export back-end converts horizontal rules by the specified
13447 =:width= and =:thickness= attributes. For example:
13450 ,#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
13456 :DESCRIPTION: Exporting to Markdown.
13458 #+cindex: Markdown export
13460 The Markdown export back-end, "md", converts an Org file to a Markdown
13461 format, as defined at http://daringfireball.net/projects/markdown/.
13463 Since "md" is built on top of the HTML back-end, any Org constructs
13464 not supported by Markdown, such as tables, the underlying "html"
13465 back-end (see [[*HTML export]]) converts them.
13467 *** Markdown export commands
13472 - {{{kbd(C-c C-e m m)}}} (~org-md-export-to-markdown~) ::
13474 #+kindex: C-c C-c m m
13475 #+findex: org-md-export-to-markdown
13476 Export to a text file with Markdown syntax. For =myfile.org=,
13477 Org exports to =myfile.md=, overwritten without warning.
13479 - {{{kbd(C-c C-e m M)}}} (~org-md-export-as-markdown~) ::
13481 #+kindex: C-c C-c m M
13482 #+findex: org-md-export-as-markdown
13483 Export to a temporary buffer. Does not create a file.
13485 - {{{kbd(C-c C-e m o)}}} ::
13487 #+kindex: C-c C-e m o
13488 Export as a text file with Markdown syntax, then open it.
13490 *** Header and sectioning structure
13495 #+vindex: org-md-headline-style
13496 Based on ~org-md-headline-style~, Markdown export can generate
13497 headlines of both /atx/ and /setext/ types. /atx/ limits headline
13498 levels to two whereas /setext/ limits headline levels to six. Beyond
13499 these limits, the export back-end converts headlines to lists. To set
13500 a limit to a level before the absolute limit (see [[*Export settings]]).
13502 ** OpenDocument Text export
13504 :DESCRIPTION: Exporting to OpenDocument Text.
13507 #+cindex: OpenDocument
13508 #+cindex: export, OpenDocument
13509 #+cindex: LibreOffice
13511 The ODT export back-end handles creating of OpenDocument Text (ODT)
13512 format. Documents created by this exporter use the
13513 {{{cite(OpenDocument-v1.2 specification)}}}[fn:124] and are compatible
13514 with LibreOffice 3.4.
13516 *** Pre-requisites for ODT export
13518 :DESCRIPTION: Required packages.
13522 The ODT export back-end relies on the zip program to create the final
13523 compressed ODT output. Check if =zip= is locally available and
13524 executable. Without it, export cannot finish.
13526 *** ODT export commands
13528 :DESCRIPTION: Invoking export.
13531 - {{{kbd(C-c C-e o o)}}} (~org-export-to-odt~) ::
13533 #+kindex: C-c C-e o o
13534 #+findex: org-export-to-odt
13535 Export as OpenDocument Text file.
13537 #+cindex: EXPORT_FILE_NAME, property
13538 #+vindex: org-odt-preferred-output-format
13540 If ~org-odt-preferred-output-format~ is specified, the ODT export
13541 back-end automatically converts the exported file to that format.
13543 For =myfile.org=, Org exports to =myfile.odt=, overwriting
13544 without warning. The ODT export back-end exports a region only
13545 if a region was active.
13547 If the selected region is a single tree, the ODT export back-end
13548 makes the tree head the document title. Incidentally, {{{kbd(C-c
13549 @)}}} selects the current sub-tree. If the tree head entry has,
13550 or inherits, an =EXPORT_FILE_NAME= property, the ODT export
13551 back-end uses that for file name.
13553 - {{{kbd(C-c C-e o O)}}} ::
13555 #+kindex: C-c C-e o O
13556 Export as an OpenDocument Text file and open the resulting file.
13558 #+vindex: org-export-odt-preferred-output-format
13559 If ~org-export-odt-preferred-output-format~ is specified, open
13560 the converted file instead. See [[*Automatically exporting to
13563 *** ODT specific export settings
13565 :DESCRIPTION: Configuration options.
13568 The ODT export back-end has several additional keywords for
13569 customizing ODT output. Setting these keywords works similar to the
13570 general options (see [[*Export settings]]).
13574 #+cindex: DESCRIPTION, keyword
13575 This is the document's description, which the ODT export back-end
13576 inserts as document metadata. For long descriptions, use
13577 multiple lines, prefixed with =DESCRIPTION=.
13581 #+cindex: KEYWORDS, keyword
13582 The keywords for the document. The ODT export back-end inserts
13583 the description along with author name, keywords, and related
13584 file metadata as metadata in the output file. Use multiple
13585 =KEYWORDS= if necessary.
13587 - =ODT_STYLES_FILE= ::
13589 #+cindex: ODT_STYLES_FILE, keyword
13590 #+vindex: org-odt-styles-file
13591 The ODT export back-end uses the ~org-odt-styles-file~ by
13592 default. See [[*Applying custom styles]] for details.
13596 #+cindex: SUBTITLE, keyword
13597 The document subtitle.
13599 *** Extending ODT export
13601 :DESCRIPTION: Producing DOC, PDF files.
13604 The ODT export back-end can produce documents in other formats besides
13605 ODT using a specialized ODT converter process. Its common interface
13606 works with popular converters to produce formats such as =doc=, or
13607 convert a document from one format, say =csv=, to another format, say
13610 #+cindex: @file{unoconv}
13611 #+vindex: org-odt-convert-process
13612 Customize ~org-odt-convert-process~ variable to point to =unoconv=,
13613 which is the ODT's preferred converter. Working installations of
13614 LibreOffice would already have =unoconv= installed. Alternatively,
13615 other converters may be substituted here. See [[*Configuring
13616 a document converter]].
13618 **** Automatically exporting to other formats
13623 #+vindex: org-odt-preferred-output-format
13624 If ODT format is just an intermediate step to get to other formats,
13625 such as =doc=, =docx=, =rtf=, or =pdf=, etc., then extend the ODT
13626 export back-end to directly produce that format. Specify the final
13627 format in the ~org-odt-preferred-output-format~ variable. This is one
13628 way to extend (see [[*ODT export commands]]).
13630 **** Converting between document formats
13635 The Org export back-end is made to be inter-operable with a wide range
13636 of text document format converters. Newer generation converters, such
13637 as LibreOffice and Pandoc, can handle hundreds of formats at once.
13638 Org provides a consistent interaction with whatever converter is
13639 installed. Here are some generic commands:
13641 - {{{kbd(M-x org-odt-convert)}}} ::
13643 #+findex: org-odt-convert
13644 Convert an existing document from one format to another. With
13645 a prefix argument, opens the newly produced file.
13647 *** Applying custom styles
13649 :DESCRIPTION: Styling the output.
13651 #+cindex: styles, custom
13652 #+cindex: template, custom
13654 The ODT export back-end comes with many OpenDocument styles (see
13655 [[*Working with OpenDocument style files]]). To expand or further
13656 customize these built-in style sheets, either edit the style sheets
13657 directly or generate them using an application such as LibreOffice.
13658 The example here shows creating a style using LibreOffice.
13660 **** Applying custom styles: the easy way
13665 1. Create a sample =example.org= file with settings as shown below,
13666 and export it to ODT format.
13668 : #+OPTIONS: H:10 num:t
13670 2. Open the above =example.odt= using LibreOffice. Use the /Stylist/
13671 to locate the target styles, which typically have the "Org" prefix.
13672 Open one, modify, and save as either OpenDocument Text (ODT) or
13673 OpenDocument Template (OTT) file.
13676 #+vindex: org-odt-styles-file
13677 Customize the variable ~org-odt-styles-file~ and point it to the
13678 newly created file. For additional configuration options, see
13679 [[x-overriding-factory-styles][Overriding factory styles]].
13681 #+cindex: ODT_STYLES_FILE, keyword
13682 To apply an ODT style to a particular file, use the
13683 =ODT_STYLES_FILE= keyword as shown in the example below:
13685 : #+ODT_STYLES_FILE: "/path/to/example.ott"
13687 #+texinfo: @noindent
13690 : #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
13692 **** Using third-party styles and templates
13697 The ODT export back-end relies on many templates and style names.
13698 Using third-party styles and templates can lead to mismatches.
13699 Templates derived from built in ODT templates and styles seem to have
13702 *** Links in ODT export
13704 :DESCRIPTION: Handling and formatting links.
13706 #+cindex: links, in ODT export
13708 ODT exporter creates native cross-references for internal links. It
13709 creates Internet-style links for all other links.
13711 A link with no description and pointing to a regular, un-itemized,
13712 outline heading is replaced with a cross-reference and section number
13715 A =\ref{label}=-style reference to an image, table etc., is replaced
13716 with a cross-reference and sequence number of the labeled entity. See
13717 [[*Labels and captions in ODT export]].
13719 *** Tables in ODT export
13721 :DESCRIPTION: Org tables conversions.
13724 #+cindex: tables, in ODT export
13726 The ODT export back-end handles native Org mode tables (see [[*Tables]])
13727 and simple =table.el= tables. Complex =table.el= tables having column
13728 or row spans are not supported. Such tables are stripped from the
13731 By default, the ODT export back-end exports a table with top and
13732 bottom frames and with ruled lines separating row and column groups
13733 (see [[*Column groups]]). All tables are typeset to occupy the same
13734 width. The ODT export back-end honors any table alignments and
13735 relative widths for columns (see [[*Column width and alignment]]).
13737 Note that the ODT export back-end interprets column widths as weighted
13738 ratios, the default weight being 1.
13740 #+cindex: ATTR_ODT, keyword
13741 Specifying =:rel-width= property on an =ATTR_ODT= line controls the
13742 width of the table. For example:
13745 ,#+ATTR_ODT: :rel-width 50
13746 | Area/Month | Jan | Feb | Mar | Sum |
13747 |---------------+-------+-------+-------+-------|
13749 | <l13> | <r5> | <r5> | <r5> | <r6> |
13750 | North America | 1 | 21 | 926 | 948 |
13751 | Middle East | 6 | 75 | 844 | 925 |
13752 | Asia Pacific | 9 | 27 | 790 | 826 |
13753 |---------------+-------+-------+-------+-------|
13754 | Sum | 16 | 123 | 2560 | 2699 |
13757 On export, the above table takes 50% of text width area. The exporter
13758 sizes the columns in the ratio: 13:5:5:5:6. The first column is
13759 left-aligned and rest of the columns, right-aligned. Vertical rules
13760 separate the header and the last column. Horizontal rules separate
13761 the header and the last row.
13763 For even more customization, create custom table styles and associate
13764 them with a table using the =ATTR_ODT= keyword. See [[*Customizing
13765 tables in ODT export]].
13767 *** Images in ODT export
13769 :DESCRIPTION: Inserting images.
13771 #+cindex: images, embedding in ODT
13772 #+cindex: embedding images in ODT
13774 **** Embedding images
13779 The ODT export back-end processes image links in Org files that do not
13780 have descriptions, such as these links =[[file:img.jpg]]= or =[[./img.jpg]]=,
13781 as direct image insertions in the final output. Either of these
13788 **** Embedding clickable images
13793 For clickable images, provide a link whose description is another link
13794 to an image file. For example, to embed a image
13795 =org-mode-unicorn.png= which when clicked jumps to http://orgmode.org
13796 website, do the following
13798 : [[http://orgmode.org][./org-mode-unicorn.png]]
13800 **** Sizing and scaling of embedded images
13805 #+cindex: ATTR_ODT, keyword
13807 Control the size and scale of the embedded images with the =ATTR_ODT=
13810 #+cindex: identify, ImageMagick
13811 #+vindex: org-odt-pixels-per-inch
13812 The ODT export back-end starts with establishing the size of the image
13813 in the final document. The dimensions of this size are measured in
13814 centimeters. The back-end then queries the image file for its
13815 dimensions measured in pixels. For this measurement, the back-end
13816 relies on ImageMagick's identify program or Emacs ~create-image~ and
13817 ~image-size~ API. ImageMagick is the preferred choice for large file
13818 sizes or frequent batch operations. The back-end then converts the
13819 pixel dimensions using ~org-odt-pixels-per-inch~ into the familiar 72
13820 dpi or 96 dpi. The default value for this is in
13821 ~display-pixels-per-inch~, which can be tweaked for better results
13822 based on the capabilities of the output device. Here are some common
13823 image scaling operations:
13825 - Explicitly size the image ::
13827 To embed =img.png= as a 10 cm x 10 cm image, do the following:
13830 ,#+ATTR_ODT: :width 10 :height 10
13834 - Scale the image ::
13836 To embed =img.png= at half its size, do the following:
13839 ,#+ATTR_ODT: :scale 0.5
13843 - Scale the image to a specific width ::
13845 To embed =img.png= with a width of 10 cm while retaining the
13846 original height:width ratio, do the following:
13849 ,#+ATTR_ODT: :width 10
13853 - Scale the image to a specific height ::
13855 To embed =img.png= with a height of 10 cm while retaining the
13856 original height:width ratio, do the following:
13859 ,#+ATTR_ODT: :height 10
13863 **** Anchoring of images
13868 #+cindex: ATTR_ODT, keyword
13869 The ODT export back-end can anchor images to ="as-char"=,
13870 ="paragraph"=, or ="page"=. Set the preferred anchor using the
13871 =:anchor= property of the =ATTR_ODT= line.
13873 To create an image that is anchored to a page:
13876 ,#+ATTR_ODT: :anchor "page"
13880 *** Math formatting in ODT export
13882 :DESCRIPTION: Formatting @LaTeX{} fragments.
13885 The ODT exporter has special support for handling math.
13887 **** LaTeX math snippets
13889 :DESCRIPTION: Embedding in @LaTeX{} format.
13892 LaTeX math snippets (see [[*LaTeX fragments]]) can be embedded in the ODT
13893 document in one of the following ways:
13898 Add this line to the Org file. This option is activated on
13903 With this option, LaTeX fragments are first converted into MathML
13904 fragments using an external LaTeX-to-MathML converter program.
13905 The resulting MathML fragments are then embedded as an
13906 OpenDocument Formula in the exported document.
13908 #+vindex: org-latex-to-mathml-convert-command
13909 #+vindex: org-latex-to-mathml-jar-file
13910 You can specify the LaTeX-to-MathML converter by customizing the
13911 variables ~org-latex-to-mathml-convert-command~ and
13912 ~org-latex-to-mathml-jar-file~.
13914 If you prefer to use MathToWeb[fn:125] as your converter, you can
13915 configure the above variables as shown below.
13917 #+begin_src emacs-lisp
13918 (setq org-latex-to-mathml-convert-command
13919 "java -jar %j -unicode -force -df %o %I"
13920 org-latex-to-mathml-jar-file
13921 "/path/to/mathtoweb.jar")
13924 To use LaTeX​ML[fn:126] use
13926 #+begin_src emacs-lisp
13927 (setq org-latex-to-mathml-convert-command
13928 "latexmlmath \"%i\" --presentationmathml=%o")
13931 To quickly verify the reliability of the LaTeX-to-MathML
13932 converter, use the following commands:
13934 - {{{kbd(M-x org-export-as-odf)}}} ::
13936 Convert a LaTeX math snippet to an OpenDocument formula
13939 - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
13941 Convert a LaTeX math snippet to an OpenDocument formula
13942 (=.odf=) file and open the formula file with the
13943 system-registered application.
13949 #+cindex: ImageMagick
13950 Add this line to the Org file. This option is activated on
13953 : #+OPTIONS: tex:dvipng
13955 : #+OPTIONS: tex:dvisvgm
13957 #+texinfo: @noindent
13960 : #+OPTIONS: tex:imagemagick
13962 Under this option, LaTeX fragments are processed into PNG or SVG
13963 images and the resulting images are embedded in the exported
13964 document. This method requires dvipng program, dvisvgm or
13965 ImageMagick programs.
13967 **** MathML and OpenDocument formula files
13969 :DESCRIPTION: Embedding in native format.
13972 When embedding LaTeX math snippets in ODT documents is not reliable,
13973 there is one more option to try. Embed an equation by linking to its
13974 MathML (=.mml=) source or its OpenDocument formula (=.odf=) file as
13977 : [[./equation.mml]]
13979 #+texinfo: @noindent
13982 : [[./equation.odf]]
13984 *** Labels and captions in ODT export
13986 :DESCRIPTION: Rendering objects.
13989 ODT format handles labeling and captioning of objects based on their
13990 types. Inline images, tables, LaTeX fragments, and Math formulas are
13991 numbered and captioned separately. Each object also gets a unique
13992 sequence number based on its order of first appearance in the Org
13993 file. Each category has its own sequence. A caption is just a label
13994 applied to these objects.
13997 ,#+CAPTION: Bell curve
13998 ,#+NAME: fig:SED-HR4049
14002 When rendered, it may show as follows in the exported document:
14004 : Figure 2: Bell curve
14006 #+vindex: org-odt-category-map-alist
14007 To modify the category component of the caption, customize the option
14008 ~org-odt-category-map-alist~. For example, to tag embedded images
14009 with the string "Illustration" instead of the default string "Figure",
14010 use the following setting:
14012 #+begin_src emacs-lisp
14013 (setq org-odt-category-map-alist
14014 '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
14017 With the above modification, the previous example changes to:
14019 : Illustration 2: Bell curve
14021 *** Literal examples in ODT export
14023 :DESCRIPTION: For source code and example blocks.
14026 The ODT export back-end supports literal examples (see [[*Literal
14027 examples]]) with full fontification. Internally, the ODT export
14028 back-end relies on =htmlfontify.el= to generate the style definitions
14029 needed for fancy listings. The auto-generated styles get =OrgSrc=
14030 prefix and inherit colors from the faces used by Emacs Font Lock
14031 library for that source language.
14033 #+vindex: org-odt-fontify-srcblocks
14034 For custom fontification styles, customize the
14035 ~org-odt-create-custom-styles-for-srcblocks~ option.
14037 #+vindex: org-odt-create-custom-styles-for-srcblocks
14038 To turn off fontification of literal examples, customize the
14039 ~org-odt-fontify-srcblocks~ option.
14041 *** Advanced topics in ODT export
14043 :DESCRIPTION: For power users.
14046 The ODT export back-end has extensive features useful for power users
14047 and frequent uses of ODT formats.
14049 **** Configuring a document converter
14051 :DESCRIPTION: Registering a document converter.
14055 #+cindex: doc, docx, rtf
14056 #+cindex: converter
14058 The ODT export back-end works with popular converters with little or
14059 no extra configuration. See [[*Extending ODT export]]. The following is
14060 for unsupported converters or tweaking existing defaults.
14062 - Register the converter ::
14064 #+vindex: org-export-odt-convert-processes
14065 Add the name of the converter to the ~org-odt-convert-processes~
14066 variable. Note that it also requires how the converter is
14067 invoked on the command line. See the variable's docstring for
14070 - Configure its capabilities ::
14072 #+vindex: org-export-odt-convert-capabilities
14073 Specify which formats the converter can handle by customizing the
14074 variable ~org-odt-convert-capabilities~. Use the entry for the
14075 default values in this variable for configuring the new
14076 converter. Also see its docstring for details.
14078 - Choose the converter ::
14080 #+vindex: org-export-odt-convert-process
14081 Select the newly added converter as the preferred one by
14082 customizing the option ~org-odt-convert-process~.
14084 **** Working with OpenDocument style files
14086 :DESCRIPTION: Exploring internals.
14089 #+cindex: styles, custom
14090 #+cindex: template, custom
14092 This section explores the internals of the ODT exporter; the means by which
14093 it produces styled documents; the use of automatic and custom OpenDocument
14096 The ODT exporter relies on two files for generating its output. These
14097 files are bundled with the distribution under the directory pointed to
14098 by the variable ~org-odt-styles-dir~. The two files are:
14100 - =OrgOdtStyles.xml= <<x-orgodtstyles-xml>> ::
14102 This file contributes to the =styles.xml= file of the final ODT
14103 document. This file gets modified for the following purposes:
14105 1. To control outline numbering based on user settings;
14107 2. To add styles generated by =htmlfontify.el= for fontification of
14110 - =OrgOdtContentTemplate.xml= <<x-orgodtcontenttemplate-xml>> ::
14112 This file contributes to the =content.xml= file of the final ODT
14113 document. The contents of the Org outline are inserted between the
14114 =<office:text>= ... =</office:text>= elements of this file.
14116 Apart from serving as a template file for the final =content.xml=,
14117 the file serves the following purposes:
14119 1. It contains automatic styles for formatting of tables which are
14120 referenced by the exporter;
14122 2. It contains =<text:sequence-decl>= ... =</text:sequence-decl>=
14123 elements that control numbering of tables, images, equations, and
14126 <<x-overriding-factory-styles>> The following two variables control
14127 the location from where the ODT exporter picks up the custom styles
14128 and content template files. Customize these variables to override the
14129 factory styles used by the exporter.
14131 - ~org-odt-styles-file~ ::
14133 The ODT export back-end uses the file pointed to by this
14134 variable, such as =styles.xml=, for the final output. It can
14135 take one of the following values:
14139 Use this file instead of the default =styles.xml=
14141 - =FILE.odt= or =FILE.ott= ::
14143 Use the =styles.xml= contained in the specified OpenDocument
14144 Text or Template file
14146 - =FILE.odt= or =FILE.ott= and a subset of included files ::
14148 Use the =styles.xml= contained in the specified OpenDocument
14149 Text or Template file. Additionally extract the specified
14150 member files and embed those within the final ODT document.
14152 Use this option if the =styles.xml= file references additional
14153 files like header and footer images.
14157 Use the default =styles.xml=.
14159 - ~org-odt-content-template-file~ ::
14161 Use this variable to specify the blank =content.xml= used in the
14164 **** Creating one-off styles
14166 :DESCRIPTION: Customizing styles, highlighting...
14170 The ODT export back-end can read embedded raw OpenDocument XML from
14171 the Org file. Such direct formatting is useful for one-off instances.
14173 - Embedding ODT tags as part of regular text ::
14175 Enclose OpenDocument syntax in =@@odt:...@@= for inline markup.
14176 For example, to highlight a region of text do the following:
14179 @@odt:<text:span text:style-name="Highlight">This is highlighted
14180 text</text:span>@@. But this is regular text.
14183 *Hint:* To see the above example in action, edit the =styles.xml=
14184 (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom /Highlight/ style as shown
14188 <style:style style:name="Highlight" style:family="text">
14189 <style:text-properties fo:background-color="#ff0000"/>
14193 - Embedding a one-line OpenDocument XML ::
14195 #+cindex: ODT, keyword
14196 The ODT export back-end can read one-liner options with =#+ODT:=
14197 in the Org file. For example, to force a page break:
14200 ,#+ODT: <text:p text:style-name="PageBreak"/>
14203 *Hint:* To see the above example in action, edit your
14204 =styles.xml= (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom =PageBreak=
14205 style as shown below.
14208 <style:style style:name="PageBreak" style:family="paragraph"
14209 style:parent-style-name="Text_20_body">
14210 <style:paragraph-properties fo:break-before="page"/>
14214 - Embedding a block of OpenDocument XML ::
14216 The ODT export back-end can also read ODT export blocks for
14217 OpenDocument XML. Such blocks use the =#+BEGIN_EXPORT odt=
14218 ... =#+END_EXPORT= constructs.
14220 For example, to create a one-off paragraph that uses bold text,
14224 ,#+BEGIN_EXPORT odt
14225 <text:p text:style-name="Text_20_body_20_bold">
14226 This paragraph is specially formatted and uses bold text.
14231 **** Customizing tables in ODT export
14233 :DESCRIPTION: Defining table templates.
14236 #+cindex: tables, in ODT export
14237 #+cindex: ATTR_ODT, keyword
14239 Override the default table format by specifying a custom table style
14240 with the =#+ATTR_ODT= line. For a discussion on default formatting of
14241 tables, see [[*Tables in ODT export]].
14243 This feature closely mimics the way table templates are defined in the
14244 OpenDocument-v1.2 specification.[fn:127]
14246 #+vindex: org-odt-table-styles
14247 For quick preview of this feature, install the settings below and export the
14248 table that follows:
14250 #+begin_src emacs-lisp
14251 (setq org-export-odt-table-styles
14252 (append org-export-odt-table-styles
14253 '(("TableWithHeaderRowAndColumn" "Custom"
14254 ((use-first-row-styles . t)
14255 (use-first-column-styles . t)))
14256 ("TableWithFirstRowandLastRow" "Custom"
14257 ((use-first-row-styles . t)
14258 (use-last-row-styles . t))))))
14262 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
14263 | Name | Phone | Age |
14264 | Peter | 1234 | 17 |
14265 | Anna | 4321 | 25 |
14268 The example above used =Custom= template and installed two table
14269 styles =TableWithHeaderRowAndColumn= and
14270 =TableWithFirstRowandLastRow=. *Important:* The OpenDocument styles
14271 needed for producing the above template were pre-defined. They are
14272 available in the section marked =Custom Table Template= in
14273 =OrgOdtContentTemplate.xml= (see [[x-orgodtcontenttemplate-xml][Factory styles]]). For adding new
14274 templates, define new styles there.
14276 To use this feature proceed as follows:
14278 1. Create a table template[fn:128].
14280 A table template is set of =table-cell= and =paragraph= styles for
14281 each of the following table cell categories:
14293 The names for the above styles must be chosen based on the name of
14294 the table template using a well-defined convention.
14296 The naming convention is better illustrated with an example. For
14297 a table template with the name =Custom=, the needed style names are
14298 listed in the following table.
14300 | Cell type | Cell style | Paragraph style |
14301 |--------------+------------------------------+-----------------------------------|
14302 | Body | =CustomTableCell= | =CustomTableParagraph= |
14303 | First column | =CustomFirstColumnTableCell= | =CustomFirstColumnTableParagraph= |
14304 | Last column | =CustomLastColumnTableCell= | =CustomLastColumnTableParagraph= |
14305 | First row | =CustomFirstRowTableCell= | =CustomFirstRowTableParagraph= |
14306 | Last row | =CustomLastRowTableCell= | =CustomLastRowTableParagraph= |
14307 | Even row | =CustomEvenRowTableCell= | =CustomEvenRowTableParagraph= |
14308 | Odd row | =CustomOddRowTableCell= | =CustomOddRowTableParagraph= |
14309 | Even column | =CustomEvenColumnTableCell= | =CustomEvenColumnTableParagraph= |
14310 | Odd column | =CustomOddColumnTableCell= | =CustomOddColumnTableParagraph= |
14312 To create a table template with the name =Custom=, define the above
14313 styles in the =<office:automatic-styles>= ...
14314 =</office:automatic-styles>= element of the content template file
14315 (see [[x-orgodtcontenttemplate-xml][Factory styles]]).
14317 2. Define a table style[fn:129].
14319 #+vindex: org-odt-table-styles
14320 To define a table style, create an entry for the style in the
14321 variable ~org-odt-table-styles~ and specify the following:
14323 - the name of the table template created in step (1),
14324 - the set of cell styles in that template that are to be activated.
14326 For example, the entry below defines two different table styles
14327 =TableWithHeaderRowAndColumn= and =TableWithFirstRowandLastRow=
14328 based on the same template =Custom=. The styles achieve their
14329 intended effect by selectively activating the individual cell
14330 styles in that template.
14332 #+begin_src emacs-lisp
14333 (setq org-export-odt-table-styles
14334 (append org-export-odt-table-styles
14335 '(("TableWithHeaderRowAndColumn" "Custom"
14336 ((use-first-row-styles . t)
14337 (use-first-column-styles . t)))
14338 ("TableWithFirstRowandLastRow" "Custom"
14339 ((use-first-row-styles . t)
14340 (use-last-row-styles . t))))))
14343 3. Associate a table with the table style.
14345 To do this, specify the table style created in step (2) as part of
14346 the =ATTR_ODT= line as shown below.
14349 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
14350 | Name | Phone | Age |
14351 | Peter | 1234 | 17 |
14352 | Anna | 4321 | 25 |
14355 **** Validating OpenDocument XML
14357 :DESCRIPTION: Debugging corrupted OpenDocument files.
14361 Sometimes ODT format files may not open due to =.odt= file corruption.
14362 To verify if such a file is corrupt, validate it against the
14363 OpenDocument Relax NG Compact (RNC) syntax schema. But first the
14364 =.odt= files have to be decompressed using =zip=. Note that =.odt=
14365 files are ZIP archives: [[info:emacs::File Archives]]. The contents of
14366 ODT files are in XML. For general help with validation -- and
14367 schema-sensitive editing -- of XML files:
14368 [[info:nxml-mode::Introduction]].
14370 #+vindex: org-export-odt-schema-dir
14371 Customize ~org-odt-schema-dir~ to point to a directory with
14372 OpenDocument RNC files and the needed schema-locating rules. The ODT
14373 export back-end takes care of updating the
14374 ~rng-schema-locating-files~.
14378 :DESCRIPTION: Exporting to Org.
14381 #+cindex: Org export
14382 /org/ export back-end creates a normalized version of the Org document
14383 in current buffer. The exporter evaluates Babel code (see [[*Evaluating
14384 code blocks]]) and removes content specific to other back-ends.
14386 *** Org export commands
14391 - {{{kbd(C-c C-e O o)}}} (~org-org-export-to-org~) ::
14393 #+kindex: C-c C-e O o
14394 #+findex: org-org-export-to-org
14395 Export as an Org file with a =.org= extension. For =myfile.org=,
14396 Org exports to =myfile.org.org=, overwriting without warning.
14398 - {{{kbd(C-c C-e O v)}}} (~~) ::
14400 #+kindex: C-c C-e O v
14401 Export to an Org file, then open it.
14405 :DESCRIPTION: Exporting to Texinfo.
14408 *** Texinfo export commands
14410 :DESCRIPTION: Invoking commands.
14413 - {{{kbd(C-c C-e i t)}}} (~org-texinfo-export-to-texinfo~) ::
14415 #+kindex: C-c C-e i t
14416 #+findex: org-texinfo-export-to-texinfo
14417 Export as a Texinfo file with =.texi= extension. For
14418 =myfile.org=, Org exports to =myfile.texi=, overwriting without
14421 - {{{kbd(C-c C-e i i)}}} (~org-texinfo-export-to-info~) ::
14423 #+kindex: C-c C-e i i
14424 #+findex: org-texinfo-export-to-info
14425 #+vindex: org-texinfo-info-process
14426 Export to Texinfo format first and then process it to make an
14427 Info file. To generate other formats, such as DocBook, customize
14428 the ~org-texinfo-info-process~ variable.
14430 *** Texinfo specific export settings
14432 :DESCRIPTION: Setting the environment.
14435 The Texinfo export back-end has several additional keywords for
14436 customizing Texinfo output. Setting these keywords works similar to
14437 the general options (see [[*Export settings]]).
14441 #+cindex: SUBTITLE, keyword
14442 The document subtitle.
14446 #+cindex: SUBAUTHOR, keyword
14447 Additional authors for the document.
14449 - =TEXINFO_FILENAME= ::
14451 #+cindex: TEXINFO_FILENAME, keyword
14452 The Texinfo filename.
14454 - =TEXINFO_CLASS= ::
14456 #+cindex: TEXINFO_CLASS, keyword
14457 #+vindex: org-texinfo-default-class
14458 The default document class (~org-texinfo-default-class~), which
14459 must be a member of ~org-texinfo-classes~.
14461 - =TEXINFO_HEADER= ::
14463 #+cindex: TEXINFO_HEADER, keyword
14464 Arbitrary lines inserted at the end of the header.
14466 - =TEXINFO_POST_HEADER= ::
14468 #+cindex: TEXINFO_POST_HEADER, keyword
14469 Arbitrary lines inserted after the end of the header.
14471 - =TEXINFO_DIR_CATEGORY= ::
14473 #+cindex: TEXINFO_DIR_CATEGORY, keyword
14474 The directory category of the document.
14476 - =TEXINFO_DIR_TITLE= ::
14478 #+cindex: TEXINFO_DIR_TITLE, keyword
14479 The directory title of the document.
14481 - =TEXINFO_DIR_DESC= ::
14483 #+cindex: TEXINFO_DIR_DESC, keyword
14484 The directory description of the document.
14486 - =TEXINFO_PRINTED_TITLE= ::
14488 #+cindex: TEXINFO_PRINTED_TITLE, keyword
14489 The printed title of the document.
14491 *** Texinfo file header
14493 :DESCRIPTION: Generating the header.
14496 #+cindex: TEXINFO_FILENAME, keyword
14497 After creating the header for a Texinfo file, the Texinfo back-end
14498 automatically generates a name and destination path for the Info file.
14499 To override this default with a more sensible path and name, specify
14500 the =TEXINFO_FILENAME= keyword.
14502 #+vindex: org-texinfo-coding-system
14503 #+cindex: TEXINFO_HEADER, keyword
14504 Along with the output's file name, the Texinfo header also contains
14505 language details (see [[*Export settings]]) and encoding system as set in
14506 the ~org-texinfo-coding-system~ variable. Insert =TEXINFO_HEADER=
14507 keywords for each additional command in the header, for example:
14509 : #+TEXINFO_HEADER: @synindex
14511 #+cindex: TEXINFO_CLASS, keyword
14512 #+vindex: org-texinfo-classes
14513 Instead of repeatedly installing the same set of commands, define
14514 a class in ~org-texinfo-classes~ once, and then activate it in the
14515 document by setting the =TEXINFO_CLASS= keyword to that class.
14517 *** Texinfo title and copyright page
14519 :DESCRIPTION: Creating preamble pages.
14522 #+cindex: TEXINFO_PRINTED_TITLE, keyword
14523 The default template for hard copy output has a title page with
14524 =TITLE= and =AUTHOR= keywords (see [[*Export settings]]). To replace the
14525 regular title with something different for the printed version, use
14526 the =TEXINFO_PRINTED_TITLE= and =SUBTITLE= keywords. Both expect raw
14527 Texinfo code for setting their values.
14529 #+cindex: SUBAUTHOR, keyword
14530 If one =AUTHOR= line is not sufficient, add multiple =SUBAUTHOR=
14531 keywords. They have to be set in raw Texinfo code.
14534 ,#+AUTHOR: Jane Smith
14535 ,#+SUBAUTHOR: John Doe
14536 ,#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{}
14539 #+cindex: COPYING, property
14540 Copying material is defined in a dedicated headline with a non-~nil~
14541 =COPYING= property. The back-end inserts the contents within
14542 a =@copying= command at the beginning of the document. The heading
14543 itself does not appear in the structure of the document.
14545 Copyright information is printed on the back of the title page.
14553 This is a short example of a complete Texinfo file, version 1.0.
14555 Copyright \copy 2016 Free Software Foundation, Inc.
14558 *** Info directory file
14560 :DESCRIPTION: Installing a manual in Info file hierarchy.
14563 #+cindex: @samp{dir} file, in Texinfo export
14564 #+cindex: Info directory file, in Texinfo export
14565 #+cindex: @code{install-info}, in Texinfo export
14567 #+cindex: TEXINFO_DIR_CATEGORY, keyword
14568 #+cindex: TEXINFO_DIR_TITLE, keyword
14569 #+cindex: TEXINFO_DIR_DESC, keyword
14570 The end result of the Texinfo export process is the creation of an
14571 Info file. This Info file's metadata has variables for category,
14572 title, and description: =TEXINFO_DIR_CATEGORY=, =TEXINFO_DIR_TITLE=,
14573 and =TEXINFO_DIR_DESC= keywords that establish where in the Info
14574 hierarchy the file fits.
14576 Here is an example that writes to the Info directory file:
14579 ,#+TEXINFO_DIR_CATEGORY: Emacs
14580 ,#+TEXINFO_DIR_TITLE: Org Mode: (org)
14581 ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer
14584 *** Headings and sectioning structure
14586 :DESCRIPTION: Building document structure.
14589 #+vindex: org-texinfo-classes
14590 #+vindex: org-texinfo-default-class
14591 #+cindex: TEXINFO_CLASS, keyword
14592 The Texinfo export back-end uses a pre-defined scheme to convert Org
14593 headlines to equivalent Texinfo structuring commands. A scheme like
14594 this maps top-level headlines to numbered chapters tagged as
14595 ~@chapter~ and lower-level headlines to unnumbered chapters tagged as
14596 ~@unnumbered~. To override such mappings to introduce ~@part~ or
14597 other Texinfo structuring commands, define a new class in
14598 ~org-texinfo-classes~. Activate the new class with the
14599 =TEXINFO_CLASS= keyword. When no new class is defined and activated,
14600 the Texinfo export back-end defaults to the
14601 ~org-texinfo-default-class~.
14603 If an Org headline's level has no associated Texinfo structuring
14604 command, or is below a certain threshold (see [[*Export settings]]), then
14605 the Texinfo export back-end makes it into a list item.
14607 #+cindex: APPENDIX, property
14608 The Texinfo export back-end makes any headline with a non-~nil~
14609 =APPENDIX= property into an appendix. This happens independent of the
14610 Org headline level or the =TEXINFO_CLASS= keyword.
14612 #+cindex: ALT_TITLE, property
14613 #+cindex: DESCRIPTION, property
14614 The Texinfo export back-end creates a menu entry after the Org
14615 headline for each regular sectioning structure. To override this with
14616 a shorter menu entry, use the =ALT_TITLE= property (see [[*Table of
14617 contents]]). Texinfo menu entries also have an option for a longer
14618 =DESCRIPTION= property. Here's an example that uses both to override
14619 the default menu entry:
14622 ,* Controlling Screen Display
14624 :ALT_TITLE: Display
14625 :DESCRIPTION: Controlling Screen Display
14629 #+cindex: Top node, in Texinfo export
14630 The text before the first headline belongs to the /Top/ node, i.e.,
14631 the node in which a reader enters an Info manual. As such, it is
14632 expected not to appear in printed output generated from the =.texi=
14633 file. See [[info:texinfo::The%20Top%20Node]], for more information.
14637 :DESCRIPTION: Creating indices.
14640 #+cindex: CINDEX, keyword
14641 #+cindex: concept index, in Texinfo export
14642 #+cindex: FINDEX, keyword
14643 #+cindex: function index, in Texinfo export
14644 #+cindex: KINDEX, keyword
14645 #+cindex: keystroke index, in Texinfo export
14646 #+cindex: PINDEX, keyword
14647 #+cindex: program index, in Texinfo export
14648 #+cindex: TINDEX, keyword
14649 #+cindex: data type index, in Texinfo export
14650 #+cindex: VINDEX, keyword
14651 #+cindex: variable index, in Texinfo export
14652 The Texinfo export back-end recognizes these indexing keywords if used
14653 in the Org file: =CINDEX=, =FINDEX=, =KINDEX=, =PINDEX=, =TINDEX= and
14654 =VINDEX=. Write their value as verbatim Texinfo code; in particular,
14655 ={=, =}= and =@= characters need to be escaped with =@= if they do not
14656 belong to a Texinfo command.
14658 : #+CINDEX: Defining indexing entries
14660 #+cindex: INDEX, property
14661 For the back-end to generate an index entry for a headline, set the
14662 =INDEX= property to =cp= or =vr=. These abbreviations come from
14663 Texinfo that stand for concept index and variable index. The Texinfo
14664 manual has abbreviations for all other kinds of indexes. The back-end
14665 exports the headline as an unnumbered chapter or section command, and
14666 then inserts the index after its contents.
14675 *** Quoting Texinfo code
14677 :DESCRIPTION: Incorporating literal Texinfo code.
14680 Use any of the following three methods to insert or escape raw Texinfo
14683 #+cindex: TEXINFO, keyword
14684 #+cindex: BEGIN_EXPORT texinfo
14686 Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU.
14688 ,#+TEXINFO: @need800
14689 This paragraph is preceded by...
14691 ,#+BEGIN_EXPORT texinfo
14692 @auindex Johnson, Mark
14693 @auindex Lakoff, George
14697 *** Plain lists in Texinfo export
14699 :DESCRIPTION: List attributes.
14702 #+cindex: ATTR_TEXINFO, keyword
14703 #+cindex: two-column tables, in Texinfo export
14705 #+cindex: table types, in Texinfo export
14706 The Texinfo export back-end by default converts description lists in
14707 the Org file using the default command =@table=, which results in
14708 a table with two columns. To change this behavior, specify
14709 =:table-type= with =ftable= or =vtable= attributes. For more
14710 information, see [[info:texinfo::Two-column Tables]].
14712 #+vindex: org-texinfo-table-default-markup
14713 The Texinfo export back-end by default also applies a text highlight
14714 based on the defaults stored in ~org-texinfo-table-default-markup~.
14715 To override the default highlight command, specify another one with
14716 the =:indic= attribute.
14718 #+cindex: multiple items in Texinfo lists
14719 Org syntax is limited to one entry per list item. Nevertheless, the
14720 Texinfo export back-end can split that entry according to any text
14721 provided through the =:sep= attribute. Each part then becomes a new
14722 entry in the first column of the table.
14724 The following example illustrates all the attributes above:
14727 ,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
14728 - foo, bar :: This is the common text for variables foo and bar.
14731 #+texinfo: @noindent
14738 This is the common text for variables foo and bar.
14742 *** Tables in Texinfo export
14744 :DESCRIPTION: Table attributes.
14747 #+cindex: ATTR_TEXINFO, keyword
14748 When exporting tables, the Texinfo export back-end uses the widest
14749 cell width in each column. To override this and instead specify as
14750 fractions of line length, use the =:columns= attribute. See example
14754 #+ATTR_TEXINFO: :columns .5 .5
14755 | a cell | another cell |
14758 *** Images in Texinfo export
14760 :DESCRIPTION: Image attributes.
14763 #+cindex: ATTR_TEXINFO, keyword
14764 Insert a file link to the image in the Org file, and the Texinfo
14765 export back-end inserts the image. These links must have the usual
14766 supported image extensions and no descriptions. To scale the image,
14767 use =:width= and =:height= attributes. For alternate text, use =:alt=
14768 and specify the text using Texinfo code, as shown in the example:
14771 ,#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text}
14775 *** Special blocks in Texinfo export
14777 :DESCRIPTION: Special block attributes.
14780 #+cindex: ATTR_TEXINFO, keyword
14782 The Texinfo export back-end converts special blocks to commands with
14783 the same name. It also adds any =:options= attributes to the end of
14784 the command, as shown in this example:
14787 ,#+ATTR_TEXINFO: :options org-org-export-to-org ...
14789 A somewhat obsessive function name.
14793 #+texinfo: @noindent
14797 @defun org-org-export-to-org ...
14798 A somewhat obsessive function name.
14802 *** A Texinfo example
14804 :DESCRIPTION: Processing Org to Texinfo.
14807 Here is a more detailed example Org file. See
14808 [[info:texinfo::GNU%20Sample%20Texts]] for an equivalent example using
14812 ,#+TITLE: GNU Sample {{{version}}}
14813 ,#+SUBTITLE: for version {{{version}}}, {{{updated}}}
14814 ,#+AUTHOR: A.U. Thor
14815 ,#+EMAIL: bug-sample@gnu.org
14817 ,#+OPTIONS: ':t toc:t author:t email:t
14820 ,#+MACRO: version 2.0
14821 ,#+MACRO: updated last updated 4 March 2014
14823 ,#+TEXINFO_FILENAME: sample.info
14824 ,#+TEXINFO_HEADER: @syncodeindex pg cp
14826 ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system
14827 ,#+TEXINFO_DIR_TITLE: sample: (sample)
14828 ,#+TEXINFO_DIR_DESC: Invoking sample
14830 ,#+TEXINFO_PRINTED_TITLE: GNU Sample
14832 This manual is for GNU Sample (version {{{version}}},
14840 This manual is for GNU Sample (version {{{version}}},
14841 {{{updated}}}), which is an example in the Texinfo documentation.
14843 Copyright \copy 2016 Free Software Foundation, Inc.
14846 Permission is granted to copy, distribute and/or modify this
14847 document under the terms of the GNU Free Documentation License,
14848 Version 1.3 or any later version published by the Free Software
14849 Foundation; with no Invariant Sections, with no Front-Cover Texts,
14850 and with no Back-Cover Texts. A copy of the license is included in
14851 the section entitled "GNU Free Documentation License".
14857 ,#+CINDEX: invoking @command{sample}
14859 This is a sample manual. There is no sample program to invoke, but
14860 if there were, you could see its basic usage and command line
14863 ,* GNU Free Documentation License
14868 ,#+TEXINFO: @include fdl.texi
14876 ** iCalendar export
14878 :DESCRIPTION: Exporting to iCalendar.
14880 #+cindex: iCalendar export
14882 A large part of Org mode's interoperability success is its ability to
14883 easily export to or import from external applications. The iCalendar
14884 export back-end takes calendar data from Org files and exports to the
14885 standard iCalendar format.
14887 #+vindex: org-icalendar-include-todo
14888 #+vindex: org-icalendar-use-deadline
14889 #+vindex: org-icalendar-use-scheduled
14890 The iCalendar export back-end can also incorporate TODO entries based
14891 on the configuration of the ~org-icalendar-include-todo~ variable.
14892 The back-end exports plain timestamps as =VEVENT=, TODO items as
14893 =VTODO=, and also create events from deadlines that are in non-TODO
14894 items. The back-end uses the deadlines and scheduling dates in Org
14895 TODO items for setting the start and due dates for the iCalendar TODO
14896 entry. Consult the ~org-icalendar-use-deadline~ and
14897 ~org-icalendar-use-scheduled~ variables for more details.
14899 #+vindex: org-icalendar-categories
14900 #+vindex: org-icalendar-alarm-time
14901 For tags on the headline, the iCalendar export back-end makes them
14902 into iCalendar categories. To tweak the inheritance of tags and TODO
14903 states, configure the variable ~org-icalendar-categories~. To assign
14904 clock alarms based on time, configure the ~org-icalendar-alarm-time~
14907 #+vindex: org-icalendar-store-UID
14908 #+cindex: ID, property
14909 The iCalendar format standard requires globally unique identifier --
14910 or UID -- for each entry. The iCalendar export back-end creates UIDs
14911 during export. To save a copy of the UID in the Org file set the
14912 variable ~org-icalendar-store-UID~. The back-end looks for the =ID=
14913 property of the entry for re-using the same UID for subsequent
14916 Since a single Org entry can result in multiple iCalendar entries --
14917 timestamp, deadline, scheduled item, or TODO item -- Org adds prefixes
14918 to the UID, depending on which part of the Org entry triggered the
14919 creation of the iCalendar entry. Prefixing ensures UIDs remains
14920 unique, yet enable synchronization programs trace the connections.
14922 - {{{kbd(C-c C-e c f)}}} (~org-icalendar-export-to-ics~) ::
14924 #+kindex: C-c C-e c f
14925 #+findex: org-icalendar-export-to-ics
14926 Create iCalendar entries from the current Org buffer and store
14927 them in the same directory, using a file extension =.ics=.
14929 - {{{kbd(C-c C-e c a)}}} (~org-icalendar-export-agenda-files~) ::
14931 #+kindex: C-c C-e c a
14932 #+findex: org-icalendar-export-agenda-files
14933 Create iCalendar entries from Org files in ~org-agenda-files~ and
14934 store in a separate iCalendar file for each Org file.
14936 - {{{kbd(C-c C-e c c)}}} (~org-icalendar-combine-agenda-files~) ::
14938 #+kindex: C-c C-e c c
14939 #+findex: org-icalendar-combine-agenda-files
14940 #+vindex: org-icalendar-combined-agenda-file
14941 Create a combined iCalendar file from Org files in
14942 ~org-agenda-files~ and write it to
14943 ~org-icalendar-combined-agenda-file~ file name.
14945 #+cindex: SUMMARY, property
14946 #+cindex: DESCRIPTION, property
14947 #+cindex: LOCATION, property
14948 #+cindex: TIMEZONE, property
14949 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
14950 =LOCATION= and =TIMEZONE= properties from the Org entries when
14951 exporting. To force the back-end to inherit the =LOCATION= and
14952 =TIMEZONE= properties, configure the ~org-use-property-inheritance~
14955 #+vindex: org-icalendar-include-body
14956 When Org entries do not have =SUMMARY=, =DESCRIPTION= and =LOCATION=
14957 properties, the iCalendar export back-end derives the summary from the
14958 headline, and derives the description from the body of the Org item.
14959 The ~org-icalendar-include-body~ variable limits the maximum number of
14960 characters of the content are turned into its description.
14962 The =TIMEZONE= property can be used to specify a per-entry time zone,
14963 and is applied to any entry with timestamp information. Time zones
14964 should be specified as per the IANA time zone database format, e.g.,
14965 =Asia/Almaty=. Alternately, the property value can be =UTC=, to force
14966 UTC time for this entry only.
14968 Exporting to iCalendar format depends in large part on the
14969 capabilities of the destination application. Some are more lenient
14970 than others. Consult the Org mode FAQ for advice on specific
14973 ** Other built-in back-ends
14975 :DESCRIPTION: Exporting to a man page.
14978 Other export back-ends included with Org are:
14980 - =ox-man.el=: Export to a man page.
14982 To activate such back-ends, either customize ~org-export-backends~ or
14983 load directly with ~(require 'ox-man)~. On successful load, the
14984 back-end adds new keys in the export dispatcher (see [[*The export
14987 Follow the comment section of such files, for example, =ox-man.el=,
14988 for usage and configuration details.
14990 ** Advanced configuration
14992 :DESCRIPTION: Fine-tuning the export output.
15000 #+vindex: org-export-before-processing-hook
15001 #+vindex: org-export-before-parsing-hook
15002 The export process executes two hooks before the actual exporting
15003 begins. The first hook, ~org-export-before-processing-hook~, runs
15004 before any expansions of macros, Babel code, and include keywords in
15005 the buffer. The second hook, ~org-export-before-parsing-hook~, runs
15006 before the buffer is parsed.
15008 Functions added to these hooks are called with a single argument: the
15009 export back-end actually used, as a symbol. You may use them for
15010 heavy duty structural modifications of the document. For example, you
15011 can remove every headline in the buffer during export like this:
15013 #+begin_src emacs-lisp
15014 (defun my-headline-removal (backend)
15015 "Remove all headlines in the current buffer.
15016 BACKEND is the export back-end being used, as a symbol."
15018 (lambda () (delete-region (point) (line-beginning-position 2)))))
15020 (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
15028 #+cindex: Filters, exporting
15029 Filters are lists of functions to be applied to certain parts for
15030 a given back-end. The output from the first function in the filter is
15031 passed on to the next function in the filter. The final output is the
15032 output from the final function in the filter.
15034 The Org export process has many filter sets applicable to different
15035 types of objects, plain text, parse trees, export options, and final
15036 output formats. The filters are named after the element type or
15037 object type: ~org-export-filter-TYPE-functions~, where {{{var(TYPE)}}}
15038 is the type targeted by the filter. Valid types are:
15040 #+attr_texinfo: :columns 0.33 0.33 0.33
15041 | body | bold | babel-call |
15042 | center-block | clock | code |
15043 | diary-sexp | drawer | dynamic-block |
15044 | entity | example-block | export-block |
15045 | export-snippet | final-output | fixed-width |
15046 | footnote-definition | footnote-reference | headline |
15047 | horizontal-rule | inline-babel-call | inline-src-block |
15048 | inlinetask | italic | item |
15049 | keyword | latex-environment | latex-fragment |
15050 | line-break | link | node-property |
15051 | options | paragraph | parse-tree |
15052 | plain-list | plain-text | planning |
15053 | property-drawer | quote-block | radio-target |
15054 | section | special-block | src-block |
15055 | statistics-cookie | strike-through | subscript |
15056 | superscript | table | table-cell |
15057 | table-row | target | timestamp |
15058 | underline | verbatim | verse-block |
15060 Here is an example filter that replaces non-breaking spaces ~Â ~ in the
15061 Org buffer with =~= for the LaTeX back-end.
15063 #+begin_src emacs-lisp
15064 (defun my-latex-filter-nobreaks (text backend info)
15065 "Ensure \"Â \" are properly handled in LaTeX export."
15066 (when (org-export-derived-backend-p backend 'latex)
15067 (replace-regexp-in-string "Â " "~" text)))
15069 (add-to-list 'org-export-filter-plain-text-functions
15070 'my-latex-filter-nobreaks)
15073 A filter requires three arguments: the code to be transformed, the
15074 name of the back-end, and some optional information about the export
15075 process. The third argument can be safely ignored. Note the use of
15076 ~org-export-derived-backend-p~ predicate that tests for /latex/
15077 back-end or any other back-end, such as /beamer/, derived from
15080 *** Defining filters for individual files
15085 The Org export can filter not just for back-ends, but also for
15086 specific files through the =BIND= keyword. Here is an example with
15087 two filters; one removes brackets from time stamps, and the other
15088 removes strike-through text. The filter functions are defined in
15089 a code block in the same Org file, which is a handy location for
15093 ,#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
15094 ,#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
15095 ,#+BEGIN_SRC emacs-lisp :exports results :results none
15096 (defun tmp-f-timestamp (s backend info)
15097 (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
15098 (defun tmp-f-strike-through (s backend info) "")
15102 *** Extending an existing back-end
15107 Some parts of the conversion process can be extended for certain
15108 elements so as to introduce a new or revised translation. That is how
15109 the HTML export back-end was extended to handle Markdown format. The
15110 extensions work seamlessly so any aspect of filtering not done by the
15111 extended back-end is handled by the original back-end. Of all the
15112 export customization in Org, extending is very powerful as it operates
15113 at the parser level.
15115 For this example, make the /ascii/ back-end display the language used
15116 in a source code block. Also make it display only when some attribute
15117 is non-~nil~, like the following:
15119 : #+ATTR_ASCII: :language t
15121 Then extend /ascii/ back-end with a custom "my-ascii" back-end.
15123 #+begin_src emacs-lisp
15124 (defun my-ascii-src-block (src-block contents info)
15125 "Transcode a SRC-BLOCK element from Org to ASCII.
15126 CONTENTS is nil. INFO is a plist used as a communication
15128 (if (not (org-export-read-attribute :attr_ascii src-block :language))
15129 (org-export-with-backend 'ascii src-block contents info)
15131 (format ",--[ %s ]--\n%s`----"
15132 (org-element-property :language src-block)
15133 (replace-regexp-in-string
15135 (org-element-normalize-string
15136 (org-export-format-code-default src-block info)))))))
15138 (org-export-define-derived-backend 'my-ascii 'ascii
15139 :translate-alist '((src-block . my-ascii-src-block)))
15142 The ~my-ascii-src-block~ function looks at the attribute above the
15143 current element. If not true, hands over to /ascii/ back-end. If
15144 true, which it is in this example, it creates a box around the code
15145 and leaves room for the inserting a string for language. The last
15146 form creates the new back-end that springs to action only when
15147 translating ~src-block~ type elements.
15149 To use the newly defined back-end, evaluate the following from an Org
15152 #+begin_src emacs-lisp
15153 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
15156 Further steps to consider would be an interactive function,
15157 self-installing an item in the export dispatcher menu, and other
15158 user-friendly improvements.
15160 ** Export in foreign buffers
15162 :DESCRIPTION: Author tables and lists in Org syntax.
15165 The export back-ends in Org often include commands to convert selected
15166 regions. A convenient feature of this in-place conversion is that the
15167 exported output replaces the original source. Here are such
15170 - ~org-html-convert-region-to-html~ ::
15172 #+findex: org-html-convert-region-to-html
15173 Convert the selected region into HTML.
15175 - ~org-latex-convert-region-to-latex~ ::
15177 #+findex: org-latex-convert-region-to-latex
15178 Convert the selected region into LaTeX.
15180 - ~org-texinfo-convert-region-to-texinfo~ ::
15182 #+findex: org-texinfo-convert-region-to-texinfo
15183 Convert the selected region into Texinfo.
15185 - ~org-md-convert-region-to-md~ ::
15187 #+findex: org-md-convert-region-to-md
15188 Convert the selected region into Markdown.
15190 In-place conversions are particularly handy for quick conversion of
15191 tables and lists in foreign buffers. For example, turn on the minor
15192 mode {{{kbd(M-x orgstruct-mode)}}} in an HTML buffer, then use the
15193 convenient Org keyboard commands to create a list, select it, and
15194 covert it to HTML with {{{kbd(M-x org-html-convert-region-to-html)}}}.
15198 :DESCRIPTION: Create a web site of linked Org files.
15200 #+cindex: publishing
15202 Org includes a publishing management system that allows you to
15203 configure automatic HTML conversion of /projects/ composed of
15204 interlinked org files. You can also configure Org to automatically
15205 upload your exported HTML pages and related attachments, such as
15206 images and source code files, to a web server.
15208 You can also use Org to convert files into PDF, or even combine HTML
15209 and PDF conversion so that files are available in both formats on the
15212 Publishing has been contributed to Org by David O'Toole.
15216 :DESCRIPTION: Defining projects.
15218 Publishing needs significant configuration to specify files,
15219 destination and many other properties of a project.
15221 *** The variable ~org-publish-project-alist~
15223 :DESCRIPTION: The central configuration variable.
15224 :ALT_TITLE: Project alist
15226 #+cindex: projects, for publishing
15228 #+cindex: org-publish-project-alist
15229 Publishing is configured almost entirely through setting the value of
15230 one variable, called ~org-publish-project-alist~. Each element of the
15231 list configures one project, and may be in one of the two following
15234 #+begin_src emacs-lisp
15235 ("project-name" :property value :property value ...)
15238 #+texinfo: @noindent
15239 i.e., a well-formed property list with alternating keys and values,
15242 #+begin_src emacs-lisp
15243 ("project-name" :components ("project-name" "project-name" ...))
15246 In both cases, projects are configured by specifying property values.
15247 A project defines the set of files that are to be published, as well
15248 as the publishing configuration to use when publishing those files.
15249 When a project takes the second form listed above, the individual
15250 members of the ~:components~ property are taken to be sub-projects,
15251 which group together files requiring different publishing options.
15252 When you publish such a "meta-project", all the components are also
15253 published, in the sequence given.
15255 *** Sources and destinations for files
15257 :DESCRIPTION: From here to there.
15258 :ALT_TITLE: Sources and destinations
15260 #+cindex: directories, for publishing
15262 Most properties are optional, but some should always be set. In
15263 particular, Org needs to know where to look for source files, and
15264 where to put published files.
15266 - ~:base-directory~ ::
15268 Directory containing publishing source files.
15270 - ~:publishing-directory~ ::
15272 Directory where output files are published. You can directly
15273 publish to a webserver using a file name syntax appropriate for
15274 the Emacs tramp package. Or you can publish to a local directory
15275 and use external tools to upload your website (see [[*Uploading
15278 - ~:preparation-function~ ::
15280 Function or list of functions to be called before starting the
15281 publishing process, for example, to run =make= for updating files
15282 to be published. Each preparation function is called with
15283 a single argument, the project property list.
15285 - ~:completion-function~ ::
15287 Function or list of functions called after finishing the
15288 publishing process, for example, to change permissions of the
15289 resulting files. Each completion function is called with
15290 a single argument, the project property list.
15292 *** Selecting files
15294 :DESCRIPTION: What files are part of the project?
15296 #+cindex: files, selecting for publishing
15298 By default, all files with extension =.org= in the base directory are
15299 considered part of the project. This can be modified by setting the
15300 following properties
15302 - ~:base-extension~ ::
15304 Extension -- without the dot -- of source files. This actually
15305 is a regular expression. Set this to the symbol ~any~ if you
15306 want to get all files in ~:base-directory~, even without
15311 Regular expression to match file names that should not be published,
15312 even though they have been selected on the basis of their extension.
15316 List of files to be included regardless of ~:base-extension~ and
15321 Non-~nil~ means, check base-directory recursively for files to
15324 *** Publishing action
15326 :DESCRIPTION: Setting the function doing the publishing.
15328 #+cindex: action, for publishing
15330 Publishing means that a file is copied to the destination directory
15331 and possibly transformed in the process. The default transformation
15332 is to export Org files as HTML files, and this is done by the function
15333 ~org-publish-org-to-html~ which calls the HTML exporter (see [[*HTML
15334 export]]). But you can also publish your content as PDF files using
15335 ~org-publish-org-to-pdf~, or as ASCII, Texinfo, etc., using the
15336 corresponding functions.
15338 If you want to publish the Org file as an =.org= file but with
15339 /archived/, /commented/, and /tag-excluded/ trees removed, use
15340 ~org-publish-org-to-org~. This produces =file.org= and put it in the
15341 publishing directory. If you want a htmlized version of this file,
15342 set the parameter ~:htmlized-source~ to ~t~. It produces
15343 =file.org.html= in the publishing directory[fn:130].
15345 Other files like images only need to be copied to the publishing
15346 destination; for this you can use ~org-publish-attachment~. For
15347 non-Org files, you always need to specify the publishing function:
15349 - ~:publishing-function~ ::
15351 Function executing the publication of a file. This may also be
15352 a list of functions, which are all called in turn.
15354 - ~:plain-source~ ::
15356 Non-~nil~ means, publish plain source.
15358 - ~:htmlized-source~ ::
15360 Non-~nil~ means, publish htmlized source.
15362 The function must accept three arguments: a property list containing
15363 at least a ~:publishing-directory~ property, the name of the file to
15364 be published, and the path to the publishing directory of the output
15365 file. It should take the specified file, make the necessary
15366 transformation, if any, and place the result into the destination
15369 *** Options for the exporters
15371 :DESCRIPTION: Tweaking HTML/@LaTeX{} export.
15372 :ALT_TITLE: Publishing options
15374 #+cindex: options, for publishing
15375 #+cindex: publishing options
15377 The property list can be used to set many export options for the HTML
15378 and LaTeX exporters. In most cases, these properties correspond to
15379 user variables in Org. The table below lists these properties along
15380 with the variable they belong to. See the documentation string for
15381 the respective variable for details.
15383 #+vindex: org-publish-project-alist
15384 When a property is given a value in ~org-publish-project-alist~, its
15385 setting overrides the value of the corresponding user variable, if
15386 any, during publishing. Options set within a file (see [[*Export
15387 settings]]), however, override everything.
15389 **** Generic properties
15394 | ~:archived-trees~ | ~org-export-with-archived-trees~ |
15395 | ~:exclude-tags~ | ~org-export-exclude-tags~ |
15396 | ~:headline-levels~ | ~org-export-headline-levels~ |
15397 | ~:language~ | ~org-export-default-language~ |
15398 | ~:preserve-breaks~ | ~org-export-preserve-breaks~ |
15399 | ~:section-numbers~ | ~org-export-with-section-numbers~ |
15400 | ~:select-tags~ | ~org-export-select-tags~ |
15401 | ~:with-author~ | ~org-export-with-author~ |
15402 | ~:with-broken-links~ | ~org-export-with-broken-links~ |
15403 | ~:with-clocks~ | ~org-export-with-clocks~ |
15404 | ~:with-creator~ | ~org-export-with-creator~ |
15405 | ~:with-date~ | ~org-export-with-date~ |
15406 | ~:with-drawers~ | ~org-export-with-drawers~ |
15407 | ~:with-email~ | ~org-export-with-email~ |
15408 | ~:with-emphasize~ | ~org-export-with-emphasize~ |
15409 | ~:with-fixed-width~ | ~org-export-with-fixed-width~ |
15410 | ~:with-footnotes~ | ~org-export-with-footnotes~ |
15411 | ~:with-latex~ | ~org-export-with-latex~ |
15412 | ~:with-planning~ | ~org-export-with-planning~ |
15413 | ~:with-priority~ | ~org-export-with-priority~ |
15414 | ~:with-properties~ | ~org-export-with-properties~ |
15415 | ~:with-special-strings~ | ~org-export-with-special-strings~ |
15416 | ~:with-sub-superscript~ | ~org-export-with-sub-superscripts~ |
15417 | ~:with-tables~ | ~org-export-with-tables~ |
15418 | ~:with-tags~ | ~org-export-with-tags~ |
15419 | ~:with-tasks~ | ~org-export-with-tasks~ |
15420 | ~:with-timestamps~ | ~org-export-with-timestamps~ |
15421 | ~:with-title~ | ~org-export-with-title~ |
15422 | ~:with-toc~ | ~org-export-with-toc~ |
15423 | ~:with-todo-keywords~ | ~org-export-with-todo-keywords~ |
15425 **** ASCII specific properties
15430 | ~:ascii-bullets~ | ~org-ascii-bullets~ |
15431 | ~:ascii-caption-above~ | ~org-ascii-caption-above~ |
15432 | ~:ascii-charset~ | ~org-ascii-charset~ |
15433 | ~:ascii-global-margin~ | ~org-ascii-global-margin~ |
15434 | ~:ascii-format-drawer-function~ | ~org-ascii-format-drawer-function~ |
15435 | ~:ascii-format-inlinetask-function~ | ~org-ascii-format-inlinetask-function~ |
15436 | ~:ascii-headline-spacing~ | ~org-ascii-headline-spacing~ |
15437 | ~:ascii-indented-line-width~ | ~org-ascii-indented-line-width~ |
15438 | ~:ascii-inlinetask-width~ | ~org-ascii-inlinetask-width~ |
15439 | ~:ascii-inner-margin~ | ~org-ascii-inner-margin~ |
15440 | ~:ascii-links-to-notes~ | ~org-ascii-links-to-notes~ |
15441 | ~:ascii-list-margin~ | ~org-ascii-list-margin~ |
15442 | ~:ascii-paragraph-spacing~ | ~org-ascii-paragraph-spacing~ |
15443 | ~:ascii-quote-margin~ | ~org-ascii-quote-margin~ |
15444 | ~:ascii-table-keep-all-vertical-lines~ | ~org-ascii-table-keep-all-vertical-lines~ |
15445 | ~:ascii-table-use-ascii-art~ | ~org-ascii-table-use-ascii-art~ |
15446 | ~:ascii-table-widen-columns~ | ~org-ascii-table-widen-columns~ |
15447 | ~:ascii-text-width~ | ~org-ascii-text-width~ |
15448 | ~:ascii-underline~ | ~org-ascii-underline~ |
15449 | ~:ascii-verbatim-format~ | ~org-ascii-verbatim-format~ |
15451 **** Beamer specific properties
15456 | ~:beamer-theme~ | ~org-beamer-theme~ |
15457 | ~:beamer-column-view-format~ | ~org-beamer-column-view-format~ |
15458 | ~:beamer-environments-extra~ | ~org-beamer-environments-extra~ |
15459 | ~:beamer-frame-default-options~ | ~org-beamer-frame-default-options~ |
15460 | ~:beamer-outline-frame-options~ | ~org-beamer-outline-frame-options~ |
15461 | ~:beamer-outline-frame-title~ | ~org-beamer-outline-frame-title~ |
15462 | ~:beamer-subtitle-format~ | ~org-beamer-subtitle-format~ |
15464 **** HTML specific properties
15469 | ~:html-allow-name-attribute-in-anchors~ | ~org-html-allow-name-attribute-in-anchors~ |
15470 | ~:html-checkbox-type~ | ~org-html-checkbox-type~ |
15471 | ~:html-container~ | ~org-html-container-element~ |
15472 | ~:html-divs~ | ~org-html-divs~ |
15473 | ~:html-doctype~ | ~org-html-doctype~ |
15474 | ~:html-extension~ | ~org-html-extension~ |
15475 | ~:html-footnote-format~ | ~org-html-footnote-format~ |
15476 | ~:html-footnote-separator~ | ~org-html-footnote-separator~ |
15477 | ~:html-footnotes-section~ | ~org-html-footnotes-section~ |
15478 | ~:html-format-drawer-function~ | ~org-html-format-drawer-function~ |
15479 | ~:html-format-headline-function~ | ~org-html-format-headline-function~ |
15480 | ~:html-format-inlinetask-function~ | ~org-html-format-inlinetask-function~ |
15481 | ~:html-head-extra~ | ~org-html-head-extra~ |
15482 | ~:html-head-include-default-style~ | ~org-html-head-include-default-style~ |
15483 | ~:html-head-include-scripts~ | ~org-html-head-include-scripts~ |
15484 | ~:html-head~ | ~org-html-head~ |
15485 | ~:html-home/up-format~ | ~org-html-home/up-format~ |
15486 | ~:html-html5-fancy~ | ~org-html-html5-fancy~ |
15487 | ~:html-indent~ | ~org-html-indent~ |
15488 | ~:html-infojs-options~ | ~org-html-infojs-options~ |
15489 | ~:html-infojs-template~ | ~org-html-infojs-template~ |
15490 | ~:html-inline-image-rules~ | ~org-html-inline-image-rules~ |
15491 | ~:html-inline-images~ | ~org-html-inline-images~ |
15492 | ~:html-link-home~ | ~org-html-link-home~ |
15493 | ~:html-link-org-files-as-html~ | ~org-html-link-org-files-as-html~ |
15494 | ~:html-link-up~ | ~org-html-link-up~ |
15495 | ~:html-link-use-abs-url~ | ~org-html-link-use-abs-url~ |
15496 | ~:html-mathjax-options~ | ~org-html-mathjax-options~ |
15497 | ~:html-mathjax-template~ | ~org-html-mathjax-template~ |
15498 | ~:html-metadata-timestamp-format~ | ~org-html-metadata-timestamp-format~ |
15499 | ~:html-postamble-format~ | ~org-html-postamble-format~ |
15500 | ~:html-postamble~ | ~org-html-postamble~ |
15501 | ~:html-preamble-format~ | ~org-html-preamble-format~ |
15502 | ~:html-preamble~ | ~org-html-preamble~ |
15503 | ~:html-table-align-individual-field~ | ~de{org-html-table-align-individual-fields~ |
15504 | ~:html-table-attributes~ | ~org-html-table-default-attributes~ |
15505 | ~:html-table-caption-above~ | ~org-html-table-caption-above~ |
15506 | ~:html-table-data-tags~ | ~org-html-table-data-tags~ |
15507 | ~:html-table-header-tags~ | ~org-html-table-header-tags~ |
15508 | ~:html-table-row-tags~ | ~org-html-table-row-tags~ |
15509 | ~:html-table-use-header-tags-for-first-column~ | ~org-html-table-use-header-tags-for-first-column~ |
15510 | ~:html-tag-class-prefix~ | ~org-html-tag-class-prefix~ |
15511 | ~:html-text-markup-alist~ | ~org-html-text-markup-alist~ |
15512 | ~:html-todo-kwd-class-prefix~ | ~org-html-todo-kwd-class-prefix~ |
15513 | ~:html-toplevel-hlevel~ | ~org-html-toplevel-hlevel~ |
15514 | ~:html-use-infojs~ | ~org-html-use-infojs~ |
15515 | ~:html-validation-link~ | ~org-html-validation-link~ |
15516 | ~:html-viewport~ | ~org-html-viewport~ |
15517 | ~:html-xml-declaration~ | ~org-html-xml-declaration~ |
15519 **** LaTeX specific properties
15524 | ~:latex-active-timestamp-format~ | ~org-latex-active-timestamp-format~ |
15525 | ~:latex-caption-above~ | ~org-latex-caption-above~ |
15526 | ~:latex-classes~ | ~org-latex-classes~ |
15527 | ~:latex-class~ | ~org-latex-default-class~ |
15528 | ~:latex-compiler~ | ~org-latex-compiler~ |
15529 | ~:latex-default-figure-position~ | ~org-latex-default-figure-position~ |
15530 | ~:latex-default-table-environment~ | ~org-latex-default-table-environment~ |
15531 | ~:latex-default-table-mode~ | ~org-latex-default-table-mode~ |
15532 | ~:latex-diary-timestamp-format~ | ~org-latex-diary-timestamp-format~ |
15533 | ~:latex-footnote-defined-format~ | ~org-latex-footnote-defined-format~ |
15534 | ~:latex-footnote-separator~ | ~org-latex-footnote-separator~ |
15535 | ~:latex-format-drawer-function~ | ~org-latex-format-drawer-function~ |
15536 | ~:latex-format-headline-function~ | ~org-latex-format-headline-function~ |
15537 | ~:latex-format-inlinetask-function~ | ~org-latex-format-inlinetask-function~ |
15538 | ~:latex-hyperref-template~ | ~org-latex-hyperref-template~ |
15539 | ~:latex-image-default-height~ | ~org-latex-image-default-height~ |
15540 | ~:latex-image-default-option~ | ~org-latex-image-default-option~ |
15541 | ~:latex-image-default-width~ | ~org-latex-image-default-width~ |
15542 | ~:latex-images-centered~ | ~org-latex-images-centered~ |
15543 | ~:latex-inactive-timestamp-format~ | ~org-latex-inactive-timestamp-format~ |
15544 | ~:latex-inline-image-rules~ | ~org-latex-inline-image-rules~ |
15545 | ~:latex-link-with-unknown-path-format~ | ~org-latex-link-with-unknown-path-format~ |
15546 | ~:latex-listings-langs~ | ~org-latex-listings-langs~ |
15547 | ~:latex-listings-options~ | ~org-latex-listings-options~ |
15548 | ~:latex-listings~ | ~org-latex-listings~ |
15549 | ~:latex-minted-langs~ | ~org-latex-minted-langs~ |
15550 | ~:latex-minted-options~ | ~org-latex-minted-options~ |
15551 | ~:latex-prefer-user-labels~ | ~org-latex-prefer-user-labels~ |
15552 | ~:latex-subtitle-format~ | ~org-latex-subtitle-format~ |
15553 | ~:latex-subtitle-separate~ | ~org-latex-subtitle-separate~ |
15554 | ~:latex-table-scientific-notation~ | ~org-latex-table-scientific-notation~ |
15555 | ~:latex-tables-booktabs~ | ~org-latex-tables-booktabs~ |
15556 | ~:latex-tables-centered~ | ~org-latex-tables-centered~ |
15557 | ~:latex-text-markup-alist~ | ~org-latex-text-markup-alist~ |
15558 | ~:latex-title-command~ | ~org-latex-title-command~ |
15559 | ~:latex-toc-command~ | ~org-latex-toc-command~ |
15561 **** Markdown specific properties
15566 | ~:md-footnote-format~ | ~org-md-footnote-format~ |
15567 | ~:md-footnotes-section~ | ~org-md-footnotes-section~ |
15568 | ~:md-headline-style~ | ~org-md-headline-style~ |
15570 **** ODT specific properties
15575 | ~:odt-content-template-file~ | ~org-odt-content-template-file~ |
15576 | ~:odt-display-outline-level~ | ~org-odt-display-outline-level~ |
15577 | ~:odt-fontify-srcblocks~ | ~org-odt-fontify-srcblocks~ |
15578 | ~:odt-format-drawer-function~ | ~org-odt-format-drawer-function~ |
15579 | ~:odt-format-headline-function~ | ~org-odt-format-headline-function~ |
15580 | ~:odt-format-inlinetask-function~ | ~org-odt-format-inlinetask-function~ |
15581 | ~:odt-inline-formula-rules~ | ~org-odt-inline-formula-rules~ |
15582 | ~:odt-inline-image-rules~ | ~org-odt-inline-image-rules~ |
15583 | ~:odt-pixels-per-inch~ | ~org-odt-pixels-per-inch~ |
15584 | ~:odt-styles-file~ | ~org-odt-styles-file~ |
15585 | ~:odt-table-styles~ | ~org-odt-table-styles~ |
15586 | ~:odt-use-date-fields~ | ~org-odt-use-date-fields~ |
15588 **** Texinfo specific properties
15593 | ~:texinfo-active-timestamp-format~ | ~org-texinfo-active-timestamp-format~ |
15594 | ~:texinfo-classes~ | ~org-texinfo-classes~ |
15595 | ~:texinfo-class~ | ~org-texinfo-default-class~ |
15596 | ~:texinfo-table-default-markup~ | ~org-texinfo-table-default-markup~ |
15597 | ~:texinfo-diary-timestamp-format~ | ~org-texinfo-diary-timestamp-format~ |
15598 | ~:texinfo-filename~ | ~org-texinfo-filename~ |
15599 | ~:texinfo-format-drawer-function~ | ~org-texinfo-format-drawer-function~ |
15600 | ~:texinfo-format-headline-function~ | ~org-texinfo-format-headline-function~ |
15601 | ~:texinfo-format-inlinetask-function~ | ~org-texinfo-format-inlinetask-function~ |
15602 | ~:texinfo-inactive-timestamp-format~ | ~org-texinfo-inactive-timestamp-format~ |
15603 | ~:texinfo-link-with-unknown-path-format~ | ~org-texinfo-link-with-unknown-path-format~ |
15604 | ~:texinfo-node-description-column~ | ~org-texinfo-node-description-column~ |
15605 | ~:texinfo-table-scientific-notation~ | ~org-texinfo-table-scientific-notation~ |
15606 | ~:texinfo-tables-verbatim~ | ~org-texinfo-tables-verbatim~ |
15607 | ~:texinfo-text-markup-alist~ | ~org-texinfo-text-markup-alist~ |
15609 *** Publishing links
15611 :DESCRIPTION: Which links keep working after publishing?
15613 #+cindex: links, publishing
15615 To create a link from one Org file to another, you would use something
15616 like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see [[*External links]]). When
15617 published, this link becomes a link to =foo.html=. You can thus
15618 interlink the pages of your "Org web" project and the links will work
15619 as expected when you publish them to HTML. If you also publish the
15620 Org source file and want to link to it, use an =http= link instead of
15621 a =file:= link, because =file= links are converted to link to the
15622 corresponding =.html= file.
15624 You may also link to related files, such as images. Provided you are
15625 careful with relative file names, and provided you have also
15626 configured Org to upload the related files, these links will work too.
15627 See [[*Example: complex publishing configuration]], for an example of this
15630 Eventually, links between published documents can contain some search
15631 options (see [[*Search options in file links]]), which will be resolved to
15632 the appropriate location in the linked file. For example, once
15633 published to HTML, the following links all point to a dedicated anchor
15637 [[file:foo.org::*heading]]
15638 [[file:foo.org::#custom-id]]
15639 [[file:foo.org::target]]
15642 *** Generating a sitemap
15644 :DESCRIPTION: Generating a list of all pages.
15645 :ALT_TITLE: Site map
15647 #+cindex: sitemap, of published pages
15649 The following properties may be used to control publishing of
15650 a map of files for a given project.
15652 - ~:auto-sitemap~ ::
15654 When non-~nil~, publish a sitemap during
15655 ~org-publish-current-project~ or ~org-publish-all~.
15657 - ~:sitemap-filename~ ::
15659 Filename for output of sitemap. Defaults to =sitemap.org=, which
15660 becomes =sitemap.html=.
15662 - ~:sitemap-title~ ::
15664 Title of sitemap page. Defaults to name of file.
15666 - ~:sitemap-format-entry~ ::
15668 #+findex: org-publish-find-date
15669 #+findex: org-publish-find-property
15670 #+findex: org-publish-find-title
15671 With this option one can tell how a site-map entry is formatted
15672 in the site-map. It is a function called with three arguments:
15673 the file or directory name relative to base directory of the
15674 project, the site-map style and the current project. It is
15675 expected to return a string. Default value turns file names into
15676 links and use document titles as descriptions. For specific
15677 formatting needs, one can use ~org-publish-find-date~,
15678 ~org-publish-find-title~ and ~org-publish-find-property~, to
15679 retrieve additional information about published documents.
15681 - ~:sitemap-function~ ::
15683 Plug-in function to use for generation of the sitemap. It is
15684 called with two arguments: the title of the site-map and
15685 a representation of the files and directories involved in the
15686 project as a nested list, which can further be transformed using
15687 ~org-list-to-generic~, ~org-list-to-subtree~ and alike. Default
15688 value generates a plain list of links to all files in the
15691 - ~:sitemap-sort-folders~ ::
15693 Where folders should appear in the sitemap. Set this to ~first~
15694 (default) or ~last~ to display folders first or last,
15695 respectively. When set to ~ignore~, folders are ignored
15696 altogether. Any other value mixes files and folders. This
15697 variable has no effect when site-map style is ~tree~.
15699 - ~:sitemap-sort-files~ ::
15701 How the files are sorted in the site map. Set this to
15702 ~alphabetically~ (default), ~chronologically~ or
15703 ~anti-chronologically~. ~chronologically~ sorts the files with
15704 older date first while ~anti-chronologically~ sorts the files
15705 with newer date first. ~alphabetically~ sorts the files
15706 alphabetically. The date of a file is retrieved with
15707 ~org-publish-find-date~.
15709 - ~:sitemap-ignore-case~ ::
15711 Should sorting be case-sensitive? Default ~nil~.
15713 - ~:sitemap-file-entry-format~ ::
15715 With this option one can tell how a sitemap's entry is formatted
15716 in the sitemap. This is a format string with some escape
15717 sequences: ~%t~ stands for the title of the file, ~%a~ stands for
15718 the author of the file and ~%d~ stands for the date of the file.
15719 The date is retrieved with the ~org-publish-find-date~ function
15720 and formatted with ~org-publish-sitemap-date-format~. Default
15723 - ~:sitemap-date-format~ ::
15725 Format string for the ~format-time-string~ function that tells
15726 how a sitemap entry's date is to be formatted. This property
15727 bypasses ~org-publish-sitemap-date-format~ which defaults to
15730 *** Generating an index
15732 :DESCRIPTION: An index that reaches across pages.
15734 #+cindex: index, in a publishing project
15736 Org mode can generate an index across the files of a publishing project.
15740 When non-~nil~, generate in index in the file =theindex.org= and
15741 publish it as =theindex.html=.
15743 The file is created when first publishing a project with the
15744 ~:makeindex~ set. The file only contains a statement =#+INCLUDE:
15745 "theindex.inc"=. You can then build around this include statement by
15746 adding a title, style information, etc.
15748 #+cindex: INDEX, keyword
15749 Index entries are specified with =INDEX= keyword. An entry that
15750 contains an exclamation mark creates a sub item.
15753 ,*** Curriculum Vitae
15755 ,#+INDEX: Application!CV
15760 :DESCRIPTION: How to get files up on the server.
15765 For those people already utilizing third party sync tools such as
15766 Rsync or Unison, it might be preferable not to use the built-in remote
15767 publishing facilities of Org mode which rely heavily on Tramp. Tramp,
15768 while very useful and powerful, tends not to be so efficient for
15769 multiple file transfer and has been known to cause problems under
15772 Specialized synchronization utilities offer several advantages. In
15773 addition to timestamp comparison, they also do content and
15774 permissions/attribute checks. For this reason you might prefer to
15775 publish your web to a local directory -- possibly even /in place/ with
15776 your Org files -- and then use Unison or Rsync to do the
15777 synchronization with the remote host.
15779 Since Unison, for example, can be configured as to which files to
15780 transfer to a certain remote destination, it can greatly simplify the
15781 project publishing definition. Simply keep all files in the correct
15782 location, process your Org files with ~org-publish~ and let the
15783 synchronization tool do the rest. You do not need, in this scenario,
15784 to include attachments such as JPG, CSS or PNG files in the project
15785 definition since the third-party tool syncs them.
15787 Publishing to a local directory is also much faster than to a remote
15788 one, so that you can afford more easily to republish entire projects.
15789 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
15790 main benefit of re-including any changed external files such as source
15791 example files you might include with =INCLUDE= keyword. The timestamp
15792 mechanism in Org is not smart enough to detect if included files have
15795 ** Sample configuration
15797 :DESCRIPTION: Example projects.
15800 Below we provide two example configurations. The first one is
15801 a simple project publishing only a set of Org files. The second
15802 example is more complex, with a multi-component project.
15804 *** Example: simple publishing configuration
15806 :DESCRIPTION: One-component publishing.
15807 :ALT_TITLE: Simple example
15810 This example publishes a set of Org files to the =public_html=
15811 directory on the local machine.
15813 #+begin_src emacs-lisp
15814 (setq org-publish-project-alist
15816 :base-directory "~/org/"
15817 :publishing-directory "~/public_html"
15818 :section-numbers nil
15819 :table-of-contents nil
15820 :style "<link rel=\"stylesheet\"
15821 href=\"../other/mystyle.css\"
15822 type=\"text/css\"/>")))
15825 *** Example: complex publishing configuration
15827 :DESCRIPTION: A multi-component publishing example.
15828 :ALT_TITLE: Complex example
15831 This more complicated example publishes an entire website, including
15832 Org files converted to HTML, image files, Emacs Lisp source code, and
15833 style sheets. The publishing directory is remote and private files
15836 To ensure that links are preserved, care should be taken to replicate
15837 your directory structure on the web server, and to use relative file
15838 paths. For example, if your Org files are kept in =~/org/= and your
15839 publishable images in =~/images/=, you would link to an image with
15841 : file:../images/myimage.png
15843 On the web server, the relative path to the image should be the same.
15844 You can accomplish this by setting up an =images/= folder in the right
15845 place on the web server, and publishing images to it.
15847 #+begin_src emacs-lisp
15848 (setq org-publish-project-alist
15850 :base-directory "~/org/"
15851 :base-extension "org"
15852 :publishing-directory "/ssh:user@host:~/html/notebook/"
15853 :publishing-function org-html-publish-to-html
15854 :exclude "PrivatePage.org" ;; regexp
15856 :section-numbers nil
15858 :html-head "<link rel=\"stylesheet\"
15859 href=\"../other/mystyle.css\" type=\"text/css\"/>"
15863 :base-directory "~/images/"
15864 :base-extension "jpg\\|gif\\|png"
15865 :publishing-directory "/ssh:user@host:~/html/images/"
15866 :publishing-function org-publish-attachment)
15869 :base-directory "~/other/"
15870 :base-extension "css\\|el"
15871 :publishing-directory "/ssh:user@host:~/html/other/"
15872 :publishing-function org-publish-attachment)
15873 ("website" :components ("orgfiles" "images" "other"))))
15876 ** Triggering publication
15878 :DESCRIPTION: Publication commands.
15881 Once properly configured, Org can publish with the following commands:
15883 - {{{kbd(C-c C-e X)}}} (~org-publish~) ::
15885 #+kindex: C-c C-e X
15886 #+findex: org-publish
15887 Prompt for a specific project and publish all files that belong
15890 - {{{kbd(C-c C-e P)}}} (~org-publish-current-project~) ::
15892 #+kindex: C-c C-e P
15893 #+findex: org-publish-current-project
15894 Publish the project containing the current file.
15896 - {{{kbd(C-c C-e F)}}} (~org-publish-current-file~) ::
15898 #+kindex: C-c C-e F
15899 #+findex: org-publish-current-file
15900 Publish only the current file.
15902 - {{{kbd(C-c C-e E)}}} (~org-publish-all~) ::
15904 #+kindex: C-c C-e E
15905 #+findex: org-publish-all
15906 Publish every project.
15908 #+vindex: org-publish-use-timestamps-flag
15909 Org uses timestamps to track when a file has changed. The above
15910 functions normally only publish changed files. You can override this
15911 and force publishing of all files by giving a prefix argument to any
15912 of the commands above, or by customizing the variable
15913 ~org-publish-use-timestamps-flag~. This may be necessary in
15914 particular if files include other files via =SETUPFILE= or =INCLUDE=
15917 * Working with source code
15919 :DESCRIPTION: Export, evaluate, and tangle code blocks.
15921 #+cindex: source code, working with
15923 Source code here refers to any plain text collection of computer
15924 instructions, possibly with comments, written using a human-readable
15925 programming language. Org can manage source code in an Org document
15926 when the source code is identified with begin and end markers.
15927 Working with source code begins with identifying source code blocks.
15928 A source code block can be placed almost anywhere in an Org document;
15929 it is not restricted to the preamble or the end of the document.
15930 However, Org cannot manage a source code block if it is placed inside
15931 an Org comment or within a fixed width section.
15933 Here is an example source code block in the Emacs Lisp language:
15936 ,#+BEGIN_SRC emacs-lisp
15937 (defun org-xor (a b)
15943 Org can manage the source code in the block delimited by =#+BEGIN_SRC=
15944 ... =#+END_SRC= in several ways that can simplify housekeeping tasks
15945 essential to modern source code maintenance. Org can edit, format,
15946 extract, export, and publish source code blocks. Org can also compile
15947 and execute a source code block, then capture the results. The Org
15948 mode literature sometimes refers to source code blocks as /live code/
15949 blocks because they can alter the content of the Org document or the
15950 material that it exports. Users can control how live they want each
15951 source code block by tweaking the header arguments (see [[*Using
15952 header arguments]]) for compiling, execution, extraction, and
15955 Source code blocks are one of many Org block types, which also include
15956 =quote=, =export=, =verse=, =latex=, =example=, and =verbatim=. This
15957 section pertains to blocks between =#+BEGIN_SRC= and =#+END_SRC=.
15959 For editing and formatting a source code block, Org uses an
15960 appropriate Emacs major mode that includes features specifically
15961 designed for source code in that language.
15963 Org can extract one or more source code blocks and write them to one
15964 or more source files---a process known as /tangling/ in literate
15965 programming terminology.
15967 For exporting and publishing, Org's back-ends can format a source code
15968 block appropriately, often with native syntax highlighting.
15970 For executing and compiling a source code block, the user can
15971 configure Org to select the appropriate compiler. Org provides
15972 facilities to collect the result of the execution or compiler output,
15973 insert it into the Org document, and/or export it. In addition to
15974 text results, Org can insert links to other data types, including
15975 audio, video, and graphics. Org can also link a compiler error
15976 message to the appropriate line in the source code block.
15978 An important feature of Org's management of source code blocks is the
15979 ability to pass variables, functions, and results to one another using
15980 a common syntax for source code blocks in any language. Although most
15981 literate programming facilities are restricted to one language or
15982 another, Org's language-agnostic approach lets the literate programmer
15983 match each programming task with the appropriate computer language and
15984 to mix them all together in a single Org document. This
15985 interoperability among languages explains why Org's source code
15986 management facility was named /Org Babel/ by its originators, Eric
15987 Schulte and Dan Davison.
15989 Org mode fulfills the promise of easy verification and maintenance of
15990 publishing reproducible research by keeping text, data, code,
15991 configuration settings of the execution environment, the results of
15992 the execution, and associated narratives, claims, references, and
15993 internal and external links in a single Org document.
15995 Details of Org's facilities for working with source code are described
15996 in the following sections.
15998 ** Structure of code blocks
16000 :DESCRIPTION: Code block syntax described.
16002 #+cindex: code block, structure
16003 #+cindex: source code, block structure
16004 #+cindex: NAME keyword, in source blocks
16005 #+cindex: BEGIN_SRC
16007 Org offers two ways to structure source code in Org documents: in
16008 a source code block, and directly inline. Both specifications are
16011 A source code block conforms to this structure:
16015 ,#+BEGIN_SRC <language> <switches> <header arguments>
16020 Do not be put-off by having to remember the source block syntax. Org
16021 mode offers a command for wrapping existing text in a block (see
16022 [[*Structure templates]]). Org also works with other completion systems
16023 in Emacs, some of which predate Org and have custom domain-specific
16024 languages for defining templates. Regular use of templates reduces
16025 errors, increases accuracy, and maintains consistency.
16027 #+cindex: source code, inline
16028 An inline code block conforms to this structure:
16030 : src_<language>{<body>}
16032 #+texinfo: @noindent
16035 : src_<language>[<header arguments>]{<body>}
16037 - =#+NAME: <name>= ::
16039 Optional. Names the source block so it can be called, like
16040 a function, from other source blocks or inline code to evaluate
16041 or to capture the results. Code from other blocks, other files,
16042 and from table formulas (see [[*The spreadsheet]]) can use the name
16043 to reference a source block. This naming serves the same purpose
16044 as naming Org tables. Org mode requires unique names. For
16045 duplicate names, Org mode's behavior is undefined.
16047 - =#+BEGIN_SRC= ... =#+END_SRC= ::
16049 Mandatory. They mark the start and end of a block that Org
16050 requires. The =#+BEGIN_SRC= line takes additional arguments, as
16055 #+cindex: language, in code blocks
16056 Mandatory. It is the identifier of the source code language in
16057 the block. See [[*Languages]], for identifiers of supported
16062 #+cindex: switches, in code blocks
16063 Optional. Switches provide finer control of the code execution,
16064 export, and format (see the discussion of switches in [[*Literal
16067 - =<header arguments>= ::
16069 #+cindex: header arguments, in code blocks
16070 Optional. Heading arguments control many aspects of evaluation,
16071 export and tangling of code blocks (see [[*Using header arguments]]).
16072 Using Org's properties feature, header arguments can be
16073 selectively applied to the entire buffer or specific sub-trees of
16078 Source code in the dialect of the specified language identifier.
16080 ** Using header arguments
16082 :DESCRIPTION: Different ways to set header arguments.
16085 Org comes with many header arguments common to all languages. New
16086 header arguments are added for specific languages as they become
16087 available for use in source code blocks. A header argument is
16088 specified with an initial colon followed by the argument's name in
16091 Since header arguments can be set in several ways, Org prioritizes
16092 them in case of overlaps or conflicts by giving local settings
16093 a higher priority. Header values in function calls, for example,
16094 override header values from global defaults.
16096 *** System-wide header arguments
16100 #+vindex: org-babel-default-header-args
16102 #+vindex: org-babel-default-header-args
16103 System-wide values of header arguments can be specified by customizing
16104 the ~org-babel-default-header-args~ variable, which defaults to the
16109 :results => "replace"
16115 The example below sets =:noweb= header arguments to =yes=, which makes
16116 Org expand =:noweb= references by default.
16118 #+begin_src emacs-lisp
16119 (setq org-babel-default-header-args
16120 (cons '(:noweb . "yes")
16121 (assq-delete-all :noweb org-babel-default-header-args)))
16124 #+cindex: language specific default header arguments
16125 #+cindex: default header arguments per language
16126 Each language can have separate default header arguments by
16127 customizing the variable ~org-babel-default-header-args:<LANG>~, where
16128 {{{var(<LANG>)}}} is the name of the language. For details, see the
16129 language-specific online documentation at
16130 http://orgmode.org/worg/org-contrib/babel.
16132 *** Header arguments in Org mode properties
16137 For header arguments applicable to the buffer, use =PROPERTY= keyword
16138 anywhere in the Org file (see [[*Property syntax]]).
16140 The following example makes all the R code blocks execute in the same
16141 session. Setting =:results= to =silent= ignores the results of
16142 executions for all blocks, not just R code blocks; no results inserted
16146 ,#+PROPERTY: header-args:R :session *R*
16147 ,#+PROPERTY: header-args :results silent
16150 #+vindex: org-use-property-inheritance
16151 Header arguments set through Org's property drawers (see [[*Property
16152 syntax]]) apply at the sub-tree level on down. Since these property
16153 drawers can appear anywhere in the file hierarchy, Org uses outermost
16154 call or source block to resolve the values. Org ignores
16155 ~org-use-property-inheritance~ setting.
16157 In this example, =:cache= defaults to =yes= for all code blocks in the
16163 :header-args: :cache yes
16167 #+kindex: C-c C-x p
16168 #+findex: org-set-property
16169 Properties defined through ~org-set-property~ function, bound to
16170 {{{kbd(C-c C-x p)}}}, apply to all active languages. They override
16171 properties set in ~org-babel-default-header-args~.
16173 #+cindex: language specific header arguments properties
16174 #+cindex: header arguments per language
16175 Language-specific header arguments are also read from properties
16176 =header-args:<LANG>= where {{{var(<LANG>)}}} is the language
16177 identifier. For example,
16182 :header-args:clojure: :session *clojure-1*
16183 :header-args:R: :session *R*
16187 :header-args:clojure: :session *clojure-2*
16191 #+texinfo: @noindent
16192 would force separate sessions for Clojure blocks in =Heading= and
16193 =Subheading=, but use the same session for all R blocks. Blocks in
16194 =Subheading= inherit settings from =Heading=.
16196 *** Code block specific header arguments
16201 Header arguments are most commonly set at the source code block level,
16202 on the =#+BEGIN_SRC= line. Arguments set at this level take
16203 precedence over those set in the ~org-babel-default-header-args~
16204 variable, and also those set as header properties.
16206 In the following example, setting =:results= to =silent= makes it
16207 ignore results of the code execution. Setting =:exports= to =code=
16208 exports only the body of the code block to HTML or LaTeX.
16212 ,#+BEGIN_SRC haskell :results silent :exports code :var n=0
16214 fac n = n * fac (n-1)
16218 The same header arguments in an inline code block:
16220 : src_haskell[:exports both]{fac 5}
16222 #+cindex: HEADER, keyword
16223 Code block header arguments can span multiple lines using =#+HEADER:=
16224 on each line. Note that Org currently accepts the plural spelling of
16225 =#+HEADER:= only as a convenience for backward-compatibility. It may
16226 be removed at some point.
16228 Multi-line header arguments on an unnamed code block:
16231 ,#+HEADER: :var data1=1
16232 ,#+BEGIN_SRC emacs-lisp :var data2=2
16233 (message "data1:%S, data2:%S" data1 data2)
16240 Multi-line header arguments on a named code block:
16243 ,#+NAME: named-block
16244 ,#+HEADER: :var data=2
16245 ,#+BEGIN_SRC emacs-lisp
16246 (message "data:%S" data)
16249 ,#+RESULTS: named-block
16253 *** Header arguments in function calls
16258 Header arguments in function calls are the most specific and override
16259 all other settings in case of an overlap. They get the highest
16260 priority. Two =#+CALL:= examples are shown below. For the complete
16261 syntax of =CALL= keyword, see [[*Evaluating code blocks]].
16263 In this example, =:exports results= header argument is applied to the
16264 evaluation of the =#+CALL:= line.
16266 : #+CALL: factorial(n=5) :exports results
16268 In this example, =:session special= header argument is applied to the
16269 evaluation of =factorial= code block.
16271 : #+CALL: factorial[:session special](n=5)
16273 ** Environment of a code block
16275 :DESCRIPTION: Arguments, sessions, working directory...
16278 *** Passing arguments
16283 #+cindex: passing arguments to code blocks
16284 #+cindex: arguments, in code blocks
16285 #+cindex: @samp{var}, header argument
16286 Use =var= for passing arguments to source code blocks. The specifics
16287 of variables in code blocks vary by the source language and are
16288 covered in the language-specific documentation. The syntax for =var=,
16289 however, is the same for all languages. This includes declaring
16290 a variable, and assigning a default value.
16292 The following syntax is used to pass arguments to code blocks using
16293 the =var= header argument.
16297 #+texinfo: @noindent
16298 {{{var(NAME)}}} is the name of the variable bound in the code block
16299 body. {{{var(ASSIGN)}}} is a literal value, such as a string,
16300 a number, a reference to a table, a list, a literal example, another
16301 code block -- with or without arguments --, or the results of
16302 evaluating a code block.
16304 Here are examples of passing values by reference:
16308 A table named with a =NAME= keyword.
16311 ,#+NAME: example-table
16317 ,#+NAME: table-length
16318 ,#+BEGIN_SRC emacs-lisp :var table=example-table
16322 ,#+RESULTS: table-length
16326 When passing a table, you can treat specially the row, or the
16327 column, containing labels for the columns, or the rows, in the
16330 #+cindex: @samp{colnames}, header argument
16331 The =colnames= header argument accepts =yes=, =no=, or =nil=
16332 values. The default value is =nil=: if an input table has column
16333 names -- because the second row is a horizontal rule --, then Org
16334 removes the column names, processes the table, puts back the
16335 column names, and then writes the table to the results block.
16336 Using =yes=, Org does the same to the first row, even if the
16337 initial table does not contain any horizontal rule. When set to
16338 =no=, Org does not pre-process column names at all.
16347 ,#+BEGIN_SRC python :var tab=less-cols :colnames nil
16348 return [[val + '*' for val in row] for row in tab]
16358 #+cindex: @samp{rownames}, header argument
16359 Similarly, the =rownames= header argument can take two values:
16360 =yes= or =no=. When set to =yes=, Org removes the first column,
16361 processes the table, puts back the first column, and then writes
16362 the table to the results block. The default is =no=, which means
16363 Org does not pre-process the first column. Note that Emacs Lisp
16364 code blocks ignore =rownames= header argument because of the ease
16365 of table-handling in Emacs.
16368 ,#+NAME: with-rownames
16369 | one | 1 | 2 | 3 | 4 | 5 |
16370 | two | 6 | 7 | 8 | 9 | 10 |
16372 ,#+BEGIN_SRC python :var tab=with-rownames :rownames yes
16373 return [[val + 10 for val in row] for row in tab]
16377 | one | 11 | 12 | 13 | 14 | 15 |
16378 | two | 16 | 17 | 18 | 19 | 20 |
16383 A simple named list.
16386 ,#+NAME: example-list
16392 ,#+BEGIN_SRC emacs-lisp :var x=example-list
16400 Note that only the top level list items are passed along. Nested
16401 list items are ignored.
16403 - code block without arguments ::
16405 A code block name, as assigned by =NAME= keyword from the example
16406 above, optionally followed by parentheses.
16409 ,#+BEGIN_SRC emacs-lisp :var length=table-length()
16417 - code block with arguments ::
16419 A code block name, as assigned by =NAME= keyword, followed by
16420 parentheses and optional arguments passed within the parentheses.
16424 ,#+BEGIN_SRC emacs-lisp :var input=8
16432 ,#+BEGIN_SRC emacs-lisp :var input=double(input=1)
16436 ,#+RESULTS: squared
16440 - literal example ::
16442 A literal example block named with a =NAME= keyword.
16445 ,#+NAME: literal-example
16451 ,#+NAME: read-literal-example
16452 ,#+BEGIN_SRC emacs-lisp :var x=literal-example
16453 (concatenate #'string x " for you.")
16456 ,#+RESULTS: read-literal-example
16457 : A literal example
16458 : on two lines for you.
16461 Indexing variable values enables referencing portions of a variable.
16462 Indexes are 0 based with negative values counting backwards from the
16463 end. If an index is separated by commas then each subsequent section
16464 indexes as the next dimension. Note that this indexing occurs
16465 /before/ other table-related header arguments are applied, such as
16466 =hlines=, =colnames= and =rownames=. The following example assigns
16467 the last cell of the first row the table =example-table= to the
16471 ,#+NAME: example-table
16477 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
16485 Two integers separated by a colon reference a range of variable
16486 values. In that case the entire inclusive range is referenced. For
16487 example the following assigns the middle three rows of =example-table=
16491 ,#+NAME: example-table
16498 ,#+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
16508 To pick the entire range, use an empty index, or the single character
16509 =*=. =0:-1= does the same thing. Example below shows how to
16510 reference the first column only.
16513 ,#+NAME: example-table
16519 ,#+BEGIN_SRC emacs-lisp :var data=example-table[,0]
16527 Index referencing can be used for tables and code blocks. Index
16528 referencing can handle any number of dimensions. Commas delimit
16529 multiple dimensions, as shown below.
16533 ,#+BEGIN_SRC emacs-lisp
16534 '(((1 2 3) (4 5 6) (7 8 9))
16535 ((10 11 12) (13 14 15) (16 17 18))
16536 ((19 20 21) (22 23 24) (25 26 27)))
16539 ,#+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
16547 Note that row names and column names are not removed prior to variable
16548 indexing. You need to take them into account, even when =colnames= or
16549 =rownames= header arguments remove them.
16551 Emacs lisp code can also set the values for variables. To
16552 differentiate a value from Lisp code, Org interprets any value
16553 starting with =(=, =[=, ='= or =`= as Emacs Lisp code. The result of
16554 evaluating that code is then assigned to the value of that variable.
16555 The following example shows how to reliably query and pass the file
16556 name of the Org mode buffer to a code block using headers. We need
16557 reliability here because the file's name could change once the code in
16558 the block starts executing.
16561 ,#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
16566 Note that values read from tables and lists are not mistakenly
16567 evaluated as Emacs Lisp code, as illustrated in the following example.
16573 ,#+HEADERS: :var data=table[0,0]
16587 #+cindex: using sessions in code blocks
16588 #+cindex: @samp{session}, header argument
16589 Two code blocks can share the same environment. The =session= header
16590 argument is for running multiple source code blocks under one session.
16591 Org runs code blocks with the same session name in the same
16592 interpreter process.
16596 Default. Each code block gets a new interpreter process to
16597 execute. The process terminates once the block is evaluated.
16599 - {{{var(STRING)}}} ::
16601 Any string besides =none= turns that string into the name of that
16602 session. For example, =:session STRING= names it =STRING=. If
16603 =session= has no value, then the session name is derived from the
16604 source language identifier. Subsequent blocks with the same
16605 source code language use the same session. Depending on the
16606 language, state variables, code from other blocks, and the
16607 overall interpreted environment may be shared. Some interpreted
16608 languages support concurrent sessions when subsequent source code
16609 language blocks change session names.
16611 Only languages that provide interactive evaluation can have session
16612 support. Not all languages provide this support, such as C and ditaa.
16613 Even languages, such as Python and Haskell, that do support
16614 interactive evaluation impose limitations on allowable language
16615 constructs that can run interactively. Org inherits those limitations
16616 for those code blocks running in a session.
16618 *** Choosing a working directory
16623 #+cindex: working directory, in a code block
16624 #+cindex: @samp{dir}, header argument
16625 The =dir= header argument specifies the default directory during code
16626 block execution. If it is absent, then the directory associated with
16627 the current buffer is used. In other words, supplying =:dir PATH=
16628 temporarily has the same effect as changing the current directory with
16629 {{{kbd(M-x cd PATH)}}}, and then not setting =dir=. Under the
16630 surface, =dir= simply sets the value of the Emacs variable
16631 ~default-directory~.
16633 For example, to save the plot file in the =Work/= folder of the home
16634 directory -- notice tilde is expanded:
16637 ,#+BEGIN_SRC R :file myplot.png :dir ~/Work
16638 matplot(matrix(rnorm(100), 10), type="l")
16642 To evaluate the code block on a remote machine, supply a remote
16643 directory name using Tramp syntax. For example:
16646 ,#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu:
16647 plot(1:10, main=system("hostname", intern=TRUE))
16651 Org first captures the text results as usual for insertion in the Org
16652 file. Then Org also inserts a link to the remote file, thanks to
16653 Emacs Tramp. Org constructs the remote path to the file name from
16654 =dir= and ~default-directory~, as illustrated here:
16656 : [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
16658 When =dir= is used with =session=, Org sets the starting directory for
16659 a new session. But Org does not alter the directory of an already
16662 Do not use =dir= with =:exports results= or with =:exports both= to
16663 avoid Org inserting incorrect links to remote files. That is because
16664 Org does not expand ~default directory~ to avoid some underlying
16665 portability issues.
16667 *** Inserting headers and footers
16672 #+cindex: headers, in code blocks
16673 #+cindex: footers, in code blocks
16674 #+cindex: @samp{prologue}, header argument
16675 The =prologue= header argument is for appending to the top of the code
16676 block for execution, like a reset instruction. For example, you may
16677 use =:prologue "reset"= in a Gnuplot code block or, for every such
16680 #+begin_src emacs-lisp
16681 (add-to-list 'org-babel-default-header-args:gnuplot
16682 '((:prologue . "reset")))
16686 #+cindex: @samp{epilogue}, header argument
16687 Likewise, the value of the =epilogue= header argument is for appending
16688 to the end of the code block for execution.
16690 ** Evaluating code blocks
16692 :DESCRIPTION: Place results of evaluation in the Org buffer.
16694 #+cindex: code block, evaluating
16695 #+cindex: source code, evaluating
16696 #+cindex: RESULTS, keyword
16698 A note about security: With code evaluation comes the risk of harm.
16699 Org safeguards by prompting for user's permission before executing any
16700 code in the source block. To customize this safeguard -- or disable
16701 it --, see [[*Code evaluation and security issues]].
16703 *** How to evaluate source code
16708 Org captures the results of the code block evaluation and inserts them
16709 in the Org file, right after the code block. The insertion point is
16710 after a newline and the =RESULTS= keyword. Org creates the =RESULTS=
16711 keyword if one is not already there.
16713 By default, Org enables only Emacs Lisp code blocks for execution.
16714 See [[*Languages]] to enable other languages.
16717 #+kindex: C-c C-v e
16718 #+findex: org-babel-execute-src-block
16719 Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or
16720 {{{kbd(C-c C-v e)}}} with the point on a code block[fn:131] calls the
16721 ~org-babel-execute-src-block~ function, which executes the code in the
16722 block, collects the results, and inserts them in the buffer.
16724 #+cindex: CALL, keyword
16725 #+vindex: org-babel-inline-result-wrap
16726 By calling a named code block[fn:132] from an Org mode buffer or
16727 a table. Org can call the named code blocks from the current Org mode
16728 buffer or from the "Library of Babel" (see [[*Library of Babel]]).
16730 The syntax for =CALL= keyword is:
16733 ,#+CALL: <name>(<arguments>)
16734 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
16737 The syntax for inline named code blocks is:
16740 ... call_<name>(<arguments>) ...
16741 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
16744 When inline syntax is used, the result is wrapped based on the
16745 variable ~org-babel-inline-result-wrap~, which by default is set to
16746 ~"=%s="~ to produce verbatim text suitable for markup.
16750 This is the name of the code block to be evaluated (see
16751 [[*Structure of code blocks]]).
16755 Org passes arguments to the code block using standard function
16756 call syntax. For example, a =#+CALL:= line that passes =4= to
16757 a code block named =double=, which declares the header argument
16758 =:var n=2=, would be written as:
16760 : #+CALL: double(n=4)
16762 #+texinfo: @noindent
16763 Note how this function call syntax is different from the header
16766 - =<inside header arguments>= ::
16768 Org passes inside header arguments to the named code block using
16769 the header argument syntax. Inside header arguments apply to
16770 code block evaluation. For example, =[:results output]= collects
16771 results printed to stdout during code execution of that block.
16772 Note how this header argument syntax is different from the
16773 function call syntax.
16775 - =<end header arguments>= ::
16777 End header arguments affect the results returned by the code
16778 block. For example, =:results html= wraps the results in
16779 a =#+BEGIN_EXPORT html= block before inserting the results in the
16782 *** Limit code block evaluation
16787 #+cindex: @samp{eval}, header argument
16788 #+cindex: control code block evaluation
16789 The =eval= header argument can limit evaluation of specific code
16790 blocks and =CALL= keyword. It is useful for protection against
16791 evaluating untrusted code blocks by prompting for a confirmation.
16793 - =never= or =no= ::
16795 Org never evaluates the source code.
16799 Org prompts the user for permission to evaluate the source code.
16801 - =never-export= or =no-export= ::
16803 Org does not evaluate the source code when exporting, yet the
16804 user can evaluate it interactively.
16806 - =query-export= ::
16808 Org prompts the user for permission to evaluate the source code
16811 If =eval= header argument is not set, then Org determines whether to
16812 evaluate the source code from the ~org-confirm-babel-evaluate~
16813 variable (see [[*Code evaluation and security issues]]).
16815 *** Cache results of evaluation
16820 #+cindex: @samp{cache}, header argument
16821 #+cindex: cache results of code evaluation
16822 The =cache= header argument is for caching results of evaluating code
16823 blocks. Caching results can avoid re-evaluating a code block that
16824 have not changed since the previous run. To benefit from the cache
16825 and avoid redundant evaluations, the source block must have a result
16826 already present in the buffer, and neither the header arguments --
16827 including the value of =var= references -- nor the text of the block
16828 itself has changed since the result was last computed. This feature
16829 greatly helps avoid long-running calculations. For some edge cases,
16830 however, the cached results may not be reliable.
16832 The caching feature is best for when code blocks are pure functions,
16833 that is functions that return the same value for the same input
16834 arguments (see [[*Environment of a code block]]), and that do not have
16835 side effects, and do not rely on external variables other than the
16836 input arguments. Functions that depend on a timer, file system
16837 objects, and random number generators are clearly unsuitable for
16840 A note of warning: when =cache= is used in a session, caching may
16841 cause unexpected results.
16843 When the caching mechanism tests for any source code changes, it does
16844 not expand Noweb style references (see [[*Noweb reference syntax]]). For
16845 reasons why, see http://thread.gmane.org/gmane.emacs.orgmode/79046.
16847 The =cache= header argument can have one of two values: =yes= or =no=.
16851 Default. No caching of results; code block evaluated every
16856 Whether to run the code or return the cached results is
16857 determined by comparing the SHA1 hash value of the combined code
16858 block and arguments passed to it. This hash value is packed on
16859 the =#+RESULTS:= line from previous evaluation. When hash values
16860 match, Org does not evaluate the code block. When hash values
16861 mismatch, Org evaluates the code block, inserts the results,
16862 recalculates the hash value, and updates =#+RESULTS:= line.
16864 In this example, both functions are cached. But =caller= runs only if
16865 the result from =random= has changed since the last run.
16869 ,#+BEGIN_SRC R :cache yes
16873 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
16877 ,#+BEGIN_SRC emacs-lisp :var x=random :cache yes
16881 ,#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
16885 ** Results of evaluation
16887 :DESCRIPTION: Choosing a results type, post-processing...
16889 #+cindex: code block, results of evaluation
16890 #+cindex: source code, results of evaluation
16892 #+cindex: @samp{results}, header argument
16893 How Org handles results of a code block execution depends on many
16894 header arguments working together. The primary determinant, however,
16895 is the =results= header argument. It accepts four classes of options.
16896 Each code block can take only one option per class:
16900 For how the results should be collected from the code block;
16904 For which type of result the code block will return; affects how
16905 Org processes and inserts results in the Org buffer;
16909 For the result; affects how Org processes and inserts results in
16914 For processing results after evaluation of the code block;
16921 Collection options specify the results. Choose one of the options;
16922 they are mutually exclusive.
16926 Default. Functional mode. Org gets the value by wrapping the
16927 code in a function definition in the language of the source
16928 block. That is why when using =:results value=, code should
16929 execute like a function and return a value. For languages like
16930 Python, an explicit ~return~ statement is mandatory when using
16931 =:results value=. Result is the value returned by the last
16932 statement in the code block.
16934 When evaluating the code block in a session (see [[*Environment of
16935 a code block]]), Org passes the code to an interpreter running as
16936 an interactive Emacs inferior process. Org gets the value from
16937 the source code interpreter's last statement output. Org has to
16938 use language-specific methods to obtain the value. For example,
16939 from the variable ~_~ in Python and Ruby, and the value of
16940 ~.Last.value~ in R.
16944 Scripting mode. Org passes the code to an external process
16945 running the interpreter. Org returns the contents of the
16946 standard output stream as text results.
16948 When using a session, Org passes the code to the interpreter
16949 running as an interactive Emacs inferior process. Org
16950 concatenates any text output from the interpreter and returns the
16951 collection as a result.
16953 Note that this collection is not the same as that would be
16954 collected from stdout of a non-interactive interpreter running as
16955 an external process. Compare for example these two blocks:
16958 ,#+BEGIN_SRC python :results output
16969 In the above non-session mode, the "2" is not printed; so it does
16970 not appear in results.
16973 ,#+BEGIN_SRC python :results output :session
16985 In the above session, the interactive interpreter receives and
16986 prints "2". Results show that.
16993 Type tells what result types to expect from the execution of the code
16994 block. Choose one of the options; they are mutually exclusive. The
16995 default behavior is to automatically determine the result type.
16997 #+attr_texinfo: :sep ,
16998 - =table=, =vector= ::
17000 Interpret the results as an Org table. If the result is a single
17001 value, create a table with one row and one column. Usage
17002 example: =:results value table=.
17004 #+cindex: @samp{hlines}, header argument
17005 In-between each table row or below the table headings, sometimes
17006 results have horizontal lines, which are also known as "hlines".
17007 The =hlines= argument with the default =no= value strips such
17008 lines from the input table. For most code, this is desirable, or
17009 else those =hline= symbols raise unbound variable errors.
17010 A =yes= accepts such lines, as demonstrated in the following
17022 ,#+BEGIN_SRC python :var tab=many-cols :hlines no
17026 ,#+RESULTS: no-hline
17032 ,#+BEGIN_SRC python :var tab=many-cols :hlines yes
17046 Interpret the results as an Org list. If the result is a single
17047 value, create a list of one element.
17049 - =scalar=, =verbatim= ::
17051 Interpret literally and insert as quoted text. Do not create
17052 a table. Usage example: =:results value verbatim=.
17056 Interpret as a filename. Save the results of execution of the
17057 code block to that file, then insert a link to it. You can
17058 control both the filename and the description associated to the
17061 #+cindex: @samp{file}, header argument
17062 #+cindex: @samp{output-dir}, header argument
17063 Org first tries to generate the filename from the value of the
17064 =file= header argument and the directory specified using the
17065 =output-dir= header arguments. If =output-dir= is not specified,
17066 Org assumes it is the current directory.
17069 ,#+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
17075 #+cindex: @samp{file-ext}, header argument
17076 If =file= is missing, Org generates the base name of the output
17077 file from the name of the code block, and its extension from the
17078 =file-ext= header argument. In that case, both the name and the
17079 extension are mandatory.
17083 ,#+BEGIN_SRC asymptote :results value file :file-ext pdf
17089 #+cindex: @samp{file-desc}, header argument
17090 The =file-desc= header argument defines the description (see
17091 [[*Link format]]) for the link. If =file-desc= has no value, Org
17092 uses the generated file name for both the "link" and
17093 "description" parts of the link.
17100 Format pertains to the type of the result returned by the code block.
17101 Choose one of the options; they are mutually exclusive. The default
17102 follows from the type specified above.
17106 Interpreted as raw Org mode. Inserted directly into the buffer.
17107 Aligned if it is a table. Usage example: =:results value raw=.
17111 Results enclosed in a =BEGIN_SRC org= block. For comma-escape,
17112 either {{{kbd(TAB)}}} in the block, or export the file. Usage
17113 example: =:results value org=.
17117 Results enclosed in a =BEGIN_EXPORT html= block. Usage example:
17118 =:results value html=.
17122 Results enclosed in a =BEGIN_EXPORT latex= block. Usage example:
17123 =:results value latex=.
17127 Result enclosed in a code block. Useful for parsing. Usage
17128 example: =:results value code=.
17132 Result converted to pretty-print source code. Enclosed in a code
17133 block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
17134 example: =:results value pp=.
17138 Result wrapped in a =RESULTS= drawer. Useful for containing
17139 =raw= or =org= results for later scripting and automated
17140 processing. Usage example: =:results value drawer=.
17147 Handling options after collecting the results.
17151 Do not insert results in the Org mode buffer, but echo them in
17152 the minibuffer. Usage example: =:results output silent=.
17156 Default. Insert results in the Org buffer. Remove previous
17157 results. Usage example: =:results output replace=.
17161 Append results to the Org buffer. Latest results are at the
17162 bottom. Does not remove previous results. Usage example:
17163 =:results output append=.
17167 Prepend results to the Org buffer. Latest results are at the
17168 top. Does not remove previous results. Usage example: =:results
17171 *** Post-processing
17176 #+cindex: @samp{post}, header argument
17177 #+cindex: @samp{*this*}, in @samp{post} header argument
17178 The =post= header argument is for post-processing results from block
17179 evaluation. When =post= has any value, Org binds the results to
17180 ~*this*~ variable for easy passing to =var= header argument
17181 specifications (see [[*Environment of a code block]]). That makes results
17182 available to other code blocks, or even for direct Emacs Lisp code
17185 The following two examples illustrate =post= header argument in
17186 action. The first one shows how to attach an =ATTR_LATEX= keyword
17191 ,#+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
17192 echo "#+ATTR_LATEX: :width $width"
17196 ,#+HEADER: :file /tmp/it.png
17197 ,#+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
17207 ,#+ATTR_LATEX :width 5cm
17208 [[file:/tmp/it.png]]
17212 The second example shows use of =colnames= header argument in =post=
17213 to pass data between code blocks.
17217 ,#+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
17218 (mapcar (lambda (row)
17219 (mapcar (lambda (cell)
17227 ,#+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
17229 data.frame(foo=rnorm(1))
17238 ** Exporting code blocks
17240 :DESCRIPTION: Export contents and/or results.
17242 #+cindex: code block, exporting
17243 #+cindex: source code, exporting
17245 It is possible to export the /code/ of code blocks, the /results/ of
17246 code block evaluation, /both/ the code and the results of code block
17247 evaluation, or /none/. Org defaults to exporting /code/ for most
17248 languages. For some languages, such as ditaa, Org defaults to
17249 /results/. To export just the body of code blocks, see [[*Literal
17250 examples]]. To selectively export sub-trees of an Org document, see
17253 #+cindex: @samp{export}, header argument
17254 The =exports= header argument is to specify if that part of the Org
17255 file is exported to, say, HTML or LaTeX formats.
17259 The default. The body of code is included into the exported
17260 file. Example: =:exports code=.
17264 The results of evaluation of the code is included in the exported
17265 file. Example: =:exports results=.
17269 Both the code and results of evaluation are included in the
17270 exported file. Example: =:exports both=.
17274 Neither the code nor the results of evaluation is included in the
17275 exported file. Whether the code is evaluated at all depends on
17276 other options. Example: =:exports none=.
17278 #+vindex: org-export-use-babel
17279 To stop Org from evaluating code blocks to speed exports, use the
17280 header argument =:eval never-export= (see [[*Evaluating code blocks]]).
17281 To stop Org from evaluating code blocks for greater security, set the
17282 ~org-export-use-babel~ variable to ~nil~, but understand that header
17283 arguments will have no effect.
17285 Turning off evaluation comes in handy when batch processing. For
17286 example, markup languages for wikis, which have a high risk of
17287 untrusted code. Stopping code block evaluation also stops evaluation
17288 of all header arguments of the code block. This may not be desirable
17289 in some circumstances. So during export, to allow evaluation of just
17290 the header arguments but not any code evaluation in the source block,
17291 set =:eval never-export= (see [[*Evaluating code blocks]]).
17293 Org never evaluates code blocks in commented sub-trees when exporting
17294 (see [[*Comment lines]]). On the other hand, Org does evaluate code
17295 blocks in sub-trees excluded from export (see [[*Export settings]]).
17297 ** Extracting source code
17299 :DESCRIPTION: Create pure source code files.
17302 #+cindex: source code, extracting
17303 #+cindex: code block, extracting source code
17305 Extracting source code from code blocks is a basic task in literate
17306 programming. Org has features to make this easy. In literate
17307 programming parlance, documents on creation are /woven/ with code and
17308 documentation, and on export, the code is tangled for execution by
17309 a computer. Org facilitates weaving and tangling for producing,
17310 maintaining, sharing, and exporting literate programming documents.
17311 Org provides extensive customization options for extracting source
17314 When Org tangles code blocks, it expands, merges, and transforms them.
17315 Then Org recomposes them into one or more separate files, as
17316 configured through the options. During this tangling process, Org
17317 expands variables in the source code, and resolves any Noweb style
17318 references (see [[*Noweb reference syntax]]).
17320 *** Header arguments
17325 #+cindex: @samp{tangle}, header argument
17326 The =tangle= header argument specifies if the code block is exported
17331 Export the code block to source file. The file name for the
17332 source file is derived from the name of the Org file, and the
17333 file extension is derived from the source code language
17334 identifier. Example: =:tangle yes=.
17338 The default. Do not extract the code in a source code file.
17339 Example: =:tangle no=.
17341 - {{{var(FILENAME)}}} ::
17343 Export the code block to source file whose file name is derived
17344 from any string passed to the =tangle= header argument. Org
17345 derives the file name as being relative to the directory of the
17346 Org file's location. Example: =:tangle FILENAME=.
17348 #+cindex: @samp{mkdirp}, header argument
17349 The =mkdirp= header argument creates parent directories for tangled
17350 files if the directory does not exist. =yes= enables directory
17351 creation and =no= inhibits directory creation.
17353 #+cindex: @samp{comments}, header argument
17354 The =comments= header argument controls inserting comments into
17355 tangled files. These are above and beyond whatever comments may
17356 already exist in the code block.
17360 The default. Do not insert any extra comments during tangling.
17364 Wrap the code block in comments. Include links pointing back to
17365 the place in the Org file from where the code was tangled.
17369 Kept for backward compatibility; same as =link=.
17373 Nearest headline text from Org file is inserted as comment. The
17374 exact text that is inserted is picked from the leading context of
17379 Includes both =link= and =org= options.
17383 Includes =link= option, expands Noweb references (see [[*Noweb
17384 reference syntax]]), and wraps them in link comments inside the
17385 body of the code block.
17387 #+cindex: @samp{padline}, header argument
17388 The =padline= header argument controls insertion of newlines to pad
17389 source code in the tangled file.
17393 Default. Insert a newline before and after each code block in
17398 Do not insert newlines to pad the tangled code blocks.
17400 #+cindex: @samp{shebang}, header argument
17401 The =shebang= header argument can turn results into executable script
17402 files. By setting it to a string value -- for example, =:shebang
17403 "#!/bin/bash"= --, Org inserts that string as the first line of the
17404 tangled file that the code block is extracted to. Org then turns on
17405 the tangled file's executable permission.
17407 #+cindex: @samp{no-expand}, header argument
17408 By default Org expands code blocks during tangling. The =no-expand=
17409 header argument turns off such expansions. Note that one side-effect
17410 of expansion by ~org-babel-expand-src-block~ also assigns values (see
17411 [[*Environment of a code block]]) to variables. Expansions also replace
17412 Noweb references with their targets (see [[*Noweb reference syntax]]).
17413 Some of these expansions may cause premature assignment, hence this
17414 option. This option makes a difference only for tangling. It has no
17415 effect when exporting since code blocks for execution have to be
17423 - ~org-babel-tangle~ ::
17425 #+findex: org-babel-tangle
17426 #+kindex: C-c C-v t
17427 Tangle the current file. Bound to {{{kbd(C-c C-v t)}}}.
17429 With prefix argument only tangle the current code block.
17431 - ~org-babel-tangle-file~ ::
17433 #+findex: org-babel-tangle-file
17434 #+kindex: C-c C-v f
17435 Choose a file to tangle. Bound to {{{kbd(C-c C-v f)}}}.
17442 - ~org-babel-post-tangle-hook~ ::
17444 #+vindex: org-babel-post-tangle-hook
17445 This hook is run from within code files tangled by
17446 ~org-babel-tangle~, making it suitable for post-processing,
17447 compilation, and evaluation of code in the tangled files.
17449 *** Jumping between code and Org
17454 #+findex: org-babel-tangle-jump-to-org
17455 Debuggers normally link errors and messages back to the source code.
17456 But for tangled files, we want to link back to the Org file, not to
17457 the tangled source file. To make this extra jump, Org uses
17458 ~org-babel-tangle-jump-to-org~ function with two additional source
17459 code block header arguments:
17461 1. Set =padline= to true -- this is the default setting.
17462 2. Set =comments= to =link=, which makes Org insert links to the Org
17467 :DESCRIPTION: List of supported code block languages.
17469 #+cindex: babel, languages
17470 #+cindex: source code, languages
17471 #+cindex: code block, languages
17473 Code blocks in the following languages are supported.
17475 | Language | Identifier | Language | Identifier |
17476 |------------+------------+----------------+------------|
17477 | Asymptote | asymptote | Awk | awk |
17478 | C | C | C++ | C++ |
17479 | Clojure | clojure | CSS | css |
17480 | D | d | ditaa | ditaa |
17481 | Graphviz | dot | Emacs Calc | calc |
17482 | Emacs Lisp | emacs-lisp | Fortran | fortran |
17483 | Gnuplot | gnuplot | Haskell | haskell |
17484 | Java | java | Javascript | js |
17485 | LaTeX | latex | Ledger | ledger |
17486 | Lisp | lisp | Lilypond | lilypond |
17487 | Lua | lua | MATLAB | matlab |
17488 | Mscgen | mscgen | Objective Caml | ocaml |
17489 | Octave | octave | Org mode | org |
17490 | Oz | oz | Perl | perl |
17491 | Plantuml | plantuml | Processing.js | processing |
17492 | Python | python | R | R |
17493 | Ruby | ruby | Sass | sass |
17494 | Scheme | scheme | GNU Screen | screen |
17495 | Sed | sed | shell | sh |
17496 | SQL | sql | SQLite | sqlite |
17497 | Vala | vala | | |
17499 Additional documentation for some languages is at
17500 http://orgmode.org/worg/org-contrib/babel/languages.html.
17502 #+vindex: org-babel-load-languages
17503 By default, only Emacs Lisp is enabled for evaluation. To enable or
17504 disable other languages, customize the ~org-babel-load-languages~
17505 variable either through the Emacs customization interface, or by
17506 adding code to the init file as shown next.
17508 In this example, evaluation is disabled for Emacs Lisp, and enabled
17511 #+begin_src emacs-lisp
17512 (org-babel-do-load-languages
17513 'org-babel-load-languages
17514 '((emacs-lisp . nil)
17518 Note that this is not the only way to enable a language. Org also
17519 enables languages when loaded with ~require~ statement. For example,
17520 the following enables execution of Clojure code blocks:
17522 #+begin_src emacs-lisp
17523 (require 'ob-clojure)
17526 ** Editing source code
17528 :DESCRIPTION: Language major-mode editing.
17530 #+cindex: code block, editing
17531 #+cindex: source code, editing
17534 Use {{{kbd(C-c ')}}} to edit the current code block. It opens a new
17535 major-mode edit buffer containing the body of the source code block,
17536 ready for any edits. Use {{{kbd(C-c ')}}} again to close the buffer
17537 and return to the Org buffer.
17540 #+vindex: org-edit-src-auto-save-idle-delay
17541 #+cindex: auto-save, in code block editing
17542 {{{kbd(C-x C-s)}}} saves the buffer and updates the contents of the
17543 Org buffer. Set ~org-edit-src-auto-save-idle-delay~ to save the base
17544 buffer after a certain idle delay time. Set
17545 ~org-edit-src-turn-on-auto-save~ to auto-save this buffer into
17546 a separate file using Auto-save mode.
17548 While editing the source code in the major mode, the Org Src minor
17549 mode remains active. It provides these customization variables as
17550 described below. For even more variables, look in the customization
17551 group ~org-edit-structure~.
17553 - ~org-src-lang-modes~ ::
17555 #+vindex: org-src-lang-modes
17556 If an Emacs major-mode named ~<LANG>-mode~ exists, where
17557 {{{var(<LANG>)}}} is the language identifier from code block's
17558 header line, then the edit buffer uses that major mode. Use this
17559 variable to arbitrarily map language identifiers to major modes.
17561 - ~org-src-window-setup~ ::
17563 #+vindex: org-src-window-setup
17564 For specifying Emacs window arrangement when the new edit buffer
17567 - ~org-src-preserve-indentation~ ::
17569 #+cindex: indentation, in code blocks
17570 #+vindex: org-src-preserve-indentation
17571 Default is ~nil~. Source code is indented. This indentation
17572 applies during export or tangling, and depending on the context,
17573 may alter leading spaces and tabs. When non-~nil~, source code
17574 is aligned with the leftmost column. No lines are modified
17575 during export or tangling, which is very useful for white-space
17576 sensitive languages, such as Python.
17578 - ~org-src-ask-before-returning-to-edit-buffer~ ::
17580 #+vindex: org-src-ask-before-returning-to-edit-buffer
17581 When ~nil~, Org returns to the edit buffer without further
17582 prompts. The default prompts for a confirmation.
17584 #+vindex: org-src-fontify-natively
17585 #+vindex: org-src-block-faces
17586 Set ~org-src-fontify-natively~ to non-~nil~ to turn on native code
17587 fontification in the /Org/ buffer. Fontification of code blocks can
17588 give visual separation of text and code on the display page. To
17589 further customize the appearance of ~org-block~ for specific
17590 languages, customize ~org-src-block-faces~. The following example
17591 shades the background of regular blocks, and colors source blocks only
17592 for Python and Emacs Lisp languages.
17594 #+begin_src emacs-lisp
17596 (set-face-attribute 'org-block nil :background
17598 (face-attribute 'default :background) 3))
17600 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
17601 ("python" (:background "#E5FFB8"))))
17604 ** Noweb reference syntax
17606 :DESCRIPTION: Literate programming in Org mode.
17608 #+cindex: code block, Noweb reference
17609 #+cindex: syntax, Noweb
17610 #+cindex: source code, Noweb reference
17612 Org supports named blocks in Noweb[fn:133] style syntax:
17614 : <<CODE-BLOCK-ID>>
17616 Org can replace the construct with the source code, or the results of
17617 evaluation, of the code block identified as {{{var(CODE-BLOCK-ID)}}}.
17619 #+cindex: @samp{noweb}, header argument
17620 The =noweb= header argument controls expansion of Noweb syntax
17621 references. Expansions occur when source code blocks are evaluated,
17622 tangled, or exported.
17626 Default. No expansion of Noweb syntax references in the body of
17627 the code when evaluating, tangling, or exporting.
17631 Expansion of Noweb syntax references in the body of the code
17632 block when evaluating, tangling, or exporting.
17636 Expansion of Noweb syntax references in the body of the code
17637 block when tangling. No expansion when evaluating or exporting.
17641 Expansion of Noweb syntax references in the body of the code
17642 block when evaluating or tangling. No expansion when exporting.
17644 - =strip-export= ::
17646 Expansion of Noweb syntax references in the body of the code
17647 block when expanding prior to evaluating or tangling. Removes
17648 Noweb syntax references when exporting.
17652 Expansion of Noweb syntax references in the body of the code
17653 block only before evaluating.
17655 In the following example,
17658 ,#+NAME: initialization
17659 ,#+BEGIN_SRC emacs-lisp
17660 (setq sentence "Never a foot too far, even.")
17663 ,#+BEGIN_SRC emacs-lisp :noweb yes
17669 #+texinfo: @noindent
17670 the second code block is expanded as
17673 ,#+BEGIN_SRC emacs-lisp :noweb yes
17674 (setq sentence "Never a foot too far, even.")
17679 Noweb insertions honor prefix characters that appear before the Noweb
17680 syntax reference. This behavior is illustrated in the following
17681 example. Because the =<<example>>= Noweb reference appears behind the
17682 SQL comment syntax, each line of the expanded Noweb reference is
17689 multi-line body of example
17693 #+texinfo: @noindent
17697 ,#+BEGIN_SRC sql :noweb yes
17702 #+texinfo: @noindent
17706 ,#+BEGIN_SRC sql :noweb yes
17708 -- multi-line body of example
17712 Since this change does not affect Noweb replacement text without
17713 newlines in them, inline Noweb references are acceptable.
17715 This feature can also be used for management of indentation in
17716 exported code snippets. With:
17720 ,#+BEGIN_SRC python :exports none
17721 print('do things when true')
17725 ,#+begin_src python :exports none
17726 print('do things when false')
17730 #+texinfo: @noindent
17734 ,#+begin_src python :noweb yes :results output
17742 #+texinfo: @noindent
17747 print('do things when true')
17749 print('do things when false')
17752 #+cindex: @samp{noweb-ref}, header argument
17753 When expanding Noweb style references, Org concatenates code blocks by
17754 matching the reference name to either the code block name or, if none
17755 is found, to the =noweb-ref= header argument.
17757 For simple concatenation, set this =noweb-ref= header argument at the
17758 sub-tree or file level. In the example Org file shown next, the body
17759 of the source code in each block is extracted for concatenation to
17760 a pure code file when tangled.
17763 ,#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
17766 ,* the mount point of the fullest disk
17768 :header-args: :noweb-ref fullest-disk
17771 ,** query all mounted disks
17776 ,** strip the header row
17781 ,** output mount point of fullest disk
17783 |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
17787 #+cindex: @samp{noweb-sep}, header argument
17788 By default a newline separates each noweb reference concatenation. To
17789 change this newline separator, edit the =noweb-sep= header argument.
17791 Eventually, Org can include the results of a code block rather than
17792 its body. To that effect, append parentheses, possibly including
17793 arguments, to the code block name, as shown below.
17795 : <<code-block-name(optional arguments)>>
17797 Note that when using the above approach to a code block's results, the
17798 code block name set by =NAME= keyword is required; the reference set
17799 by =noweb-ref= does not work in that case.
17801 Here is an example that demonstrates how the exported content changes
17802 when Noweb style references are used with parentheses versus without.
17807 ,#+BEGIN_SRC python :var num=0 :results output :exports none
17812 #+texinfo: @noindent
17816 ,#+BEGIN_SRC text :noweb yes
17821 #+texinfo: @noindent
17826 Below, a similar Noweb style reference is used, but with parentheses,
17827 while setting a variable =num= to 10:
17830 ,#+BEGIN_SRC text :noweb yes
17831 <<some-code(num=10)>>
17835 #+texinfo: @noindent
17836 Note that now the expansion contains the results of the code block
17837 =some-code=, not the code block itself:
17841 ** Library of Babel
17843 :DESCRIPTION: Use and contribute to a library of useful code blocks.
17845 #+cindex: babel, library of
17846 #+cindex: source code, library
17847 #+cindex: code block, library
17849 The "Library of Babel" is a collection of code blocks. Like
17850 a function library, these code blocks can be called from other Org
17851 files. A collection of useful code blocks is available on [[http://orgmode.org/worg/library-of-babel.html][Worg]]. For
17852 remote code block evaluation syntax, see [[*Evaluating code blocks]].
17854 #+kindex: C-c C-v i
17855 #+findex: org-babel-lob-ingest
17856 For any user to add code to the library, first save the code in
17857 regular code blocks of an Org file, and then load the Org file with
17858 ~org-babel-lob-ingest~, which is bound to {{{kbd(C-c C-v i)}}}.
17860 ** Key bindings and useful functions
17862 :DESCRIPTION: Work quickly with code blocks.
17864 #+cindex: code block, key bindings
17866 Many common Org mode key sequences are re-bound depending on
17869 Active key bindings in code blocks:
17872 #+findex: org-babel-execute-src-block
17874 #+findex: org-babel-open-src-block-result
17876 #+findex: org-babel-load-in-session
17878 #+findex: org-babel-pop-to-session
17879 #+attr_texinfo: :columns 0.2 0.55
17880 | Key binding | Function |
17881 |--------------------+-----------------------------------|
17882 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~ |
17883 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ |
17884 | {{{kbd(M-up)}}} | ~org-babel-load-in-session~ |
17885 | {{{kbd(M-down)}}} | ~org-babel-pop-to-session~ |
17887 Active key bindings in Org mode buffer:
17889 #+kindex: C-c C-v p
17890 #+kindex: C-c C-v C-p
17891 #+kindex: C-c C-v n
17892 #+kindex: C-c C-v C-n
17893 #+kindex: C-c C-v e
17894 #+kindex: C-c C-v C-e
17895 #+kindex: C-c C-v o
17896 #+kindex: C-c C-v C-o
17897 #+kindex: C-c C-v v
17898 #+kindex: C-c C-v C-v
17899 #+kindex: C-c C-v u
17900 #+kindex: C-c C-v C-u
17901 #+kindex: C-c C-v g
17902 #+kindex: C-c C-v C-g
17903 #+kindex: C-c C-v r
17904 #+kindex: C-c C-v C-r
17905 #+kindex: C-c C-v b
17906 #+kindex: C-c C-v C-b
17907 #+kindex: C-c C-v s
17908 #+kindex: C-c C-v C-s
17909 #+kindex: C-c C-v d
17910 #+kindex: C-c C-v C-d
17911 #+kindex: C-c C-v t
17912 #+kindex: C-c C-v C-t
17913 #+kindex: C-c C-v f
17914 #+kindex: C-c C-v C-f
17915 #+kindex: C-c C-v c
17916 #+kindex: C-c C-v C-c
17917 #+kindex: C-c C-v j
17918 #+kindex: C-c C-v C-j
17919 #+kindex: C-c C-v l
17920 #+kindex: C-c C-v C-l
17921 #+kindex: C-c C-v i
17922 #+kindex: C-c C-v C-i
17923 #+kindex: C-c C-v I
17924 #+kindex: C-c C-v C-I
17925 #+kindex: C-c C-v z
17926 #+kindex: C-c C-v C-z
17927 #+kindex: C-c C-v a
17928 #+kindex: C-c C-v C-a
17929 #+kindex: C-c C-v h
17930 #+kindex: C-c C-v C-h
17931 #+kindex: C-c C-v x
17932 #+kindex: C-c C-v C-x
17933 #+findex: org-babel-previous-src-block
17934 #+findex: org-babel-next-src-block
17935 #+findex: org-babel-execute-maybe
17936 #+findex: org-babel-open-src-block-result
17937 #+findex: org-babel-expand-src-block
17938 #+findex: org-babel-goto-src-block-head
17939 #+findex: org-babel-goto-named-src-block
17940 #+findex: org-babel-goto-named-result
17941 #+findex: org-babel-execute-buffer
17942 #+findex: org-babel-execute-subtree
17943 #+findex: org-babel-demarcate-block
17944 #+findex: org-babel-tangle
17945 #+findex: org-babel-tangle-file
17946 #+findex: org-babel-check-src-block
17947 #+findex: org-babel-insert-header-arg
17948 #+findex: org-babel-load-in-session
17949 #+findex: org-babel-lob-ingest
17950 #+findex: org-babel-view-src-block-info
17951 #+findex: org-babel-switch-to-session-with-code
17952 #+findex: org-babel-sha1-hash
17953 #+findex: org-babel-describe-bindings
17954 #+findex: org-babel-do-key-sequence-in-edit-buffer
17955 #+attr_texinfo: :columns 0.45 0.55
17956 | Key binding | Function |
17957 |------------------------------------------------+--------------------------------------------|
17958 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~ |
17959 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~ |
17960 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~ |
17961 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~ |
17962 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~ |
17963 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~ |
17964 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~ |
17965 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~ |
17966 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~ |
17967 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~ |
17968 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~ |
17969 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~ |
17970 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~ |
17971 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~ |
17972 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~ |
17973 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~ |
17974 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~ |
17975 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~ |
17976 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~ |
17977 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~ |
17978 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~ |
17979 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
17983 :DESCRIPTION: Call functions from the command line.
17985 #+cindex: code block, batch execution
17986 #+cindex: source code, batch execution
17988 Org mode features, including working with source code facilities can
17989 be invoked from the command line. This enables building shell scripts
17990 for batch processing, running automated system tasks, and expanding
17991 Org mode's usefulness.
17993 The sample script shows batch processing of multiple files using
17994 ~org-babel-tangle~.
17998 # Tangle files with Org mode
18000 emacs -Q --batch --eval "
18002 (require 'ob-tangle)
18003 (dolist (file command-line-args-left)
18004 (with-current-buffer (find-file-noselect file)
18005 (org-babel-tangle))))
18011 :DESCRIPTION: All the rest which did not fit elsewhere.
18016 :DESCRIPTION: M-TAB guesses completions.
18018 #+cindex: completion, of @TeX{} symbols
18019 #+cindex: completion, of TODO keywords
18020 #+cindex: completion, of dictionary words
18021 #+cindex: completion, of option keywords
18022 #+cindex: completion, of tags
18023 #+cindex: completion, of property keys
18024 #+cindex: completion, of link abbreviations
18025 #+cindex: @TeX{} symbol completion
18026 #+cindex: TODO keywords completion
18027 #+cindex: dictionary word completion
18028 #+cindex: option keyword completion
18029 #+cindex: tag completion
18030 #+cindex: link abbreviations, completion of
18032 Org has in-buffer completions. Unlike minibuffer completions, which
18033 are useful for quick command interactions, Org's in-buffer completions
18034 are more suitable for content creation in Org documents. Type one or
18035 more letters and invoke the hot key to complete the text in-place.
18036 Depending on the context and the keys, Org offers different types of
18037 completions. No minibuffer is involved. Such mode-specific hot keys
18038 have become an integral part of Emacs and Org provides several
18041 - {{{kbd(M-TAB)}}} ::
18044 Complete word at point.
18046 - At the beginning of a headline, complete TODO keywords.
18048 - After =\=, complete TeX symbols supported by the exporter.
18050 - After =*=, complete headlines in the current buffer so that
18051 they can be used in search links like:
18053 : [[*find this headline]]
18055 - After =:= in a headline, complete tags. The list of tags is
18056 taken from the variable ~org-tag-alist~ -- possibly set through
18057 the =#+TAGS= in-buffer option, see [[*Setting tags]] --, or it is
18058 created dynamically from all tags used in the current buffer.
18060 - After =:= and not in a headline, complete property keys. The
18061 list of keys is constructed dynamically from all keys used in
18062 the current buffer.
18064 - After =[=, complete link abbreviations (see [[*Link
18067 - After =#+=, complete the special keywords like =TYP_TODO= or
18068 file-specific =OPTIONS=. After option keyword is complete,
18069 pressing {{{kbd(M-TAB)}}} again inserts example settings for
18072 - After =STARTUP= keyword, complete startup items.
18074 - When point is anywhere else, complete dictionary words using
18077 ** Structure templates
18079 :DESCRIPTION: Quick insertion of structural elements.
18081 #+cindex: template insertion
18082 #+cindex: insertion, of templates
18084 With just a few keystrokes, it is possible to insert empty structural
18085 blocks, such as =#+BEGIN_SRC= ... =#+END_SRC=, or to wrap existing
18086 text in such a block.
18088 - {{{kbd(C-c C-x w)}}} (~org-insert-structure-template~) ::
18090 Prompt for a type of block structure, and insert the block at
18091 point. If the region is active, it is wrapped in the block.
18092 First prompts the user for a key, which is used to look up
18093 a structure type from the values below. If the key is
18094 {{{kbd(TAB)}}}, the user is prompted to enter a type.
18096 #+vindex: org-structure-template-alist
18097 Available structure types are defined in
18098 ~org-structure-template-alist~, see the docstring for adding or
18102 #+cindex: template expansion
18103 #+cindex: insertion, of templates
18104 #+vindex: org-tempo-keywords-alist
18105 #+vindex: org-structure-template-alist
18106 Org Tempo expands snippets to structures defined in
18107 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For
18108 example, {{{kbd(< s TAB)}}} creates a code block. Enable it by
18109 customizing ~org-modules~ or add ~(require 'org-tempo)~ to your Emacs
18113 #+attr_texinfo: :columns 0.1 0.9
18114 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
18115 | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER= |
18116 | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT= |
18117 | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE= |
18118 | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT= |
18119 | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= |
18120 | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE= |
18121 | {{{kbd(s)}}} | =#+BEGIN_SRC= ... =#+END_SRC= |
18122 | {{{kbd(v)}}} | =#+BEGIN_VERSE= ... =#+END_VERSE= |
18126 :DESCRIPTION: Electric commands at the beginning of a headline.
18128 #+cindex: speed keys
18130 Single keystrokes can execute custom commands in an Org file when the
18131 cursor is on a headline. Without the extra burden of a meta or
18132 modifier key, Speed Keys can speed navigation or execute custom
18133 commands. Besides faster navigation, Speed Keys may come in handy on
18134 small mobile devices that do not have full keyboards. Speed Keys may
18135 also work on TTY devices known for their problems when entering Emacs
18138 #+vindex: org-use-speed-commands
18139 By default, Org has Speed Keys disabled. To activate Speed Keys, set
18140 the variable ~org-use-speed-commands~ to a non-~nil~ value. To
18141 trigger a Speed Key, the cursor must be at the beginning of an Org
18142 headline, before any of the stars.
18144 #+vindex: org-speed-commands-user
18145 #+findex: org-speed-command-help
18146 Org comes with a pre-defined list of Speed Keys. To add or modify
18147 Speed Keys, customize the variable, ~org-speed-commands-user~. For
18148 more details, see the variable's docstring. With Speed Keys
18149 activated, {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when
18150 cursor is at the beginning of an Org headline, shows currently active
18151 Speed Keys, including the user-defined ones.
18153 ** Code evaluation and security issues
18155 :DESCRIPTION: Org files evaluate in-line code.
18156 :ALT_TITLE: Code evaluation security
18159 Unlike plain text, running code comes with risk. Each =src= code
18160 block, in terms of risk, is equivalent to an executable file. Org
18161 therefore puts a few confirmation prompts by default. This is to
18162 alert the casual user from accidentally running untrusted code.
18164 For users who do not run code blocks or write code regularly, Org's
18165 default settings should suffice. However, some users may want to
18166 tweak the prompts for fewer interruptions. To weigh the risks of
18167 automatic execution of code blocks, here are some details about code
18170 Org evaluates code in the following circumstances:
18172 - /Source code blocks/ ::
18174 Org evaluates =src= code blocks in an Org file during export.
18175 Org also evaluates a =src= code block with the {{{kbd(C-c C-c)}}}
18176 key chord. Users exporting or running code blocks must load
18177 files only from trusted sources. Be wary of customizing
18178 variables that remove or alter default security measures.
18180 #+attr_texinfo: :options org-confirm-babel-evaluate
18182 When ~t~, Org prompts the user for confirmation before executing
18183 each code block. When ~nil~, Org executes code blocks without
18184 prompting the user for confirmation. When this option is set to
18185 a custom function, Org invokes the function with these two
18186 arguments: the source code language and the body of the code
18187 block. The custom function must return either a ~t~ or ~nil~,
18188 which determines if the user is prompted. Each source code
18189 language can be handled separately through this function
18193 For example, here is how to execute ditaa code blocks without
18196 #+begin_src emacs-lisp
18197 (defun my-org-confirm-babel-evaluate (lang body)
18198 (not (string= lang "ditaa"))) ;don't ask for ditaa
18199 (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
18202 - /Following =shell= and =elisp= links/ ::
18204 Org has two link types that can directly evaluate code (see
18205 [[*External links]]). Because such code is not visible, these links
18206 have a potential risk. Org therefore prompts the user when it
18207 encounters such links. The customization variables are:
18209 #+attr_texinfo: :options org-confirm-shell-link-function
18211 Function that prompts the user before executing a shell link.
18214 #+attr_texinfo: :options org-confirm-elisp-link-function
18216 Function that prompts the user before executing an Emacs Lisp link.
18219 - /Formulas in tables/ ::
18221 Formulas in tables (see [[*The spreadsheet]]) are code that is
18222 evaluated either by the Calc interpreter, or by the Emacs Lisp
18227 :DESCRIPTION: Adapting Org to your taste.
18229 #+cindex: customization
18230 #+cindex: options, for customization
18231 #+cindex: variables, for customization
18233 Org has more than 500 variables for customization. They can be
18234 accessed through the usual {{{kbd(M-x org-customize)}}} command. Or
18235 through the Org menu: Org \rarr Customization \rarr Browse Org Group.
18237 Org also has per-file settings for some variables (see [[*Summary of
18238 in-buffer settings]]).
18240 ** Summary of in-buffer settings
18242 :DESCRIPTION: Overview of the #+KEYWORDS.
18243 :ALT_TITLE: In-buffer settings
18245 #+cindex: in-buffer settings
18246 #+cindex: special keywords
18248 In-buffer settings start with =#+=, followed by a keyword, a colon,
18249 and then a word for each setting. Org accepts multiple settings on
18250 the same line. Org also accepts multiple lines for a keyword. This
18251 manual describes these settings throughout. A summary follows here.
18253 #+cindex: refresh set-up
18254 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
18255 Closing and reopening the Org file in Emacs also activates the
18258 #+attr_texinfo: :sep ,
18259 - =#+ARCHIVE: %s_done= ::
18261 #+cindex: ARCHIVE, keyword
18262 #+vindex: org-archive-location
18263 Sets the archive location of the agenda file. The corresponding
18264 variable is ~org-archive-location~.
18268 #+cindex: CATEGORY, keyword
18269 Sets the category of the agenda file, which applies to the entire
18272 - =#+COLUMNS: %25ITEM ...= ::
18274 #+cindex: COLUMNS, property
18275 Set the default format for columns view. This format applies
18276 when columns view is invoked in locations where no =COLUMNS=
18279 - =#+CONSTANTS: name1=value1 ...= ::
18281 #+cindex: CONSTANTS, keyword
18282 #+vindex: org-table-formula-constants
18283 #+vindex: org-table-formula
18284 Set file-local values for constants that table formulas can use.
18285 This line sets the local variable
18286 ~org-table-formula-constants-local~. The global version of this
18287 variable is ~org-table-formula-constants~.
18289 - =#+FILETAGS: :tag1:tag2:tag3:= ::
18291 #+cindex: FILETAGS, keyword
18292 Set tags that all entries in the file inherit from, including the
18295 - =#+LINK: linkword replace= ::
18297 #+cindex: LINK, keyword
18298 #+vindex: org-link-abbrev-alist
18299 Each line specifies one abbreviation for one link. Use multiple
18300 =LINK= keywords for more, see [[*Link abbreviations]]. The
18301 corresponding variable is ~org-link-abbrev-alist~.
18303 - =#+PRIORITIES: highest lowest default= ::
18305 #+cindex: PRIORITIES, keyword
18306 #+vindex: org-highest-priority
18307 #+vindex: org-lowest-priority
18308 #+vindex: org-default-priority
18309 This line sets the limits and the default for the priorities.
18310 All three must be either letters A--Z or numbers 0--9. The
18311 highest priority must have a lower ASCII number than the lowest
18314 - =#+PROPERTY: Property_Name Value= ::
18316 #+cindex: PROPERTY, keyword
18317 This line sets a default inheritance value for entries in the
18318 current buffer, most useful for specifying the allowed values of
18321 - =#+SETUPFILE: file= ::
18323 #+cindex: SETUPFILE, keyword
18324 The setup file or a URL pointing to such file is for additional
18325 in-buffer settings. Org loads this file and parses it for any
18326 settings in it only when Org opens the main file. If URL is
18327 specified, the contents are downloaded and stored in a temporary
18328 file cache. {{{kbd(C-c C-c)}}} on the settings line parses and
18329 loads the file, and also resets the temporary file cache. Org
18330 also parses and loads the document during normal exporting
18331 process. Org parses the contents of this document as if it was
18332 included in the buffer. It can be another Org file. To visit
18333 the file -- not a URL --, use {{{kbd(C-c ')}}} while the cursor
18334 is on the line with the file name.
18338 #+cindex: STARTUP, keyword
18339 Startup options Org uses when first visiting a file.
18341 #+vindex: org-startup-folded
18342 The first set of options deals with the initial visibility of the
18343 outline tree. The corresponding variable for global default
18344 settings is ~org-startup-folded~ with a default value of ~t~,
18345 which is the same as ~overview~.
18349 Top-level headlines only.
18357 No folding on any entry.
18359 - =showeverything= ::
18361 Show even drawer contents.
18363 #+vindex: org-startup-indented
18364 Dynamic virtual indentation is controlled by the variable
18365 ~org-startup-indented~.[fn:135]
18369 Start with ~org-indent-mode~ turned on.
18373 Start with ~org-indent-mode~ turned off.
18375 #+vindex: org-startup-align-all-tables
18376 Aligns tables consistently upon visiting a file. The corresponding
18377 variable is ~org-startup-align-all-tables~ with ~nil~ as default
18386 Do not align tables on startup.
18388 #+vindex: org-startup-shrink-all-tables
18389 Shrink table columns with a width cookie. The corresponding
18390 variable is ~org-startup-shrink-all-tables~ with ~nil~ as default
18393 #+vindex: org-startup-with-inline-images
18394 When visiting a file, inline images can be automatically displayed.
18395 The corresponding variable is ~org-startup-with-inline-images~,
18396 with a default value ~nil~ to avoid delays when visiting a file.
18398 - =inlineimages= ::
18400 Show inline images.
18402 - =noinlineimages= ::
18404 Do not show inline images on startup.
18406 #+vindex: org-log-done
18407 #+vindex: org-log-note-clock-out
18408 #+vindex: org-log-repeat
18409 Logging the closing and reopening of TODO items and clock
18410 intervals can be configured using these options (see variables
18411 ~org-log-done~, ~org-log-note-clock-out~, and ~org-log-repeat~).
18415 Record a timestamp when an item is marked DONE.
18419 Record timestamp and a note when DONE.
18423 Do not record when items are marked DONE.
18427 Record a time when reinstating a repeating item.
18429 - =lognoterepeat= ::
18431 Record a note when reinstating a repeating item.
18435 Do not record when reinstating repeating item.
18437 - =lognoteclock-out= ::
18439 Record a note when clocking out.
18441 - =nolognoteclock-out= ::
18443 Do not record a note when clocking out.
18445 - =logreschedule= ::
18447 Record a timestamp when scheduling time changes.
18449 - =lognotereschedule= ::
18451 Record a note when scheduling time changes.
18453 - =nologreschedule= ::
18455 Do not record when a scheduling date changes.
18457 - =logredeadline= ::
18459 Record a timestamp when deadline changes.
18461 - =lognoteredeadline= ::
18463 Record a note when deadline changes.
18465 - =nologredeadline= ::
18467 Do not record when a deadline date changes.
18471 Record a timestamp when refiling.
18473 - =lognoterefile= ::
18475 Record a note when refiling.
18479 Do not record when refiling.
18481 #+vindex: org-hide-leading-stars
18482 #+vindex: org-odd-levels-only
18483 Here are the options for hiding leading stars in outline headings,
18484 and for indenting outlines. The corresponding variables are
18485 ~org-hide-leading-stars~ and ~org-odd-levels-only~, both with
18486 a default setting ~nil~ (meaning =showstars= and =oddeven=).
18490 Make all but one of the stars starting a headline invisible.
18494 Show all stars starting a headline.
18498 Virtual indentation according to outline level.
18502 No virtual indentation according to outline level.
18506 Allow only odd outline levels (1, 3, ...).
18510 Allow all outline levels.
18512 #+vindex: org-put-time-stamp-overlays
18513 #+vindex: org-time-stamp-overlay-formats
18514 To turn on custom format overlays over timestamps (variables
18515 ~org-put-time-stamp-overlays~ and ~org-time-stamp-overlay-formats~),
18520 Overlay custom time format.
18522 #+vindex: constants-unit-system
18523 The following options influence the table spreadsheet (variable
18524 ~constants-unit-system~).
18528 =constants.el= should use the c-g-s unit system.
18532 =constants.el= should use the SI unit system.
18534 #+vindex: org-footnote-define-inline
18535 #+vindex: org-footnote-auto-label
18536 #+vindex: org-footnote-auto-adjust
18537 To influence footnote settings, use the following keywords. The
18538 corresponding variables are ~org-footnote-define-inline~,
18539 ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
18543 Define footnotes inline.
18547 Define footnotes in separate section.
18551 Define footnotes near first reference, but not inline.
18555 Prompt for footnote labels.
18559 Create =[fn:1]=-like labels automatically (default).
18563 Offer automatic label for editing or confirmation.
18567 Automatically renumber and sort footnotes.
18571 Do not renumber and sort automatically.
18573 #+cindex: org-hide-block-startup
18574 To hide blocks on startup, use these keywords. The corresponding
18575 variable is ~org-hide-block-startup~.
18579 Hide all begin/end blocks on startup.
18581 - =nohideblocks= ::
18583 Do not hide blocks on startup.
18585 #+cindex: org-pretty-entities
18586 The display of entities as UTF-8 characters is governed by the
18587 variable ~org-pretty-entities~ and the keywords
18589 - =entitiespretty= ::
18591 Show entities as UTF-8 characters where possible.
18593 - =entitiesplain= ::
18595 Leave entities plain.
18597 - =#+TAGS: TAG1(c1) TAG2(c2)= ::
18599 #+cindex: TAGS, keyword
18600 #+vindex: org-tag-alist
18601 These lines (several such lines are allowed) specify the valid
18602 tags in this file, and (potentially) the corresponding /fast tag
18603 selection/ keys. The corresponding variable is ~org-tag-alist~.
18605 - =#+TODO:=, =#+SEQ_TODO:=, =#+TYP_TODO:= ::
18607 #+cindex: SEQ_TODO, keyword
18608 #+cindex: TODO, keyword
18609 #+cindex: TYP_TODO, keyword
18610 #+vindex: org-todo-keywords
18611 These lines set the TODO keywords and their interpretation in the
18612 current file. The corresponding variable is ~org-todo-keywords~.
18614 ** The very busy {{{kbd(C-c C-c)}}} key
18616 :DESCRIPTION: When in doubt, press @kbd{C-c C-c}.
18619 #+cindex: C-c C-c, overview
18621 The {{{kbd(C-c C-c)}}} key in Org serves many purposes depending on
18622 the context. It is probably the most over-worked, multi-purpose key
18623 combination in Org. Its uses are well documented throughout this
18624 manual, but here is a consolidated list for easy reference.
18626 - If any highlights shown in the buffer from the creation of a sparse
18627 tree, or from clock display, remove such highlights.
18629 - If the cursor is in one of the special =KEYWORD= lines, scan the
18630 buffer for these lines and update the information. Also reset the
18631 Org file cache used to temporary store the contents of URLs used as
18632 values for keywords like =SETUPFILE=.
18634 - If the cursor is inside a table, realign the table. The table
18635 realigns even if automatic table editor is turned off.
18637 - If the cursor is on a =TBLFM= keyword, re-apply the formulas to the
18640 - If the current buffer is a capture buffer, close the note and file
18641 it. With a prefix argument, also jump to the target location after
18644 - If the cursor is on a =<<<target>>>=, update radio targets and
18645 corresponding links in this buffer.
18647 - If the cursor is on a property line or at the start or end of
18648 a property drawer, offer property commands.
18650 - If the cursor is at a footnote reference, go to the corresponding
18651 definition, and /vice versa/.
18653 - If the cursor is on a statistics cookie, update it.
18655 - If the cursor is in a plain list item with a checkbox, toggle the
18656 status of the checkbox.
18658 - If the cursor is on a numbered item in a plain list, renumber the
18661 - If the cursor is on the =#+BEGIN= line of a dynamic block, the block
18664 - If the cursor is at a timestamp, fix the day name in the timestamp.
18666 ** A cleaner outline view
18668 :DESCRIPTION: Getting rid of leading stars in the outline.
18669 :ALT_TITLE: Clean view
18671 #+cindex: hiding leading stars
18672 #+cindex: dynamic indentation
18673 #+cindex: odd-levels-only outlines
18674 #+cindex: clean outline view
18676 Org's default outline with stars and no indents can become too
18677 cluttered for short documents. For /book-like/ long documents, the
18678 effect is not as noticeable. Org provides an alternate stars and
18679 indentation scheme, as shown on the right in the following table. It
18680 uses only one star and indents text to line with the heading:
18683 ,* Top level headline | * Top level headline
18684 ,** Second level | * Second level
18685 ,*** Third level | * Third level
18686 some text | some text
18687 ,*** Third level | * Third level
18688 more text | more text
18689 ,* Another top level headline | * Another top level headline
18692 #+texinfo: @noindent
18693 #+cindex: Indent mode
18694 #+findex: org-indent-mode
18695 To turn this mode on, use the minor mode, ~org-indent-mode~. Text
18696 lines that are not headlines are prefixed with spaces to vertically
18697 align with the headline text[fn:136].
18699 #+vindex: org-indent-indentation-per-level
18700 To make more horizontal space, the headlines are shifted by two stars.
18701 This can be configured by the ~org-indent-indentation-per-level~
18702 variable. Only one star on each headline is visible, the rest are
18703 masked with the same font color as the background.
18705 Note that turning on ~org-indent-mode~ sets ~org-hide-leading-stars~
18706 to ~t~ and ~org-adapt-indentation~ to ~nil~.
18708 #+vindex: org-startup-indented
18709 To globally turn on ~org-indent-mode~ for all files, customize the
18710 variable ~org-startup-indented~.
18712 To turn on indenting for individual files, use =STARTUP= keyword as
18715 : #+STARTUP: indent
18717 Indent on startup makes Org use hard spaces to align text with
18718 headings as shown in examples below.
18720 - /Indentation of text below headlines/ ::
18722 Indent text to align with the headline.
18726 more text, now indented
18729 #+vindex: org-adapt-indentation
18730 Org supports this with paragraph filling, line wrapping, and
18731 structure editing, preserving or adapting the indentation as
18732 appropriate[fn:137].
18734 - /Hiding leading stars/ ::
18736 #+vindex: org-hide-leading-stars
18737 Org can make leading stars invisible. For global preference,
18738 configure the variable ~org-hide-leading-stars~. For per-file
18739 preference, use these file =STARTUP= options:
18742 ,#+STARTUP: hidestars
18743 ,#+STARTUP: showstars
18746 With stars hidden, the tree is shown as:
18749 ,* Top level headline
18755 #+texinfo: @noindent
18756 #+vindex: org-hide, face
18757 Because Org makes the font color the same as the background color
18758 to hide to stars, sometimes ~org-hide~ face may need tweaking to
18759 get the effect right. For some black and white combinations,
18760 ~grey90~ on a white background might mask the stars better.
18764 #+vindex: org-odd-levels-only
18765 Using stars for only odd levels, 1, 3, 5, ..., can also clean up
18766 the clutter. This removes two stars from each level[fn:138].
18767 For Org to properly handle this cleaner structure during edits
18768 and exports, configure the variable ~org-odd-levels-only~. To
18769 set this per-file, use either one of the following lines:
18773 ,#+STARTUP: oddeven
18776 To switch between single and double stars layouts, use {{{kbd(M-x
18777 org-convert-to-odd-levels)}}} and {{{kbd(M-x
18778 org-convert-to-oddeven-levels)}}}.
18780 ** Using Org on a TTY
18782 :DESCRIPTION: Using Org on a tty.
18783 :ALT_TITLE: TTY keys
18785 #+cindex: tty key bindings
18787 Org provides alternative key bindings for TTY and modern mobile
18788 devices that cannot handle cursor keys and complex modifier key
18789 chords. Some of these workarounds may be more cumbersome than
18790 necessary. Users should look into customizing these further based on
18791 their usage needs. For example, the normal {{{kbd(S-cursor)}}} for
18792 editing timestamp might be better with {{{kbd(C-c .)}}} chord.
18794 #+attr_texinfo: :columns 0.2 0.25 0.1 0.25
18795 | Default | Alternative 1 | Speed key | Alternative 2 |
18796 |----------------------+--------------------------+--------------+----------------------|
18797 | {{{kbd(S-TAB)}}} | {{{kbd(C-u TAB)}}} | {{{kbd(C)}}} | |
18798 | {{{kbd(M-left)}}} | {{{kbd(C-c C-x l)}}} | {{{kbd(l)}}} | {{{kbd(Esc left)}}} |
18799 | {{{kbd(M-S-left)}}} | {{{kbd(C-c C-x L)}}} | {{{kbd(L)}}} | |
18800 | {{{kbd(M-right)}}} | {{{kbd(C-c C-x r)}}} | {{{kbd(r)}}} | {{{kbd(Esc right)}}} |
18801 | {{{kbd(M-S-right)}}} | {{{kbd(C-c C-x R)}}} | {{{kbd(R)}}} | |
18802 | {{{kbd(M-up)}}} | {{{kbd(C-c C-x u)}}} | | {{{kbd(Esc up)}}} |
18803 | {{{kbd(M-S-up)}}} | {{{kbd(C-c C-x U)}}} | {{{kbd(U)}}} | |
18804 | {{{kbd(M-down)}}} | {{{kbd(C-c C-x d)}}} | | {{{kbd(Esc down)}}} |
18805 | {{{kbd(M-S-down)}}} | {{{kbd(C-c C-x D)}}} | {{{kbd(D)}}} | |
18806 | {{{kbd(S-RET)}}} | {{{kbd(C-c C-x c)}}} | | |
18807 | {{{kbd(M-RET)}}} | {{{kbd(C-c C-x m)}}} | | {{{kbd(Esc RET)}}} |
18808 | {{{kbd(M-S-RET)}}} | {{{kbd(C-c C-x M)}}} | | |
18809 | {{{kbd(S-left)}}} | {{{kbd(C-c left)}}} | | |
18810 | {{{kbd(S-right)}}} | {{{kbd(C-c right)}}} | | |
18811 | {{{kbd(S-up)}}} | {{{kbd(C-c up)}}} | | |
18812 | {{{kbd(S-down)}}} | {{{kbd(C-c down)}}} | | |
18813 | {{{kbd(C-S-left)}}} | {{{kbd(C-c C-x left)}}} | | |
18814 | {{{kbd(C-S-right)}}} | {{{kbd(C-c C-x right)}}} | | |
18816 ** Interaction with other packages
18818 :DESCRIPTION: With other Emacs packages.
18819 :ALT_TITLE: Interaction
18821 #+cindex: packages, interaction with other
18823 Org's compatibility and the level of interaction with other Emacs
18824 packages are documented here.
18826 *** Packages that Org cooperates with
18828 :DESCRIPTION: Packages Org cooperates with.
18829 :ALT_TITLE: Cooperation
18832 - =calc.el= by Dave Gillespie ::
18833 #+cindex: @file{calc.el}
18835 Org uses the Calc package for implementing spreadsheet
18836 functionality in its tables (see [[*The spreadsheet]]). Org also
18837 uses Calc for embedded calculations. See [[info:calc:Embedded%20Mode][GNU Emacs Calc Manual]].
18839 - =constants.el= by Carsten Dominik ::
18840 #+cindex: @file{constants.el}
18841 #+vindex: org-table-formula-constants
18843 Org can use names for constants in formulas in tables. Org can
18844 also use calculation suffixes for units, such as =M= for =Mega=.
18845 For a standard collection of such constants, install the
18846 =constants= package. Install version 2.0 of this package,
18847 available at [[http://www.astro.uva.nl/~dominik/Tools]]. Org checks
18848 if the function ~constants-get~ has been autoloaded.
18849 Installation instructions are in the file =constants.el=.
18851 - =cdlatex.el= by Carsten Dominik ::
18852 #+cindex: @file{cdlatex.el}
18854 Org mode can make use of the CDLaTeX package to efficiently enter
18855 LaTeX fragments into Org files. See [[*Using CDLaTeX to enter
18858 - =imenu.el= by Ake Stenhoff and Lars Lindberg ::
18859 #+cindex: @file{imenu.el}
18861 Imenu creates dynamic menus based on an index of items in a file.
18862 Org mode supports Imenu menus. Enable it with a mode hook as
18865 #+begin_src emacs-lisp
18866 (add-hook 'org-mode-hook
18867 (lambda () (imenu-add-to-menubar "Imenu")))
18870 #+vindex: org-imenu-depth
18871 By default the index is two levels deep -- you can modify the
18872 depth using the option ~org-imenu-depth~.
18874 - =speedbar.el= by Eric M. Ludlam ::
18875 #+cindex: @file{speedbar.el}
18877 Speedbar package creates a special Emacs frame for displaying
18878 files and index items in files. Org mode supports Speedbar;
18879 users can drill into Org files directly from the Speedbar. The
18880 {{{kbd(<)}}} in the Speedbar frame tweaks the agenda commands to
18881 that file or to a subtree.
18883 - =table.el= by Takaaki Ota ::
18884 #+cindex: table editor, @file{table.el}
18885 #+cindex: @file{table.el}
18887 Complex ASCII tables with automatic line wrapping, column- and
18888 row-spanning, and alignment can be created using the Emacs table
18889 package by Takaaki Ota. Org mode recognizes such tables and
18890 exports them properly. {{{kbd(C-c ')}}} to edit these tables in
18891 a special buffer, much like Org's code blocks. Because of
18892 interference with other Org mode functionality, Takaaki Ota
18893 tables cannot be edited directly in the Org buffer.
18895 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
18898 #+findex: org-edit-special
18899 Edit a =table.el= table. Works when the cursor is in
18900 a =table.el= table.
18902 - {{{kbd(C-c ~ )}}} (~org-table-create-with-table.el~) ::
18905 #+findex: org-table-create-with-table.el
18906 Insert a =table.el= table. If there is already a table at
18907 point, this command converts it between the =table.el=
18908 format and the Org mode format. See the documentation
18909 string of the command ~org-convert-table~ for the
18910 restrictions under which this is possible.
18912 *** Packages that conflict with Org mode
18914 :DESCRIPTION: Packages that lead to conflicts.
18915 :ALT_TITLE: Conflicts
18918 #+cindex: shift-selection-mode
18919 #+vindex: org-support-shift-select
18920 In Emacs, ~shift-selection-mode~ combines cursor motions with shift
18921 key to enlarge regions. Emacs sets this mode by default. This
18922 conflicts with Org's use of {{{kbd(S-<cursor>)}}} commands to change
18923 timestamps, TODO keywords, priorities, and item bullet types, etc.
18924 Since {{{kbd(S-<cursor>)}}} commands outside of specific contexts do
18925 not do anything, Org offers the variable ~org-support-shift-select~
18926 for customization. Org mode accommodates shift selection by (i)
18927 making it available outside of the special contexts where special
18928 commands apply, and (ii) extending an existing active region even if
18929 the cursor moves across a special context.
18931 - =cua.el= by Kim. F. Storm ::
18933 #+cindex: @file{cua.el}
18934 #+vindex: org-replace-disputed-keys
18935 Org key bindings conflict with {{{kbd(S-cursor)}}} keys used by
18936 CUA mode. For Org to relinquish these bindings to CUA mode,
18937 configure the variable ~org-replace-disputed-keys~. When set,
18938 Org moves the following key bindings in Org files, and in the
18939 agenda buffer -- but not during date selection.
18941 | S-UP \rArr{} M-p | S-DOWN \rArr{} M-n |
18942 | S-LEFT \rArr{} M-- | S-RIGHT \rArr{} M-+ |
18943 | C-S-LEFT \rArr{} M-S-- | C-S-RIGHT \rArr{} M-S-+ |
18945 #+vindex: org-disputed-keys
18946 Yes, these are unfortunately more difficult to remember. If you
18947 want to have other replacement keys, look at the variable
18948 ~org-disputed-keys~.
18950 - =ecomplete.el= by Lars Magne Ingebrigtsen ::
18952 #+cindex: @file{ecomplete.el}
18953 Ecomplete provides "electric" address completion in address
18954 header lines in message buffers. Sadly Orgtbl mode cuts
18955 Ecomplete's power supply: no completion happens when Orgtbl mode
18956 is enabled in message buffers while entering text in address
18957 header lines. If one wants to use ecomplete one should /not/
18958 follow the advice to automagically turn on Orgtbl mode in message
18959 buffers (see [[*The Orgtbl minor mode]]), but instead -- after
18960 filling in the message headers -- turn on Orgtbl mode manually
18961 when needed in the messages body.
18963 - =filladapt.el= by Kyle Jones ::
18965 #+cindex: @file{filladapt.el}
18966 Org mode tries to do the right thing when filling paragraphs,
18967 list items and other elements. Many users reported problems
18968 using both =filladapt.el= and Org mode, so a safe thing to do is
18969 to disable filladapt like this:
18971 #+begin_src emacs-lisp
18972 (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
18975 - =viper.el= by Michael Kifer ::
18976 #+cindex: @file{viper.el}
18979 Viper uses {{{kbd(C-c /)}}} and therefore makes this key not
18980 access the corresponding Org mode command ~org-sparse-tree~. You
18981 need to find another key for this command, or override the key in
18982 ~viper-vi-global-user-map~ with
18984 #+begin_src emacs-lisp
18985 (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
18988 - =windmove.el= by Hovav Shacham ::
18989 #+cindex: @file{windmove.el}
18991 This package also uses the {{{kbd(S-<cursor>)}}} keys, so
18992 everything written in the paragraph above about CUA mode also
18993 applies here. If you want to make the windmove function active
18994 in locations where Org mode does not have special functionality
18995 on {{{kbd(S-<cursor>)}}}, add this to your configuration:
18997 #+begin_src emacs-lisp
18998 ;; Make windmove work in Org mode:
18999 (add-hook 'org-shiftup-final-hook 'windmove-up)
19000 (add-hook 'org-shiftleft-final-hook 'windmove-left)
19001 (add-hook 'org-shiftdown-final-hook 'windmove-down)
19002 (add-hook 'org-shiftright-final-hook 'windmove-right)
19005 - =yasnippet.el= ::
19007 #+cindex: @file{yasnippet.el}
19008 The way Org mode binds the {{{kbd(TAB)}}} key (binding to ~[tab]~
19009 instead of ~"\t"~) overrules YASnippet's access to this key. The
19010 following code fixed this problem:
19012 #+begin_src emacs-lisp
19013 (add-hook 'org-mode-hook
19015 (setq-local yas/trigger-key [tab])
19016 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
19019 The latest version of YASnippet does not play well with Org mode.
19020 If the above code does not fix the conflict, start by defining
19021 the following function:
19023 #+begin_src emacs-lisp
19024 (defun yas/org-very-safe-expand ()
19025 (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
19028 Then, tell Org mode to use that function:
19030 #+begin_src emacs-lisp
19031 (add-hook 'org-mode-hook
19033 (make-variable-buffer-local 'yas/trigger-key)
19034 (setq yas/trigger-key [tab])
19035 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
19036 (define-key yas/keymap [tab] 'yas/next-field)))
19041 :DESCRIPTION: Encrypting Org files.
19044 Org Crypt encrypts the text of an entry, but not the headline, or
19045 properties. Behind the scene, it uses the Emacs EasyPG library to
19046 encrypt and decrypt files.
19048 #+vindex: org-crypt-tag-matcher
19049 Any text below a headline that has a =crypt= tag is automatically
19050 encrypted when the file is saved. To use a different tag, customize
19051 the ~org-crypt-tag-matcher~ setting.
19053 Here is a suggestion for Org Crypt settings in Emacs init file:
19055 #+begin_src emacs-lisp
19056 (require 'org-crypt)
19057 (org-crypt-use-before-save-magic)
19058 (setq org-tags-exclude-from-inheritance '("crypt"))
19060 (setq org-crypt-key nil)
19061 ;; GPG key to use for encryption
19062 ;; Either the Key ID or set to nil to use symmetric encryption.
19064 (setq auto-save-default nil)
19065 ;; Auto-saving does not cooperate with org-crypt.el: so you need to
19066 ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
19067 ;; you'll get an (annoying) message each time you start Org.
19069 ;; To turn it off only locally, you can insert this:
19071 ;; # -*- buffer-auto-save-file-name: nil; -*-
19074 Excluding the =crypt= tag from inheritance prevents already encrypted
19075 text from being encrypted again.
19079 :DESCRIPTION: How to hack your way around.
19080 :APPENDIX: Appendix
19084 This appendix describes some ways a user can extend the functionality
19089 :DESCRIPTION: How to reach into Org's internals.
19093 Org has a large number of hook variables for adding functionality.
19094 This appendix illustrates using a few. A complete list of hooks with
19095 documentation is maintained by the Worg project at
19096 http://orgmode.org/worg/doc.html#hooks.
19100 :DESCRIPTION: Available extensions.
19102 #+cindex: add-on packages
19104 Various authors wrote a large number of add-on packages for Org.
19106 These packages are not part of Emacs, but they are distributed as
19107 contributed packages with the separate release available at
19108 http://orgmode.org. See the =contrib/README= file in the source code
19109 directory for a list of contributed files. Worg page with more
19110 information is at: http://orgmode.org/worg/org-contrib/.
19112 ** Adding hyperlink types
19114 :DESCRIPTION: New custom link types.
19116 #+cindex: hyperlinks, adding new types
19118 Org has many built-in hyperlink types (see [[*Hyperlinks]]), and an
19119 interface for adding new link types. The example file, =org-man.el=,
19120 shows the process of adding Org links to Unix man pages, which look
19123 : [[man:printf][The printf manual]]
19125 #+begin_src emacs-lisp
19126 ;;; org-man.el - Support for links to manpages in Org
19130 (org-add-link-type "man" 'org-man-open)
19131 (add-hook 'org-store-link-functions 'org-man-store-link)
19133 (defcustom org-man-command 'man
19134 "The Emacs command to be used to display a man page."
19136 :type '(choice (const man) (const woman)))
19138 (defun org-man-open (path)
19139 "Visit the manpage on PATH.
19140 PATH should be a topic that can be thrown at the man command."
19141 (funcall org-man-command path))
19143 (defun org-man-store-link ()
19144 "Store a link to a manpage."
19145 (when (memq major-mode '(Man-mode woman-mode))
19146 ;; This is a man page, we do make this link
19147 (let* ((page (org-man-get-page-name))
19148 (link (concat "man:" page))
19149 (description (format "Manpage for %s" page)))
19150 (org-store-link-props
19153 :description description))))
19155 (defun org-man-get-page-name ()
19156 "Extract the page name from the buffer name."
19157 ;; This works for both `Man-mode' and `woman-mode'.
19158 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
19159 (match-string 1 (buffer-name))
19160 (error "Cannot create link to this man page")))
19164 ;;; org-man.el ends here
19167 #+texinfo: @noindent
19168 To activate links to man pages in Org, enter this in the init file:
19170 #+begin_src emacs-lisp
19174 #+texinfo: @noindent
19175 A review of =org-man.el=:
19177 1. First, ~(require 'org)~ ensures =org.el= is loaded.
19179 2. Then ~org-add-link-type~ defines a new link type with =man= prefix.
19180 The call contains the function to call that follows the link type.
19183 #+vindex: org-store-link-functions
19184 The next line adds a function to ~org-store-link-functions~ that
19185 records a useful link with the command {{{kbd(C-c l)}}} in a buffer
19186 displaying a man page.
19188 The rest of the file defines necessary variables and functions. First
19189 is the customization variable ~org-man-command~. It has two options,
19190 ~man~ and ~woman~. Next is a function whose argument is the link
19191 path, which for man pages is the topic of the man command. To follow
19192 the link, the function calls the ~org-man-command~ to display the man
19195 {{{kbd(C-c l)}}} constructs and stores the link.
19197 {{{kbd(C-c l)}}} calls the function ~org-man-store-link~, which first
19198 checks if the ~major-mode~ is appropriate. If check fails, the
19199 function returns ~nil~. Otherwise the function makes a link string by
19200 combining the =man:= prefix with the man topic. The function then
19201 calls ~org-store-link-props~ with ~:type~ and ~:link~ properties.
19202 A ~:description~ property is an optional string that is displayed when
19203 the function inserts the link in the Org buffer.
19205 {{{kbd(C-c C-l)}}} inserts the stored link.
19207 To define new link types, define a function that implements completion
19208 support with {{{kbd(C-c C-l)}}}. This function should not accept any
19209 arguments but return the appropriate prefix and complete link string.
19211 ** Adding export back-ends
19213 :DESCRIPTION: How to write new export back-ends.
19215 #+cindex: Export, writing back-ends
19217 Org's export engine makes it easy for writing new back-ends. The
19218 framework on which the engine was built makes it easy to derive new
19219 back-ends from existing ones.
19221 #+findex: org-export-define-backend
19222 #+findex: org-export-define-derived-backend
19223 The two main entry points to the export engine are:
19224 ~org-export-define-backend~ and ~org-export-define-derived-backend~.
19225 To grok these functions, see =ox-latex.el= for an example of defining
19226 a new back-end from scratch, and =ox-beamer.el= for an example of
19227 deriving from an existing engine.
19229 For creating a new back-end from scratch, first set its name as
19230 a symbol in an alist consisting of elements and export functions. To
19231 make the back-end visible to the export dispatcher, set ~:menu-entry~
19232 keyword. For export options specific to this back-end, set the
19235 For creating a new back-end from an existing one, set
19236 ~:translate-alist~ to an alist of export functions. This alist
19237 replaces the parent back-end functions.
19239 For complete documentation, see [[http://orgmode.org/worg/dev/org-export-reference.html][the Org Export Reference on Worg]].
19241 ** Tables in arbitrary syntax
19243 :DESCRIPTION: Orgtbl for LaTeX and other programs.
19245 #+cindex: tables, in other modes
19246 #+cindex: lists, in other modes
19247 #+cindex: Orgtbl mode
19249 Due to Org's success in handling tables with Orgtbl, a frequently
19250 requested feature is the use of Org's table functions in other modes,
19251 e.g., LaTeX. This would be hard to do in a general way without
19252 complicated customization nightmares. Moreover, that would take Org
19253 away from its simplicity roots that Orgtbl has proven. There is,
19254 however, an alternate approach to accomplishing the same.
19256 This approach involves implementing a custom /translate/ function that
19257 operates on a native Org /source table/ to produce a table in another
19258 format. This strategy would keep the excellently working Orgtbl
19259 simple and isolate complications, if any, confined to the translate
19260 function. To add more alien table formats, we just add more translate
19261 functions. Also the burden of developing custom translate functions
19262 for new table formats is in the hands of those who know those formats
19267 :DESCRIPTION: Sending and receiving radio tables.
19269 #+cindex: radio tables
19271 Radio tables are target locations for translated tables that are not near
19272 their source. Org finds the target location and inserts the translated
19275 The key to finding the target location is the magic words =BEGIN/END
19276 RECEIVE ORGTBL=. They have to appear as comments in the current mode.
19277 If the mode is C, then:
19280 /* BEGIN RECEIVE ORGTBL table_name */
19281 /* END RECEIVE ORGTBL table_name */
19284 #+texinfo: @noindent
19285 At the location of source, Org needs a special line to direct Orgtbl
19286 to translate and to find the target for inserting the translated
19287 table. For example:
19289 #+cindex: ORGTBL, keyword
19290 : #+ORGTBL: SEND table_name translation_function arguments ...
19292 #+texinfo: @noindent
19293 =table_name= is the table's reference name, which is also used in the
19294 receiver lines, and the =translation_function= is the Lisp function
19295 that translates. This line, in addition, may also contain alternating
19296 key and value arguments at the end. The translation function gets
19297 these values as a property list. A few standard parameters are
19298 already recognized and acted upon before the translation function is
19303 Skip the first N lines of the table. Hlines do count; include
19304 them if they are to be skipped.
19306 - =:skipcols (n1 n2 ...)= ::
19308 List of columns to be skipped. First Org automatically discards
19309 columns with calculation marks and then sends the table to the
19310 translator function, which then skips columns as specified in
19313 #+texinfo: @noindent
19314 To keep the source table intact in the buffer without being disturbed
19315 when the source file is compiled or otherwise being worked on, use one
19316 of these strategies:
19318 - Place the table in a block comment. For example, in C mode you
19319 could wrap the table between =/*= and =*/= lines.
19321 - Put the table after an "end" statement. For example ~\bye~ in TeX
19322 and ~\end{document}~ in LaTeX.
19324 - Comment and un-comment each line of the table during edits. The
19325 {{{kbd(M-x orgtbl-toggle-comment)}}} command makes toggling easy.
19327 *** A LaTeX example of radio tables
19329 :DESCRIPTION: Step by step, almost a tutorial.
19330 :ALT_TITLE: A LaTeX example
19332 #+cindex: @LaTeX{}, and Orgtbl mode
19334 To wrap a source table in LaTeX, use the =comment= environment
19335 provided by =comment.sty=[fn:139]. To activate it, put
19336 ~\usepackage{comment}~ in the document header. Orgtbl mode inserts
19337 a radio table skeleton[fn:138] with the command {{{kbd(M-x
19338 orgtbl-insert-radio-table)}}}, which prompts for a table name. For
19339 example, if =salesfigures= is the name, the template inserts:
19342 % BEGIN RECEIVE ORGTBL salesfigures
19343 % END RECEIVE ORGTBL salesfigures
19345 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
19350 #+vindex: @LaTeX{}-verbatim-environments
19351 #+texinfo: @noindent
19352 The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
19353 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
19354 the table at the target (receive) location named =salesfigures=. Now
19355 the table is ready for data entry. It can even use spreadsheet
19359 % BEGIN RECEIVE ORGTBL salesfigures
19360 % END RECEIVE ORGTBL salesfigures
19362 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
19363 | Month | Days | Nr sold | per day |
19364 |-------+------+---------+---------|
19365 | Jan | 23 | 55 | 2.4 |
19366 | Feb | 21 | 16 | 0.8 |
19367 | March | 22 | 278 | 12.6 |
19368 ,#+TBLFM: $4=$3/$2;%.1f
19369 % $ (optional extra dollar to keep Font Lock happy, see footnote)
19373 #+texinfo: @noindent
19374 After editing, {{{kbd(C-c C-c)}}} inserts the translated table at the
19375 target location, between the two marker lines.
19377 For hand-made custom tables, note that the translator needs to skip
19378 the first two lines of the source table. Also the command has to
19379 /splice/ out the target table without the header and footer.
19382 \begin{tabular}{lrrr}
19383 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
19384 % BEGIN RECEIVE ORGTBL salesfigures
19385 % END RECEIVE ORGTBL salesfigures
19389 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
19390 | Month | Days | Nr sold | per day |
19391 |-------+------+---------+---------|
19392 | Jan | 23 | 55 | 2.4 |
19393 | Feb | 21 | 16 | 0.8 |
19394 | March | 22 | 278 | 12.6 |
19395 ,#+TBLFM: $4=$3/$2;%.1f
19399 The LaTeX translator function ~orgtbl-to-latex~ is already part of
19400 Orgtbl mode and uses a =tabular= environment to typeset the table and
19401 marks horizontal lines with ~\hline~. For additional parameters to
19402 control output, see [[*Translator functions]]:
19404 - ~:splice nil/t~ ::
19406 When non-~nil~, return only table body lines; not wrapped in
19407 tabular environment. Default is ~nil~.
19411 Format to warp each field. It should contain =%s= for the
19412 original field value. For example, to wrap each field value in
19413 dollar symbol, you could use =:fmt "$%s$"=. Format can also wrap
19414 a property list with column numbers and formats, for example
19415 =:fmt (2 "$%s$" 4 "%s\\%%")=. In place of a string, a function
19416 of one argument can be used; the function must return a formatted
19421 Format numbers as exponentials. The spec should have =%s= twice
19422 for inserting mantissa and exponent, for example ="%s\\times10^{%s}"=.
19423 This may also be a property list with column numbers and formats,
19424 for example =:efmt (2 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")=. After
19425 {{{var(EFMT)}}} has been applied to a value, {{{var(FMT)}}} --
19426 see above -- is also be applied. Functions with two arguments
19427 can be supplied instead of strings. By default, no special
19428 formatting is applied.
19430 *** Translator functions
19432 :DESCRIPTION: Copy and modify.
19434 #+cindex: HTML, and Orgtbl mode
19435 #+cindex: translator function
19437 #+findex: orgtbl-to-csv
19438 #+findex: orgtbl-to-tsv
19439 #+findex: orgtbl-to-latex
19440 #+findex: orgtbl-to-html
19441 #+findex: orgtbl-to-texinfo
19442 #+findex: orgtbl-to-unicode
19443 #+findex: orgtbl-to-orgtbl
19444 #+findex: orgtbl-to-generic
19445 Orgtbl mode has built-in translator functions: ~orgtbl-to-csv~
19446 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values),
19447 ~orgtbl-to-latex~, ~orgtbl-to-html~, ~orgtbl-to-texinfo~,
19448 ~orgtbl-to-unicode~ and ~orgtbl-to-orgtbl~. They use the generic
19449 translator, ~orgtbl-to-generic~, which delegates translations to
19450 various export back-ends.
19452 Properties passed to the function through the =ORGTBL SEND= line take
19453 precedence over properties defined inside the function. For example,
19454 this overrides the default LaTeX line endings, ~\\~, with ~\\[2mm]~:
19456 : #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
19458 For a new language translator, define a converter function. It can be
19459 a generic function, such as shown in this example. It marks
19460 a beginning and ending of a table with =!BTBL!= and =!ETBL!=;
19461 a beginning and ending of lines with =!BL!= and =!EL!=; and uses a TAB
19462 for a field separator:
19464 #+begin_src emacs-lisp
19465 (defun orgtbl-to-language (table params)
19466 "Convert the orgtbl-mode TABLE to language."
19469 (org-combine-plists
19470 '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
19474 #+texinfo: @noindent
19475 The documentation for the ~orgtbl-to-generic~ function shows
19476 a complete list of parameters, each of which can be passed through to
19477 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
19478 that generic function.
19480 For complicated translations the generic translator function could be
19481 replaced by a custom translator function. Such a custom function must
19482 take two arguments and return a single string containing the formatted
19483 table. The first argument is the table whose lines are a list of
19484 fields or the symbol ~hline~. The second argument is the property
19485 list consisting of parameters specified in the =#+ORGTBL: SEND= line.
19486 Please share your translator functions by posting them to the Org
19487 users mailing list, at mailto:emacs-orgmode@gnu.org.
19491 :DESCRIPTION: Automatically filled blocks.
19493 #+cindex: dynamic blocks
19495 Org supports /dynamic blocks/ in Org documents. They are inserted
19496 with begin and end markers like any other code block, but the contents
19497 are updated automatically by a user function. For example, {{{kbd(C-c
19498 C-x C-r)}}} inserts a dynamic table that updates the work time (see
19499 [[*Clocking work time]]).
19501 Dynamic blocks can have names and function parameters. The syntax is
19502 similar to source code block specifications:
19505 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
19510 These commands update dynamic blocks:
19512 - {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
19514 #+kindex: C-c C-x C-u
19515 #+findex: org-dblock-update
19516 Update dynamic block at point.
19518 - {{{kbd(C-u C-c C-x C-u)}}} ::
19520 #+kindex: C-u C-c C-x C-u
19521 Update all dynamic blocks in the current file.
19523 Before updating a dynamic block, Org removes content between the
19524 =BEGIN= and =END= markers. Org then reads the parameters on the
19525 =BEGIN= line for passing to the writer function. If the function
19526 expects to access the removed content, then Org expects an extra
19527 parameter, =:content=, on the =BEGIN= line.
19529 The syntax for naming a writer function with a dynamic block labelled
19530 =myblock= is: ~org-dblock-write:myblock~. Parameters come from the
19533 The following is an example of a dynamic block and a block writer function
19534 that updates the time when the function was last run:
19537 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
19542 #+texinfo: @noindent
19543 The dynamic block's writer function:
19545 #+begin_src emacs-lisp
19546 (defun org-dblock-write:block-update-time (params)
19547 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
19548 (insert "Last block update at: "
19549 (format-time-string fmt))))
19552 To keep dynamic blocks up-to-date in an Org file, use the function,
19553 ~org-update-all-dblocks~ in hook, such as ~before-save-hook~. The
19554 ~org-update-all-dblocks~ function does not run if the file is not in
19557 #+findex: org-narrow-to-block
19558 Dynamic blocks, like any other block, can be narrowed with
19559 ~org-narrow-to-block~.
19561 ** Special agenda views
19563 :DESCRIPTION: Customized views.
19565 #+cindex: agenda views, user-defined
19567 #+vindex: org-agenda-skip-function
19568 #+vindex: org-agenda-skip-function-global
19569 Org provides a special hook to further limit items in agenda views:
19570 ~agenda~, ~agenda*~[fn:141], ~todo~, ~alltodo~, ~tags~, ~tags-todo~,
19571 ~tags-tree~. Specify a custom function that tests inclusion of every
19572 matched item in the view. This function can also skip as much as is
19575 For a global condition applicable to agenda views, use the
19576 ~org-agenda-skip-function-global~ variable. Org uses a global
19577 condition with ~org-agenda-skip-function~ for custom searching.
19579 This example defines a function for a custom view showing TODO items
19580 with =waiting= status. Manually this is a multi-step search process,
19581 but with a custom view, this can be automated as follows:
19583 The custom function searches the subtree for the =waiting= tag and
19584 returns ~nil~ on match. Otherwise it gives the location from where
19585 the search continues.
19587 #+begin_src emacs-lisp
19588 (defun my-skip-unless-waiting ()
19589 "Skip trees that are not waiting"
19590 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
19591 (if (re-search-forward ":waiting:" subtree-end t)
19592 nil ; tag found, do not skip
19593 subtree-end))) ; tag not found, continue after end of subtree
19596 To use this custom function in a custom agenda command:
19598 #+begin_src emacs-lisp
19599 (org-add-agenda-custom-command
19600 '("b" todo "PROJECT"
19601 ((org-agenda-skip-function 'my-skip-unless-waiting)
19602 (org-agenda-overriding-header "Projects waiting for something: "))))
19605 #+vindex: org-agenda-overriding-header
19606 Note that this also binds ~org-agenda-overriding-header~ to a more
19607 meaningful string suitable for the agenda view.
19609 #+vindex: org-odd-levels-only
19610 #+vindex: org-agenda-skip-function
19611 Search for entries with a limit set on levels for the custom search.
19612 This is a general approach to creating custom searches in Org. To
19613 include all levels, use =LEVEL>0=[fn:142]. Then to selectively pick
19614 the matched entries, use ~org-agenda-skip-function~, which also
19615 accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and
19616 ~org-agenda-skip-subtree-if~. For example:
19618 - ~(org-agenda-skip-entry-if 'scheduled)~ ::
19620 Skip current entry if it has been scheduled.
19622 - ~(org-agenda-skip-entry-if 'notscheduled)~ ::
19624 Skip current entry if it has not been scheduled.
19626 - ~(org-agenda-skip-entry-if 'deadline)~ ::
19628 Skip current entry if it has a deadline.
19630 - ~(org-agenda-skip-entry-if 'scheduled 'deadline)~ ::
19632 Skip current entry if it has a deadline, or if it is scheduled.
19634 - ~(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))~ ::
19636 Skip current entry if the TODO keyword is TODO or WAITING.
19638 - ~(org-agenda-skip-entry-if 'todo 'done)~ ::
19640 Skip current entry if the TODO keyword marks a DONE state.
19642 - ~(org-agenda-skip-entry-if 'timestamp)~ ::
19644 Skip current entry if it has any timestamp, may also be deadline
19647 - ~(org-agenda-skip-entry-if 'regexp "regular expression")~ ::
19649 Skip current entry if the regular expression matches in the
19652 - ~(org-agenda-skip-entry-if 'notregexp "regular expression")~ ::
19654 Skip current entry unless the regular expression matches.
19656 - ~(org-agenda-skip-subtree-if 'regexp "regular expression")~ ::
19658 Same as above, but check and skip the entire subtree.
19660 The following is an example of a search for =waiting= without the
19663 #+begin_src emacs-lisp
19664 (org-add-agenda-custom-command
19665 '("b" todo "PROJECT"
19666 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
19667 'regexp ":waiting:"))
19668 (org-agenda-overriding-header "Projects waiting for something: "))))
19671 ** Speeding up your agendas
19673 :DESCRIPTION: Tips on how to speed up your agendas.
19675 #+cindex: agenda views, optimization
19677 Some agenda commands slow down when the Org files grow in size or
19678 number. Here are tips to speed up:
19680 - Reduce the number of Org agenda files to avoid slowdowns due to hard drive
19683 - Reduce the number of DONE and archived headlines so agenda
19684 operations that skip over these can finish faster.
19686 - Do not dim blocked tasks:
19687 #+vindex: org-agenda-dim-blocked-tasks
19689 #+begin_src emacs-lisp
19690 (setq org-agenda-dim-blocked-tasks nil)
19693 - Stop preparing agenda buffers on startup:
19694 #+vindex: org-startup-folded
19695 #+vindex: org-agenda-inhibit-startup
19697 #+begin_src emacs-lisp
19698 (setq org-agenda-inhibit-startup nil)
19701 - Disable tag inheritance for agendas:
19702 #+vindex: org-agenda-show-inherited-tags
19703 #+vindex: org-agenda-use-tag-inheritance
19705 #+begin_src emacs-lisp
19706 (setq org-agenda-use-tag-inheritance nil)
19709 These options can be applied to selected agenda views. For more
19710 details about generation of agenda views, see the docstrings for the
19711 relevant variables, and this [[http://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda
19714 ** Extracting agenda information
19716 :DESCRIPTION: Post-processing agenda information.
19718 #+cindex: agenda, pipe
19719 #+cindex: scripts, for agenda processing
19721 Org provides commands to access agendas through Emacs batch mode.
19722 Through this command-line interface, agendas are automated for further
19723 processing or printing.
19725 #+vindex: org-agenda-custom-commands
19726 #+findex: org-batch-agenda
19727 ~org-batch-agenda~ creates an agenda view in ASCII and outputs to
19728 standard output. This command takes one string parameter. When
19729 string consists of a single character, Org uses it as a key to
19730 ~org-agenda-custom-commands~. These are the same ones available
19731 through {{{kbd(C-c a)}}}.
19733 This example command line directly prints the TODO list to the printer:
19735 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
19737 When the string parameter length is two or more characters, Org
19738 matches it with tags/TODO strings. For example, this example command
19739 line prints items tagged with =shop=, but excludes items tagged with
19743 emacs -batch -l ~/.emacs \
19744 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
19747 #+texinfo: @noindent
19748 An example showing on-the-fly parameter modifications:
19751 emacs -batch -l ~/.emacs \
19752 -eval '(org-batch-agenda "a" \
19753 org-agenda-span (quote month) \
19754 org-agenda-include-diary nil \
19755 org-agenda-files (quote ("~/org/project.org")))' \
19759 #+texinfo: @noindent
19760 which produces an agenda for the next 30 days from just the
19761 =~/org/projects.org= file.
19763 #+findex: org-batch-agenda-csv
19764 For structured processing of agenda output, use ~org-batch-agenda-csv~
19765 with the following fields:
19767 - category :: The category of the item
19768 - head :: The headline, without TODO keyword, TAGS and PRIORITY
19769 - type :: The type of the agenda entry, can be
19771 | ~todo~ | selected in TODO match |
19772 | ~tagsmatch~ | selected in tags match |
19773 | ~diary~ | imported from diary |
19774 | ~deadline~ | a deadline |
19775 | ~scheduled~ | scheduled |
19776 | ~timestamp~ | appointment, selected by timestamp |
19777 | ~closed~ | entry was closed on date |
19778 | ~upcoming-deadline~ | warning about nearing deadline |
19779 | ~past-scheduled~ | forwarded scheduled item |
19780 | ~block~ | entry has date block including date |
19782 - todo :: The TODO keyword, if any
19783 - tags :: All tags including inherited ones, separated by colons
19784 - date :: The relevant date, like =2007-2-14=
19785 - time :: The time, like =15:00-16:50=
19786 - extra :: String with extra planning info
19787 - priority-l :: The priority letter if any was given
19788 - priority-n :: The computed numerical priority
19790 #+texinfo: @noindent
19791 If the selection of the agenda item was based on a timestamp,
19792 including those items with =DEADLINE= and =SCHEDULED= keywords, then
19793 Org includes date and time in the output.
19795 If the selection of the agenda item was based on a timestamp (or
19796 deadline/scheduled), then Org includes date and time in the output.
19798 Here is an example of a post-processing script in Perl. It takes the
19799 CSV output from Emacs and prints with a checkbox:
19804 # define the Emacs command to run
19805 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
19807 # run it and capture the output
19808 $agenda = qx{$cmd 2>/dev/null};
19810 # loop over all lines
19811 foreach $line (split(/\n/,$agenda)) {
19812 # get the individual values
19813 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
19814 $priority_l,$priority_n) = split(/,/,$line);
19815 # process and print
19816 print "[ ] $head\n";
19820 ** Using the property API
19822 :DESCRIPTION: Writing programs that use entry properties.
19824 #+cindex: API, for properties
19825 #+cindex: properties, API
19827 Here is a description of the functions that can be used to work with
19830 #+attr_texinfo: :options org-entry-properties &optional pom which
19832 Get all properties of the entry at point-or-marker {{{var(POM)}}}.
19833 This includes the TODO keyword, the tags, time strings for deadline,
19834 scheduled, and clocking, and any additional properties defined in the
19835 entry. The return value is an alist. Keys may occur multiple times
19836 if the property key was used several times. {{{var(POM)}}} may also
19837 be ~nil~, in which case the current entry is used. If
19838 {{{var(WHICH)}}} is ~nil~ or ~all~, get all properties. If
19839 {{{var(WHICH)}}} is ~special~ or ~standard~, only get that subclass.
19842 #+vindex: org-use-property-inheritance
19843 #+findex: org-insert-property-drawer
19844 #+attr_texinfo: :options org-entry-get pom property &optional inherit
19846 Get value of {{{var(PROPERTY)}}} for entry at point-or-marker
19847 {{{var(POM)}}}. By default, this only looks at properties defined
19848 locally in the entry. If {{{var(INHERIT)}}} is non-~nil~ and the
19849 entry does not have the property, then also check higher levels of the
19850 hierarchy. If {{{var(INHERIT)}}} is the symbol ~selective~, use
19851 inheritance if and only if the setting of
19852 ~org-use-property-inheritance~ selects {{{var(PROPERTY)}}} for
19856 #+attr_texinfo: :options org-entry-delete pom property
19858 Delete the property {{{var(PROPERTY)}}} from entry at point-or-marker
19862 #+attr_texinfo: :options org-entry-put pom property value
19864 Set {{{var(PROPERTY)}}} to {{{var(VALUES)}}} for entry at
19865 point-or-marker POM.
19868 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
19870 Get all property keys in the current buffer.
19873 #+attr_texinfo: :options org-insert-property-drawer
19875 Insert a property drawer for the current entry. Also
19878 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
19880 Set {{{var(PROPERTY)}}} at point-or-marker {{{var(POM)}}} to
19881 {{{var(VALUES)}}}. {{{var(VALUES)}}} should be a list of strings.
19882 They are concatenated, with spaces as separators.
19885 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
19887 Treat the value of the property {{{var(PROPERTY)}}} as
19888 a whitespace-separated list of values and return the values as a list
19892 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
19894 Treat the value of the property {{{var(PROPERTY)}}} as
19895 a whitespace-separated list of values and make sure that
19896 {{{var(VALUE)}}} is in this list.
19899 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
19901 Treat the value of the property {{{var(PROPERTY)}}} as
19902 a whitespace-separated list of values and make sure that
19903 {{{var(VALUE)}}} is /not/ in this list.
19906 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
19908 Treat the value of the property {{{var(PROPERTY)}}} as
19909 a whitespace-separated list of values and check if {{{var(VALUE)}}} is
19913 #+attr_texinfo: :options org-property-allowed-value-functions
19915 Hook for functions supplying allowed values for a specific property.
19916 The functions must take a single argument, the name of the property,
19917 and return a flat list of allowed values. If =:ETC= is one of the
19918 values, use the values as completion help, but allow also other values
19919 to be entered. The functions must return ~nil~ if they are not
19920 responsible for this property.
19923 ** Using the mapping API
19925 :DESCRIPTION: Mapping over all or selected entries.
19927 #+cindex: API, for mapping
19928 #+cindex: mapping entries, API
19930 Org has sophisticated mapping capabilities to find all entries
19931 satisfying certain criteria. Internally, this functionality is used
19932 to produce agenda views, but there is also an API that can be used to
19933 execute arbitrary functions for each or selected entries. The main
19934 entry point for this API is:
19936 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
19938 Call {{{(var(FUNC))}}} at each headline selected by {{{var(MATCH)}}}
19939 in {{{var(SCOPE)}}}.
19941 {{{var(FUNC)}}} is a function or a Lisp form. With the cursor
19942 positioned at the beginning of the headline, call the function without
19943 arguments. Org returns an alist of return values of calls to the
19946 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in
19947 save-excursion form. After evaluation, Org moves the cursor to the
19948 end of the line that was just processed. Search continues from that
19949 point forward. This may not always work as expected under some
19950 conditions, such as if the current sub-tree was removed by a previous
19951 archiving operation. In such rare circumstances, Org skips the next
19952 entry entirely when it should not. To stop Org from such skips, make
19953 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
19956 {{{var(MATCH)}}} is a tags/property/TODO match. Org iterates only
19957 matched headlines. Org iterates over all headlines when
19958 {{{var(MATCH)}}} is ~nil~ or ~t~.
19960 {{{var(SCOPE)}}} determines the scope of this command. It can be any
19965 The current buffer, respecting the restriction, if any.
19969 The subtree started with the entry at point.
19973 The entries within the active region, if any.
19977 The current buffer, without restriction.
19979 - ~file-with-archives~ ::
19981 The current buffer, and any archives associated with it.
19987 - ~agenda-with-archives~ ::
19989 All agenda files with any archive files associated with them.
19991 - ~(file1 file2 ...)~ ::
19993 If this is a list, all files in the list are scanned.
19995 #+texinfo: @noindent
19996 The remaining arguments are treated as settings for the scanner's
19997 skipping facilities. Valid arguments are:
20001 Skip trees with the archive tag.
20005 Skip trees with the COMMENT keyword.
20007 - function or Lisp form ::
20009 #+vindex: org-agenda-skip-function
20010 Used as value for ~org-agenda-skip-function~, so whenever the
20011 function returns ~t~, {{{var(FUNC)}}} is called for that entry
20012 and search continues from the point where the function leaves it.
20015 The mapping routine can call any arbitrary function, even functions
20016 that change meta data or query the property API (see [[*Using the
20017 property API]]). Here are some handy functions:
20019 #+attr_texinfo: :options org-todo &optional arg
20021 Change the TODO state of the entry. See the docstring of the
20022 functions for the many possible values for the argument
20026 #+attr_texinfo: :options org-priority &optional action
20028 Change the priority of the entry. See the docstring of this function
20029 for the possible values for {{{var(ACTION)}}}.
20032 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
20034 Toggle the tag {{{var(TAG)}}} in the current entry. Setting
20035 {{{var(ONOFF)}}} to either ~on~ or ~off~ does not toggle tag, but
20036 ensure that it is either on or off.
20039 #+attr_texinfo: :options org-promote
20041 Promote the current entry.
20044 #+attr_texinfo: :options org-demote
20046 Demote the current entry.
20049 This example turns all entries tagged with =TOMORROW= into TODO
20050 entries with keyword =UPCOMING=. Org ignores entries in comment trees
20053 #+begin_src emacs-lisp
20054 (org-map-entries '(org-todo "UPCOMING")
20055 "+TOMORROW" 'file 'archive 'comment)
20058 The following example counts the number of entries with TODO keyword
20059 =WAITING=, in all agenda files.
20061 #+begin_src emacs-lisp
20062 (length (org-map-entries t "/+WAITING" 'agenda))
20067 :DESCRIPTION: Viewing and capture on a mobile device.
20068 :APPENDIX: Appendix
20071 #+cindex: smartphone
20073 #+cindex: MobileOrg
20075 MobileOrg is a companion mobile app that runs on iOS and Android
20076 devices. MobileOrg enables offline-views and capture support for an
20077 Org mode system that is rooted on a "real" computer. MobileOrg can
20078 record changes to existing entries.
20080 The [[https://github.com/MobileOrg/][iOS implementation]] for the /iPhone/iPod Touch/iPad/ series of
20081 devices, was started by Richard Moreland and is now in the hands of
20082 Sean Escriva. Android users should check out [[http://wiki.github.com/matburt/mobileorg-android/][MobileOrg Android]] by
20083 Matt Jones. Though the two implementations are not identical, they
20084 offer similar features.
20086 This appendix describes Org's support for agenda view formats
20087 compatible with MobileOrg. It also describes synchronizing changes,
20088 such as to notes, between MobileOrg and the computer.
20090 To change tags and TODO states in MobileOrg, first customize the
20091 variables ~org-todo-keywords~ and ~org-tag-alist~. These should cover
20092 all the important tags and TODO keywords, even if Org files use only
20093 some of them. Though MobileOrg has in-buffer settings, it understands
20094 TODO states /sets/ (see [[*Setting up keywords for individual files]]) and
20095 /mutually exclusive/ tags (see [[*Setting tags]]) only for those set in
20098 ** Setting up the staging area
20100 :DESCRIPTION: For the mobile device.
20103 MobileOrg needs access to a file directory on a server to interact
20104 with Emacs. With a public server, consider encrypting the files.
20105 MobileOrg version 1.5 supports encryption for the iPhone. Org also
20106 requires =openssl= installed on the local computer. To turn on
20107 encryption, set the same password in MobileOrg and in Emacs. Set the
20108 password in the variable ~org-mobile-use-encryption~[fn:143]. Note
20109 that even after MobileOrg encrypts the file contents, the file name
20110 remains visible on the file systems of the local computer, the server,
20111 and the mobile device.
20113 For a server to host files, consider options like [[http://dropbox.com][Dropbox.com]]
20114 account[fn:144]. On first connection, MobileOrg creates a directory
20115 =MobileOrg= on Dropbox. Pass its location to Emacs through an
20116 initialisation file variable as follows:
20118 #+begin_src emacs-lisp
20119 (setq org-mobile-directory "~/Dropbox/MobileOrg")
20122 Org copies files to the above directory for MobileOrg. Org also uses
20123 the same directory for sharing notes between Org and MobileOrg.
20125 ** Pushing to MobileOrg
20127 :DESCRIPTION: Uploading Org files and agendas.
20130 #+vindex: org-mobile-files
20131 #+vindex: org-directory
20132 Org pushes files listed in ~org-mobile-files~ to
20133 ~org-mobile-directory~. Files include agenda files (as listed in
20134 ~org-agenda-files~). Customize ~org-mobile-files~ to add other files.
20135 File names are staged with paths relative to ~org-directory~, so all
20136 files should be inside this directory[fn:145].
20138 Push creates a special Org file =agendas.org= with custom agenda views
20139 defined by the user[fn:146].
20141 Finally, Org writes the file =index.org=, containing links to other
20142 files. MobileOrg reads this file first from the server to determine
20143 what other files to download for agendas. For faster downloads,
20144 MobileOrg only reads files whose checksums[fn:147] have changed.
20146 ** Pulling from MobileOrg
20148 :DESCRIPTION: Integrating captured and flagged items.
20151 When MobileOrg synchronizes with the server, it pulls the Org files
20152 for viewing. It then appends to the file =mobileorg.org= on the
20153 server the captured entries, pointers to flagged and changed entries.
20154 Org integrates its data in an inbox file format.
20157 #+vindex: org-mobile-inbox-for-pull
20158 Org moves all entries found in =mobileorg.org=[fn:148] and appends
20159 them to the file pointed to by the variable
20160 ~org-mobile-inbox-for-pull~. Each captured entry and each editing
20161 event is a top-level entry in the inbox file.
20163 2. After moving the entries, Org attempts changes to MobileOrg. Some
20164 changes are applied directly and without user interaction.
20165 Examples include changes to tags, TODO state, headline and body
20166 text. Entries for further action are tagged as =FLAGGED=. Org
20167 marks entries with problems with an error message in the inbox.
20168 They have to be resolved manually.
20170 3. Org generates an agenda view for flagged entries for user
20171 intervention to clean up. For notes stored in flagged entries,
20172 MobileOrg displays them in the echo area when the cursor is on the
20173 corresponding agenda item.
20178 Pressing {{{kbd(?)}}} displays the entire flagged note in
20179 another window. Org also pushes it to the kill ring. To
20180 store flagged note as a normal note, use {{{kbd(? z C-y C-c
20181 C-c)}}}. Pressing{{{kbd(?)}}} twice does these things: first
20182 it removes the =FLAGGED= tag; second, it removes the flagged
20183 note from the property drawer; third, it signals that manual
20184 editing of the flagged entry is now finished.
20187 {{{kbd(C-c a ?)}}} returns to the agenda view to finish processing
20188 flagged entries. Note that these entries may not be the most recent
20189 since MobileOrg searches files that were last pulled. To get an
20190 updated agenda view with changes since the last pull, pull again.
20192 * History and acknowledgments
20194 :DESCRIPTION: How Org came into being.
20203 Org was born in 2003, out of frustration over the user interface of
20204 the Emacs Outline mode. I was trying to organize my notes and
20205 projects, and using Emacs seemed to be the natural way to go.
20206 However, having to remember eleven different commands with two or
20207 three keys per command, only to hide and show parts of the outline
20208 tree, that seemed entirely unacceptable to me. Also, when using
20209 outlines to take notes, I constantly wanted to restructure the tree,
20210 organizing it parallel to my thoughts and plans. /Visibility cycling/
20211 and /structure editing/ were originally implemented in the package
20212 =outline-magic.el=, but quickly moved to the more general =org.el=.
20213 As this environment became comfortable for project planning, the next
20214 step was adding /TODO entries/, basic /timestamps/, and /table
20215 support/. These areas highlighted the two main goals that Org still
20216 has today: to be a new, outline-based, plain text mode with innovative
20217 and intuitive editing features, and to incorporate project planning
20218 functionality directly into a notes file.
20220 Since the first release, literally thousands of emails to me or to the
20221 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
20222 new ideas, and sometimes patches and add-on code. Many thanks to
20223 everyone who has helped to improve this package. I am trying to keep
20224 here a list of the people who had significant influence in shaping one
20225 or more aspects of Org. The list may not be complete, if I have
20226 forgotten someone, please accept my apologies and let me know.
20228 Before I get to this list, a few special mentions are in order:
20230 - Bastien Guerry ::
20232 Bastien has written a large number of extensions to Org (most of
20233 them integrated into the core by now), including the LaTeX
20234 exporter and the plain list parser. His support during the early
20235 days was central to the success of this project. Bastien also
20236 invented Worg, helped establishing the Web presence of Org, and
20237 sponsored hosting costs for the orgmode.org website. Bastien
20238 stepped in as maintainer of Org between 2011 and 2013, at a time
20239 when I desperately needed a break.
20241 - Eric Schulte and Dan Davison ::
20243 Eric and Dan are jointly responsible for the Org-babel system,
20244 which turns Org into a multi-language environment for evaluating
20245 code and doing literate programming and reproducible research.
20246 This has become one of Org's killer features that define what Org
20251 John has contributed a number of great ideas and patches directly
20252 to Org, including the attachment system (=org-attach.el=),
20253 integration with Apple Mail (=org-mac-message.el=), hierarchical
20254 dependencies of TODO items, habit tracking (=org-habits.el=), and
20255 encryption (=org-crypt.el=). Also, the capture system is really
20256 an extended copy of his great =remember.el=.
20258 - Sebastian Rose ::
20260 Without Sebastian, the HTML/XHTML publishing of Org would be the
20261 pitiful work of an ignorant amateur. Sebastian has pushed this
20262 part of Org onto a much higher level. He also wrote
20263 =org-info.js=, a Java script for displaying webpages derived from
20264 Org using an Info-like or a folding interface with single-key
20267 #+texinfo: @noindent
20268 See below for the full list of contributions! Again, please let me
20269 know what I am missing here!
20276 I (Bastien) have been maintaining Org between 2011 and 2013. This
20277 appendix would not be complete without adding a few more
20278 acknowledgments and thanks.
20280 I am first grateful to Carsten for his trust while handing me over the
20281 maintainership of Org. His unremitting support is what really helped
20282 me getting more confident over time, with both the community and the
20285 When I took over maintainership, I knew I would have to make Org more
20286 collaborative than ever, as I would have to rely on people that are
20287 more knowledgeable than I am on many parts of the code. Here is
20288 a list of the persons I could rely on, they should really be
20289 considered co-maintainers, either of the code or the community:
20293 Eric is maintaining the Babel parts of Org. His reactivity here
20294 kept me away from worrying about possible bugs here and let me
20295 focus on other parts.
20297 - Nicolas Goaziou ::
20299 Nicolas is maintaining the consistency of the deepest parts of
20300 Org. His work on =org-element.el= and =ox.el= has been
20301 outstanding, and it opened the doors for many new ideas and
20302 features. He rewrote many of the old exporters to use the new
20303 export engine, and helped with documenting this major change.
20304 More importantly (if that's possible), he has been more than
20305 reliable during all the work done for Org 8.0, and always very
20306 reactive on the mailing list.
20310 Achim rewrote the building process of Org, turning some /ad hoc/
20311 tools into a flexible and conceptually clean process. He
20312 patiently coped with the many hiccups that such a change can
20317 The Org mode mailing list would not be such a nice place without
20318 Nick, who patiently helped users so many times. It is impossible
20319 to overestimate such a great help, and the list would not be so
20320 active without him.
20322 I received support from so many users that it is clearly impossible to
20323 be fair when shortlisting a few of them, but Org's history would not
20324 be complete if the ones above were not mentioned in this manual.
20326 ** List of contributions
20331 - Russel Adams came up with the idea for drawers.
20333 - Thomas Baumann wrote =org-bbdb.el= and =org-mhe.el=.
20335 - Christophe Bataillon created the great unicorn logo that we use on
20336 the Org mode website.
20338 - Alex Bochannek provided a patch for rounding timestamps.
20340 - Jan Böcker wrote =org-docview.el=.
20342 - Brad Bozarth showed how to pull RSS feed data into Org files.
20344 - Tom Breton wrote =org-choose.el=.
20346 - Charles Cave's suggestion sparked the implementation of templates
20347 for Remember, which are now templates for capture.
20349 - Pavel Chalmoviansky influenced the agenda treatment of items with
20352 - Gregory Chernov patched support for Lisp forms into table
20353 calculations and improved XEmacs compatibility, in particular by
20354 porting =nouline.el= to XEmacs.
20356 - Sacha Chua suggested copying some linking code from Planner.
20358 - Baoqiu Cui contributed the DocBook exporter.
20360 - Eddward DeVilla proposed and tested checkbox statistics. He also
20361 came up with the idea of properties, and that there should be an API
20364 - Nick Dokos tracked down several nasty bugs.
20366 - Kees Dullemond used to edit projects lists directly in HTML and so
20367 inspired some of the early development, including HTML export. He
20368 also asked for a way to narrow wide table columns.
20370 - Thomas S. Dye contributed documentation on Worg and helped
20371 integrating the Org Babel documentation into the manual.
20373 - Christian Egli converted the documentation into Texinfo format,
20374 inspired the agenda, patched CSS formatting into the HTML exporter,
20375 and wrote =org-taskjuggler.el=.
20377 - David Emery provided a patch for custom CSS support in exported HTML
20380 - Nic Ferrier contributed mailcap and XOXO support.
20382 - Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
20384 - John Foerch figured out how to make incremental search show context
20385 around a match in a hidden outline tree.
20387 - Raimar Finken wrote =org-git-line.el=.
20389 - Mikael Fornius works as a mailing list moderator.
20391 - Austin Frank works as a mailing list moderator.
20393 - Eric Fraga drove the development of Beamer export with ideas and
20396 - Barry Gidden did proofreading the manual in preparation for the book
20397 publication through Network Theory Ltd.
20399 - Niels Giesen had the idea to automatically archive DONE trees.
20401 - Nicolas Goaziou rewrote much of the plain list code.
20403 - Kai Grossjohann pointed out key-binding conflicts with other
20406 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
20409 - Bernt Hansen has driven much of the support for auto-repeating
20410 tasks, task state change logging, and the clocktable. His clear
20411 explanations have been critical when we started to adopt the Git
20412 version control system.
20414 - Manuel Hermenegildo has contributed various ideas, small fixes and
20417 - Phil Jackson wrote =org-irc.el=.
20419 - Scott Jaderholm proposed footnotes, control over whitespace between
20420 folded entries, and column view for properties.
20422 - Matt Jones wrote MobileOrg Android.
20424 - Tokuya Kameshima wrote =org-wl.el= and =org-mew.el=.
20426 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it. He also
20427 provided frequent feedback and some patches.
20429 - Matt Lundin has proposed last-row references for table formulas and
20430 named invisible anchors. He has also worked a lot on the FAQ.
20432 - David Maus wrote =org-atom.el=, maintains the issues file for Org,
20433 and is a prolific contributor on the mailing list with competent
20434 replies, small fixes and patches.
20436 - Jason F. McBrayer suggested agenda export to CSV format.
20438 - Max Mikhanosha came up with the idea of refiling.
20440 - Dmitri Minaev sent a patch to set priority limits on a per-file
20443 - Stefan Monnier provided a patch to keep the Emacs Lisp compiler
20446 - Richard Moreland wrote MobileOrg for the iPhone.
20448 - Rick Moynihan proposed allowing multiple TODO sequences in a file
20449 and being able to quickly restrict the agenda to a subtree.
20451 - Todd Neal provided patches for links to Info files and Elisp forms.
20453 - Greg Newman refreshed the unicorn logo into its current form.
20455 - Tim O'Callaghan suggested in-file links, search options for general
20456 file links, and tags.
20458 - Osamu Okano wrote =orgcard2ref.pl=, a Perl program to create a text
20459 version of the reference card.
20461 - Takeshi Okano translated the manual and David O'Toole's tutorial
20464 - Oliver Oppitz suggested multi-state TODO items.
20466 - Scott Otterson sparked the introduction of descriptive text for
20467 links, among other things.
20469 - Pete Phillips helped during the development of the TAGS feature,
20470 and provided frequent feedback.
20472 - Martin Pohlack provided the code snippet to bundle character
20473 insertion into bundles of 20 for undo.
20475 - T.V. Raman reported bugs and suggested improvements.
20477 - Matthias Rempe (Oelde) provided ideas, Windows support, and quality
20480 - Paul Rivier provided the basic implementation of named footnotes.
20481 He also acted as mailing list moderator for some time.
20483 - Kevin Rogers contributed code to access VM files on remote hosts.
20485 - Frank Ruell solved the mystery of the =keymapp nil= bug, a conflict
20488 - Jason Riedy generalized the send-receive mechanism for Orgtbl
20489 tables with extensive patches.
20491 - Philip Rooke created the Org reference card, provided lots of
20492 feedback, developed and applied standards to the Org documentation.
20494 - Christian Schlauer proposed angular brackets around links, among
20497 - Paul Sexton wrote =org-ctags.el=.
20499 - Tom Shannon's =organizer-mode.el= inspired linking to VM/BBDB/Gnus.
20501 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
20502 literal examples, and remote highlighting for referenced code lines.
20504 - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is
20505 now packaged into Org's =contrib/= directory.
20507 - Daniel Sinder came up with the idea of internal archiving by locking
20510 - Dale Smith proposed link abbreviations.
20512 - James TD Smith has contributed a large number of patches for
20513 useful tweaks and features.
20515 - Adam Spiers asked for global linking commands, inspired the link
20516 extension system, added support for Mairix, and proposed the mapping
20519 - Ulf Stegemann created the table to translate special symbols to
20520 HTML, LaTeX, UTF-8, Latin-1 and ASCII.
20522 - Andy Stewart contributed code to =org-w3m.el=, to copy
20523 HTML content with links transformation to Org syntax.
20525 - David O'Toole wrote =org-publish.el= and drafted the
20526 manual chapter about publishing.
20528 - Jambunathan K. contributed the ODT exporter.
20530 - Sebastien Vauban reported many issues with LaTeX and Beamer export
20531 and enabled source code highlighting in Gnus.
20533 - Stefan Vollmar organized a video-recorded talk at the
20534 Max-Planck-Institute for Neurology. He also inspired the creation
20535 of a concept index for HTML export.
20537 - Jürgen Vollmer contributed code generating the table of contents in
20540 - Samuel Wales has provided important feedback and bug reports.
20542 - Chris Wallace provided a patch implementing the =QUOTE= block.
20544 - David Wainberg suggested archiving, and improvements to the
20547 - Carsten Wimmer suggested some changes and helped fix a bug in
20550 - Roland Winkler requested additional key bindings to make Org work on
20553 - Piotr Zielinski wrote =org-mouse.el=, proposed agenda
20554 blocks and contributed various ideas and code snippets.
20556 * GNU Free Documentation License
20559 :DESCRIPTION: The license for this documentation.
20562 #+TEXINFO: @include ../doc/doclicense.texi
20566 :ALT_TITLE: Main Index
20568 :DESCRIPTION: An index of Org's concepts and features.
20573 :DESCRIPTION: Key bindings and where they are described.
20574 :ALT_TITLE: Key Index
20578 * Command and function index
20580 :DESCRIPTION: Command names and some internal functions.
20581 :ALT_TITLE: Command and Function Index
20587 :DESCRIPTION: Variables mentioned in the manual.
20588 :ALT_TITLE: Variable Index
20592 This is not a complete index of variables and faces, only the ones
20593 that are mentioned in the manual. For a more complete list, use
20594 {{{kbd(M-x org-customize)}}} and then click yourself through the tree.
20601 This manual is for Org version {{{version}}}.
20603 Copyright \copy 2004--2017 Free Software Foundation, Inc.
20606 Permission is granted to copy, distribute and/or modify this document
20607 under the terms of the GNU Free Documentation License, Version 1.3 or
20608 any later version published by the Free Software Foundation; with no
20609 Invariant Sections, with the Front-Cover texts being "A GNU Manual",
20610 and with the Back-Cover Texts as in (a) below. A copy of the license
20611 is included in the section entitled "GNU Free Documentation License".
20613 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
20614 modify this GNU manual."
20617 * Export setup :noexport:
20619 #+subtitle: Release {{{version}}}
20620 #+author: by Carsten Dominik
20621 #+subauthor: with contributions by Bastien Guerry, Nicolas Goaziou, Eric Schulte, Jambunathan K, Dan Davison, Thomas Dye, David O'Toole, and Philip Rooke.
20622 #+date: {{{modification-time}}}
20623 #+email: tsd@tsdye.com
20626 # XXX: We cannot use TODO keyword as a node starts with "TODO".
20627 #+todo: REVIEW FIXME | DONE
20628 #+property: header-args :eval no
20629 #+startup: overview nologdone
20631 #+texinfo_dir_category: Emacs editing modes
20632 #+texinfo_dir_title: Org Mode: (org)
20633 #+texinfo_dir_desc: Outline-based notes management and organizer
20635 # Use proper quote and backtick for code sections in PDF output
20636 # Cf. Texinfo manual 14.2
20637 #+texinfo_header: @set txicodequoteundirected
20638 #+texinfo_header: @set txicodequotebacktick
20641 #+texinfo_header: @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
20642 #+texinfo_header: @set MAINTAINER Carsten Dominik
20643 #+texinfo_header: @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
20644 #+texinfo_header: @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
20646 #+options: H:4 num:t toc:t author:t \n:nil ::t |:t ^:nil -:t f:t *:t <:t e:t ':t
20647 #+options: d:nil todo:nil pri:nil tags:not-in-toc stat:nil broken-links:mark
20648 #+select_tags: export
20649 #+exclude_tags: noexport
20651 #+macro: cite @@texinfo:@cite{@@$1@@texinfo:}@@
20652 #+macro: var @@texinfo:@var{@@$1@@texinfo:}@@
20654 # The "version" macro returns major.minor version number. This is
20655 # sufficient since bugfix releases are not expected to add features
20656 # and therefore imply manual modifications.
20657 #+macro: version (eval (mapconcat #'identity (cl-subseq (split-string (org-version) "\\.") 0 -1) "."))
20659 # The "kbd" macro turns KBD into @kbd{KBD}. Additionnally, it
20660 # encloses case-sensitive special keys (SPC, RET...) within @key{...}.
20661 #+macro: kbd (eval (let ((case-fold-search nil) (regexp (regexp-opt '("SPC" "RET" "LFD" "TAB" "BS" "ESC" "DELETE" "SHIFT" "CTRL" "META" "up" "left" "right" "down") 'words))) (format "@@texinfo:@kbd{@@%s@@texinfo:}@@" (replace-regexp-in-string regexp "@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t))))
20665 [fn:1] If you do not use Font Lock globally turn it on in Org buffer
20666 with ~(add-hook 'org-mode-hook 'turn-on-font-lock)~.
20668 [fn:2] Please consider subscribing to the mailing list in order to
20669 minimize the work the mailing list moderators have to do.
20671 [fn:3] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
20672 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
20673 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines. Note
20674 also that clocking only works with headings indented less than 30
20677 [fn:4] See, however, the option ~org-cycle-emulate-tab~.
20679 [fn:5] The indirect buffer contains the entire buffer, but is narrowed
20680 to the current tree. Editing the indirect buffer also changes the
20681 original buffer, but without affecting visibility in that buffer. For
20682 more information about indirect buffers, see [[info:emacs:Indirect%20Buffers][GNU Emacs Manual]].
20684 [fn:6] When ~org-agenda-inhibit-startup~ is non-~nil~, Org does not
20685 honor the default visibility state when first opening a file for the
20686 agenda (see [[*Speeding up your agendas]]).
20688 [fn:7] See also the variable ~org-show-context-detail~ to decide how
20689 much context is shown around each match.
20691 [fn:8] This depends on the option ~org-remove-highlights-with-change~.
20693 [fn:9] When using =*= as a bullet, lines must be indented so that they
20694 are not interpreted as headlines. Also, when you are hiding leading
20695 stars to get a clean outline view, plain list items starting with
20696 a star may be hard to distinguish from true headlines. In short: even
20697 though =*= is supported, it may be better to not use it for plain list
20700 [fn:10] You can filter out any of them by configuring
20701 ~org-plain-list-ordered-item-terminator~.
20703 [fn:11] You can also get =a.=, =A.=, =a)= and =A)= by configuring
20704 ~org-list-allow-alphabetical~. To minimize confusion with normal
20705 text, those are limited to one character only. Beyond that limit,
20706 bullets automatically fallback to numbers.
20708 [fn:12] If there's a checkbox in the item, the cookie must be put
20709 /before/ the checkbox. If you have activated alphabetical lists, you
20710 can also use counters like =[@b]=.
20712 [fn:13] If you do not want the item to be split, customize the
20713 variable ~org-M-RET-may-split-line~.
20715 [fn:14] If you want to cycle around items that way, you may customize
20716 ~org-list-use-circular-motion~.
20718 [fn:15] See ~org-list-use-circular-motion~ for a cyclic behavior.
20720 [fn:16] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
20721 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
20723 [fn:17] The corresponding in-buffer setting is: =#+STARTUP: fninline=
20724 or =#+STARTUP: nofninline=.
20726 [fn:18] The corresponding in-buffer options are =#+STARTUP: fnadjust=
20727 and =#+STARTUP: nofnadjust=.
20729 [fn:19] To insert a vertical bar into a table field, use =\vert= or,
20730 inside a word =abc\vert{}def=.
20732 [fn:20] Org understands references typed by the user as =B4=, but it
20733 does not use this syntax when offering a formula for editing. You can
20734 customize this behavior using the variable
20735 ~org-table-use-standard-references~.
20737 [fn:21] The computation time scales as O(N^2) because table
20738 {{{var(FOO)}}} is parsed for each field to be copied.
20740 [fn:22] The file =constants.el= can supply the values of constants in
20741 two different unit systems, =SI= and =cgs=. Which one is used depends
20742 on the value of the variable ~constants-unit-system~. You can use the
20743 =STARTUP= options =constSI= and =constcgs= to set this value for the
20746 [fn:23] The printf reformatting is limited in precision because the
20747 value passed to it is converted into an "integer" or "double". The
20748 "integer" is limited in size by truncating the signed value to 32
20749 bits. The "double" is limited in precision to 64 bits overall which
20750 leaves approximately 16 significant decimal digits.
20752 [fn:24] Such names must start with an alphabetic character and use
20753 only alphanumeric/underscore characters.
20755 [fn:25] To insert a link targeting a headline, in-buffer completion
20756 can be used. Just type a star followed by a few optional letters into
20757 the buffer and press {{{kbd(M-TAB)}}}. All headlines in the current
20758 buffer are offered as completions.
20760 [fn:26] When targeting a =NAME= keyword, =CAPTION= keyword is
20761 mandatory in order to get proper numbering (see [[*Images and tables]]).
20763 [fn:27] The actual behavior of the search depends on the value of the
20764 variable ~org-link-search-must-match-exact-headline~. If its value is
20765 ~nil~, then a fuzzy text search is done. If it is ~t~, then only the
20766 exact headline is matched, ignoring spaces and statistic cookies. If
20767 the value is ~query-to-create~, then an exact headline is searched; if
20768 it is not found, then the user is queried to create it.
20770 [fn:28] If the headline contains a timestamp, it is removed from the
20771 link, which results in a wrong link -- you should avoid putting
20772 a timestamp in the headline.
20774 [fn:29] The Org Id library must first be loaded, either through
20775 ~org-customize~, by enabling ~id~ in ~org-modules~, or by adding
20776 ~(require 'org-id)~ in your Emacs init file.
20778 [fn:30] Note that you do not have to use this command to insert
20779 a link. Links in Org are plain text, and you can type or paste them
20780 straight into the buffer. By using this command, the links are
20781 automatically enclosed in double brackets, and you will be asked for
20782 the optional descriptive text.
20784 [fn:31] After insertion of a stored link, the link will be removed
20785 from the list of stored links. To keep it in the list later use, use
20786 a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
20787 configure the option ~org-keep-stored-link-after-insertion~.
20789 [fn:32] This works if a function has been defined in the ~:complete~
20790 property of a link in ~org-link-parameters~.
20792 [fn:33] See the variable ~org-display-internal-link-with-indirect-buffer~.
20794 [fn:34] The variable ~org-startup-with-inline-images~ can be set
20795 within a buffer with the =STARTUP= options =inlineimages= and
20798 [fn:35] For backward compatibility, line numbers can also follow a
20801 [fn:36] Of course, you can make a document that contains only long
20802 lists of TODO items, but this is not required.
20804 [fn:37] Changing the variable ~org-todo-keywords~ only becomes
20805 effective after restarting Org mode in a buffer.
20807 [fn:38] This is also true for the {{{kbd(t)}}} command in the timeline
20808 and agenda buffers.
20810 [fn:39] All characters are allowed except =@=, =^= and =!=, which have
20811 a special meaning here.
20813 [fn:40] Check also the variable ~org-fast-tag-selection-include-todo~,
20814 it allows you to change the TODO state through the tags interface
20815 ([[*Setting tags]]), in case you like to mingle the two concepts. Note
20816 that this means you need to come up with unique keys across both sets
20819 [fn:41] Org mode parses these lines only when Org mode is activated
20820 after visiting a file. {{{kbd(C-c C-c)}}} with the cursor in a line
20821 starting with =#+= is simply restarting Org mode for the current
20824 [fn:42] The corresponding in-buffer setting is: =#+STARTUP: logdone=.
20826 [fn:43] The corresponding in-buffer setting is: =#+STARTUP:
20829 [fn:44] See the variable ~org-log-states-order-reversed~.
20831 [fn:45] Note that the =LOGBOOK= drawer is unfolded when pressing
20832 {{{kbd(SPC)}}} in the agenda to show an entry -- use {{{kbd(C-u
20833 SPC)}}} to keep it folded here.
20835 [fn:46] It is possible that Org mode records two timestamps when you
20836 are using both ~org-log-done~ and state change logging. However, it
20837 never prompts for two notes: if you have configured both, the state
20838 change recording note takes precedence and cancel the closing note.
20840 [fn:47] See also the option ~org-priority-start-cycle-with-default~.
20842 [fn:48] To keep subtasks out of the global TODO list, see the
20843 ~org-agenda-todo-list-sublevels~.
20845 [fn:49] With the exception of description lists. But you can allow it
20846 by modifying ~org-list-automatic-rules~ accordingly.
20848 [fn:50] Set the variable ~org-hierarchical-checkbox-statistics~ if you
20849 want such cookies to count all checkboxes below the cookie, not just
20850 those belonging to direct children.
20852 [fn:51] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
20853 checkbox adds checkboxes to the rest of the list.
20855 [fn:52] As with all these in-buffer settings, pressing {{{kbd(C-c
20856 C-c)}}} activates any changes in the line.
20858 [fn:53] This is only true if the search does not involve more complex
20859 tests including properties (see [[*Property searches]]).
20861 [fn:54] Keys are automatically assigned to tags that have no
20864 [fn:55] If more than one summary type applies to the same property,
20865 the parent values are computed according to the first of them.
20867 [fn:56] An age is defined as a duration, using effort modifiers
20868 defined in ~org-effort-durations~, e.g., =3d 1h=. If any value in the
20869 column is as such, the summary is also an effort duration.
20871 [fn:57] Please note that the =COLUMNS= definition must be on a single
20872 line; it is wrapped here only because of formatting constraints.
20874 [fn:58] Contributed packages are not part of Emacs, but are
20875 distributed with the main distribution of Org -- visit
20876 [[http://orgmode.org]].
20878 [fn:59] The Org date format is inspired by the standard ISO 8601
20879 date/time format. To use an alternative format, see [[*Custom time
20880 format]]. The day name is optional when you type the date yourself.
20881 However, any date inserted or modified by Org adds that day name, for
20882 reading convenience.
20884 [fn:60] When working with the standard diary sexp functions, you need
20885 to be very careful with the order of the arguments. That order
20886 depends evilly on the variable ~calendar-date-style~. For example, to
20887 specify a date December 12, 2005, the call might look like
20888 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date
20889 2005 12 1)=, depending on the settings. This has been the source of
20890 much confusion. Org mode users can resort to special versions of
20891 these functions like ~org-date~ or ~org-anniversary~. These work just
20892 like the corresponding ~diary-~ functions, but with stable ISO order
20893 of arguments (year, month, day) wherever applicable, independent of
20894 the value of ~calendar-date-style~.
20896 [fn:61] See the variable ~org-read-date-prefer-future~. You may set
20897 that variable to the symbol ~time~ to even make a time before now
20898 shift the date to tomorrow.
20900 [fn:62] If you do not need/want the calendar, configure the variable
20901 ~org-popup-calendar-for-date-prompt~.
20903 [fn:63] If you find this distracting, turn off the display with
20904 ~org-read-date-display-live~.
20906 [fn:64] It will still be listed on that date after it has been marked
20907 DONE. If you do not like this, set the variable
20908 ~org-agenda-skip-scheduled-if-done~.
20910 [fn:65] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
20911 right below the headline. Do not put any text between this line and
20914 [fn:66] Note the corresponding =STARTUP= options =logredeadline=,
20915 =lognoteredeadline=, and =nologredeadline=.
20917 [fn:67] Note the corresponding =STARTUP= options =logreschedule=,
20918 =lognotereschedule=, and =nologreschedule=.
20920 [fn:68] In fact, the target state is taken from, in this sequence, the
20921 =REPEAT_TO_STATE= property, the variable ~org-todo-repeat-to-state~ if
20922 it is a string, the previous TODO state if ~org-todo-repeat-to-state~
20923 is ~t~, or the first state of the TODO state sequence.
20925 [fn:69] You can change this using the option ~org-log-repeat~, or the
20926 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=.
20927 With =lognoterepeat=, you will also be prompted for a note.
20929 [fn:70] Clocking only works if all headings are indented with less
20930 than 30 stars. This is a hard-coded limitation of ~lmax~ in
20933 [fn:71] To resume the clock under the assumption that you have worked
20934 on this task while outside Emacs, use ~(setq org-clock-persist t)~.
20936 [fn:72] To add an effort estimate "on the fly", hook a function doing
20937 this to ~org-clock-in-prepare-hook~.
20939 [fn:73] The last reset of the task is recorded by the =LAST_REPEAT=
20942 [fn:74] See also the variable ~org-clock-modeline-total~.
20944 [fn:75] The corresponding in-buffer setting is: =#+STARTUP:
20947 [fn:76] Language terms can be set through the variable
20948 ~org-clock-clocktable-language-setup~.
20950 [fn:77] Note that all parameters must be specified in a single line --
20951 the line is broken here only to fit it into the manual.
20953 [fn:78] On computers using Mac OS X, idleness is based on actual user
20954 idleness, not just Emacs' idle time. For X11, you can install
20955 a utility program =x11idle.c=, available in the =contrib/scripts/=
20956 directory of the Org Git distribution, or install the xprintidle
20957 package and set it to the variable ~org-clock-x11idle-program-name~ if
20958 you are running Debian, to get the same general treatment of idleness.
20959 On other systems, idle time refers to Emacs idle time only.
20961 [fn:79] Please note the pitfalls of summing hierarchical data in
20962 a flat list ([[*Using column view in the agenda]]).
20964 [fn:80] Please select your own key, {{{kbd(C-c c)}}} is only
20967 [fn:81] Org used to offer four different targets for date/week tree
20968 capture. Now, Org automatically translates these to use
20969 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
20970 properties. Please rewrite your date/week-tree targets using
20971 ~file+olp+datetree~ since the older targets are now deprecated.
20973 [fn:82] A date tree is an outline structure with years on the highest
20974 level, months or ISO weeks as sublevels and then dates on the lowest
20975 level. Tags are allowed in the tree structure.
20977 [fn:83] If you need one of these sequences literally, escape the =%=
20980 [fn:84] If you define your own link types (see [[*Adding hyperlink
20981 types]]), any property you store with ~org-store-link-props~ can be
20982 accessed in capture templates in a similar way.
20984 [fn:85] This is always the other, not the user. See the variable
20985 ~org-from-is-user-regexp~.
20987 [fn:86] If you move entries or Org files from one directory to
20988 another, you may want to configure ~org-attach-directory~ to contain
20991 [fn:87] Note the corresponding =STARTUP= options =logrefile=,
20992 =lognoterefile=, and =nologrefile=.
20994 [fn:88] If the value of that variable is not a list, but a single file
20995 name, then the list of agenda files in maintained in that external
20998 [fn:89] When using the dispatcher, pressing {{{kbd(<)}}} before
20999 selecting a command actually limits the command to the current file,
21000 and ignores ~org-agenda-files~ until the next dispatcher command.
21002 [fn:90] For backward compatibility, you can also press {{{kbd(1)}}} to
21003 restrict to the current buffer.
21005 [fn:91] For backward compatibility, you can also press {{{kbd(0)}}} to
21006 restrict to the current region/subtree.
21008 [fn:92] For backward compatibility, the universal prefix
21009 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
21010 This feature is deprecated, use the dedicated TODO list, or a block
21011 agenda instead (see [[*Block agenda]]).
21013 [fn:93] The variable ~org-anniversary~ used in the example is just
21014 like ~diary-anniversary~, but the argument order is always according
21015 to ISO and therefore independent of the value of
21016 ~calendar-date-style~.
21018 [fn:94] Custom commands can preset a filter by binding the variable
21019 ~org-agenda-tag-filter-preset~ as an option. This filter is then
21020 applied to the view and persists as a basic filter through refreshes
21021 and more secondary filtering. The filter is a global property of the
21022 entire agenda view -- in a block agenda, you should only set this in
21023 the global options section, not in the section of an individual block.
21025 [fn:95] Only tags filtering is respected here, effort filtering is
21028 [fn:96] You can also create persistent custom functions through
21029 ~org-agenda-bulk-custom-functions~.
21031 [fn:97] This file is parsed for the agenda when
21032 ~org-agenda-include-diary~ is set.
21034 [fn:98] You can provide a description for a prefix key by inserting
21035 a cons cell with the prefix and the description.
21037 [fn:99] /Planned/ means here that these entries have some planning
21038 information attached to them, like a time-stamp, a scheduled or
21039 a deadline string. See ~org-agenda-entry-types~ on how to set what
21040 planning information is taken into account.
21042 [fn:100] For HTML you need to install Hrvoje Niksic's =htmlize.el=
21043 from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Niksic's repository]].
21045 [fn:101] To create PDF output, the Ghostscript ps2pdf utility must be
21046 installed on the system. Selecting a PDF file also creates the
21049 [fn:102] If you want to store standard views like the weekly agenda or
21050 the global TODO list as well, you need to define custom commands for
21051 them in order to be able to specify file names.
21053 [fn:103] Quoting depends on the system you use, please check the FAQ
21056 [fn:104] This works automatically for the HTML backend (it requires
21057 version 1.34 of the =htmlize.el= package, which you need to install).
21058 Fontified code chunks in LaTeX can be achieved using either the
21059 listings package or the [[https://github.com/gpoore/minted][minted]] package. Refer to
21060 ~org-export-latex-listings~ for details.
21062 [fn:105] Source code in code blocks may also be evaluated either
21063 interactively or on export. See [[*Working with source code]] for more
21064 information on evaluating code blocks.
21066 [fn:106] Adding =-k= to =-n -r= /keeps/ the labels in the source code
21067 while using line numbers for the links, which might be useful to
21068 explain those in an Org mode example code.
21070 [fn:107] Upon exit, lines starting with =*=, =,*=, =#+= and =,#+= get
21071 a comma prepended, to keep them from being interpreted by Org as
21072 outline nodes or special syntax. These commas are stripped when
21073 editing with {{{kbd(C-c ')}}}, and also before export.
21075 [fn:108] You may select a different-mode with the variable
21076 ~org-edit-fixed-width-region-mode~.
21078 [fn:109] You can turn this on by default by setting the variable
21079 ~org-pretty-entities~, or on a per-file base with the =STARTUP= option
21082 [fn:110] This behaviour can be disabled with =-= export setting (see
21083 [[*Export settings]]).
21085 [fn:111] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
21086 system. Many of the features described here as "LaTeX" are really
21087 from TeX, but for simplicity I am blurring this distinction.
21089 [fn:112] When MathJax is used, only the environments recognized by
21090 MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
21091 used to create images, any LaTeX environment is handled.
21093 [fn:113] These are respectively available at
21094 [[http://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
21095 and from the ImageMagick suite. Choose the converter by setting the
21096 variable ~org-preview-latex-default-process~ accordingly.
21098 [fn:114] Org mode has a method to test if the cursor is inside such
21099 a fragment, see the documentation of the function
21100 ~org-inside-LaTeX-fragment-p~.
21102 [fn:115] The variable ~org-export-date-timestamp-format~ defines how
21103 this timestamp are exported.
21105 [fn:116] At the moment, some export back-ends do not obey this
21106 specification. For example, LaTeX export excludes every unnumbered
21107 headline from the table of contents.
21109 [fn:117] Since commas separate the arguments, commas within arguments
21110 have to be escaped with the backslash character. So only those
21111 backslash characters before a comma need escaping with another
21112 backslash character.
21114 [fn:118] For a less drastic behavior, consider using a select tag (see
21115 [[*Export settings]]) instead.
21117 [fn:119] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
21118 to make it visible. The tag serves as a visual aid and has no
21119 semantic relevance.
21121 [fn:120] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by
21122 [[http://www.mathjax.org][MathJax]].
21124 [fn:121] See [[http://docs.mathjax.org/en/latest/tex.html#tex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn
21127 [fn:122] If the classes on TODO keywords and tags lead to conflicts,
21128 use the variables ~org-html-todo-kwd-class-prefix~ and
21129 ~org-html-tag-class-prefix~ to make them unique.
21131 [fn:123] This does not allow setting different bibliography compilers
21132 for different files. However, "smart" LaTeX compilation systems, such
21133 as latexmk, can select the correct bibliography compiler.
21135 [fn:124] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications
21136 (OpenDocument) Version 1.2]].
21138 [fn:125] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
21140 [fn:126] See [[http://dlmf.nist.gov/LaTeXML/]].
21142 [fn:127] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]]
21144 [fn:128] See the =<table:table-template>= element of the
21145 OpenDocument-v1.2 specification.
21147 [fn:129] See the attributes =table:template-name=,
21148 =table:use-first-row-styles=, =table:use-last-row-styles=,
21149 =table:use-first-column-styles=, =table:use-last-column-styles=,
21150 =table:use-banding-rows-styles=, and =table:use-banding-column-styles=
21151 of the =<table:table>= element in the OpenDocument-v1.2 specification.
21153 [fn:130] If the publishing directory is the same as the source
21154 directory, =file.org= is exported as =file.org.org=, so you probably
21155 do not want to do this.
21157 [fn:131] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used
21158 to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
21160 [fn:132] Actually, the constructs =call_<name>()= and =src_<lang>{}=
21161 are not evaluated when they appear in a keyword line -- i.e. lines
21162 starting with =#+KEYWORD:=, see [[*Summary of in-buffer settings]].
21164 [fn:133] For Noweb literate programming details, see
21165 http://www.cs.tufts.edu/~nr/noweb/.
21167 [fn:134] For more information, please refer to the commentary section
21170 [fn:135] Note that ~org-indent-mode~ also sets the ~wrap-prefix~
21171 property, such that ~visual-line-mode~ (or purely setting ~word-wrap~)
21172 wraps long lines (including headlines) correctly indented.
21174 [fn:136] The ~org-indent-mode~ also sets the ~wrap-prefix~ correctly
21175 for indenting and wrapping long lines of headlines or text. This
21176 minor mode handles ~visual-line-mode~ and directly applied settings
21177 through ~word-wrap~.
21179 [fn:137] Also see the variable ~org-adapt-indentation~.
21181 [fn:138] Because =LEVEL=2= has 3 stars, =LEVEL=3= has 4 stars, and so
21184 [fn:139] https://ctan.org/tex-archive/macros/latex/contrib/comment?lang=en
21186 [fn:140] If the =TBLFM= keyword contains an odd number of dollar
21187 characters, this may cause problems with Font Lock in LaTeX mode. As
21188 shown in the example you can fix this by adding an extra line inside
21189 the =comment= environment that is used to balance the dollar
21190 expressions. If you are using AUCTeX with the font-latex library,
21191 a much better solution is to add the =comment= environment to the
21192 variable ~LaTeX-verbatim-environments~.
21194 [fn:141] The ~agenda*~ view is the same as ~agenda~ except that it
21195 only considers /appointments/, i.e., scheduled and deadline items that
21196 have a time specification =[h]h:mm= in their time-stamps.
21198 [fn:142] Note that, for ~org-odd-levels-only~, a level number
21199 corresponds to order in the hierarchy, not to the number of stars.
21201 [fn:143] If Emacs is configured for safe storing of passwords, then
21202 configure the variable, ~org-mobile-encryption-password~; please read
21203 the docstring of that variable.
21205 [fn:144] An alternative is to use a WebDAV server. MobileOrg
21206 documentation has details of WebDAV server configuration. Additional
21207 help is at this [[http://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
21209 [fn:145] Symbolic links in ~org-directory~ need to have the same name
21212 [fn:146] While creating the agendas, Org mode forces ID properties on
21213 all referenced entries, so that these entries can be uniquely
21214 identified if MobileOrg flags them for further action. To avoid
21215 setting properties configure the variable
21216 ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies
21217 on outline paths, assuming they are unique.
21219 [fn:147] Checksums are stored automatically in the file
21222 [fn:148] The file will be empty after this operation.